18.03.2017, 19:05
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
When I added this for my /makeadmin command:
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
PHP код:
public OnPlayerDisconnect(playerid, reason)
{
new day,year,month;
getdate(year,month,day);
new query[128];
new Float:x, Float:y, Float:z, Float:a;
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, a);
mysql_format(g_Sql, query, sizeof(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], x, y, z, a, PlayerInfo[playerid][Warnings], PlayerInfo[playerid][isBanned], PlayerInfo[playerid][ID]);
mysql_tquery(g_Sql, query, "", "");
return 1;
}
Код:
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