Raised This Month: $ Target: $400
 0% 

Menu with cvar


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Debesėlis
Senior Member
Join Date: Aug 2008
Location: Lithuania
Old 10-13-2010 , 03:52   Menu with cvar
Reply With Quote #1

Hello, why doesn`t show how much HP will give...?

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"); 
Debesėlis is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 10-13-2010 , 04:03   Re: Menu with cvar
Reply With Quote #2

Format the menu item into a string and pass the string into the menu_additem().
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Debesėlis
Senior Member
Join Date: Aug 2008
Location: Lithuania
Old 10-13-2010 , 04:07   Re: Menu with cvar
Reply With Quote #3

Please give me some example.
Debesėlis is offline
Altecaho
Senior Member
Join Date: Oct 2010
Old 10-13-2010 , 08:57   Re: Menu with cvar
Reply With Quote #4

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);
Altecaho is offline
Debesėlis
Senior Member
Join Date: Aug 2008
Location: Lithuania
Old 10-13-2010 , 09:22   Re: Menu with cvar
Reply With Quote #5

Quote:
Originally Posted by Altecaho View Post
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);
"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...

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>

Last edited by Debesėlis; 10-13-2010 at 09:37.
Debesėlis is offline
Altecaho
Senior Member
Join Date: Oct 2010
Old 10-13-2010 , 09:53   Re: Menu with cvar
Reply With Quote #6

Add simple menu with
Code:
        case 1:
        {
            set_user_health(id, get_user_health(id) + 50);
        }
Altecaho is offline
Debesėlis
Senior Member
Join Date: Aug 2008
Location: Lithuania
Old 10-13-2010 , 10:06   Re: Menu with cvar
Reply With Quote #7

Quote:
Originally Posted by Exolent[jNr] View Post
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 ); 
Debesėlis is offline
mottzi
Veteran Member
Join Date: May 2010
Location: Switzerland
Old 10-13-2010 , 10:27   Re: Menu with cvar
Reply With Quote #8

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" ); 
__________________
Quote:
#define true ((rand() % 2)? true: false) //Happy debugging suckers
mottzi is offline
Send a message via MSN to mottzi
Reply



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 10:28.


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