save score problem - 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: save score problem (
/showthread.php?tid=607651)
save score problem -
1fret - 22.05.2016
Ok i made a login system which save score obviously and it worked no all of a sudden it doesnt save the player score and but if i edit it in the user files it will load the amount i set it to. but when i use /setscore I.G it doesnt save the score when the player disconnect, but it sets the score but doest save it when the player leave , please help me out someone.
the code i use to save the player stats when they disconnet
pawn Код:
//onplayedisconnet
new INI:ACCOUNT = INI_Open(UserPath(playerid));
INI_SetTag(ACCOUNT,"data");
INI_WriteInt(ACCOUNT,"Level",pInfo[playerid][aAdmin]);
INI_WriteInt(ACCOUNT,"Cash",GetPlayerCash(playerid));
INI_WriteInt(ACCOUNT,"Kills",pInfo[playerid][Kills]);
INI_WriteInt(ACCOUNT,"Deaths",pInfo[playerid][Deaths]);
INI_WriteInt(ACCOUNT, "Banned",pInfo[playerid][Banned]);
INI_WriteInt(ACCOUNT, "Donator",pInfo[playerid][Donator]);
INI_WriteInt(ACCOUNT, "Score", pInfo[playerid][Score]);
INI_WriteInt(ACCOUNT, "Skin", pInfo[playerid][Skin]);
INI_WriteInt(ACCOUNT, "Muted",pInfo[playerid][Muted]);
INI_Close(ACCOUNT);
And i dont think its the loaduser has the issue cause as i have stated earlier if i set it from the user file it load perfectly but if i set it in game it doesnt save when they player leaves..
Re: save score problem - WhiteGhost - 22.05.2016
Then the command is the issue,show the /setscore Command.
Re: save score problem -
N0FeaR - 22.05.2016
Show us the cmd /setscore
Re: save score problem -
Stinged - 22.05.2016
You're probably using SetPlayerScore without changing pInfo[playerid][Score].
Re: save score problem -
1fret - 22.05.2016
I dont think this is the problem but ok:
pawn Код:
CMD:setscore(playerid,params[])
{
if(IsPlayerAdmin(playerid) || pInfo[playerid][aAdmin] >= 7)
{
new id,score;
if(sscanf(params, "ui", id, score)) return
SendClientMessage(playerid, red, "Usage: /Setscore <PlayerID> <New score>") ;
if(IsPlayerConnected(id))
{
format(astring,sizeof(astring),"You have set %s's score to '%d'", GetName(id), score);
SendClientMessage(playerid,blue,astring);
format(astring, sizeof(astring), "An Administrator has set your Score to '%d'",score);
SendClientMessage(id,yellow,astring);
CommandToAdmins(playerid,"setscore");
return SetPlayerScore(id, score);
}
else return ShowMessage(playerid, red, 2);
}
else return ShowMessage(playerid, red, 1);
}
Re: save score problem -
1fret - 22.05.2016
RESOLVED