18.11.2014, 16:48
This is my script:
This callback is being called when a player registers and when a player disconnects.
It works perfectly when a player registers.
When a player disconnect, it just doesnt! The (hashed) password field is empty, the position of the player stays the same (doesn't save)
What's wrong?
EDIT: Yes, the whole script IS getting processed when a player logs, and so 'OnAccountFirstSave' - the query itself (and the data?) is not working
pawn Код:
stock SaveAccount(playerid) {
if(gPlayerLogged[playerid] && AdminDuty[playerid] == 0) {
new
szPlayerName[MAX_PLAYER_NAME],
szQuery[2048];
GetPlayerName(playerid, szPlayerName, MAX_PLAYER_NAME);
printf("d - %s", PlayerInfo[playerid][pKey]);
mysql_format(gMySQLConnection, szQuery, sizeof(szQuery), "UPDATE players SET Username = '%e', Password = '%e', Level = %d, AdminLevel = %d, Donator = %d, Banned = %d, LastIP = '%e', Registered = %d, \
Sex = %d, Age = %d, Skin = %d, PosX = '%f', PosY = '%f', PosZ = '%f', PosR = '%f', ConnectTime = %d, Respect = %d, PhoneNumber = %d, Warnings = %d, Faction = %d, Leader = %d, Rank = %d WHERE ID = %d",
szPlayerName, PlayerInfo[playerid][pKey], PlayerInfo[playerid][pLevel], PlayerInfo[playerid][pAdmin], PlayerInfo[playerid][pDonator], PlayerInfo[playerid][pBanned],
PlayerInfo[playerid][pIP], PlayerInfo[playerid][pReg], PlayerInfo[playerid][pSex], PlayerInfo[playerid][pAge], PlayerInfo[playerid][pSkin], PlayerInfo[playerid][pPos_x],
PlayerInfo[playerid][pPos_y], PlayerInfo[playerid][pPos_z], PlayerInfo[playerid][pPos_r], PlayerInfo[playerid][pConnectTime], PlayerInfo[playerid][pRespect], PlayerInfo[playerid][pNumber], PlayerInfo[playerid][pWarns],
PlayerInfo[playerid][pFaction], PlayerInfo[playerid][pLeader], PlayerInfo[playerid][pRank], PlayerInfo[playerid][pID]);
mysql_pquery(gMySQLConnection, szQuery, "OnAccountFirstSave", "i", playerid);
}
return 1;
}
It works perfectly when a player registers.
When a player disconnect, it just doesnt! The (hashed) password field is empty, the position of the player stays the same (doesn't save)
What's wrong?
EDIT: Yes, the whole script IS getting processed when a player logs, and so 'OnAccountFirstSave' - the query itself (and the data?) is not working