SA-MP Forums Archive
Stats wont save when player dicconnect - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Stats wont save when player dicconnect (/showthread.php?tid=504878)



Stats wont save when player dicconnect - 9noober - 06.04.2014

player stats won't save when disconnect

this is the code

PHP код:
public OnPlayerDisconnect(playeridreason)
{
    new
    
Query200 ], // We need to create such a query so we can format it.
    
nameMAX_PLAYER_NAME ]    ;
    
GetPlayerName(playeridnamesizeof(name)); // Gather the name of the player.
    
if(Bit1_Get(g_PlayerLoggedplayerid) == 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_AdminLevelplayerid), // Gather the Admin Level
    
DB_Escape(name)); // Gather the name of the player then escape it.
    
db_query(DatabaseQuery);
    
Bit1_Set(g_PlayerLoggedplayeridfalse);
    
SendClientMessage(playerid,COLOR_LIGHTGREEN,"[STATS]:{FFFFFF}Your stats has been save.");
    }
    return 
1;




Re: Stats wont save when player dicconnect - BizzyD - 06.04.2014

Wrong section, Post it in Scripting Help