Quick INI read - 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: Quick INI read (
/showthread.php?tid=514646)
Quick INI read -
Nathan_Taylor - 22.05.2014
What is the quickest way to read one line from an INI file. I am wriitng a filterscript and I want to be able to check the user's admin level from the gamemode in the filterscripts folder. I just want to read the row "adminlevel" in "filterscripts/users/%username%.ini" and save it under AdminLevel[playerid]; I already know how ot save it under AdminLevel[playerid] and all, I just want to know what method I should use for grabbing that value. I use y_INI in the gamemode, with something like this
pawn Код:
enum pVars
{
Name[128],
Password[128],
AdminLevel,
etc....
}
new pInfo[MAX_PLAYERS][pVars];
forward LoadPlayer_info ( playerid, name[], value[] );
public LoadPlayer_info ( playerid, name[], value[] )
{
INI_String("name", pInfo[playerid][Name], 128);
INI_String("password", pInfo[playerid][Password], 128);
INI_Int("adminlevel", pInfo[playerid][AdminLevel]);
}
In my filterscript should I just do this?
pawn Код:
new AdminLevel[MAX_PLAYERS];
forward LoadAdminLevel ( playerid, name[], value[] );
public LoadAdminLevel ( playerid, name[], value[] )
{
INI_Int("adminlevel", AdminLevel[playerid]);
}
Also, not exactly sure how to actually call the function LoadAdminLevel();
EDIT: I am using y_ini