22.05.2014, 15:59
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
In my filterscript should I just do this?
Also, not exactly sure how to actually call the function LoadAdminLevel();
EDIT: I am using y_ini
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]);
}
pawn Код:
new AdminLevel[MAX_PLAYERS];
forward LoadAdminLevel ( playerid, name[], value[] );
public LoadAdminLevel ( playerid, name[], value[] )
{
INI_Int("adminlevel", AdminLevel[playerid]);
}
EDIT: I am using y_ini