AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Menu Colors (https://forums.alliedmods.net/showthread.php?t=213700)

joshknifer 04-17-2013 16:43

Menu Colors
 
Edit: Connor figured it out :) Check the request for the solution.

Hey all. Tried to help with a request to change a menu from auto opening to being available via say command, which I was able to do by adding the clcmd functions, but after adding the two lines, it messed with the color on the menu? Not sure what is wrong, the codes for the menu structure look the same...

Here is the request: https://forums.alliedmods.net/showthread.php?t=213662
Code for the menu:
PHP Code:

/*============================================================
                     KNIFE SHOP
============================================================*/
public Tienda1(id)
{
    if(
get_pcvar_num(OnOff2))
    {
        if (
get_user_team(id) == )
        {
            static 
Item[64]
                        
            
formatex(Itemcharsmax(Item),"\y%L"LANG_PLAYER"SHOP"
            new 
Menu menu_create(Item"CuchilleroHandler")
                        
            
formatex(Itemcharsmax(Item),"\w%L \r%d$",LANG_PLAYER"KNIFE1"get_pcvar_num(precioC1))
            
menu_additem(MenuItem"1")
                            
            
formatex(Itemcharsmax(Item),"\w%L \r%d$",LANG_PLAYER"KNIFE2"get_pcvar_num(precioC2))
            
menu_additem(MenuItem"2")
            
            
formatex(Itemcharsmax(Item),"\w%L \r%d$",LANG_PLAYER"KNIFE3"get_pcvar_num(precioC3))
            
menu_additem(MenuItem"3")
            
            
formatex(Itemcharsmax(Item),"\w%L \r%d$",LANG_PLAYER"KNIFE4"get_pcvar_num(precioC4))
            
menu_additem(MenuItem"4")

            
menu_setprop(MenuMPROP_EXITMEXIT_ALL)
            
menu_display(idMenu)
        }
    }
    return 
PLUGIN_HANDLED
}

public 
CuchilleroHandler(idmenuitem)
{
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    new 
data[6], iName[64];
    new 
accesscallback;
    
menu_item_getinfo(menuitemaccessdata,5iName63callback);
    
    new 
vivo     is_user_alive(id)
    new 
Obtener1     get_pcvar_num(precioC1)
    new 
Obtener2     get_pcvar_num(precioC2)
    new 
Obtener3     get_pcvar_num(precioC3)
    new 
Obtener4     get_pcvar_num(precioC4)    
    
    new 
key str_to_num(data);
    
    switch(
key)
    {
        case 
1:
        {
            if (
g_jbpacks[id]>= Obtener1 && vivo)
            {
                
g_jbpacks[id] -= Obtener1
                CTCuchillo
[id]     = 0
                TCuchillo
[id]     = 0
                Destapador
[id]     = 1
                Hacha
[id]     = 0
                Machete
[id]     = 0
                Motocierra
[id]     = 0
                
                
                ham_strip_weapon
(id"weapon_knife")
                
give_item(id"weapon_knife")

                
ChatColor(id"%L"LANG_PLAYER"BUY_KNIFE1")
                
emit_sound(idCHAN_AUTOSiVOL_NORMATTN_NORM 0PITCH_NORM
            }
            else
            {
                
ChatColor(id"%L"LANG_PLAYER"MONEY")
                
emit_sound(idCHAN_AUTONoVOL_NORMATTN_NORM 0PITCH_NORM
            }
        }
        
        case 
2:
        {
            if (
g_jbpacks[id] >= Obtener2 && vivo)
            {
                
                
g_jbpacks[id] -= Obtener2
                CTCuchillo
[id]     = 0
                TCuchillo
[id]     = 0
                Destapador
[id]     = 0
                Hacha
[id]     = 1
                Machete
[id]     = 0
                Motocierra
[id]     = 0
                
                ham_strip_weapon
(id"weapon_knife")
                
give_item(id"weapon_knife")
                
                
ChatColor(id"%L"LANG_PLAYER"BUY_KNIFE2")
                
emit_sound(idCHAN_AUTOSiVOL_NORMATTN_NORM 0PITCH_NORM
            }
            else
            {
                
ChatColor(id"%L"LANG_PLAYER"MONEY")
                
emit_sound(idCHAN_AUTONoVOL_NORMATTN_NORM 0PITCH_NORM
            }
        }
            
        case 
3:
        {
            if (
g_jbpacks[id] >= Obtener3 && vivo)
            {
                
                
g_jbpacks[id] -= Obtener3
                CTCuchillo
[id]     = 0
                TCuchillo
[id]     = 0
                Destapador
[id]     = 0
                Hacha
[id]     = 0
                Machete
[id]     = 1
                Motocierra
[id]     = 0
                
                ham_strip_weapon
(id"weapon_knife")
                
give_item(id"weapon_knife")
                
                
ChatColor(id"%L"LANG_PLAYER"BUY_KNIFE3")
                
emit_sound(idCHAN_AUTOSiVOL_NORMATTN_NORM 0PITCH_NORM
            }
            else
            {
                
ChatColor(id"%L"LANG_PLAYER"MONEY")
                
emit_sound(idCHAN_AUTONoVOL_NORMATTN_NORM 0PITCH_NORM
            }
        }
        
        case 
4:
        {
            if (
g_jbpacks[id] >= Obtener4 && vivo)
            {
                
                
g_jbpacks[id] -= Obtener4
                CTCuchillo
[id]     = 0
                TCuchillo
[id]     = 0
                Destapador
[id]    = 0
                Hacha
[id]     = 0
                Machete
[id]     = 0
                Motocierra
[id]     = 1
                
                
                ham_strip_weapon
(id"weapon_knife")
                
give_item(id"weapon_knife")
                
                
ChatColor(id"%L"LANG_PLAYER"BUY_KNIFE4")
                
emit_sound(idCHAN_AUTOSiVOL_NORMATTN_NORM 0PITCH_NORM
            }
            else
            {
                
ChatColor(id"%L"LANG_PLAYER"MONEY")
                
emit_sound(idCHAN_AUTONoVOL_NORMATTN_NORM 0PITCH_NORM
            }
        }
    }
    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;




All times are GMT -4. The time now is 10:47.

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