| Welcome, Guest |
You have to register before you can post on our site.
|
| Forum Statistics |
» Members: 7,803
» Latest member: Kremzy
» Forum threads: 2,365
» Forum posts: 12,247
Full Statistics
|
| Online Users |
There are currently 365 online users. » 1 Member(s) | 361 Guest(s) Baidu, Google, Bing, LapizTJ
|
| Latest Threads |
NoxxeR is back, with vide...
Forum: Videos and Screenshots
Last Post: NoxxeR
9 hours ago
» Replies: 1
» Views: 34
|
AntyCheat System [SA-MP/O...
Forum: Filterscripts
Last Post: Pevenaider
2025-12-25, 04:58 PM
» Replies: 9
» Views: 17,643
|
After School Roleplay - G...
Forum: Advertisements
Last Post: cosminupgaming
2025-12-25, 12:58 PM
» Replies: 7
» Views: 509
|
RolePlay Gamemode [WIP]
Forum: Gamemodes
Last Post: su109551
2025-12-24, 10:48 PM
» Replies: 5
» Views: 146
|
Discord Server Unable to ...
Forum: Chat
Last Post: cosminupgaming
2025-12-24, 05:58 PM
» Replies: 0
» Views: 39
|
My website is now up
Forum: Tech
Last Post: Centnodes
2025-12-23, 07:19 PM
» Replies: 1
» Views: 102
|
Broken voice
Forum: Support
Last Post: yunnnjunior
2025-12-23, 11:41 AM
» Replies: 0
» Views: 38
|
United Gaming Life Rolepl...
Forum: Advertisements
Last Post: Cruncher
2025-12-22, 09:14 PM
» Replies: 0
» Views: 51
|
LCSHosting.eu - Free SA-M...
Forum: Tech
Last Post: LCSLaces
2025-12-22, 07:54 PM
» Replies: 1
» Views: 128
|
Discord problem.
Forum: Support
Last Post: drwnrbbt
2025-12-22, 04:52 AM
» Replies: 2
» Views: 81
|
|
|
Problema de guardado con SQL. |
|
Posted by: nittro - 2020-11-07, 08:04 PM - Forum: Programaci?n
- No Replies
|
 |
Mi problema es que el sistema de registro va bien, pero al desconectarse y loguear otra vez, coloca todos los datos en 0. Estaba probando el sistema hasta que ocurrio.
PHP Code: new DB:sqldb;
new guardadordeCuenta;
enum d@usuario
{
ID,
Nivel,
NivelStaff,
Vip,
bool:Ingreso,
Muteado,
Dinero,
Vida,
Chaleco,
Genero,
Float:PosX,
Float:PosZ,
Float:PosY,
bool:NewSpawn
};
new Cuenta[MAX_PLAYERS][d@usuario];
forward GuardarCuentas();
/*
*=======================================*
*===============Dialogos================*
*=======================================*
*/
#define DIALOGO_REGISTRO (0)
#define DIALOGO_INGRESO (1)
#define DIALOGO_GENERO (2)
public OnGameModeInit()
{
//Conectar al SQlite.
sqldb = db_open("sqldb.db");
//Crear la tabla Sqlite.
db_query(sqldb, "CREATE TABLE IF NOT EXISTS `usuarios` (ID INTEGER PRIMARY KEY AUTOINCREMENT, Nombre TEXT, Llave TEXT, Nivel NUMERIC, NivelStaff NUMERIC, Vip NUMERIC, Muteado NUMERIC, Vida NUMERIC, Chaleco NUMERIC, Dinero NUMERIC, Genero NUMERIC, PosX FLOAT, PosY FLOAT, PosZ FLOAT)");
// Algunos Timers sobre la base de datos SQlite.
guardadordeCuenta = SetTimer("GuardarCuentas", 120000, true); // Guardar cuentas cada dos minutos.
}
public OnGameModeExit()
{
//Cierro la base de datos.
db_close(sqldb);
return 1;
}
public OnPlayerConnect(playerid)
{
ReiniciarD(playerid);
new query[(59)];
format(query, sizeof(query), "SELECT * FROM usuarios WHERE Nombre = '%s' COLLATE NOCASE", DB_Escape(Nombre(playerid)));
new DBResult:R = db_query(sqldb, query);
if(db_num_rows(R))
{
ShowPlayerDialog(playerid,DIALOGO_INGRESO,DIALOG_STYLE_PASSWORD,""GRISCLARO"? "AZULMARINO"Bienvenido de nuevo al servidor",""ROJO"Escribe tu contrase?a para ingresar al servidor.","Ingresar","Salir");
}
else
{
ShowPlayerDialog(playerid,DIALOGO_REGISTRO,DIALOG_STYLE_INPUT,""GRISCLARO"? "AZULMARINO"Bienvenido al servidor",""ROJO"Escribe tu contrase?a para poder guardar tus datos.",""TURQUESA"Registrar",""ROJO"Salir");
}
db_free_result(R);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
//Guardar posici?n del jugador.
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x,y,z);
Cuenta[playerid][PosX] = x;
Cuenta[playerid][PosY] = y;
Cuenta[playerid][PosZ] = z;
GuardarCuenta(playerid);
ReiniciarD(playerid);
return 1;
}
public OnDialogResponse(playerid,dialogid,response,listitem,inputtext[])
{
if(dialogid == DIALOGO_INGRESO)
{
if(!response)Kick(playerid);
if(response){
new query[(76�)];
format(query,sizeof(query),"SELECT * FROM usuarios WHERE Nombre = '%s' AND Llave = '%s' COLLATE NOCASE",DB_Escape(Nombre(playerid)),DB_Escape(inputtext));
new DBResult:R = db_query(sqldb,query);
if(db_num_rows(R)){
Cuenta[playerid][ID]? ? ? = db_get_field_assoc_int(R,"ID");
Cuenta[playerid][Nivel]? ? = db_get_field_assoc_int(R,"Nivel");
Cuenta[playerid][NivelStaff]? ? = db_get_field_assoc_int(R,"NivelStaff");
Cuenta[playerid][Dinero]? = db_get_field_assoc_int(R,"Dinero");
Cuenta[playerid][Vida] = db_get_field_assoc_int(R,"Vida");
Cuenta[playerid][Chaleco] = db_get_field_assoc_int(R,"Chaleco");
Cuenta[playerid][Vip]? ? ? = db_get_field_assoc_int(R,"Vip");
? ? Cuenta[playerid][Muteado]? = db_get_field_assoc_int(R,"Muteado");
? ? Cuenta[playerid][Genero] = db_get_field_assoc_int(R,"Genero");
? ? Cuenta[playerid][PosX] = db_get_field_assoc_float(R, "PosX");
? ? Cuenta[playerid][PosY] = db_get_field_assoc_float(R, "PosY");
? ? Cuenta[playerid][PosZ] = db_get_field_assoc_float(R, "PosZ");
? format(query,sizeof(query),"~y~%s~n~~b~usted Ingreso con exito.",Nombre(playerid));
GameTextForPlayer(playerid,query,4000,5);
Cuenta[playerid][Ingreso] = true;
Cuenta[playerid][NewSpawn] = false;
}else return ShowPlayerDialog(playerid,DIALOGO_INGRESO,DIALOG_STYLE_PASSWORD,""GRISCLARO"? "AZULMARINO"Bienvenido de nuevo al servidor",""TURQUESA"Escribe tu contrase?a para ingresar al servidor.\n"ROJO"La contrase?a que has ingresado es incorrecta.",""TURQUESA"Ingresar",""ROJO"Salir");
db_free_result(R);
}}
if(dialogid == DIALOGO_REGISTRO)
{
if(!response)Kick(playerid);
if(response)
{
if(strlen(inputtext) < 4 || strlen(inputtext) > 32) return ShowPlayerDialog(playerid,DIALOGO_REGISTRO,DIALOG_STYLE_INPUT,""GRISCLARO"? "AZULMARINO"Bienvenido al servidor",""ROJO"Escribe tu contrase?a para poder guardar tus datos.",""TURQUESA"Registrar",""ROJO"Salir");
ShowPlayerDialog(playerid, DIALOGO_GENERO, DIALOG_STYLE_MSGBOX, ""GRISCLARO"? "AZULMARINO"?Excelente!",""ROJO"Selecciona tu genero para poder continuar.", "Hombre", "Mujer");
new query[(144�)];
format(query,sizeof(query),"INSERT INTO usuarios (Nombre,Llave,Dinero,NivelStaff,Vip,Nivel,Muteado,PosX,PosY,PosZ) VALUES ('%s','%s','0','0','0','0','0','0', '0', '0')",Nombre(playerid),inputtext);
db_query(sqldb,query);
format(query,sizeof(query),"~y~%s~n~~b~usted fue registrado con exito.",Nombre(playerid));
GameTextForPlayer(playerid,query,4000,5);
Cuenta[playerid][Ingreso] = true;
Cuenta[playerid][NewSpawn] = true;
}
}
if(dialogid == DIALOGO_GENERO)
{
if(!response)Kick(playerid);
if(!response)
{
new query[60];
format(query,sizeof(query),"INSERT INTO usuarios (Genero) VALUES ('1')");
Cuenta[playerid][Genero] = 1;
}
else
{
new query[60];
format(query,sizeof(query),"INSERT INTO usuarios (Genero) VALUES ('0')");
Cuenta[playerid][Genero] = 0;
}
}
return 1;
}
// Evitar bugs //
public OnPlayerRequestSpawn(playerid)
{
if(Cuenta[playerid][Ingreso] == false)
{
GameTextForPlayer(playerid,"~r~~n~~n~Primero debes ingresar/registrarte.",2000,5);
return 0;
}
return 1;
}
public OnPlayerUpdate(playerid)
{
if(GetPlayerMoney(playerid) != Cuenta[playerid][Dinero])
{
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid,Cuenta[playerid][Dinero]);
}
if(GetPlayerScore(playerid) != Cuenta[playerid][Nivel])
{
SetPlayerScore(playerid,Cuenta[playerid][Nivel]);
}
if(IsPlayerAdmin(playerid) && !TienePermisos(playerid))
{
new msg[(57)];
format(msg,sizeof(msg),"%s fue expulsado por ingresar a la rcon sin autorizaci?n.",Nombre(playerid));
SendClientMessageToAll(-1,msg);
Kick(playerid);
}
return 1;
}
public OnPlayerSpawn(playerid)
{
if(Cuenta[playerid][NewSpawn] == false)
{
SetPlayerPos(playerid, Cuenta[playerid][PosX], Cuenta[playerid][PosY], Cuenta[playerid][PosZ]);
SetPlayerInterior(playerid, 0);
}
else
{
new posal = random(3);
switch(posal)
{
case 0: SetPlayerPos(playerid, 1682.7462,-2292.2656,13.5168);
case 1: SetPlayerPos(playerid, 1663.3788,-2286.2458,5.2656);
case 2: SetPlayerPos(playerid, 1682.0084,-2286.5540,-1.2325);
}
SetPlayerInterior(playerid, 0);
}
return 1;
}
// GuardarCuentas //
public GuardarCuentas()
{
for(new i=0;i<MAX_PLAYERS;i)
{
if(IsPlayerConnected(i))
{
GuardarCuenta(i);
}
}
return 1;
}
// Restablecer datos por defecto //
stock ReiniciarD(playerid)
{
Cuenta[playerid][Ingreso]? = false;
Cuenta[playerid][ID] = -1;
Cuenta[playerid][Dinero]? ? = 0;
Cuenta[playerid][Vida] = 0;
Cuenta[playerid][Chaleco] = 0;
Cuenta[playerid][NivelStaff]? ? = 0;
Cuenta[playerid][Vip]? ? ? = 0;
Cuenta[playerid][Nivel]? ? = 0;
Cuenta[playerid][Muteado]? = 0;
Cuenta[playerid][Genero] = 0;
Cuenta[playerid][PosX] = 0.0;
Cuenta[playerid][PosY] = 0.0;
Cuenta[playerid][PosZ] = 0.0;
}
// Verificar si la Cuenta existe //
stock CuentaExistente(name[])
{
new query[(42)];
format(query,sizeof(query),"SELECT * FROM usuarios WHERE Nombre = '%s'",name);
new DBResult:R = db_query(sqldb,query);
if(db_num_rows(R))
{
return true;
}
db_free_result(R);
return false;
}
// Escape //
stock DB_Escape(text[]){
new ret[80 * 2],
ch,
i,
j;
while ((ch = text[i]) && j < sizeof (ret))
{
if (ch == '\'')
{
if (j < sizeof (ret) - 2)
{
ret[j] = '\'';
ret[j] = '\'';
}
}
else if (j < sizeof (ret))
{
ret[j] = ch;
}
else
{
j;
}
}
ret[sizeof (ret) - 1] = '\0';
return ret;
}
stock Nombre(playerid)
{
new name[24];
GetPlayerName(playerid,name,sizeof(name));
return name;
}
stock GuardarCuenta(playerid)
{
if(CuentaExistente(Nombre(playerid)))
{
new query[400];
format(query,sizeof(query),"UPDATE usuarios SET Nivel = '%d', Dinero = '%d', NivelStaff = '%d', Vip = '%d', Muteado = '%d', PosX = '%f', PosY = '%f' PosZ = '%f' WHERE Nombre = '%s'",Cuenta[playerid][Nivel],Cuenta[playerid][Dinero],Cuenta[playerid][NivelStaff],Cuenta[playerid][Vip],Cuenta[playerid][Muteado],Cuenta[playerid][PosX],Cuenta[playerid][PosY],Cuenta[playerid][PosZ],Nombre(playerid));
db_query(sqldb,query);
}
}
}
Los logs:
PHP Code: [15:43:41] [db_log_queries]: CREATE TABLE IF NOT EXISTS `usuarios` (ID INTEGER PRIMARY KEY AUTOINCREMENT, Nombre TEXT, Llave TEXT, Nivel NUMERIC, NivelStaff NUMERIC, Vip NUMERIC, Muteado NUMERIC, Vida NUMERIC, Chaleco NUMERIC, Dinero NUMERIC, Genero NUMERIC, PosX FLOAT, PosY FLOAT, PosZ FLOAT)
[15:43:41] Nova Roleplay.
[15:43:41] Number of vehicle models: 0
[15:44:34] [connection] 127.0.0.1:61684 requests connection cookie.
[15:44:35] [connection] incoming connection: 127.0.0.1:61684 id: 0
[15:44:35] [join] Phillip_Blackstone has joined the server (0:127.0.0.1)
[15:44:35] [db_log_queries]: SELECT * FROM usuarios WHERE Nombre = 'Phillip_Blackstone' COLLATE NOCASE
[15:44:39] [db_log_queries]: INSERT INTO usuarios (Nombre,Llave,Dinero,NivelStaff,Vip,Nivel,Muteado,PosX,PosY,PosZ) VALUES ('Phillip_Blackstone','20061219','0','0','0','0','0','0', '0', '0')
[15:44:54] [db_log_queries]: SELECT * FROM usuarios WHERE Nombre = 'Phillip_Blackstone'
[15:44:54] [db_log_queries]: UPDATE usuarios SET Nivel = '0', Dinero = '0', NivelStaff = '0', Vip = '0', Muteado = '0', PosX = '1668.851074', PosY = '-2242.367187' PosZ = '7.907007' WHERE Nombre = 'Phillip_Blackstone'
[15:44:54] [part] Phillip_Blackstone has left the server (0:1)
[15:45:47] [connection] 127.0.0.1:63435 requests connection cookie.
[15:45:48] [connection] incoming connection: 127.0.0.1:63435 id: 0
[15:45:48] [join] Phillip_Blackstone has joined the server (0:127.0.0.1)
[15:45:48] [db_log_queries]: SELECT * FROM usuarios WHERE Nombre = 'Phillip_Blackstone' COLLATE NOCASE
[15:45:51] [db_log_queries]: SELECT * FROM usuarios WHERE Nombre = 'Phillip_Blackstone'
[15:45:51] [db_log_queries]: UPDATE usuarios SET Nivel = '0', Dinero = '0', NivelStaff = '0', Vip = '0', Muteado = '0', PosX = '0.000000', PosY = '0.000000' PosZ = '0.000000' WHERE Nombre = 'Phillip_Blackstone'
[15:45:59] [db_log_queries]: SELECT * FROM usuarios WHERE Nombre = 'Phillip_Blackstone' AND Llave = '20061219' COLLATE NOCASE
[15:46:06] [db_log_queries]: SELECT * FROM usuarios WHERE Nombre = 'Phillip_Blackstone'
[15:46:06] [db_log_queries]: UPDATE usuarios SET Nivel = '0', Dinero = '0', NivelStaff = '0', Vip = '0', Muteado = '0', PosX = '0.000000', PosY = '0.000000' PosZ = '-87.565048' WHERE Nombre = 'Phillip_Blackstone'
[15:46:06] [part] Phillip_Blackstone has left the server (0:1)
|
|
|
|
| OnPlayerEditDynamicObject |
|
Posted by: JaKe Elite - 2020-11-07, 01:46 PM - Forum: Support
- Replies (1)
|
 |
