Raised This Month: $ Target: $400
 0% 

Help with adminmenu


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Zapdos1
BANNED
Join Date: Jul 2009
Location: Chile - La Serena
Old 08-25-2009 , 22:05   Help with adminmenu
Reply With Quote #1

well, when i write say /adminmenu
the menu doesn't appear.
plz help.

PHP Code:

new mAdminMenu 
new maxplayers
new g_iMaxPlayers
new mcbAdminMenu

public plugin_init()
{
          
register_clcmd("say /adminmenu","adminmenu",ADMIN_MENU"Show adminmenu")
          
register_clcmd("say_team /adminmneu""adminmenu"ADMIN_MENU"Show adminmenu")
          
register_concmd("adminmenu""adminmenu"ADMIN_MENU"Show adminmenu")
}

public 
adminmenu(id
{
    for( new 
1<= g_iMaxPlayers i++ )
    {
        if( 
is_user_admin(i) )
            
        
mAdminMenu menu_create("admin menu""mh_AdminMenu")
        
menu_additem(mAdminMenu"\Changelevel""1"ADMIN_MENUmcbAdminMenu)
        
menu_additem(mAdminMenu"\Change to Allied""2"ADMIN_MENUmcbAdminMenu)
        
menu_additem(mAdminMenu"\Change to Soviet""3"ADMIN_MENUmcbAdminMenu)
        
menu_additem(mAdminMenu"\Restart Server""4"ADMIN_MENUmcbAdminMenu)
        
        
menu_setprop(mAdminMenu,MPROP_EXITNAME,"Salir")
        
menu_setprop(mAdminMenuMPROP_EXITMEXIT_ALL)
    }
}

public 
mh_AdminMenu(idmenuitem
{
    if (
item == MENU_EXIT)
    {
        
menu_destroy(mAdminMenu)
        return 
PLUGIN_HANDLED
    

    new 
iData[6];
    new 
iAccess;
    new 
iCallback;
    new 
iName[64];
    
menu_item_getinfo(mAdminMenuitemiAccessiData5iName63iCallback)
    
    switch (
str_to_num(iData))
    { 
        case 
1:
        {
            
server_cmd("changelevel  de_dust2")
        }
        case 
2:
        {
            
Allied(id)
        }
        case 
3:
        {
            
Soviet(id)
        }
        case 
4:
        {
            
restartmenu(id)
        }
        
    }
    
    return 
PLUGIN_HANDLED


public 
Allied(id)
{
    new 
temp1[32]
    new 
temp2[2]
    new 
Menu menu_create("Players:","handle")  
    
    for (new 
1<= maxplayersi++){
        if (
is_user_connected(i))
        {
            
get_user_name(i,temp1,32);
            
num_to_str(i,temp2,2);
            
menu_additem(Menutemp1,temp2);
        }
    }
    
menu_display(idMenu0);  
}

public 
handle(idMenuitem)
{
    if (
item == MENU_EXIT)
    {
        
menu_destroy(Menu)
        return 
PLUGIN_HANDLED
    
}
    
    new 
iData[6];
    new 
iAccess;
    new 
iCallback;
    new 
iName[64];
    
menu_item_getinfo(MenuitemiAccessiData5iName63iCallback)
    
    if(
cs_get_user_team(id) == CS_TEAM_T)
    {
        
cs_set_user_team(idCS_TEAM_CT)
    }
    return 
PLUGIN_HANDLED
}  

public 
Soviet(id)
{
    new 
temp1[32]
    new 
temp2[2]
    new 
Menu menu_create("Players:","handles")  
    
    for (new 
1<= maxplayersi++){
        if (
is_user_connected(i))
        {
            
get_user_name(i,temp1,32);
            
num_to_str(i,temp2,2);
            
menu_additem(Menutemp1,temp2);
        }
    }
    
menu_display(idMenu0);  
}

public 
handles(idMenuitem)
{
    if (
item == MENU_EXIT)
    {
        
menu_destroy(Menu)
        return 
PLUGIN_HANDLED
    
}
    
    new 
iData[6];
    new 
iAccess;
    new 
iCallback;
    new 
iName[64];
    
menu_item_getinfo(MenuitemiAccessiData5iName63iCallback)
    
    if(
cs_get_user_team(id) == CS_TEAM_CT)
    {
        
cs_set_user_team(idCS_TEAM_T)
    }
    
    return 
PLUGIN_HANDLED
}  

public 
restartmenu(id)
{
    new 
restart menu_create("\wEscoja el tiempo de restart""mostrar_menu"
    
menu_additem(restart"\1 Segundo"            "1"0
    
menu_additem(restart"\5 Segundos"    "2"0
    
menu_additem(restart"\10 Segundos"            "3"0
    
    
menu_setprop(restartMPROP_EXITMEXIT_ALL)
    
menu_display(idrestart0)


public 
mostrar_menu(idrestartitem)
{
    if (
item == MENU_EXIT)
    {
        
menu_destroy(restart)
        return 
PLUGIN_HANDLED
    

    
    new 
iData[6];
    new 
iAccess;
    new 
iCallback;
    new 
iName[64];
    
menu_item_getinfo(restartitemiAccessiData5iName63iCallback
    
    switch (
str_to_num(iData))
    { 
        case 
1:
        {
            
server_cmd("sv_restart 1")
        }
        case 
2:
        {
            
server_cmd("sv_restart 5")
        }
        case 
3
        {
            
server_cmd("sv_restart 10")
        }
        
    }
    
    return 
PLUGIN_HANDLED

plz help.
Zapdos1 is offline
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viņa del Mar, Chile
Old 08-25-2009 , 22:11   Re: Help with adminmenu
Reply With Quote #2

menu_display(i, mAdminMenu, 0)
__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS is offline
Zapdos1
BANNED
Join Date: Jul 2009
Location: Chile - La Serena
Old 08-25-2009 , 22:16   Re: Help with adminmenu
Reply With Quote #3

thanks, but i tested and nothing yet :S
Zapdos1 is offline
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viņa del Mar, Chile
Old 08-25-2009 , 22:47   Re: Help with adminmenu
Reply With Quote #4

Quote:
Originally Posted by Zapdos1 View Post
thanks, but i tested and nothing yet :S
PHP Code:
for( new 1<= g_iMaxPlayers i++ ) 
Why that Loop?
__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-25-2009 , 23:56   Re: Help with adminmenu
Reply With Quote #5

Try this and see what happens:

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>

new maxplayers

public plugin_init()
{
    
register_clcmd("say /adminmenu","adminmenu",ADMIN_MENU"Show adminmenu")
    
register_clcmd("say_team /adminmneu""adminmenu"ADMIN_MENU"Show adminmenu")
    
register_concmd("adminmenu""adminmenu"ADMIN_MENU"Show adminmenu")
}

public 
adminmenu(id,level,cid)
{
    if(!
cmd_access(id,level,cid,1))
    {
        return 
PLUGIN_HANDLED
    
}

    new 
mAdminMenu menu_create("admin menu""mh_AdminMenu")
    
menu_additem(mAdminMenu"\Changelevel""1")
    
menu_additem(mAdminMenu"\Change to Allied""2")
    
menu_additem(mAdminMenu"\Change to Soviet""3")
    
menu_additem(mAdminMenu"\Restart Server""4")

    
menu_setprop(mAdminMenu,MPROP_EXITNAME,"Salir")
    
menu_setprop(mAdminMenuMPROP_EXITMEXIT_ALL)

    
menu_display(idmAdminMenu0)

    return 
PLUGIN_HANDLED
}

public 
mh_AdminMenu(idmenuitem)
{
    if (
item == MENU_EXIT)
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}

    new 
iData[6];
    new 
iAccess;
    new 
iCallback;
    new 
iName[64];
    
menu_item_getinfo(menuitemiAccessiData5iName63iCallback)

    switch (
str_to_num(iData))
    {
        case 
1:
        {
            
server_cmd("changelevel de_dust2")
        }
        case 
2:
        {
            
Allied(id)
        }
        case 
3:
        {
            
Soviet(id)
        }
        case 
4:
        {
            
restartmenu(id)
        }

    }

    return 
PLUGIN_HANDLED
}

public 
Allied(id)
{
    new 
temp1[32]
    new 
temp2[2]
    new 
Menu menu_create("Players:","handle")

    for (new 
1<= maxplayersi++){
        if (
is_user_connected(i))
        {
            
get_user_name(i,temp1,32);
            
num_to_str(i,temp2,2);
            
menu_additem(Menutemp1,temp2);
        }
    }
    
menu_display(idMenu0);
}

public 
handle(idMenuitem)
{
    if (
item == MENU_EXIT)
    {
        
menu_destroy(Menu)
        return 
PLUGIN_HANDLED
    
}

    new 
iData[6];
    new 
iAccess;
    new 
iCallback;
    new 
iName[64];
    
menu_item_getinfo(MenuitemiAccessiData5iName63iCallback)

    if(
cs_get_user_team(id) == CS_TEAM_T)
    {
        
cs_set_user_team(idCS_TEAM_CT)
    }
    return 
PLUGIN_HANDLED
}

public 
Soviet(id)
{
    new 
temp1[32]
    new 
temp2[2]
    new 
Menu menu_create("Players:","handles")

    for (new 
1<= maxplayersi++){
        if (
is_user_connected(i))
        {
            
get_user_name(i,temp1,32);
            
num_to_str(i,temp2,2);
            
menu_additem(Menutemp1,temp2);
        }
    }
    
menu_display(idMenu0);
}

public 
handles(idMenuitem)
{
    if (
item == MENU_EXIT)
    {
        
menu_destroy(Menu)
        return 
PLUGIN_HANDLED
    
}

    new 
iData[6];
    new 
iAccess;
    new 
iCallback;
    new 
iName[64];
    
menu_item_getinfo(MenuitemiAccessiData5iName63iCallback)

    if(
cs_get_user_team(id) == CS_TEAM_CT)
    {
        
cs_set_user_team(idCS_TEAM_T)
    }

    return 
PLUGIN_HANDLED
}

public 
restartmenu(id)
{
    new 
restart menu_create("\wEscoja el tiempo de restart""mostrar_menu")
    
menu_additem(restart"\1 Segundo"            "1"0)
    
menu_additem(restart"\5 Segundos"    "2"0)
    
menu_additem(restart"\10 Segundos"            "3"0)

    
menu_setprop(restartMPROP_EXITMEXIT_ALL)
    
menu_display(idrestart0)
}

public 
mostrar_menu(idrestartitem)
{
    if (
item == MENU_EXIT)
    {
        
menu_destroy(restart)
        return 
PLUGIN_HANDLED
    
}

    new 
iData[6];
    new 
iAccess;
    new 
iCallback;
    new 
iName[64];
    
menu_item_getinfo(restartitemiAccessiData5iName63iCallback)

    switch (
str_to_num(iData))
    {
        case 
1:
        {
            
server_cmd("sv_restart 1")
        }
        case 
2:
        {
            
server_cmd("sv_restart 5")
        }
        case 
3:
        {
            
server_cmd("sv_restart 10")
        }

    }

    return 
PLUGIN_HANDLED

__________________
fysiks is offline
Zapdos1
BANNED
Join Date: Jul 2009
Location: Chile - La Serena
Old 08-26-2009 , 22:46   Re: Help with adminmenu
Reply With Quote #6

@ fysiks:

thanks it works .

but i have a little problem.

all the options say
hangledchangelevel
hangledallied
hangledsoviet
estart server

plz help, if you need a screenshot, only post here.
Zapdos1 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-27-2009 , 00:18   Re: Help with adminmenu
Reply With Quote #7

Get rid of the backslashes in the options strings.
__________________
fysiks is offline
BOYSplayCS
BANNED
Join Date: Apr 2008
Location: Gainesville, FL
Old 08-27-2009 , 09:38   Re: Help with adminmenu
Reply With Quote #8

Adding the backslashes tells the plugin that you are trying to add colors into the menu items.

You define colors by the '\' symbol when using menus, for example: \r creates red and /y will create yellow. In your code, for example, you added "\Changelevel" which makes the plugin recognize "\C" as an invalid color option. The reason it is invalid is because the C is capitalized and AMXX will only recognize lower-case letters.
BOYSplayCS is offline
zacky
Senior Member
Join Date: Mar 2008
Location: Sweden
Old 08-27-2009 , 11:18   Re: Help with adminmenu
Reply With Quote #9

Quote:
Originally Posted by BOYSplayCS View Post
You define colors by the '\' symbol when using menus, for example: \r creates red and /y will create yellow. In your code, for example, you added "\Changelevel" which makes the plugin recognize "\C" as an invalid color option.
Fail? xD
zacky is offline
Send a message via Skype™ to zacky
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 08-27-2009 , 11:25   Re: Help with adminmenu
Reply With Quote #10

say_team /adminmneu -> say_team /adminmenu

register_concmd -> register_clcmd
We dont want allow menu for server console right ?
__________________
xPaw is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:00.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode