SA-MP Forums Archive
Accounts Won't Save OnPlayerDisconnect - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Accounts Won't Save OnPlayerDisconnect (/showthread.php?tid=614130)



Accounts Won't Save OnPlayerDisconnect - Allura - 04.08.2016

Account will not save when player disconnects.

Код:
forward SaveAccount(playerid);
public SaveAccount(playerid)
{
    new query[300], Float:pos[4], playerip[16];

    GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
    GetPlayerFacingAngle(playerid, pos[3]);
    GetPlayerIp(playerid, playerip, sizeof(playerip));

    mysql_format(mysql, query, sizeof(query), "UPDATE `accounts` SET `Name` = '%e', `Password` = '%e', `IP` = '%e', `Admin` = %d, `Money` = %d, `PosX` = %f, `PosY` = %f, `PosZ` = %f, `PosA` = %f WHERE `ID` = %d",
    Player[playerid][Name], Player[playerid][Password], playerip, Player[playerid][Admin], GetPlayerMoney(playerid), pos[0], pos[1], pos[2], pos[3], Player[playerid][ID]);
    mysql_tquery(mysql, query, "", "");
    return true;
}
And, under OnPlayerDisconnect, I call the save function.


Re: Accounts Won't Save OnPlayerDisconnect - AndySedeyn - 04.08.2016

What does mysql_log.txt say?

EDIT: not sure why you would save the player's name and password anywhere else other than at the end of your register process or after changing their name.


Re: Accounts Won't Save OnPlayerDisconnect - Vince - 04.08.2016

GetPlayer_ functions do NOT work in OnPlayerDisconnect because the client is already disconnected at that point. There's nothing to "get" anymore.