Dialog not showing
#1

Whenever I do /acmds and I'm admin level 7, The admin level 1 dialog pops up where I want to do it, when I do /acmds only that specific Admin level dialog should show up, and this is my code:

PHP код:
COMMAND:acmds(playeridparams[])
{
    if(
playerData[playerid][playerLoggedIn])
    {
        if(
playerData[playerid][playerLevel] >= 1)
        {
            new 
string[1400];
            
format(stringsizeof(string), "%s{98B0CD}LEVEL 1 COMMANDS{51FF00}\n/goto /aod /kick /jail /asay /spawn /slap /warn\n/(un)freeze /playerstats /spec /specoff /rarb\n\n"string);
            
ShowPlayerDialog(playeridDIALOG_ADMIN_LEVEL1DIALOG_STYLE_MSGBOX"Admin Level 1 Commands"string"OK""");
            return 
1;
        }
        else if (
playerData[playerid][playerLevel] >= 2)
        {
              new 
string[1400];
            
format(stringsizeof(string), "%s{98B0CD}LEVEL 2 COMMANDS{51FF00}\n/alog /explode /vrespawn /Duel /(un)mute\n/playerweapons /arenas /clearchat /blockask /blockreport\n\n"string);
            
ShowPlayerDialog(playeridDIALOG_ADMIN_LEVEL2DIALOG_STYLE_MSGBOX"Admin Level 2 Commands"string"OK""");
            return 
1;
        }
        else if (
playerData[playerid][playerLevel] >= 3)
        {
            new 
string[1400];
            
format(stringsizeof(string), "%s{98B0CD}LEVEL 3 COMMANDS{51FF00}\n/ban /vc(create) /getpforevent /unfreezeall /setskin /vdestroy /get /vgoto /vbring /resetweapons\n/forcerules /forcecoptutorial \n/aheal /playertokens /playervehicles /playertokens \n/playerjailtime /playerjob\n\n"string);
            
ShowPlayerDialog(playeridDIALOG_ADMIN_LEVEL3DIALOG_STYLE_MSGBOX"Admin Level 2 Commands"string"OK""");
            return 
1;
        }
        else if (
playerData[playerid][playerLevel] >= 7)
        {
            new 
string[1400];
            
format(stringsizeof(string), "%s{98B0CD}LEVEL 443 COMMANDS{51FF00}\n/ban /vc(create) /getpforevent /unfreezeall /setskin /vdestroy /get /vgoto /vbring /resetweapons\n/forcerules /forcecoptutorial \n/aheal /playertokens /playervehicles /playertokens \n/playerjailtime /playerjob\n\n"string);
            
ShowPlayerDialog(playeridDIALOG_ADMIN_LEVEL7DIALOG_STYLE_MSGBOX"Admin Level 7 Commands"string"OK""");
            return 
1;
        }
        return 
1;
    }
    return 
0;

Reply
#2

I'm not 100% sure what you want to achieve with this command.

Код:
COMMAND:acmds(playerid, params[]) 
{ 
    if(playerData[playerid][playerLoggedIn]) 
    { 
        if(playerData[playerid][playerLevel] == 1) 
        { 
            new string[1400]; 
            format(string, sizeof(string), "%s{98B0CD}LEVEL 1 COMMANDS{51FF00}\n/goto /aod /kick /jail /asay /spawn /slap /warn\n/(un)freeze /playerstats /spec /specoff /rarb\n\n", string); 
            ShowPlayerDialog(playerid, DIALOG_ADMIN_LEVEL1, DIALOG_STYLE_MSGBOX, "Admin Level 1 Commands", string, "OK", ""); 
            return 1; 
        } 
        else if (playerData[playerid][playerLevel] == 2) 
        { 
              new string[1400]; 
            format(string, sizeof(string), "%s{98B0CD}LEVEL 2 COMMANDS{51FF00}\n/alog /explode /vrespawn /Duel /(un)mute\n/playerweapons /arenas /clearchat /blockask /blockreport\n\n", string); 
            ShowPlayerDialog(playerid, DIALOG_ADMIN_LEVEL2, DIALOG_STYLE_MSGBOX, "Admin Level 2 Commands", string, "OK", ""); 
            return 1; 
        } 
        else if (playerData[playerid][playerLevel] == 3) 
        { 
            new string[1400]; 
            format(string, sizeof(string), "%s{98B0CD}LEVEL 3 COMMANDS{51FF00}\n/ban /vc(create) /getpforevent /unfreezeall /setskin /vdestroy /get /vgoto /vbring /resetweapons\n/forcerules /forcecoptutorial \n/aheal /playertokens /playervehicles /playertokens \n/playerjailtime /playerjob\n\n", string); 
            ShowPlayerDialog(playerid, DIALOG_ADMIN_LEVEL3, DIALOG_STYLE_MSGBOX, "Admin Level 2 Commands", string, "OK", ""); 
            return 1; 
        } 
        else if (playerData[playerid][playerLevel] == 7) 
        { 
            new string[1400]; 
            format(string, sizeof(string), "%s{98B0CD}LEVEL 443 COMMANDS{51FF00}\n/ban /vc(create) /getpforevent /unfreezeall /setskin /vdestroy /get /vgoto /vbring /resetweapons\n/forcerules /forcecoptutorial \n/aheal /playertokens /playervehicles /playertokens \n/playerjailtime /playerjob\n\n", string); 
            ShowPlayerDialog(playerid, DIALOG_ADMIN_LEVEL7, DIALOG_STYLE_MSGBOX, "Admin Level 7 Commands", string, "OK", ""); 
            return 1; 
        } 
        return 1; 
    } 
    return 0; 
}
Reply
#3

Quote:
Originally Posted by Luis-
Посмотреть сообщение
I'm not 100% sure what you want to achieve with this command.
I want my command to show only the admin level you are, Example: I'm level 7 admin and when I do /acmds It should only show me the dialog of Admin lvl 7 instead its showing me the first dialog which is admin lvl 1, How do I fix this?
Reply
#4

Quote:
Originally Posted by XBoss30
Посмотреть сообщение
I want my command to show only the admin level you are, Example: I'm level 7 admin and when I do /acmds It should only show me the dialog of Admin lvl 7 instead its showing me the first dialog which is admin lvl 1, How do I fix this?
He just showed you how, but I would personally use a switch case. The names do look a little weird though, but I'm sure thats not the problem. You can do what he said or do a switch case like so
Код:
switch(playerData[playerid][playerLevel])
{
	case 1:
		// show level 1 cmds
		break;
	case 2:
               // show level 2 cmds
		break;
}
and so on
Reply
#5

>= 1 is true for 7 , check with equality.Using switch would be better.
Reply
#6

So...how do I use this switch? I'm guessing like this:
PHP код:
COMMAND:acmds(playeridparams[])
{
    if(
playerData[playerid][playerLoggedIn])
    {
        switch(
playerData[playerid][playerLevel])
        {
            case 
1:
                new 
string[1400];
                  
format(stringsizeof(string), "%s{98B0CD}LEVEL 1 COMMANDS{51FF00}\n/goto /aod /kick /jail /asay /spawn /slap /warn\n/(un)freeze /playerstats /spec /specoff /rarb\n\n"string);
                
ShowPlayerDialog(playeridDIALOG_ADMIN_LEVEL1DIALOG_STYLE_MSGBOX"Admin Level 1 Commands"string"OK""");
            break;
            case 
2:
                new 
string[1400];
                   
format(stringsizeof(string), "%s{98B0CD}LEVEL 2 COMMANDS{51FF00}\n/alog /explode /vrespawn /Duel /(un)mute\n/playerweapons /arenas /clearchat /blockask /blockreport\n\n"string);
                   
ShowPlayerDialog(playeridDIALOG_ADMIN_LEVEL2DIALOG_STYLE_MSGBOX"Admin Level 2 Commands"string"OK""");
            break;
        }
    }

Reply
#7

#Fixed, Thanks you guys.
Reply
#8

I'm glad you fixed your issue, but I'd still like to point out why you were facing troubles.
You've done this '>= 1' which actually means, 1 OR HIGHER. So in order to have every admin of its own level viewing their commands, you'll have to use '=='.
Reply
#9

This is my code right now, working perfectly:
PHP код:
COMMAND:acmds(playeridparams[])
{
    if(
playerData[playerid][playerLoggedIn])
    {
        if(
playerData[playerid][playerLevel] == 1)
        {
            new 
string[1400];
            
format(stringsizeof(string), "%s{98B0CD}LEVEL 1 COMMANDS{51FF00}\n/goto /aod /kick /jail /asay /spawn /slap /warn\n/(un)freeze /playerstats /spec /specoff /rarb\n\n"string);
            
ShowPlayerDialog(playeridDIALOG_ADMIN_LEVEL1DIALOG_STYLE_MSGBOX"Admin Level 1 Commands"string"OK""");
            return 
1;
        }
        else if (
playerData[playerid][playerLevel] == 2)
        {
            new 
string[1400];
            
format(stringsizeof(string), "%s{98B0CD}LEVEL 2 COMMANDS{51FF00}\n/alog /explode /vrespawn /Duel /(un)mute\n/playerweapons /arenas /clearchat /blockask /blockreport\n\n"string);
            
ShowPlayerDialog(playeridDIALOG_ADMIN_LEVEL2DIALOG_STYLE_MSGBOX"Admin Level 2 Commands"string"OK""");
            return 
1;
        }
        else if (
playerData[playerid][playerLevel] == 3)
        {
            new 
string[1400];
            
format(stringsizeof(string), "%s{98B0CD}LEVEL 3 COMMANDS{51FF00}\n/ban /vc(create) /getpforevent /unfreezeall /setskin /vdestroy /get /vgoto /vbring /resetweapons\n/forcerules /forcecoptutorial \n/aheal /playertokens /playervehicles /playertokens \n/playerjailtime /playerjob\n\n"string);
            
ShowPlayerDialog(playeridDIALOG_ADMIN_LEVEL3DIALOG_STYLE_MSGBOX"Admin Level 2 Commands"string"OK""");
            return 
1;
        }
        else if (
playerData[playerid][playerLevel] == 4)
        {
            new 
string[1400];
                
format(stringsizeof(string), "%s{98B0CD}LEVEL 4 COMMANDS{51FF00}\n//unban /un)copban /gspy /resetskin <player id> /getip /countdown /respawnalluv /(un)armyban /destroyallav \n/announce /ffaevent /startffa /destroyffa/pmspy /dmevent /startdm /glassevent\n/startglass /destroyglass /falloutevent /startfallout /destroyfallout \n/cvrevent /startcvr /lmsevent /destroylms /adkill /uncuff\n\n"string);
            
ShowPlayerDialog(playeridDIALOG_ADMIN_LEVEL4DIALOG_STYLE_MSGBOX"Admin Level 4 Commands"string"OK""");
            return 
1;
        }
        else if (
playerData[playerid][playerLevel] == 5)
        {
            new 
string[1400];
                
format(stringsizeof(string), "%s{98B0CD}LEVEL 5 COMMANDS{51FF00}\n/ahealall /cwspy /createhouse /deletehouse  /giveweapon /respawnallv /resetallweapons \n/pingimmune /gotocase /startcase /houseinfo\n\n"string);
            
ShowPlayerDialog(playeridDIALOG_ADMIN_LEVEL5DIALOG_STYLE_MSGBOX"Admin Level 5 Commands"string"OK""");
            return 
1;
        }
        else if (
playerData[playerid][playerLevel] == 6)
        {
            new 
string[1400];
            
format(stringsizeof(string), "%s{98B0CD}LEVEL 6 COMMANDS{51FF00}\n/teleport /giveallweapon /doublexp /motd /motd(1-3) /ping /fine \n/playerhouses /standardvip \n/silvervip /goldvip /givetoken /givecash \n/givexp /b\n\nTo view commands in lower level admin click Next"string);
            
ShowPlayerDialog(playeridDIALOG_ADMIN_LEVEL6DIALOG_STYLE_MSGBOX"Admin Level 6 Commands"string"Okay""");
            return 
1;
        }
         else if (
playerData[playerid][playerLevel] == 7)
        {
            new 
string[1400];
            
format(stringsizeof(string), "%s{98B0CD}LEVEL 7 COMMANDS{51FF00}\nset\nTo view commands in lower level admin click Next"string);
            
ShowPlayerDialog(playeridDIALOG_ADMIN_LEVEL7DIALOG_STYLE_MSGBOX"Admin Level 7 Commands"string"Okay""Next");
            return 
1;
        }
        return 
1;
    }
    return 
0;

Now i want to make so, that when a level 7 admin click next it takes them to Admin lvl 6,5,4,3,2,1 commands. Example: Admin level 7 player clicks next there he is by lvl 6 cmds, again he clicks next then by lvl 5 cmds etc.
Reply
#10

Here it is

PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    new 
string[1400];
    switch(
dialogid)
    {
        case 
DIALOG_ADMIN_LEVEL7:
        {
             if(
response == 1)
            {
                
format(stringsizeof(string), "%s{98B0CD}LEVEL 6 COMMANDS{51FF00}\n/teleport /giveallweapon /doublexp /motd /motd(1-3) /ping /fine \n/playerhouses /standardvip \n/silvervip /goldvip /givetoken /givecash \n/givexp /b\n\nTo view commands in lower level admin click Next"string);
                
ShowPlayerDialog(playeridDIALOG_ADMIN_LEVEL6DIALOG_STYLE_MSGBOX"Admin Level 6 Commands"string"Okay""Next");
                return 
1;
            }
        }
        case 
DIALOG_ADMIN_LEVEL6:
        {
             if(
response == 1)
            {
                
format(stringsizeof(string), "%s{98B0CD}LEVEL 5 COMMANDS{51FF00}\n/ahealall /cwspy /createhouse /deletehouse  /giveweapon /respawnallv /resetallweapons \n/pingimmune /gotocase /startcase /houseinfo\n\n"string);
                
ShowPlayerDialog(playeridDIALOG_ADMIN_LEVEL5DIALOG_STYLE_MSGBOX"Admin Level 5 Commands"string"Okay""Next");
                return 
1;
            }
        }
        case 
DIALOG_ADMIN_LEVEL5:
        {
             if(
response == 1)
            {
                
format(stringsizeof(string), "%s{98B0CD}LEVEL 4 COMMANDS{51FF00}\n//unban /un)copban /gspy /resetskin <player id> /getip /countdown /respawnalluv /(un)armyban /destroyallav \n/announce /ffaevent /startffa /destroyffa/pmspy /dmevent /startdm /glassevent\n/startglass /destroyglass /falloutevent /startfallout /destroyfallout \n/cvrevent /startcvr /lmsevent /destroylms /adkill /uncuff\n\n"string);
                
ShowPlayerDialog(playeridDIALOG_ADMIN_LEVEL4DIALOG_STYLE_MSGBOX"Admin Level 4 Commands"string"Okay""Next");
                return 
1;
            }
        }
        case 
DIALOG_ADMIN_LEVEL4:
        {
             if(
response == 1)
            {
                   
format(stringsizeof(string), "%s{98B0CD}LEVEL 3 COMMANDS{51FF00}\n/ban /vc(create) /getpforevent /unfreezeall /setskin /vdestroy /get /vgoto /vbring /resetweapons\n/forcerules /forcecoptutorial \n/aheal /playertokens /playervehicles /playertokens \n/playerjailtime /playerjob\n\n"string);
                  
ShowPlayerDialog(playeridDIALOG_ADMIN_LEVEL3DIALOG_STYLE_MSGBOX"Admin Level 2 Commands"string"Okay""Next");
                return 
1;
            }
        }
        case 
DIALOG_ADMIN_LEVEL3:
        {
             if(
response == 1)
            {
                
format(stringsizeof(string), "%s{98B0CD}LEVEL 2 COMMANDS{51FF00}\n/alog /explode /vrespawn /Duel /(un)mute\n/playerweapons /arenas /clearchat /blockask /blockreport\n\n"string);
                
ShowPlayerDialog(playeridDIALOG_ADMIN_LEVEL2DIALOG_STYLE_MSGBOX"Admin Level 2 Commands"string"Okay""Next");
                return 
1;
            }
        }
          case 
DIALOG_ADMIN_LEVEL2:
        {
             if(
response == 1)
            {
                
format(stringsizeof(string), "%s{98B0CD}LEVEL 1 COMMANDS{51FF00}\n/goto /aod /kick /jail /asay /spawn /slap /warn\n/(un)freeze /playerstats /spec /specoff /rarb\n\n"string);
                
ShowPlayerDialog(playeridDIALOG_ADMIN_LEVEL1DIALOG_STYLE_MSGBOX"Admin Level 1 Commands"string"Okay""Next");
                return 
1;
            }
        }
    }

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)