Setlevel doesn't work properly
#1

Hello,

I'm making a /setlevel command where I want the player to be either logged into RCON or level 4 admin to be able to use it, but it isn't working. When I get on and log into RCON and attempt to use the command it tells me that I can't use it.

pawn Код:
CMD:setlevel(playerid,params[])
{
    if(PlayerInfo[playerid][Level] < 4) return SendClientMessage(playerid, 0xF69521AA,"You can't use this command!");//Doesn't let admins under level 4 set an admin level
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xF69521AA,"You can't use this command!");//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,0xF69521AA,"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,0xF69521AA,"The specified player is currently not connected!");//Checking if the selected user is connected or not.
    if (!(0 <= level <= 4)) return SendClientMessage(playerid,0xF69521AA,"Please specify an admin level between 0 and 4");
    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,0xF69521AA,"You have successfully changed the selected user's admin level");
    SendClientMessage(id,0xF69521AA,"Your admin level has successfully been changed, congratulations!");
    return 1;
}
Reply


Messages In This Thread
Setlevel doesn't work properly - by Vasu99 - 01.03.2014, 16:00
Re: Setlevel doesn't work properly - by RajatPawar - 01.03.2014, 16:06
Re: Setlevel doesn't work properly - by ReD_HunTeR - 01.03.2014, 16:07
Re: Setlevel doesn't work properly - by Vasu99 - 01.03.2014, 16:14
Re: Setlevel doesn't work properly - by RajatPawar - 01.03.2014, 16:16
Re: Setlevel doesn't work properly - by Vasu99 - 01.03.2014, 16:18
Re: Setlevel doesn't work properly - by RajatPawar - 01.03.2014, 16:19
Re: Setlevel doesn't work properly - by Konstantinos - 01.03.2014, 16:49
Re: Setlevel doesn't work properly - by DaniceMcHarley - 01.03.2014, 17:25
Re: Setlevel doesn't work properly - by Konstantinos - 01.03.2014, 17:32

Forum Jump:


Users browsing this thread: 1 Guest(s)