AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [HELP] Menu modify. (https://forums.alliedmods.net/showthread.php?t=99103)

lolzin123 08-01-2009 15:40

[HELP] Menu modify.
 
How i modify this menu.
PHP Code:

menu_additem(gCustomMenu"Godmode""2"accessCustom, -1); 

I've tryed
PHP Code:

case 2// GodMode
        
{
            new 
szTitle[49];
            new 
szGodmode[6];
            
szGodmode = (get_user_godmode(plr) ? "\yOn" "\rOff");
            
            
format(szTitle48"GodMode: %s"szGodmode); 

Any idea? I'm trying to make like B.M

THX

AntiBots 08-01-2009 18:10

Re: [HELP] Menu modify.
 
You can copy string to a Array.

formatex(szTitle, 48, "GodMode: %s", get_user_godmode(plr) ? "\yOn" : "\rOff" );

lolzin123 08-01-2009 19:51

Re: [HELP] Menu modify.
 
but this gonna change the case two of the menu to the right way?

fysiks 08-02-2009 00:21

Re: [HELP] Menu modify.
 
It doesn't change the menu . . . well it might, you don't give us much reference to the actual menu.

lolzin123 08-02-2009 11:16

Re: [HELP] Menu modify.
 
PHP Code:

gCustomMenu menu_create("Custom Menu""mnuCustom"0);
    
menu_additem(gCustomMenu"Revive""1"accessCustom, -1);
    
menu_additem(gCustomMenu"Godmode""2"accessCustom, -1);
    
menu_additem(gCustomMenu"Scout + Usp""3"accessCustom, -1);
    
menu_additem(gCustomMenu"Healer""4"accessCustom, -1);
    
menu_additem(gCustomMenu"About Plugin.""5"0, -1);
    
menu_setprop(gCustomMenuMPROP_EXITNAME"Main Menu"); 

PHP Code:

public mnuCustom(plrmenuitem)
{
    if( 
item == MENU_EXIT )
    {
        
menu_display(plrgMainMenu0);
        return 
PLUGIN_CONTINUE;
    }
    
    new 
szCmd[3],  _accesscallback;
    
menu_item_getinfo(menuitem_accessszCmd2""0callback);
    
    switch( 
str_to_num(szCmd) )
    {
        case 
1// Revive
        
{
            
/// CODE
                
}
        case 
2// GodMode
        
{
               new 
szTitle[49]; 
                           new 
szGodmode[6]; 
                           
szGodmode = (get_user_godmode(plr) ? "\yOn" "\rOff"); 
             
                           
format(szTitle48"GodMode: %s"szGodmode);  
                       
// CODE
                
}            
        case 
3// Scout + Usp
        // CODE
        
case 5// Sobre este plugin.
        
{
            
// CODE
        
}
    }
    
    
menu_display(plrgCustomMenu0);
    return 
PLUGIN_CONTINUE;



fysiks 08-02-2009 16:12

Re: [HELP] Menu modify.
 
Ok, so I forgot to ask: What is the question? I can't understand you.

lolzin123 08-02-2009 16:29

Re: [HELP] Menu modify.
 
I'm tryng to modify the GodMode... When is turn on apears in the mnu GODMODE: ON and when is off GODMODE: OFF... understand dude?

fysiks 08-02-2009 17:13

Re: [HELP] Menu modify.
 
Quote:

Originally Posted by lolzin123 (Post 888658)
understand dude?

dude? Way to be rude.

Code:

menu_additem(gCustomMenu, get_user_godmode(plr) ? "GODMODE: \yON" : "GODMODE: \rOFF", "2", accessCustom, -1);

lolzin123 08-03-2009 10:21

Re: [HELP] Menu modify.
 
I've tryed this before... but doesn't works. :/ and sorry about 'dude'.

lolzin123 08-03-2009 10:38

Re: [HELP] Menu modify.
 
I'm add at:

PHP Code:

public plugin_init() 

And when i add this code:
PHP Code:

gCustomMenu menu_create("Custom Menu""mnuCustom"0);
    
menu_additem(gCustomMenu"Revive""1"accessCustom, -1);
    
menu_additem(gCustomMenuget_user_godmode(plr) ? "GODMODE: \yON" "GODMODE: \rOFF""2"accessCustom, -1);
    
menu_additem(gCustomMenu"Scout + Usp""3"accessCustom, -1);
    
menu_additem(gCustomMenu"Healer""4"accessCustom, -1);
    
menu_additem(gCustomMenu"Sobre este plugin.""5"0, -1);
    
menu_setprop(gCustomMenuMPROP_EXITNAME"Main Menu"); 

With 'plr' apears the code bug:
undefined symbol 'plr'

and

argument type mistmach <argument 2>

And my plugin doesn't works with 'id' ... the way is add plr at:
PHP Code:

public plugin_init() 

but i think this bug the plugin...


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

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