Burgershot
  • Home
  • Members
  • Team
  • Help
  • Search
  • Register
  • Login
  • Home
  • Members
  • Help
  • Search
Burgershot SA-MP Support [Server] Duplicate CallBack call

 
  • 0 Vote(s) - 0 Average
Server Duplicate CallBack call
RhaegarX
Offline

Burgershot Member
Posts: 66
Threads: 12
Joined: Nov 2020
Reputation: 4
#1
2021-03-19, 04:45 PM (This post was last modified: 2021-03-19, 04:47 PM by RhaegarX.)
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?
« Next Oldest | Next Newest »



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

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Burgershot - Powered by our Community and MyBB Original Theme by Emerald

Linear Mode
Threaded Mode