20.09.2014, 18:32
So by the long title you can understand that I'm having an issue.
Well, bassicly I don't know how but when I raise deaths and kills by one they update in the database
but then when a player quits the game it goes back to zero.
It only happens on this thing, not sure why.
I assume because the player exits the game so it doesn't get to save it.. I don't really know.
Here's the code:
Well, bassicly I don't know how but when I raise deaths and kills by one they update in the database
but then when a player quits the game it goes back to zero.
It only happens on this thing, not sure why.
I assume because the player exits the game so it doesn't get to save it.. I don't really know.
Here's the code:
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
pInfo[playerid][Deaths]++;
if(killerid != INVALID_PLAYER_ID)
{
pInfo[killerid][Kills]++;
}
return 1;
}
stock MySQL_SAVE(playerid)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
mysql_format(g_Write, query, sizeof(query), "UPDATE accounts SET PosX = %f, PosY = %f, PosZ = %f, AdminLevel = %d, Kills = %d AND Deaths = %d WHERE Name = '%s'", x, y, z, pInfo[playerid][AdminLevel], pInfo[playerid][Kills], pInfo[playerid][Deaths], GetName(playerid));
mysql_pquery(g_Write, query);
pInfo[playerid][RconLogged] = false;
pInfo[playerid][LoggedIn] = false;
pInfo[playerid][Registered] = false;
return 1;
}