Help with switch/elseif
#3

if I am not wrong if will be more helpful here, as it can compare above / lower values than the var wanted too.
so your code would look like:

PHP код:
COMMAND:acmds(playeridparams[])
{
    if(
playerData[playerid][playerLoggedIn])
    {
        if(
playerData[playerid][playerLevel] >= 1)
        {
            new 
string[1400];
            if(
playerData[playerid][playerLevel] >= 4)
                
format(stringsizeof(string), "%s{98B0CD}LEVEL 4 COMMANDS{FFFFFF}\n/unban /teleport /ipban /level /setstats\n\n"string);
            if(
playerData[playerid][playerLevel] >= 3)
                
format(stringsizeof(string), "%s{98B0CD}LEVEL 3 COMMANDS{FFFFFF}\n/ban /v /vdestroy /get /vgoto /vbring /resetweapons\n/forcerules /cc /aheal \n/playerjailtime\n\n"string);
            if(
playerData[playerid][playerLevel] >= 2)
                
format(stringsizeof(string), "%s{98B0CD}LEVEL 2 COMMANDS{FFFFFF}\n/explode /vrespawn /(un)mute\n"string);
            if(
playerData[playerid][playerLevel] >= 1)
                
format(stringsizeof(string), "%s{98B0CD}LEVEL 1 COMMANDS{FFFFFF}\n/goto /aod /kick /jail /asay /playerstats /spec /specoff\n\n"string);
            
ShowPlayerDialog(playerid200DIALOG_STYLE_MSGBOX"Admin Commands"string"OK""");
            return 
1;
        }
    }
    return 
0;

Edit: @Misiur was faster ;-;
Reply


Messages In This Thread
Help with switch/elseif - by DeathReaper - 28.09.2017, 10:30
Re: Help with switch/elseif - by Misiur - 28.09.2017, 10:36
Re: Help with switch/elseif - by jlalt - 28.09.2017, 10:37

Forum Jump:


Users browsing this thread: 2 Guest(s)