y_ini problem or am I doing something wrong - 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)
+--- Thread: y_ini problem or am I doing something wrong (
/showthread.php?tid=495965)
y_ini problem or am I doing something wrong -
PrivatioBoni - 19.02.2014
Hello,
I am currently experiencing quite a large problem. It seems to happen both on the actual server and my localhost.
This is the code:
pawn Код:
CMD:setscore(playerid, params[])
{
new playerb;
if(!IsPlayerConnected(playerb)) return SendClientMessage(playerid, COLOR_RED, "invalid id/name");
if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, COLOR_RED, "Permissions.");
else
{
new score;
if(sscanf(params, "ui", playerb, score)) return SendClientMessage(playerid, COLOR_RED, "syntax");
SetPlayerScore(playerb, score);
PlayerInfo[playerb][pScore] = score;
}
return 1;
}
What happens is, I /setscore myself, make a
NEW account and the score is on that account too. This is seriously confusing.
Any ideas?
Here is the relevant code for connecting:
pawn Код:
public OnPlayerConnect(playerid)
{
new score = PlayerInfo[playerid][pScore];
SetPlayerScore(playerid, score);
The saving system I use is Y_INI. Any help would be appreciated.
Re: y_ini problem or am I doing something wrong -
Golimad - 19.02.2014
Remove those things in player connect, and add this line in Dialog script ( of login )
SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);
Re: y_ini problem or am I doing something wrong -
PrivatioBoni - 21.02.2014
I feel incredibly silly - school boy error.
Thanks, you've fixed it. Rep will be given.