Raised This Month: $ Target: $400
 0% 

amxx menu


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 07-13-2010 , 12:42   Re: amxx menu
Reply With Quote #2

This is how you can create menu with multiple pages using old menu system:
PHP Code:
#define MAX_PLAYERS 32
new g_p_page[MAX_PLAYERS+1]

#define MAX_ITEMS 60
new g_item_name[MAX_ITEMS]


public 
main_menu(id){
    
//...
}


public 
main_menu_handler(idkey){
    switch(
key){
        
//...
        
case SOME_KEYmultiple_pages_menu(id0)
    }
}


public 
multiple_pages_menu(idpage){
    if(
page<0){
        
main_menu(id)
        return 
PLUGIN_HANDLED
    
}
    
g_p_page[id] = page
    
new cache[512]
    new 
pos formatex(cache511"Menu title...^n")
    new 
keys 1<<9
    
new menu_items MAX_ITEMS%8

    
for(new i=0i<menu_itemsi++){
        
pos += formatex(cache[pos], 511-pos"%d. %s^n"i+1g_item_name[page*8+i])
        
keys |= 1<<i
    
}

    if((
page+1)*8<=MAX_ITEMS){
        
pos += formatex(cache[pos], 511-pos"9. Next^n")
        
keys |= 1<<8
    
}else{
        
pos += formatex(cache[pos], 511-pos"\d9. Next^n")
    }
    
pos += formatex(cache[pos], 511-pos"\w0. %s"page>0?"Back":"Exit")
    
show_menu(idkeyscache, -1)
    return 
PLUGIN_HANDLED
}


public 
multiple_pages_menu_handler(idkey){
    switch(
key){
        case 
8multiple_pages_menu(idg_p_page[id]+1)
        case 
9multiple_pages_menu(idg_p_page[id]-1)
        default:{
            new 
item_id g_p_page[id]*8+key
            client_print
(id"You selected item %s"g_item_name[item_id])
        }
    }

__________________
Impossible is Nothing

Last edited by Sylwester; 07-13-2010 at 12:47.
Sylwester 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 07:04.


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