Raised This Month: $ Target: $400
 0% 

scripting and menu


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
neverminde
Senior Member
Join Date: Feb 2011
Location: St.Piter
Old 04-07-2011 , 11:41   scripting and menu
Reply With Quote #1

(I hope I have not made ​​mistakes in this pattern)

In this menu handler 1 key runs some function and opens menu again
(first page).
Last key runs another function, but it must open second page of menu.
I dont know how.


Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <fakemeta>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"


public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)

    register_clcmd("menu_example", "function_menu", ADMIN_ALL,"")
        
    register_clcmd("music_switch" , "my_switch")
}

public my_action(id)
{
    //something here
} 

public my_switch(id)
{
    //something here
} 

public function_menu(id)
{
    new menu = menu_create("My_menu", "menu_handler")
    menu_additem(menu, "first menu item","1")
    menu_additem(menu, "second menu item","2")
    menu_additem(menu, "...", "3")
    menu_additem(menu, "...", "4")
    menu_additem(menu, "...", "5")
    menu_additem(menu, "...", "6")
    menu_additem(menu, "...", "7")
    menu_additem(menu, "...", "8")
    menu_additem(menu, "...", "9")    
    menu_additem(menu, "..." "10")    
    menu_additem(menu, "last menu item" , "11")

    menu_setprop(menu, MPROP_EXIT,MEXIT_ALL)
    menu_display(id,menu,0)

    return PLUGIN_HANDLED
}

public menu_handler(id,menu,item)
{
    if(item == MENU_EXIT)
    {
        menu_destroy(menu)
        return PLUGIN_HANDLED
    }

    new data[6], iName[64], access, callback
    menu_item_getinfo(menu, item, access, data, 5, iName, 63, callback)

    new key = str_to_num(data)
    switch(key)
    {
case 1:
    client_cmd(id, "my_action")
    client_cmd(id, "menu_example")

case 2:
    //something
       
case 3:
    //something
       
case 4:
    //something          

case 5:
    //something

case 6:
    //something  

case 7:
    //something

case 8:
    //something
   
case 9:
    //something
case 10:
{
    //something
}
case 11:
{
    client_cmd(id, "music_switch")
    client_cmd(id, "menu_example")
     

}

    return PLUGIN_CONTINUE
}
ps how set [phpcode] ?

Last edited by neverminde; 04-07-2011 at 13:00.
neverminde 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 19:54.


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