10.04.2014, 20:56
how to save score after exit the server ?
public OnPlayerDisconnect(playerid, reason)
{
new name[MAX_PLAYER_NAME], file[256];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), SERVER_USER_FILE, name); // Change path
if(gPlayerLogged[playerid] == 1) // Change your is player logged in
{
dini_IntSet(file, "Score", PInfo[playerid][pScore]); // Change to the settings you made in the enum
}
return 1;
}
pawn Код:
|
pawn Код:
|
#define PATH "/Users/%s.ini"
stock UserPath(playerid)
{
new string[128],playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
format(string,sizeof(string),PATH,playername);
return string;
}
public OnPlayerDisconnect(playerid, reason)
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Score",GetPlayerScore);
INI_Close(File);
return 1;
}
I can make you a Y_INI saving system, aight ?
put this ontop of the script pawn Код:
pawn Код:
pawn Код:
|