AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   admin menu problem (https://forums.alliedmods.net/showthread.php?t=164632)

SourceNZ 08-13-2011 23:21

admin menu problem
 
so im trying to add a custom menu in adminmenu_custom to change the number of throwing knives without using the command every time

"Commands"
{
"ServerCommands"
{
"Throwing knives"
{
"admin" "sm_cvar"
"cmd" "sm_cvar sm_throwingknives_count #1"
"1"
{
"title" "Throwing knives"
"type" "list"
"1" "1"
"50" "50"
"100" "100"
}
}
}
}

whats wrong with this??

THANKS!

deadman909 08-14-2011 00:50

Re: admin menu problem
 
Try this
PHP Code:

#include <amxmodx>

public plugin_init()
{
    
register_plugin"Knifes""1.0""Dead Man" );

    
register_clcmd"say /knifes""KnifeMenu" );

    
register_clcmd"team_say /knifes""KnifeMenu" );
}

public 
KnifeMenu(idlevelcid)
{
    if (
get_user_flags(id) & ADMIN_KICK)
    {
    new 
menu menu_create("\yThrowing Knives""KnifeMenu_handler")

    
menu_additem(menu"\wSet Knifes Value to (\r1\w)""1"0);
    
menu_additem(menu"\wSet Knifes Value to (\r25\w)""2"0);
    
menu_additem(menu"\wSet Knifes Value to (\r50\w)""3"0);
    
menu_additem(menu"\wSet Knifes Value to (\r75\w)""4"0);
    
menu_additem(menu"\wSet Knifes Value to (\r100\w)""5"0);

    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
menu_display(idmenu0);
    }
}

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

    new 
data[6], szName[64];
    new 
accesscallback;
    
menu_item_getinfo(menuitemaccessdata,charsmax(data), szName,charsmax(szName), callback);

    new 
key str_to_num(data);

    switch(
key)
    {
        case 
1:
        {
            
server_cmd("sm_throwingknives_count 1")
        }
        case 
2:
        {
            
server_cmd("sm_throwingknives_count 25")
        }
        case 
3:
        {
            
server_cmd("sm_throwingknives_count 50")
        }
         case 
4:
        {
            
server_cmd("sm_throwingknives_count 75")
        }
        case 
5:
        {
            
server_cmd("sm_throwingknives_count 100")
    }
    }

    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;



fysiks 08-14-2011 02:38

Re: admin menu problem
 
Post in the SourceMod section.


All times are GMT -4. The time now is 03:31.

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