Raised This Month: $ Target: $400
 0% 

Menu's


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
marky_uk
Junior Member
Join Date: Aug 2008
Old 03-28-2009 , 23:47   Menu's
Reply With Quote #1

Yeah, me again >.<
Right well I've been working on menus for 2 days now...really am stumped. I've read the tutorials on using the new menus but I just don't understand how I call another menu from a menu.

I can get the first menu to display. But the second menu doesnt want to pop up.

Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <cstrike>
 
new PLUGIN[]="PlayerMODMenu"
new AUTHOR[]="Marky_UK"
new VERSION[]="1.00"

new g_MainMenu
new g_HPMenu
//new g_HPValue

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_clcmd("amx_playermenu","mainmenu",ADMIN_CFG,"Opens players menu")
}

public mainmenu(id)
{
    g_MainMenu = menu_create("Player Menu","mainmenu_handle")
    menu_additem(g_MainMenu, "Health", "1")
    menu_setprop(g_MainMenu, MPROP_EXIT, MEXIT_ALL)
    menu_display(id, g_MainMenu, 0)
    return PLUGIN_HANDLED
}

public hpmenu(id)
{
    g_HPMenu = menu_create("Health","hpmenu_handle")
    menu_additem(g_HPMenu, "100HP", "1")
    menu_additem(g_HPMenu, "200HP", "2")
    menu_setprop(g_HPMenu, MPROP_EXIT, MEXIT_ALL)
    menu_display(id, g_HPMenu, 0)
    return PLUGIN_HANDLED
}

public mainmenu_handle(id, menu, item)
{
    if(item == MENU_EXIT)
    {
        menu_destroy(g_MainMenu)
        return PLUGIN_CONTINUE
    }
    
    new option[1], optionname[11]
    new access, callback
    menu_item_getinfo(menu, item, access, option,0, optionname, 10, callback)

    new key = str_to_num(option)

    switch(key)
    {
        case 1:
            {
                menu_destroy(g_MainMenu)
                hpmenu(id)
                return PLUGIN_HANDLED
            }
    }
    menu_destroy(g_MainMenu)
    return PLUGIN_HANDLED
}

public hpmenu_handle(id, menu, item)
{
    if(item == MENU_EXIT)
    {
        menu_destroy(g_HPMenu)
        return PLUGIN_CONTINUE
    }
    
    new option[2], optionname[11]
    new access, callback
    menu_item_getinfo(menu, item, access, option,1, optionname, 10, callback)

    new key = str_to_num(option)

    switch(key)
    {
        case 1:
            {
                menu_destroy(g_HPMenu)
                set_user_health(id, 100)
                return PLUGIN_HANDLED
            }
        case 2:
            {
                menu_destroy(g_HPMenu)
                set_user_health(id, 200)
                return PLUGIN_HANDLED
            }
    }
    menu_destroy(g_HPMenu)
    return PLUGIN_HANDLED
}
Please could I have help? <3
Thanks.
marky_uk is offline
 


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 09:00.


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