25.02.2014, 18:05
I want to check if player is not logged on this script and save these fields:
I was trying to many ways, but does not work... If works when player is not logged, then doesn't work when player is logged. What can you suggest?
pawn Код:
if(GetPVarInt(playerid, "IsPlayerLogged") == 0)
{
}
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
if(MySQLConnection == AK_TRUE)
{
// If player is logged in
if(GetPVarInt(playerid, "IsPlayerLogged") == 1)
{
// Create variables
new
MySQLQuery[300],
pname[24];
// Get player name
GetPlayerName(playerid, pname, 24);
// Format MySQL UPDATE command
format(MySQLQuery, sizeof(MySQLQuery), "UPDATE Users SET Kills=%i, Deaths=%i, Money=%i, Bank=%i, Admin=%i WHERE Name='%s'", GetPVarInt(playerid, "Kills"), GetPVarInt(playerid, "Deaths"), GetPlayerMoney(playerid), GetPVarInt(playerid, "Bank"), GetPVarInt(playerid, "Admin"), pname);
// Execute UPDATE command
mysql_query(MySQLQuery);
}
}
// Exit
return 1;
}