y_ini 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 question (
/showthread.php?tid=558381)
y_ini question -
Brooks1 - 16.01.2015
I want to make command that check if a player is admin, when he isn't connected to the server.
I mean: /checkadmin [nickname]
For this command I need to check player's file, the line "Admin".
In Dini I can do this with: dini_Int(File,"Admin"), but how with y_ini ?
Re: y_ini question -
Lynn - 16.01.2015
pawn Code:
//To read;
INI_Int("Admin", PlayerInfo[playerid][pAdmin]);// Change to your servers pAdmin define.
//To write to the file;
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);// Change to your servers pAdmin define.
Re: y_ini question -
Brooks1 - 16.01.2015
I want to read when the player is offline, not when is online.
Re: y_ini question -
RedFusion - 16.01.2015
something like this i guess
pawn Code:
new
admin_name[MAX_PLAYER_NAME + 1],
admin_var
;
INI_Int(adminname, adminvar);
if(adminvar > 0) // This player is admin
else // This player is not an admin
Re: y_ini question -
Brooks1 - 18.01.2015
And how I can use INI_Int, when the player is offline ?
Re: y_ini question -
RedFusion - 18.01.2015
Just make your command in such a way that you enter the player's name rather than the playerid.
(since non-connected players do not have playerid's, obviously)
Re: y_ini question -
Schneider - 18.01.2015
In case you have zcmd and sscanf you could do something like:
pawn Code:
COMMAND:checkadmin(playerid, params[])
{
new targetname[MAX_PLAYER_NAME];
if(sscanf(params, "s[MAX_PLAYER_NAME]", targetname)) return SendClientMessage(playerid, -1, "/checkadmin [name]");
// I have no experience with y_ini so from here you have to do it youself. I don't know if there's a function to check if
// a file with the targetname exists. If the file does not exists send a clientmessage to say that that player does not exist
// and if the file is found, read the data with INI_Int.
return 1;
}
Re: y_ini question -
Brooks1 - 19.01.2015
Quote:
Originally Posted by RedFusion
Just make your command in such a way that you enter the player's name rather than the playerid.
(since non-connected players do not have playerid's, obviously)
|
Can you give me example?
Re: y_ini question -
Schneider - 19.01.2015
Quote:
Originally Posted by Brooks1
Can you give me example?
|
I gave you an example, see post above you.