• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Server] Duplicate CallBack call
#1
In my gamemode I use mysql as a data saving system. Most of the player data I will save the moment it is changed to avoid problems in case of server crash or crash, and I also save the player data when restarting the server (/ gmx).

PHP Code:
public OnPlayerDisconnect() { Player_DestroyAllVehicles(playerid); Player_SaveRanking(playerid); Player_SaveConfig(playerid); Player_SaveMoney(playerid); ? ? Player_SaveData(playerid); ? ? Player_ClearVars(playerid); Player_ClearAcessories(playerid); Player_ClearInfo(playerid); Inventory_Reset(playerid); }

PHP Code:
public OnGameModeExit() { foreach(new i : Player) { Player_DestroyAllVehicles(i); Player_SaveRanking(i); Player_SaveConfig(i); Player_SaveMoney(i); Player_SaveData(i); Player_ClearVars(i); Player_ClearAcessories(i); Player_ClearInfo(i); Inventory_Reset(i); } DestroyAllDynamicMapIcons(); DestroyAllDynamic3DTextLabels(); DestroyAllDynamicPickups(); mysql_close(ConexaoSQL); return 1; }



What I noticed is that when I restart the server, OnGameModeExit is saved and OnPlayerDisconnect is saved, doubling each player's save. For example: when I restart the server (/ gmx) the player's money is saved in OnGameModeExit and OnPlayerDisconnect, being saved 2 times without need.
How do I avoid this duplication of calls? Do I need to save player data on OnGameModeExit or just OnPlayerDisconnect?
Is OnPlayerDisconnect called by default by OnGameModeExit?
  Reply


Messages In This Thread
Duplicate CallBack call - by RhaegarX - 2021-03-19, 04:45 PM
RE: Duplicate CallBack call - by Kodokushi - 2021-03-19, 05:02 PM
RE: Duplicate CallBack call - by RhaegarX - 2021-03-19, 05:15 PM
RE: Duplicate CallBack call - by Pinch - 2021-03-19, 05:47 PM
RE: Duplicate CallBack call - by RhaegarX - 2021-03-19, 06:06 PM
RE: Duplicate CallBack call - by Pinch - 2021-03-19, 09:56 PM
RE: Duplicate CallBack call - by RhaegarX - 2021-03-20, 04:33 PM
RE: Duplicate CallBack call - by Pinch - 2021-03-20, 08:55 PM
RE: Duplicate CallBack call - by Y_Less - 2021-03-21, 12:16 PM
RE: Duplicate CallBack call - by Pinch - 2021-03-21, 05:42 PM