SA-MP Forums Archive
How to make! - 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: How to make! (/showthread.php?tid=657174)



How to make! - Man43 - 02.08.2018

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;




Re: How to make! - Man43 - 02.08.2018

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?


Re: How to make! - Banditul18 - 02.08.2018

Код:
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)



Re: How to make! - Rufio - 02.08.2018

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.