Y_INI - Not loading
#1

Код:
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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)