Raised This Month: $ Target: $400
 0% 

Menu's


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

So like

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")

    g_MainMenu = menu_create("Player Menu","mainmenu_handle")
    menu_additem(g_MainMenu, "Health", "1")
    menu_setprop(g_MainMenu, MPROP_EXIT, MEXIT_ALL)


    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)
}

public mainmenu(id)
{
    menu_display(id, g_MainMenu, 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)
                menu_display(id, g_HPMenu, 0)
                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
}
EDIT:

Just tested the code, same problem.

First menu appears fine, press number 1. Nothing happens.
If I try to open the first menu again nothing happens

Last edited by marky_uk; 03-29-2009 at 00:07.
marky_uk is offline
 



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