Stats won't save when player dicconnect
#1

player stats won't save when disconnect

this is the code

Код:
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); 
    } 
    return 1; 
}
Reply
#2

Try this as your query. Be sure to wrap it in double quotes.

UPDATE `USERS` SET `SCORE` = %d, `CASH` = %d, `ADMINLEVEL` = %d WHERE `NAME` = '%s'
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)