Score are gone [HELP] +rep
#1

hey guys So I have a server but my problem is when I play for like few minutes and my score is for example its 100. and when I close the server (CMD based) and open it, my scores are gone. how can I save that ?
Reply
#2

You can use Y_Ini or dini... and I don't need your REP
Reply
#3

Do you have an account system?
Reply
#4

i have dini but still it doesn't save
Reply
#5

be sure to save the userdata also on OnGameModeExit
Here:
Код:
public OnGameModeExit()
{
    for(new i = 0; i < MAX_PLAYERS; i ++)
    {
        SavePlayer(i); // or whatever your save function is called 
    }
}
Reply
#6

Quote:
Originally Posted by [AK]Nazgul
Посмотреть сообщение
be sure to save the userdata also on OnGameModeExit
Here:
Код:
public OnGameModeExit()
{
    for(new i = 0; i < MAX_PLAYERS; i ++)
    {
        SavePlayer(i); // or whatever your save function is called 
    }
}
I already have this but still not saving
Reply
#7

In the same way you created stats for a registered player (money-score-kills-deaths or whatever), create one more and that is "Logged". When Logged=1 means player is logged in. Adding an if (Logged==1) under public OnPlayerUpdate(playerid) will make this public be triggered only when player is logged in. What is happening to your situation is that OnplayerUpdate takes the stats values as soon as you enter, which of cource are all 0 and set them in .ini file, reseting your stats. I had the same exact problem and that's how i solved it.
Reply
#8

I solved the problem by doing the following:
Код:
- On each restart function in your script:
 > Save all players
 > Set logged for all players to 0
- OnPlayerDisconnect
 > Only save a players stats if logged == 1
Reply
#9

Quote:
Originally Posted by [AK]Nazgul
Посмотреть сообщение
I solved the problem by doing the following:
Код:
- On each restart function in your script:
 > Save all players
 > Set logged for all players to 0
- OnPlayerDisconnect
 > Only save a players stats if logged == 1
That's what I said smart ass. Stated in a misleading way too.
Reply
#10

Quote:
Originally Posted by HurtLocker
Посмотреть сообщение
That's what I said smart ass. Stated in a misleading way too.
I said 'add it in OnPlayerDisconnect', not in OnplayerUpdate
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)