AlliedModders

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

Debesėlis 10-13-2010 03:52

Menu with cvar
 
Hello, why doesn`t show how much HP will give...? :bacon:

Example:
PHP Code:

new g_Hp;

public 
plugin_init ( ) {
    
g_Hp register_cvar"amx_give_hp""50" );
}

menu_additemmenu"Give HP (+%s HP)""1"0get_pcvar_numg_Hp ) ); 

Doesn`t work and this:
PHP Code:

menu_additemmenu"Give HP (+get_pcvar_num( g_Hp ) HP)""1"); 


Exolent[jNr] 10-13-2010 04:03

Re: Menu with cvar
 
Format the menu item into a string and pass the string into the menu_additem().

Debesėlis 10-13-2010 04:07

Re: Menu with cvar
 
Please give me some example.

Altecaho 10-13-2010 08:57

Re: Menu with cvar
 
Code:

    menu_additem(menu, "\w+50hp and +100 armor", "1", 0);
    menu_additem(menu, "\wAdrenalinas", "2", 0);
    menu_additem(menu, "\wUSP", "3", 0);
    menu_additem(menu, "\w300 armor", "4", 0);


Debesėlis 10-13-2010 09:22

Re: Menu with cvar
 
Quote:

Originally Posted by Altecaho (Post 1323731)
Code:

    menu_additem(menu, "\w+50hp and +100 armor", "1", 0);
    menu_additem(menu, "\wAdrenalinas", "2", 0);
    menu_additem(menu, "\wUSP", "3", 0);
    menu_additem(menu, "\w300 armor", "4", 0);


:bacon: "Give HP (+%s HP)", "1" here must show "amx_give_hp", "50"

Cause if i create menu with:
PHP Code:

menu_additem(menu"\w+50hp and +100 armor""1"0); 

and all the time i must edit CVar and menu text... :grrr:

I try:
PHP Code:

new g_Hp;

public 
plugin_init ( ) {
    
g_Hp register_cvar"amx_give_hp""50" );
}

new 
szHp33 ];
get_pcvar_stringg_HpszHp32 );

menu_additemmenu"Give HP (+%s HP)""1"0szHp ); 

And got error: argument type nismatch <argument 5>

Altecaho 10-13-2010 09:53

Re: Menu with cvar
 
Add simple menu with
Code:

        case 1:
        {
            set_user_health(id, get_user_health(id) + 50);
        }


Debesėlis 10-13-2010 10:06

Re: Menu with cvar
 
Quote:

Originally Posted by Exolent[jNr] (Post 1323610)
Format the menu item into a string and pass the string into the menu_additem().

Please can you help why i gor argument 5?

PHP Code:

new g_Hp;

public 
plugin_init ( ) {
    
g_Hp register_cvar"amx_give_hp""50" );
}

new 
szHp33 ];
get_pcvar_stringg_HpszHp32 );

menu_additemmenu"Give HP (+%s HP)""1"0szHp ); 


mottzi 10-13-2010 10:27

Re: Menu with cvar
 
PHP Code:

new g_Hp;

public 
plugin_init ( ) {
    
g_Hp register_cvar"amx_give_hp""50" );
}

new 
szHp100 ];
formatex(szHpcharsmax(szHp), "Give HP (+%i HP)"get_pcvar_num(g_Hp))

menu_additemmenuszHp"1" ); 



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

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