Y_ini loading file question
#1

Hello guys, is possible to make loading of player files using function INI_Load, not with INI_ParseFile? Example:

pawn Код:
new
    LoadingUsers[] = UserFile(playerid);

INI_Load(LoadingUsers); //This should be located in my logging in

INI:LoadingUsers[Informations](name[], value[])
{
    INI_Int("AdminLevel", PlayerInformations[playerid][AdminLevel]);
    //Other loading stuff here
}

stock UserFile(playerid)
{
    new string[30], PlayerName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
    format(string, sizeof(string), "%s.ini", PlayerName);
    return string;
}
Thanks.
Reply
#2

You're supposed to use INI_ParseFile so you can pass the playerid as argument.
Reply
#3

Where is the playerid?

pawn Код:
INI_ParseFile(UserFile, "LoadingUsers", .bExtra = true, .extra = playerid);
Reply
#4

Yes.
Reply
#5

And from where it gets this playerid? When it parses?
Reply
#6

I don't understand your question.

An example (from a tutorial):
pawn Код:
public OnPlayerConnect(playerid)
{
    if(fexist(UserPath(playerid)))
    {
        INI_ParseFile(UserPath(playerid), "LoadUser_data", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,""COL_WHITE"Login",""COL_WHITE"Type your password below to login.","Login","Quit");
    }
    else
    {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,""COL_WHITE"Registering...",""COL_WHITE"Type your password below to register a new account.","Register","Quit");
    }
    return 1;
}
extra parameter is assigned playerid which is given by OnPlayerConnect callback.
Reply
#7

Hm, and when I write something to ini for example while is player in-game do I need to parse file again? To parse that variable which I wrote to file?
Reply


Forum Jump:


Users browsing this thread: 7 Guest(s)