AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Make menu from constants (https://forums.alliedmods.net/showthread.php?t=232669)

Paradox. 01-03-2014 04:48

Make menu from constants
 
Let's say that I have this constant:
Quote:

new const test [][] = {

"a",
"b",
"c"

}
How can I make a menu to show up that read the items from this constant ? And how can I make option c to be available only if you have admin_level_h acces ?

BlueGaming 01-03-2014 05:49

Re: Make menu from constants
 
im not understanding very well, but a good method to make a menu is creating him in "plugin_cfg" using and put them in a global variabile !

Paradox. 01-03-2014 06:04

Re: Make menu from constants
 
You dind't understood. A menu usually is made using menu_additem(menu,"item","",0)
I want to make the menu to read the items from the constant and the menu items to be the items from constant. Like in Cs Shop https://www.google.ro/url?sa=t&rct=j...58187178,d.bGQ

fysiks 01-03-2014 06:44

Re: Make menu from constants
 
If you know a plugin that already does it, you can look at its code to see how the author did it.

Basically, you loop through all the items in the array and create the menu item based the iteration of the array.

PHP Code:

    for( new 0sizeof(test[]); i++ )
    {
        
menu_additem(menutest[i], ""0);
    } 


Paradox. 01-03-2014 09:43

Re: Make menu from constants
 
Quote:

Originally Posted by fysiks (Post 2080446)
If you know a plugin that already does it, you can look at its code to see how the author did it.

Basically, you loop through all the items in the array and create the menu item based the iteration of the array.

PHP Code:

    for( new 0sizeof(test[]); i++ )
    {
        
menu_additem(menutest[i], ""0);
    } 


I don't understand the code from the plugin .Can you make me a clearly example ? And how can I make an option to be available only from players with ADMIN_LEVEL_H. Like menu_additem(menu,"item",0,ADMIN_LEVEL_H). And how to make the menu handler.

fysiks 01-03-2014 16:28

Re: Make menu from constants
 
I just gave you an example. Everything else you need to know about that menu system can be found in the "New AMXX Menu System" tutorial.

Paradox. 01-04-2014 04:22

Re: Make menu from constants
 
If I make a menu usign your method,I can't make the handler in the classic way,or I can?

fysiks 01-04-2014 04:33

Re: Make menu from constants
 
Look at the tutorial.

Paradox. 01-04-2014 08:09

Re: Make menu from constants
 
Quote:

Originally Posted by fysiks (Post 2080861)
Look at the tutorial.

You still don't want to understand. I know how make a menu using new amxx style menu. But I'm asking you if I can make the handler in the same way if I use constants. It's so hard to understand ? I think you shoul pay a little attention when you try to "help" someone because you keep saying same stupid thing again and again without understanding the question.

YamiKaitou 01-04-2014 08:11

Re: Make menu from constants
 
Have you tried it yet?


All times are GMT -4. The time now is 10:05.

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