AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Menu, is it possible? (https://forums.alliedmods.net/showthread.php?t=225868)

~Ice*shOt 09-10-2013 08:42

Menu, is it possible?
 
I want to ask is it possible to remove/hide numbers in new menu system?

Black Rose 09-10-2013 11:00

Re: Menu, is it possible?
 
Explain further. Do you want to skip certain numbers? Is there a specific reason?

~Ice*shOt 09-10-2013 11:45

Re: Menu, is it possible?
 
I want to hide all numbers except 8, 9 and 0 - next/back and exit

Quote:

Your menu:

First
Second
....

8. Back
9. Next
0. Exit

Black Rose 09-10-2013 13:12

Re: Menu, is it possible?
 
menu_addtext() or do you actually need the buttons working?

~Ice*shOt 09-10-2013 13:25

Re: Menu, is it possible?
 
I know menu_addtext() but it's must be after menu_additem, isn't? That hidden buttons no need to work.

Black Rose 09-10-2013 13:47

Re: Menu, is it possible?
 
Then just use the old menu style.

Baws 09-10-2013 21:44

Re: Menu, is it possible?
 
It's possible to do a menu without numbers.

dark_style 09-11-2013 00:44

Re: Menu, is it possible?
 
Quote:

Originally Posted by baws (Post 2032350)
It's possible to do a menu without numbers.

The new amxx menu system automatically adds the numbers, so as Black Rose said, he must use the old menu.

~Ice*shOt 09-11-2013 08:22

Re: Menu, is it possible?
 
OK, but how then create pages in old menu style?

HamletEagle 09-11-2013 10:05

Re: Menu, is it possible?
 
To create pages in old menu style:
First define the keys for each option:
#define Keysrod (1<<0)|(1<<1)|(1<<2) etc.It depends on the number of options that you add into the menu.

In public plugin_init() add this
register_menucmd(register_menuid("rod"), Keysrod, "Pressedrod")
register_clcmd("say /menu" , "Showrod")

Then make a public called Showrod

public Showrod(id) {
show_menu(id, Keysrod, "Menu_title^n\w1. Option 1 ^n\w2. Option 2^n0. Exit^n", -1, "rod")
}
public Pressedrod(id, key) {

switch (key) {
case 0: {
//do something. I'm option 1

}
case 1: {
//do something. I'm option 2

}

}
}

At the end you cand use this block of code into your plugin:

Code:

#include <amxmodx>

#define Keysrod (1<<0)|(1<<1)|(1<<2)

public plugin_init() {
        register_menucmd(register_menuid("rod"), Keysrod, "Pressedrod")
        register_clcmd("say /menu" , "Showrod")
       
       
}
public Showrod(id) {
        show_menu(id, Keysrod, "Menu_title^n\w1. Option 1 ^n\w2. Option 2^n0. Exit^n", -1, "rod")
}
public Pressedrod(id, key) {
       
        switch (key) {
                case 0: {
                        //do something. I'm option 1
                       
                }
               
                case 1: {
                        //do something. I'm option 2
                       
                }
               
        }
}

This was an example for this style menu. I didn't want to bore you with lessons.


All times are GMT -4. The time now is 18:48.

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