Raised This Month: $ Target: $400
 0% 

Menu help.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GarbageBox
Senior Member
Join Date: Feb 2010
Old 05-03-2011 , 13:01   Menu help.
Reply With Quote #1

If i am using new amxx menu, how can I change the no.8 button to be a values.
When admin press the player's name, increase the player's health by what number is.
Also, its default in the code.
1. XXX
2. XXX
...
8. Add: %s
0. Exit

If you still dont know what exactly I am talking about, I talk it easily.
I am using new amxx menu, and I want 1 to 7 is player's name and the 8 is a choose. Just like the ban menu, when you press it once, it will change the ban time.
__________________
You can be a SUPER coder but you Haven't to say such as "stupid, etc." words to the others
GarbageBox is offline
JocAnis
Veteran Member
Join Date: Jun 2010
Old 05-03-2011 , 14:18   Re: Menu help.
Reply With Quote #2

for ~10 mins i will post the code..
JocAnis is offline
SonicSonedit
Veteran Member
Join Date: Nov 2008
Location: Silent Hill
Old 05-03-2011 , 14:37   Re: Menu help.
Reply With Quote #3

Quote:
how can I change the no.8 button to be a values.
You can't. But you can use button 6 for this.
__________________

SonicSonedit is offline
JocAnis
Veteran Member
Join Date: Jun 2010
Old 05-03-2011 , 15:04   Re: Menu help.
Reply With Quote #4

PHP Code:
#include <amxmodx>
#include <amxmisc>

native set_user_healthindexhealth )

new 
add_hp 10page

public plugin_init() 
{
    
register_plugin"HP Menu""007""amxmodx.org")
    
    
register_clcmd"say /hpmenu""HealthMenu" )
}
public 
HealthMenuid )
{
    new 
p32 ], nplayertempid15 ], name32 ], name_hp120 ], add_keyname30 ], addtext60 ]
    new 
menu menu_create"Health Menu""hp_keys" )
    
    
get_playerspn"c" )
    
    for( new 
zljzlj nzlj++ )
    {
        
player pzlj ]
        
        
num_to_strplayertempid14 )
        
get_user_nameplayernamecharsmaxname ) )
        
        
formatname_hp119"\w%s \d(\w %d\d HP )"nameget_user_healthplayer ) )
        switch( 
player )//dunno this
        
{
            case 
7142128:
            {
                
tempidplayer ] += 1
            
}
        }
        if( 
)
        {
            
addname_hpcharsmaxname_hp ), "^n" )
        }
        
menu_additemmenuname_hptempid 
    }
    
menu_setpropmenuMPROP_PERPAGE)
    
formatadd_keyname29"Add HP:\y %d"add_hp )
    
menu_additemmenuadd_keyname"7" )
    
    
menu_displayidmenupage )
    return 
PLUGIN_HANDLED
}
public 
hp_keysidmenuitem )
{
    if( 
item == MENU_EXIT )
    {
        
menu_destroymenu )
        return 
PLUGIN_HANDLED
    

    
    new 
data], name64 ];
    new 
accesscallback;
    
menu_item_getinfomenuitemaccessdata5name63callback )

    new 
p_key str_to_numdata )
    
    
HealthMenuid )
    switch( 
p_key )
    {
        case 
7:
        {
            if( 
add_hp 50 )
            {
                
add_hp += 10 
            
}
            else if( 
add_hp 50 )
            {
                
add_hp += 25
            
}
            else if ( 
add_hp >= 100 )
            {
                
add_hp += 50 
            
}
            else if ( 
add_hp >= 250 )
            {
                
add_hp 
            
}
        }
        case 
MENU_MORE:
        {
            
menu_displayidmenupage )
        }
        case 
MENU_BACK:
        {
            
menu_displayidmenupage )
        }
    }
    if( 
is_user_alivep_key ) )
    {
        
set_user_healthp_keyget_user_healthp_key ) + add_hp )
    }
    
    return 
PLUGIN_CONTINUE

tested and doesnt work very well...
JocAnis is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-03-2011 , 18:17   Re: Menu help.
Reply With Quote #5

To make that successfully you would need to use the original menu style because the new menu style does pages automatically and thus requires 8, 9, and 0 for navigating the menu options.
__________________
fysiks is offline
GarbageBox
Senior Member
Join Date: Feb 2010
Old 05-08-2011 , 13:48   Re: Menu help.
Reply With Quote #6

Quote:
Originally Posted by fysiks View Post
To make that successfully you would need to use the original menu style because the new menu style does pages automatically and thus requires 8, 9, and 0 for navigating the menu options.
Can you make it out?
I don't really good at menu.
Thank!
__________________
You can be a SUPER coder but you Haven't to say such as "stupid, etc." words to the others
GarbageBox is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-08-2011 , 13:59   Re: Menu help.
Reply With Quote #7

You can look at the amx_slapmenu to see how it's done (in plmenu.sma)
__________________
fysiks is offline
GarbageBox
Senior Member
Join Date: Feb 2010
Old 05-09-2011 , 10:10   Re: Menu help.
Reply With Quote #8

Why my code can not heal player's hp correctly?

Mine:
Code:
set_user_health(player, (get_user_health(player) + g_menuSettings[id]) ? g_menuSettings[id] : 0)
Original:
Code:
user_slap(player, (get_user_health(player) > g_menuSettings[id]) ? g_menuSettings[id] : 0)
__________________
You can be a SUPER coder but you Haven't to say such as "stupid, etc." words to the others
GarbageBox is offline
SonicSonedit
Veteran Member
Join Date: Nov 2008
Location: Silent Hill
Old 05-09-2011 , 10:14   Re: Menu help.
Reply With Quote #9

I'm not sure what your trying to do, but it's probably should look like this:
PHP Code:
new hp=get_user_health(player)
set_user_health(player, (hp g_menuSettings[id]) ? g_menuSettings[id] : hp
__________________

SonicSonedit is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-09-2011 , 14:29   Re: Menu help.
Reply With Quote #10

If you just want to add the selected heatlh like you say in your first post then:

PHP Code:
set_user_health(playerget_user_health(player) + g_menuSettings[id]) 
__________________
fysiks is offline
Reply


Thread Tools
Display Modes

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 04:26.


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