SA-MP Forums Archive
Score saving but suddenly going back to 0! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Score saving but suddenly going back to 0! (/showthread.php?tid=277630)



Score saving but suddenly going back to 0! - OleKristian95 - 18.08.2011

Title says all, I wonder if anyone got any idea why this is happening.

It's starting to annoy me because players are getting very happy when they get some 100s score and then the next day it can be back to 0.


Re: Score saving but suddenly going back to 0! - [L3th4l] - 18.08.2011

Explain more. Does it reset on the next time the player logs in? When he disconnects? It will also help if you showed the saving and loading part.


Re: Score saving but suddenly going back to 0! - Shockey HD - 18.08.2011

Quote:
Originally Posted by OleKristian95
Посмотреть сообщение
Title says all, I wonder if anyone got any idea why this is happening.

It's starting to annoy me because players are getting very happy when they get some 100s score and then the next day it can be back to 0.
I suggest you to save there score. Theres many ways to do so. Do you have a enum in your script?


Re: Score saving but suddenly going back to 0! - OleKristian95 - 18.08.2011

It is saving!
Its just for no reason going back to 0 at random times.

pawn Код:
SavePlayer(playerid)
{
        dUserSetINT(PlayerName2(playerid)).("score",GetPlayerScore(playerid));
}
pawn Код:
stock UpdateConfig()
{
     if(!dini_Isset(file,"SaveScore")) dini_IntSet(file,"SaveScore",1);
    ServerInfo[SetScore] = dini_Int(file,"SaveScore");
}
pawn Код:
enum pInfo
{
    Score,
}
pawn Код:
enum ServerData
{
    SetScore,
};
pawn Код:
public OnPlayerConnect(playerid)
{]
            SetPlayerScore(playerid,dUserINT(PlayerName2(playerid)).("score")-GetPlayerScore(playerid));
            PlayerInfo[playerid][Score] = (dUserINT(PlayerName2(playerid)).("score"));
    return 1;
}
Thats all my score savings and loadings I think, idk. lol


Re: Score saving but suddenly going back to 0! - [MWR]Blood - 18.08.2011

At random times?
You mean like while the player is having fun, suddenly, without disconnecting, crashing, server restart, or something it goes back to 0?
I don't see how.
It should be another thing
Also are you sure it is saving in the file?


Re: Score saving but suddenly going back to 0! - OleKristian95 - 18.08.2011

Quote:
Originally Posted by Delux13
Посмотреть сообщение
At random times?
You mean like while the player is having fun, suddenly, without disconnecting, crashing, server restart, or something it goes back to 0?
I don't see how.
It should be another thing
Also are you sure it is saving in the file?
Well if it does when they disconnect, crash or on a server restart then its hard to find out.

Код:
password_hash=
ip=
registered=1
RegisteredDate=18/8/2011
loggedin=0
banned=0
level=10
LastOn=18.8.2011
money=10076465
score=7
kills=0
deaths=0
Bank=0
weed=0
Gang=0
Condoms=0
inalcatraz=0
hours=0
minutes=39
seconds=49
x1=-358
y1=1511
z1=77
interior1=0
weap1=0
weap1ammo=0
weap2=27
weap2ammo=2497
weap3=28
weap3ammo=4992
weap4=31
weap4ammo=3724
weap5=0
weap5ammo=0
weap6=0
weap6ammo=0
health=80
armour=0
TimesOnServer=67
bowner=1
bowned=23
vowned=846
vowner=1
vowned2=847
vowner2=1
vowned3=822
vowner3=1
vowned4=40
vowner4=1
vowned5=110
vowner5=1
Houseid=-255
Rentid=-255
SpawnX=0
SpawnY=0
SpawnZ=0
SpawnInt=0
this is my userfile it saves.


Re: Score saving but suddenly going back to 0! - Kingunit - 19.08.2011

You need to save them at OnPlayerDisconnect and OnGameModeExit. Try that.


Re: Score saving but suddenly going back to 0! - OleKristian95 - 19.08.2011

Quote:
Originally Posted by Kingunit
Посмотреть сообщение
You need to save them at OnPlayerDisconnect and OnGameModeExit. Try that.
how? what code


Re: Score saving but suddenly going back to 0! - Kingunit - 19.08.2011

In the tutorial section you can find alot of DINI tutorials. Also I suggest you to quit with DINI. Use Y_INI instead.


Re: Score saving but suddenly going back to 0! - Admigo - 19.08.2011

Add this on playerdisconnect and onplayerupdate:
dUserSetINT(PlayerName2(playerid)).("score",GetPla yerScore(playerid));