Accounts Won't Save OnPlayerDisconnect
#1

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.
Reply
#2

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.
Reply
#3

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


Forum Jump:


Users browsing this thread: 1 Guest(s)