Saving accounts at GMX
#1

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?
Reply
#2

Hello.
Heres my code for accounts save.
PHP код:
http://pastebin.com/YKnfuEK9 
Make something like this.
Reply
#3

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...
Reply
#4

Can you show me your code?
Reply
#5

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.
Reply
#6

I had same problem on my gm but i created this.
PHP код:
public OnGameModeExit()
{
    
cvector_clear(players);
    for(new 
1<= TotalBizzi++) SaveBizz(i);
    for(new 
1<= TotalHousei++) SaveProperty(i);
    
SaveAccounts();
    
SaveMaterials();
    
SaveGZ();
    
SaveBankMafia();
    
SaveBankFrac();
    
SaveKazino();
    
ClearReconnect();
    
GameModeExitFunc();
    return 
true;

Reply
#7

As I said if I save something under OnGameModeExit it just doesn't save because gamemode exit is too fast or something.
Reply
#8

It's not true, Everything is saving. :P
Reply
#9

For me and many other people not. Also I don't use MySQL so there could be a difference in speed.
Reply
#10

I created sub script for this. Now its saving everything.
PHP код:
publicsSaveAccounts()
{
    foreach(new 
i:Player)
    {
         
OnPlayerUpdateAc(i);
    }

Reply


Forum Jump:


Users browsing this thread: 6 Guest(s)