01.12.2018, 14:05
Код:
define PATH "/PlayerData/%s.ini" 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; } public OnPlayerConnect(playerid) { if(fexist(UserPath(playerid))) { INI_ParseFile(UserPath(playerid), "/PlayerData/%s.ini", .bExtra = true, .extra = playerid); } } hook OnPlayerDisconnect(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; }