Save Score Problem.
#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


Messages In This Thread
Save Score Problem. - by ScripteRNaBEEL - 15.05.2014, 18:11
Re: Save Score Problem. - by Lynn - 15.05.2014, 18:12
Re: Save Score Problem. - by ScripteRNaBEEL - 15.05.2014, 18:16
Re: Save Score Problem. - by Lynn - 15.05.2014, 19:50
Re: Save Score Problem. - by ScripteRNaBEEL - 16.05.2014, 03:55

Forum Jump:


Users browsing this thread: 2 Guest(s)