Posts: 944
Threads: 128
Joined: Sep 2014
Reputation:
0
Hi, I've bumped into a problem where players' stats are not saved on gamemode exit. I've ******d and found that this happens for everyone and some guy told another guy to create a restart command which saves players' accounts first then performs a gamemode exit. I tried that, but it doesn't seem to work. I've looked into my old SCRP edit and found that they have exactly the same thing - when a server restarts with /restart it saves all the accounts first then performs a gamemode exit. I was thinking about a setting a timer that restarts the server after all accounts were saved, but I don't really want it to be like that because I want it to be smooth and nice and it works on SCRP, but not here so I'm asking you guys if there is another way to do it?
Posts: 283
Threads: 67
Joined: Jun 2015
Hello.
Heres my code for accounts save.
PHP код:
http://pastebin.com/YKnfuEK9
Make something like this.
Posts: 944
Threads: 128
Joined: Sep 2014
Reputation:
0
Lol man I know how to save accounts, the problem here is that the accounts don't save when I restart the server. :P Wait... Don't tell me you save the accounts under OnPlayerUpdate...
Posts: 283
Threads: 67
Joined: Jun 2015
Can you show me your code?
Posts: 283
Threads: 67
Joined: Jun 2015
I had same problem on my gm but i created this.
PHP код:
public OnGameModeExit()
{
cvector_clear(players);
for(new i = 1; i <= TotalBizz; i++) SaveBizz(i);
for(new i = 1; i <= TotalHouse; i++) SaveProperty(i);
SaveAccounts();
SaveMaterials();
SaveGZ();
SaveBankMafia();
SaveBankFrac();
SaveKazino();
ClearReconnect();
GameModeExitFunc();
return true;
}
Posts: 944
Threads: 128
Joined: Sep 2014
Reputation:
0
As I said if I save something under OnGameModeExit it just doesn't save because gamemode exit is too fast or something.
Posts: 283
Threads: 67
Joined: Jun 2015
It's not true, Everything is saving. :P
Posts: 944
Threads: 128
Joined: Sep 2014
Reputation:
0
For me and many other people not. Also I don't use MySQL so there could be a difference in speed.
Posts: 283
Threads: 67
Joined: Jun 2015
I created sub script for this. Now its saving everything.
PHP код:
publics: SaveAccounts()
{
foreach(new i:Player)
{
OnPlayerUpdateAc(i);
}
}