13.10.2011, 17:39
this script just won't work..
i get no errors or stuff so what am i doing wrong?
it doesn't update the database!
i get no errors or stuff so what am i doing wrong?
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
new pname[MAX_PLAYER_NAME], rows;
GetPlayerName(playerid, pname, sizeof(pname));
format(fquery, sizeof(fquery), "SELECT * FROM users WHERE username = '%s'", pname);
mysql_query(fquery);
mysql_store_result();
rows = mysql_num_rows();
if(rows == 1) {
new Float:posx, Float:posy, Float:posz, Float:pangle;
GetPlayerPos(playerid, posx, posy, posz);
GetPlayerFacingAngle(playerid, pangle);
format(fquery, sizeof(fquery), "UPDATE users SET cash = %i, score = %i, posx = %f, posy = %f, posz = %f, angle = %f, virtualworld = %i, interior = %i, skin = %i WHERE username = '%s'", GetPlayerMoney(playerid), GetPlayerScore(playerid), posx, posy, posz, pangle, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid), pname);
mysql_query(fquery);
}
mysql_free_result();
return 1;
}