[Help] MySQL saving
#1

Now that I finally converted to the MySQL system, It's been kindda hard. I want when the player disconnects all the stats to be saved, so I have

PHP код:
public OnPlayerDisconnect(playeridreason)
{
    new 
day,year,month;
    
getdate(year,month,day);
    new 
query[128];
    new 
Float:xFloat:yFloat:zFloat:a;
    
    
GetPlayerPos(playeridxyz);
    
GetPlayerFacingAngle(playerida);
    
mysql_format(g_Sqlquerysizeof(query), "UPDATE `accounts` SET `Level` = %d, `Admin` = %d, `Cash` = %d, `Kills` = %d, `Deaths` = %d, `PosX` = %f, `PosY` = %f, `PosZ` = %f, `PosA` = %f, `Warnings` = %d, `isBanned` = %d WHERE `ID` = %d",
    
PlayerInfo[playerid][Level], PlayerInfo[playerid][Admin], GetPlayerMoney(playerid), PlayerInfo[playerid][Kills], PlayerInfo[playerid][Deaths], xyzaPlayerInfo[playerid][Warnings], PlayerInfo[playerid][isBanned], PlayerInfo[playerid][ID]);
    
mysql_tquery(g_Sqlquery"""");
    return 
1;

When I added this for my /makeadmin command:

Код:
mysql_format(g_Sql, query, sizeof(query), "UPDATE `accounts` SET `Admin` = %d WHERE `ID` = %d", level, PlayerInfo[givingID][ID]);
mysql_tquery(g_Sql, query, "", "");

The admin level gets saved here. BEFORE I added these lines, it wouldn't save on OnPlayerDisconnect .But, It's a pain in the ass to add these lines for every command and everything. So, how do I make all of these stats save when the player disconnects, as my onPlayerDisconnect doesn't work, obviously
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)