02.12.2018, 17:23
So I tried to make it so whenever you get a status update it'll automatically change aka a saving system. It does save when you relog but it does not when you restart the server.
Код:
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
INI_Int("Admin Level", PlayerInfo[playerid][pAdmin]);
INI_Int("Faction Director", PlayerInfo[playerid][pFacDirector]);
INI_Int("Faction", PlayerInfo[playerid][pFaction]);
INI_Int("Faction Rank", PlayerInfo[playerid][pFacRanks]);
return 1;
}
stock UserPath(playerid)
{
new string[128],playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
format(string,sizeof(string),PATH,playername);
return string;
}
hook OnGameModeInit(playerid)
{
if(fexist(UserPath(playerid)))
{
INI_ParseFile(UserPath(playerid), "/PlayerData/%s.ini", .bExtra = true, .extra = playerid);
}
return 1;
}
hook OnPlayerUpdate(playerid, reason)
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Admin Level", PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"Faction Director", PlayerInfo[playerid][pFacDirector]);
INI_WriteInt(File,"Faction", PlayerInfo[playerid][pFaction]);
INI_WriteInt(File,"Faction Rank", PlayerInfo[playerid][pFacRanks]);
INI_Close(File);
return 1;
}