OnPlayerEditDynamicObject acts weird, randomly saving / cancelling the player's object edit session. OnPlayerEditAttachedObject is affected as well.
Any clue or hints on what might cause this?
|
|
|
|
| How to save message with custom color to database? |
|
Posted by: Zow - 2020-11-06, 06:04 PM - Forum: Pawn Scripting
- Replies (7)
|
 |
PHP Code: CMD:save(playerid, params[]) { ? ? new message[100]; ? ? sscanf(params, "s[100]", message); ? ? format(PlayerInfo[playerid][pMessage], 100, message); SaveMessage(playerid); ? ? return 1; } CMD:show(playerid, params[]) { ? ? new string[100]; ? ? if (!strcmp(PlayerInfo[playerid][pMessage], "None", true)) ? ? ? ? ?return SendClientMessage(playerid, COLOR_YELLOW, "No message");
? ? format(string, sizeof string, "%s", PlayerInfo[playerid][pMessage]); ? ? SendClientMessage(playerid, COLOR_WHITE, string); ? ? return 1; } SaveMessage(playerid) { new query[256]; mysql_format(dbCon, query, sizeof(query), "UPDATE `players` SET `MessageText` = '%e' WHERE `ID` = '%d'", PlayerInfo[playerid][pMessage], PlayerInfo[playerid][pSQLID]); mysql_tquery(dbCon, query); return 1; }
/save {F60000}Message {FFFFFF}Message
But its only save Message?Message?
This is what I want
|
|
|
|
Noob| Hey. |
|
Posted by: Bowner96 - 2020-11-06, 02:42 PM - Forum: General Discussions
- Replies (3)
|
 |
