SA-MP Forums Archive
Scores - 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: Scores (/showthread.php?tid=68809)



Scores - notec100 - 13.03.2009

I was wondering I am having issues with my scores not always saving for some reason so I am wondering in script when a player does something good i give them plus 1 score so in the script would I put both:
dUserSetINT(PlayerName(playerid)).("Score",GetPlay erScore(playerid)+1);
SetPlayerScore(playerid, GetPlayerScore(playerid)+1);

Or is this the reason the score does not always save? I am using them both such as:

* notec100 slaps around a bit with a large trout.
dUserSetINT(PlayerName(playerid)).("Score",GetPlay erScore(playerid)+1);
SetPlayerScore(playerid, GetPlayerScore(playerid)+1);

Thanks in advance.




Re: Scores - Pyrokid - 13.03.2009

I know what's wrong. It's saving the player's current ingame score and adding 1. For example, let's say your player had 5 points last night and he has 5 points now in his profile. He comes on again today and only gets 2 points. His profile will go back to 2 because you're using the current in-game score to save.

Change:
pawn Код:
dUserINT(PlayerName(playerid)).("Score",GetPlayerScore(playerid)+1);
to this:
pawn Код:
dUserSetINT(PlayerName(playerid)).("Score",dUserINT(PlayerName(playerid)).("Score")+1);



Re: Scores - notec100 - 13.03.2009

Quote:
Originally Posted by [Fackin'
Pyro ]
I know what's wrong. It's saving the player's current ingame score and adding 1. For example, let's say your player had 5 points last night and he has 5 points now in his profile. He comes on again today and only gets 2 points. His profile will go back to 2 because you're using the current in-game score to save.

Change:
pawn Код:
dUserINT(PlayerName(playerid)).("Score",GetPlayerScore(playerid)+1);
to this:
pawn Код:
dUserSetINT(PlayerName(playerid)).("Score",dUserINT(PlayerName(playerid)).("Score")+1);
Wow man thanks a lot! I didn't even think of it in that perspective nor did I think I ever would Thanks again you have given me some more knowledge!


Re: Scores - Pyrokid - 13.03.2009

Any time. Glad I could be of service.