Save crashes server MYSQL
#1

Whenever I disconnect from the server it crashes in the middle of the save.
Here is the code:
Код:
stock SaveStats(playerid)
{
	new query[1024];
	new Float:x, Float:y, Float:z;
	GetPlayerPos(playerid, x, y, z);
	
	format(query, sizeof(query), "UPDATE playerdata SET Cash=%i, PosX=%f, PosY=%f, PosZ=%f, Interior=%f, VirtualWorld=%f, AdminLevel=%i WHERE Name='%s'",
	PlayerInfo[playerid][Cash],
	x,
	y,
	z,
	PlayerInfo[playerid][Int],
	PlayerInfo[playerid][VW],
	PlayerInfo[playerid][Admin],
	GetName(playerid));
	
	mysql_query(query);
	printf("Player Saved");
	return 1;
}
Here is the server log:
Quote:

[13:04:11] [join] Jason_Smith has joined the server (0:127.0.0.1)
[13:04:20] sscanf warning: String buffer overflow.
[13:04:30] RCON (In-Game): Player #0 (Jason_Smith) has logged in.
[13:04:34] [debug] Server crashed while executing RP_Mysql.amx
[13:04:34] [debug] AMX backtrace:
[13:04:34] [debug] #0 native fwrite () [004056e0] from samp-server.exe
[13:04:34] [debug] #1 0003893c in ?? (0x0003bd6c, 0x0003fb44) from RP_Mysql.amx
[13:04:34] [debug] #2 0003eb3c in public cmd_makeadmin (0x00000000, 0x0003be40) from RP_Mysql.amx
[13:04:34] [debug] #3 native CallLocalFunction () [00472ad0] from samp-server.exe
[13:04:34] [debug] #4 000064d4 in public OnPlayerCommandText (0x00000000, 0x0003be0c) from RP_Mysql.amx
[13:04:34] [debug] Native backtrace:
[13:04:34] [debug] #0 77cf22d2 in ?? () from C:\Windows\SysWOW64\ntdll.dll
[13:04:34] [debug] #1 00493990 in ?? () from samp-server.exe
[13:04:34] [debug] #2 0040531e in ?? () from samp-server.exe

Reply
#2

Are you sure it's the saving query that is causing the crash?

Also, inside your format function you should change this:

Interior=%f, VirtualWorld=%f

to this:

Interior=%i, VirtualWorld=%i

Both of the variables are not float i belieave.
Reply
#3

pawn Код:
stock SaveStats(playerid)
{
    new query[400];
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    format(query, sizeof(query), "UPDATE playerdata SET Cash='%d', PosX='%f', PosY='%f', PosZ='%f', Interior='%d', VirtualWorld='%d', AdminLevel='%d' WHERE Name='%s'",
    PlayerInfo[playerid][Cash],x,y,z,PlayerInfo[playerid][Int],PlayerInfo[playerid][VW],PlayerInfo[playerid][Admin],GetName(playerid));
    mysql_query(query);
    printf("Player Saved");
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)