23.02.2019, 10:02
I don't know why my code didn't work (the master account wont save) when I did GMX through samp-server.exe and in-game ('/rcon gmx'), but it all went well when I did quit (/q). Does somebody know why?
PS: I have restore the player's name back to their master account name in OnPlayerDisconnect, because my script only loads master account name when the player is connecting. So, I don't need to /quit to change back my name to master account name.
My codes:
PS: I have restore the player's name back to their master account name in OnPlayerDisconnect, because my script only loads master account name when the player is connecting. So, I don't need to /quit to change back my name to master account name.
My codes:
Code:
public OnGameModeExit() { for(new i = 0; i < MAX_DEALERS; i++) { CallFunction(OnDealershipUpdate(i)); KillTimer(DealerInfo[i][dUpdateTimer]); DestroyDynamicPickup(DealerInfo[i][dPickup]); new resetDealerInfo[E_DEALER_INFO]; DealerInfo[i] = resetDealerInfo; } mysql_close(gConnection); return 1; } public OnPlayerDisconnect(playerid, reason) { if(PlayerInfo[playerid][isPlayerLogged]) { KillTimer(PlayerInfo[playerid][pSavingTimer]); format(PlayerInfo[playerid][pLastLogin], 60, "%s at %s", GetDate(), GetTime()); CallFunction(OnPlayerStatsUpdate(playerid)); new sReason[30]; switch(reason) { case 0: sReason = "Timeout"; case 1: sReason = "Quit"; case 2: sReason = "Kicked/Banned"; } SendLocalMessage(playerid, RADIUS_LONG, COLOR_WHITE, COLOR_WHITE, COLOR_WHITE, COLOR_WHITE, COLOR_WHITE, "%s has left the server. (%s)", GetName(playerid), sReason); } if(!isnull(PlayerInfo[playerid][pMasterName])) SetPlayerName(playerid, PlayerInfo[playerid][pMasterName]); ResetPlayerVariables(playerid); return 1; } public:OnPlayerStatsUpdate(playerid) { new query[1000]; mysql_format(gConnection, query, sizeof(query), "UPDATE masters SET name = '%e', password = '%e', ipaddress = '%e', admin = '%d', helps = '%d' WHERE masterid = '%d'", PlayerInfo[playerid][pMasterName], PlayerInfo[playerid][pMasterPass], PlayerInfo[playerid][pMasterIP], PlayerInfo[playerid][pMasterAdmin], PlayerInfo[playerid][pMasterHelps], PlayerInfo[playerid][pMasterID]); mysql_tquery(gConnection, query); return 1; }