Saving accounts at GMX -
GoldenLion - 19.11.2016
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?
Re: Saving accounts at GMX -
Pearson - 19.11.2016
Hello.
Heres my code for accounts save.
PHP код:
http://pastebin.com/YKnfuEK9
Make something like this.
Re: Saving accounts at GMX -
GoldenLion - 19.11.2016
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...
Re: Saving accounts at GMX -
Pearson - 19.11.2016
Can you show me your code?
Re: Saving accounts at GMX -
GoldenLion - 19.11.2016
There's nothing to do with the code, but here it is if you need it so much:
Код:
for (new i, j = GetPlayerPoolSize(); i <= j; i++) if (IsPlayerConnected(i)) SaveAccount(i);
GameModeExit();
I'm trying to say that this way doesn't work in my gamemode, but in SCRP it does. I'm asking if someone knows what's up.
Re: Saving accounts at GMX -
Pearson - 19.11.2016
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;
}
Re: Saving accounts at GMX -
GoldenLion - 19.11.2016
As I said if I save something under OnGameModeExit it just doesn't save because gamemode exit is too fast or something.
Re: Saving accounts at GMX -
Pearson - 19.11.2016
It's not true, Everything is saving. :P
Re: Saving accounts at GMX -
GoldenLion - 19.11.2016
For me and many other people not. Also I don't use MySQL so there could be a difference in speed.
Re: Saving accounts at GMX -
Pearson - 19.11.2016
I created sub script for this. Now its saving everything.
PHP код:
publics: SaveAccounts()
{
foreach(new i:Player)
{
OnPlayerUpdateAc(i);
}
}