admin command
#1

Hi. Can you fix my admin cmd? I want to sort them by admin level, and if i am admin level 5, i want to see those 1,2,3,4 too, but if i am admin level 1, i want to see only admin level 1 commands.

PHP код:
CMD:acmds(playerid)
{
    if(
pInfo[playerid][pAdminLevel] >= 1)
    {
        new 
str[250];
        
SendClientMessage(playerid, -1" - Comenzi Administrator - ");
        
format(strsizeof(str),""COL_LIGHTBLUE"Trial Admin:{FFFFFF} /o(oc), /acmds, /info, /getcar, /cc, /wslap");
        
SendClientMessage(playerid,-1str);
        
format(strsizeof(str),""COL_LIGHTBLUE" Trial Admin:{FFFFFF} /a, /gethere, /spec, /specoff, /goto, /gotols, /gotolv, /gotosf");
        
SendClientMessage(playerid,-1str);
        
format(strsizeof(str),""COL_LIGHTBLUE"Trial Admin:{FFFFFF} /mute, /unmute, /kick, /clearanim, /freeze, /unfreeze, /jetpack,");
        
SendClientMessage(playerid,-1str);
        
format(strsizeof(str),""COL_LIGHTBLUE"Trial Admin:{FFFFFF} /aduty, /ajail, /unjail, /setvw, /setint, /rjetpack");
        
SendClientMessage(playerid,-1str);
    }
    
    if(
pInfo[playerid][pAdminLevel] >= 2)
    {
        new 
str[250];
        
format(strsizeof(str),""COL_LIGHTBLUE"Moderator Team:{FFFFFF} /ban, /tban, /unbanip, /unbanname, /ip, /forumname, /targetinv");
        
SendClientMessage(playerid,-1str);
    }
    
    if(
pInfo[playerid][pAdminLevel] >= 3)
    {
        new 
str[250];
        
format(strsizeof(str),""COL_LIGHTBLUE"Administrator Team:{FFFFFF} /ann2, /akill, /nuke");
        
SendClientMessage(playerid,-1str);
    }
    if(
pInfo[playerid][pAdminLevel] >= 4)
    {
        new 
str[250];
        
format(strsizeof(str),""COL_LIGHTBLUE"Support Team:{FFFFFF} /sethelper, /setleader, /respawncars");
        
SendClientMessage(playerid,-1str);
    }
    if(
pInfo[playerid][pAdminLevel] >= 5)
    {
        new 
str[250];
        
format(strsizeof(str),""COL_LIGHTBLUE"Management Team:{FFFFFF} /resetinv, /setadmin, /setVIP, /saveall, /sethumanity, /setblood");
        
SendClientMessage(playerid,-1str);
        
format(strsizeof(str),""COL_LIGHTBLUE" Management Team:{FFFFFF} /setthirst, /sethunger, /setskin, /respawnallcars");
        
SendClientMessage(playerid,-1str);
        
format(strsizeof(str),""COL_LIGHTBLUE"Trial Admin:{FFFFFF} /mute, /unmute, /kick, /clearanim");
        
SendClientMessage(playerid,-1str);
    }
    
    if(
pInfo[playerid][pAdminLevel] >= 6)
    {
        new 
str[250];
        
format(strsizeof(str),""COL_LIGHTBLUE" Developer Team:{FFFFFF} /giveallitems, /lootres, /airdrop, /tentres, /giveitem");
        
SendClientMessage(playerid,-1str);
    }
    
    
    else return 
SendClientMessage(playerid,-1,"*"COL_RED" You aint admin!");
    return 
1;

Reply
#2

help
Reply
#3

What are you requesting is already done with this code, did you tested it firstly?
Reply
#4

Yeah. I found the error, on admin level 5 i added again "trial admin"


but it shows me "You are not admin" at every use of /acmds ... even if i am admin
Reply
#5

Rcon?
Reply
#6

No, if i am admin level 6 it works fine.
But if i am lower than level 6, it shows me "you aint admin" even if command works.
Reply
#7

Do you know using 'switch' ? It'll be more useful at your case here.
Reply
#8

I don't. That's why I made this code instead of using switch
Reply
#9

Quote:
Originally Posted by Zeus666
Посмотреть сообщение
i want to see those 1,2,3,4 too,
In fact, that cannot be done by switch..

Just verify your 'pAdminLevel' if is really more than or equal 5
Reply
#10

Change this line
PHP код:
else return SendClientMessage(playerid,-1,"*"COL_RED" You aint admin!"); 
To this

PHP код:
if ( pInfo[playerid][pAdminLevel] < ) return SendClientMessage(playerid,-1,"*"COL_RED" You aint admin!"); 
Currently, the line is called every time if you are under level 6 as it checks for a level 6 admin and then does the else statement if you are a lower level.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)