Setlevel Command Help
#1

Hi,

Thanks for reading once again. This time I need help with the same command, although I would like to limit it somehow. By that, I mean I'd like to set a limit to which admin level you may set with that command, because right now there's no limit to which level I may set a player. I'd like to set the limit to 4, although I can't figure out how to do this. If you do decide to help me out, please also explain exactly what you're doing as I'd like to learn how to script and I feel like that's a great start.

Код:
CMD:setlevel(playerid,params[])
{
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,0x3740B3,"Only rcon admins can set admin levels!");//Checking if the player is rcon admin to set an admin level
    new id, level;//Creating the id variable to store the selected id and a level variable for the chosen admin level.
    if(sscanf(params,"ui",id,level)) return SendClientMessage(playerid,0x3740B3,"USAGE: /setlevel <id> <level(1-4)>");//Check if the player inputted a username or id and a admin level.
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid,0x3740B3,"The specified player is currently not connected!");//Checking if the selected user is connected or not.
    new file[64],PlayerName[24];//Creating a variable to store the file path, and a variable to store the players name.
    GetPlayerName(id,PlayerName,sizeof PlayerName);//Retrieving the selected id's name,
    format(file,sizeof file,"Admin/%s.ini",PlayerName);
    PlayerInfo[id][Level] = level;
    SendClientMessage(playerid,0x3740B3,"You have successfully changed the selected user's admin level");
    SendClientMessage(id,0x3740B3,"Your admin level has successfully been changed, congratulations!");
    return 1;
}
Cheers!
Reply


Messages In This Thread
Setlevel Command Help - by Vasu99 - 27.02.2014, 16:47
Re: Setlevel Command Help - by Konstantinos - 27.02.2014, 16:54
Re: Setlevel Command Help - by Vasu99 - 27.02.2014, 17:19
Re: Setlevel Command Help - by Konstantinos - 27.02.2014, 17:42
Re: Setlevel Command Help - by Vasu99 - 27.02.2014, 17:53
Re: Setlevel Command Help - by Konstantinos - 27.02.2014, 17:56
Re: Setlevel Command Help - by Miado_Hulk - 27.02.2014, 18:08
Re: Setlevel Command Help - by Konstantinos - 27.02.2014, 18:12
Re: Setlevel Command Help - by Miado_Hulk - 27.02.2014, 18:16

Forum Jump:


Users browsing this thread: 2 Guest(s)