y_ini question
#1

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 ?
Reply
#2

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.
Reply
#3

I want to read when the player is offline, not when is online.
Reply
#4

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
Reply
#5

And how I can use INI_Int, when the player is offline ?
Reply
#6

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)
Reply
#7

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;
}
Reply
#8

Quote:
Originally Posted by RedFusion
View Post
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?
Reply
#9

Quote:
Originally Posted by Brooks1
View Post
Can you give me example?
I gave you an example, see post above you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)