SA-MP Forums Archive
Y_INI - Not loading - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Y_INI - Not loading (/showthread.php?tid=661343)



Y_INI - Not loading - Mo123 - 01.12.2018

Код:
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;
}
Doesn't load. Why? It does create a file with the data listed but the data itself doesn't load.