Y_ini loading file question - 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 loading file question (
/showthread.php?tid=486448)
Y_ini loading file question -
Riwerry - 08.01.2014
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.
Re: Y_ini loading file question -
Konstantinos - 08.01.2014
You're supposed to use INI_ParseFile so you can pass the
playerid as argument.
Re: Y_ini loading file question -
Riwerry - 08.01.2014
Where is the playerid?
pawn Код:
INI_ParseFile(UserFile, "LoadingUsers", .bExtra = true, .extra = playerid);
Re: Y_ini loading file question -
Konstantinos - 08.01.2014
Yes.
Re: Y_ini loading file question -
Riwerry - 08.01.2014
And from where it gets this playerid? When it parses?
Re: Y_ini loading file question -
Konstantinos - 08.01.2014
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.
Re: Y_ini loading file question -
Riwerry - 08.01.2014
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?