How to make!
#1

Hi How to I can make If admin level 1 using command /unmuteall and this command only for admins +4level they must send him a message example" This command only for admins +level 4.

PHP код:
CMD:unmuteall(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] >= && 5)
    {
        new 
countstring[120]; // new variables
        
for(new 0MAX_PLAYERSi++) // loops all the players one-by-one
        
{
            if(
IsPlayerConnected(i)) // checks if the player is connected
            
{
                if(
Mute[i] >= 1// if the looped player has a mute time more than 0
                
{
                    
count++; // the count will go up
                    
Mute[i] = 0// and the mute time will be set to 0
                
}
            }
        }
        new 
uname[MAX_PLAYER_NAME]; // this is the name of the sender
        
GetPlayerName(playeridunamesizeof(uname)); // this will get the playerid (sender)'s name
        
format(stringsizeof(string), "{FAFF00}[UNMUTED ALL]: %d players have been admin-unmuted by %s (%d)"countunameplayerid); // sets the string to say how many players were unmuted and by who
        
SendClientMessageToAll(0xFFFFFFFFstring); // sends this global message
    
}
    else
        
SendClientMessage(playerid, -1"{FF0000}Error: {FFFFFF}Wrong command!! {FF0000}Check availables commands from here `{FFFFFF}/cmds{FF0000}`.");
    return 
1;

Reply
#2

I just want example If admin an level +1 - 2 - 3 he can't use this command because he low level admin he must be +4 level how?
Reply
#3

Код:
if(PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid, -1, "You are not level 4+ admin");
This
Код:
if(PlayerInfo[playerid][pAdmin] >= 3 && 5)
Make no sense unless you make it like this
Код:
if(PlayerInfo[playerid][pAdmin] >= 3 && PlayerInfo[playerid][pAdmin] <= 5)
Reply
#4

You are using the AND operator incorrectly. You have to type a statement before and after the AND operator like this;
if(statement && statement)

What it does is, it checks if both statements are true. Returns the result(it's taught in math but basically 0 and 1 is 0, 1 and 0 is 0, 0 and 0 is 0, 1 and 1 is 1 and it can have 2^n equations at most, n being the amount of statements you have) and in your case it should be;

if(PlayerInfo[playerid][pAdmin] >= 3 && PlayerInfo[playerid][pAdmin] >= 5)

We use 2 statements.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)