Save Score Problem.
#1

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

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

YINI dude
Reply
#4

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

in my script files save like this
Quote:

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

Quote:

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

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)