Hey there guys.
So i just got back to PC after a while, i always wanted my SAMP server, now that i have the 'tools' to do so i wanna learn basic scripting and go from there.
Now i know SAMP isnt active as much and isnt 'worth' it, i know. I just wanna learn basic scripting,?test and have fun with my ideas.
I saw this post?and it was very helpfull but i have some questions left. I saw SAMP forums are closed down so even if i see some guides ( thanks to?https://web.archive.org/ ) i cant ask questions or get my help over there.
I dont have any specific questions but i wanna ask if anyone got the time and the patience to help fella noob around ill be thankfull.?
Some questions in mind:
? Can i put all my maps in FilterScript and then load it to the server/gamemode? If so then how? (Please explaing like the noob i am.)
? How do i create dialog?
? ?? Do dialogs can open to other styles of dialog?
? ?? How do i create simple 'Missions' system with dialogs? (Go from checkpoint A to checkpoint B, so on and so on..)
? ?? How i create vehicle spawner with dialog?
? How i give players objects? (Boxes, Wood logs and even a screwdriver)
? How do i create pickup?
? And so many more.
Im looking for dude how can answer my random question with out getting annoyed by my noob lvl. Thanks in advance.
Discord?:?bowner96#5052
|
|
|
|
| LSRP Players |
|
Posted by: DamjanLOL - 2020-11-06, 01:53 PM - Forum: General Discussions
- No Replies
|
 |
Dear LSRP players.
If you don't play LSRP anymore & you don't plan to return, can you please contact me here via PM?
I'm just looking for some people who have cars/money in LSRP that is willing to gift me their stuff lol :D
|
|
|
|
| Indonesia Sub Forum |
|
Posted by: Tama - 2020-11-06, 07:42 AM - Forum: Other
- No Replies
|
 |
Karena gak ada yang serius, mari aku buat disini.
Rules simple, share apa yang kamu punya, diskusi apa yang kamu mau, share kode, dll.
Don't be a dick, be respectful to other people.
Ok that's?it, enjoy.
|
|
|
|
| samp-cctv | Create CCTV with one line! Monitor everything. |
|
Posted by: Mergevos - 2020-11-05, 11:05 PM - Forum: Libraries
- Replies (4)
|
 |
samp-cctv
This library allows you to create CCTV. CCTV stands for closed-circuit television.?
Usage
Code: CCTV_Create(Float: x, Float: y,? Float: z, Float: rotX, Float: rotY, Float: rotZ, Float: lookX, Float: lookY, Float: lookZ, virtualworld, interiorid)[/align]
[align=center]CCTV_Destroy(cctvid)[/align]
[align=center]CCTV_Watch(playerid, cctvid)[/align]
[align=center]CCTV_Unwatch(playerid, cctvid)
I think the names of these functions are self-explanatory. You either create, watch, destroy or unwatch a specific CCTV.?
For more info, check github.
Installation
Of course, use the modern standards
Code: sampctl p install Mergevos/samp-cctv[/align]
[align=center]
Then include it and start using library.
Images
|
|
|
|
| Dynamic storage containers |
|
Posted by: EvilShadeZ - 2020-11-05, 08:57 PM - Forum: Questions and Suggestions
- Replies (3)
|
 |
I would like for some kind of dynamic storage container to be implemented such as list. This would be especially beneficial now that we have removed limits for various entity types. It would be quite ridiculous defining enormous arrays to keep track of things.
I imagine it working something similar to how y_iterate was implemented.
Code: new List:list = List_New();
List_Add(list,value);
List_Remove(list,value);
List_Delete(list);
List_Clear(list);
List_Random(list);
List_Next(...);??
List_Previous(...);
etc...
If different data types could be supported it would be a plus, but integers would be a great start.
|
|
|
|
|