06.04.2014, 04:33
player stats won't save when disconnect
this is the code
this is the code
PHP код:
public OnPlayerDisconnect(playerid, reason)
{
new
Query[ 200 ], // We need to create such a query so we can format it.
name[ MAX_PLAYER_NAME ] ;
GetPlayerName(playerid, name, sizeof(name)); // Gather the name of the player.
if(Bit1_Get(g_PlayerLogged, playerid) == 1)
{
format(Query,sizeof(Query),"UPDATE `USERS` SET SCORE = '%d', CASH = '%d', ADMINLEVEL = '%d' WHERE `NAME` = '%s'",
GetPlayerScore(playerid), // Gather the player's score
GetPlayerMoney(playerid), // Gather the player's money
Bit16_Get(g_AdminLevel, playerid), // Gather the Admin Level
DB_Escape(name)); // Gather the name of the player then escape it.
db_query(Database, Query);
Bit1_Set(g_PlayerLogged, playerid, false);
SendClientMessage(playerid,COLOR_LIGHTGREEN,"[STATS]:{FFFFFF}Your stats has been save.");
}
return 1;
}