SA-MP Forums Archive
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=513331)



Save Score Problem. - ScripteRNaBEEL - 15.05.2014

Hello Guyz ANy One Can Help To Save Score In SATDM ladmin i dont know how to save score pls help me any one?


Re: Save Score Problem. - Lynn - 15.05.2014

Make it so when the player logs out, it saves to their player's .ini.
We can't really show you how to, without knowing what player file system you use.
I.E; DINI, YINI, etc.


Re: Save Score Problem. - ScripteRNaBEEL - 15.05.2014

YINI dude


Re: Save Score Problem. - Lynn - 15.05.2014

pawn Код:
enum PlayerStats
{
   Score,
};
new P_Info[MAX_PLAYERS][PlayerStats];
pawn Код:
public OnPlayerConnect(playerid)
{
    P_Info[playerid][Score] = 0;
    return 1;
}
pawn Код:
public OnPlayerSpawn(playerid)
{
    SetPlayerScore(playerid, P_Info[playerid][Score]);
    return 1;
}
Assuming you have a Dialog based registration system;
Under dialogid == DIALOG_REGISTER // Or what ever your Dialog name is called;
pawn Код:
new INI:iFile = INI_Open(PlayerPath(playerid));
INI_SetTag(iFile,"data");
INI_WriteInt(iFile,"Score",0);
INI_Close(iFile);
Under your login Dialog;
pawn Код:
SetPlayerScore(playerid,P_Info[playerid][Score]); //Loading player score
Under your Account loading public function
pawn Код:
INI_Int("Score",P_Info[playerid][Score]);
Under your account saving Public Function
pawn Код:
P_Info[playerid][Score] = GetPlayerScore(playerid);
new INI:file = INI_Open(PlayerPath(playerid));
INI_SetTag(file,"data");
INI_WriteInt(file,"Score",P_Info[playerid][Score]);
INI_Close(file);
You will have to make some small adjustments, and maybe remove some of the code above for it to work with your existing system. So don't try and just Copy + Paste everything because ods are it won't work. I expect you to get some errors if you copy + Paste everything.


Re: Save Score Problem. - ScripteRNaBEEL - 16.05.2014

in my script files save like this
Quote:

PlayerInfo[playerid][gang] = (dUserINT(PlayerName2(playerid)).("Gang"));

Quote:

dUserSetINT(PlayerName2(playerid)).("Gang",PlayerI nfo[playerid][gang]);