This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

Make menu from constants


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Paradox.
Member
Join Date: May 2013
Old 01-03-2014 , 04:48   Make menu from constants
Reply With Quote #1

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 ?

Last edited by Paradox.; 01-03-2014 at 05:02.
Paradox. is offline
BlueGaming
BANNED
Join Date: Nov 2013
Old 01-03-2014 , 05:49   Re: Make menu from constants
Reply With Quote #2

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 !
BlueGaming is offline
Paradox.
Member
Join Date: May 2013
Old 01-03-2014 , 06:04   Re: Make menu from constants
Reply With Quote #3

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

Last edited by Paradox.; 01-03-2014 at 06:05.
Paradox. is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-03-2014 , 06:44   Re: Make menu from constants
Reply With Quote #4

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);
    } 
__________________
fysiks is offline
Paradox.
Member
Join Date: May 2013
Old 01-03-2014 , 09:43   Re: Make menu from constants
Reply With Quote #5

Quote:
Originally Posted by fysiks View Post
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.

Last edited by Paradox.; 01-03-2014 at 12:14.
Paradox. is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-03-2014 , 16:28   Re: Make menu from constants
Reply With Quote #6

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.
__________________
fysiks is offline
Paradox.
Member
Join Date: May 2013
Old 01-04-2014 , 04:22   Re: Make menu from constants
Reply With Quote #7

If I make a menu usign your method,I can't make the handler in the classic way,or I can?
Paradox. is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-04-2014 , 04:33   Re: Make menu from constants
Reply With Quote #8

Look at the tutorial.
__________________
fysiks is offline
Paradox.
Member
Join Date: May 2013
Old 01-04-2014 , 08:09   Re: Make menu from constants
Reply With Quote #9

Quote:
Originally Posted by fysiks View Post
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.
Paradox. is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 01-04-2014 , 08:11   Re: Make menu from constants
Reply With Quote #10

Have you tried it yet?
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Reply



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 15:20.


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