AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   [MENU QUESTIONS] Next&Back run sound, and why on page 2 options start from 1 (https://forums.alliedmods.net/showthread.php?t=263433)

groofshark 05-25-2015 09:51

[MENU QUESTIONS] Next&Back run sound, and why on page 2 options start from 1
 
Hello, I have 2 questions about menu...

How to run sound when click Next or Back button?
I tried with
PHP Code:

if( iItem == MENU_NEXT || iItem == MENU_BACK 
{
        
emit_sound(idCHAN_AUTOg_strSoundButtonClick0.6ATTN_NORM0PITCH_HIGH);


but local compiler shows me undefined symbol MENU_NEXT

My second questions is why when I put amxmodx 1.8.3 menus with more pages, every page starts from 1... I mean not continue the last number from previous page? Is that from 1.8.3 or no?

Black Rose 05-26-2015 16:05

Re: [MENU QUESTIONS] Next&Back run sound, and why on page 2 options start from 1
 
Code:
#define MENU_EXIT   -3 #define MENU_BACK   -2 #define MENU_MORE   -1 #define ITEM_IGNORE     0 #define ITEM_ENABLED    1 #define ITEM_DISABLED   2

The numbers represents the key you're supposed to press. It should restart at 1 on every page. You can enumerate them within the text. Or am I misunderstanding you?

groofshark 05-26-2015 16:27

Re: [MENU QUESTIONS] Next&Back run sound, and why on page 2 options start from 1
 
Hmm, why cant I hear a sound when click Next or Back, I am using this now.
PHP Code:

if( iItem == MENU_EXIT 
{
     
menu_destroy(iMenu);
     return 
PLUGIN_HANDLED;
}
else if( 
iItem == MENU_MORE || iItem == MENU_BACK 
{
    
client_cmd(id"spk shop/buttonclick.wav");


Yea, I just want to be 1, 2, 3, 4, 5, 6, 7, next page -> 8, 9, ..
not 1, 2, 3, 4, 5, 6, 7, next page -> 1, 2, ..
How to enumerate it with that style of menu:

PHP Code:

new szTemp[500 char];
formatex(szTempcharsmax(szTemp), "Title");
         
new 
iMenu menu_create(szTemp"Menu_Handler");
new 
iCallback menu_makecallback("Menu_Callback");
        
formatex(szTempcharsmax(szTemp), "Item 1");
menu_additem(iMenuszTemp"1", .callback iCallback);
        
formatex(szTempcharsmax(szTemp), "Item 2");
menu_additem(iMenuszTemp"2", .callback iCallback);
    
formatex(szTempcharsmax(szTemp), "Item 3");
menu_additem(iMenuszTemp"3", .callback iCallback);
        
formatex(szTempcharsmax(szTemp), "Item 4");
menu_additem(iMenuszTemp"4", .callback iCallback);
        
formatex(szTempcharsmax(szTemp), "Item 5");
menu_additem(iMenuszTemp"5", .callback iCallback);
        
formatex(szTempcharsmax(szTemp), "Item 6");
menu_additem(iMenuszTemp"6", .callback iCallback);
        
formatex(szTempcharsmax(szTemp), "Item 7");
menu_additem(iMenuszTemp"7", .callback iCallback);
        
formatex(szTempcharsmax(szTemp), "Item 8");
menu_additem(iMenuszTemp"8", .callback iCallback);
        
formatex(szTempcharsmax(szTemp), "Item 9");
menu_additem(iMenuszTemp"9", .callback iCallback); 


Black Rose 05-28-2015 17:17

Re: [MENU QUESTIONS] Next&Back run sound, and why on page 2 options start from 1
 
Use the old menusystem. That is flexible enough to do whatever you want it to do.

nnajko 05-28-2015 18:20

Re: [MENU QUESTIONS] Next&Back run sound, and why on page 2 options start from 1
 
You can remove the pagination. By setting MPROP_PERPAGE to 0.
Like so;
PHP Code:

    menu_additem(menu"Item 1""1");
    
menu_additem(menu"Item 2""2");
    
menu_additem(menu"Item 3""3");
    
menu_additem(menu"Item 4""4");
    
menu_additem(menu"Item 5""5");
    
menu_additem(menu"Item 6""6");
    
menu_additem(menu"Item 7""7");
    
menu_additem(menu"Item 8""8");
    
menu_additem(menu"Item 9""9");
    
menu_addblank(menu0);
    
menu_additem(menu"Exit""0");
    
menu_setprop(menuMPROP_PERPAGE0);
    
menu_display(idmenu); 

The downside is the exit button gets removed and you manually have to add it / catch the case of it getting pressed.

Since this is not working?
Code:

#define MEXIT_FORCE                2


All times are GMT -4. The time now is 20:01.

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