Score saving but suddenly going back to 0!
#1

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

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

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

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
Reply
#5

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

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

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

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

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)