Raised This Month: $32 Target: $400
 8% 

More help learning


Post New Thread Reply   
 
Thread Tools Display Modes
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 03-30-2004 , 09:06  
Reply With Quote #71

Quote:
Originally Posted by Peli
Okay , I will work on a plugin , I got a good idea it is probably made already but who cares I'm practicing. How would I make a menu with options? Someone please help , that's all I don't know , the rest I will look at your plugin and get some info.
I once wrote a tut for Menu systems in AMX, it should suffice since making menus in AMXX hasn't changed!!

Also, I wrote the tutorial a long time ago, and I explained using the add() function for combining strings, but you should use format().. anyway, not a big deal there..

You could find it here!

(Maybe Bailopan has written a better one since tho, be sure to check for his in the AMXX Docs!!)

Hope it helps!!
xeroblood is offline
Send a message via MSN to xeroblood
Peli
Veteran Member
Join Date: Mar 2004
Location: San Diego, CA
Old 03-30-2004 , 15:22  
Reply With Quote #72

Xeroblood , I looked in the Amx scripting section I saw your stickie a long time ago , I just thought of it right now , thanks it really helps One question though , I know how to set the menu up , but how do you set actions up for each option?
Peli is offline
Send a message via MSN to Peli
Gor.d
Junior Member
Join Date: Mar 2004
Location: South Carolina
Old 03-30-2004 , 16:17  
Reply With Quote #73

I hate to jack someone else's help thread, but what is the significance of i++?
Gor.d is offline
Send a message via AIM to Gor.d Send a message via MSN to Gor.d Send a message via Yahoo to Gor.d
Peli
Veteran Member
Join Date: Mar 2004
Location: San Diego, CA
Old 03-30-2004 , 18:05  
Reply With Quote #74

No problem man. This is for all to get help I am a noob but I think that would mean , i could be more? Just a guess.
Peli is offline
Send a message via MSN to Peli
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 03-31-2004 , 09:00  
Reply With Quote #75

@Peli:

first, of course, you display the menu (I know you got that), but that will only show it on screen..
when you register the Menu with AMX/X, it will call any function you specify when a user chooses one of the options.. register it like:
Code:
register_menucmd(register_menuid("\yYour Menu:"), (1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<7|1<<8|1<<9|1<<0), "MenuCommand" )

where "\yYour Menu:" is whatever you named your menu when displaying it (the very first part of the string)

If I did the above in code I am telling AMX/X that my menu uses all 10 options: (1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<7|1<<8 |1<<9|1<<0)
1<<0 = KeyPad Key 1
1<<1 = KeyPad Key 2
1<<2 = KeyPad Key 3
...
...
1<<8 = KeyPad Key 9
1<<9 = KeyPad Key 0

and when any one of those keys is pressed by the user, AMX/X will hide the on-screen menu and call the "MenuCommand" function..

now in your MenuCommand function (you can name it anything) you would 'catch' the key pressed by the user (sent from AMX/X) in a parameter (ussually called 'key') so that your code knows what option was chosen:

id = the user who seen then menu and chose option,
key = the option they chose (as a bit, so if they Press 1 on keypad, you get 0 in code, just like above)
Code:
public MenuCommand( id, key ) {     switch( key )     {         case 0: client_print( id, print_chat, "Menu Option #1" )         case 1: client_print( id, print_chat, "Menu Option #2" )                case 2: client_print( id, print_chat, "Menu Option #3" )         case 3: client_print( id, print_chat, "Menu Option #4" )         case 4: client_print( id, print_chat, "Menu Option #5" )         case 5: client_print( id, print_chat, "Menu Option #6" )         case 6: client_print( id, print_chat, "Menu Option #7" )         case 7: client_print( id, print_chat, "Menu Option #8" )         case 8: client_print( id, print_chat, "Menu Option #9" )         case 9: client_print( id, print_chat, "Menu Option #0" )     }     return PLUGIN_HANDLED }

Hope that helps!!

@Gor.d:

i++ is a postfix 'increment' operation..

i++ is simply i = i + 1 after the current usage of i (postfix)
++i is simply i = i + 1 before the current usage of i (prefix)

so if i = 5
and I did: call_some_ex_func( i++ )

then the function "call_some_ex_func" would recieve a value of '5'
then, the i gets incremented by one..
however, if I did: call_some_ex_func( ++i )
then i gets incremented first to '6' then the function gets called, passing the new value of 6!!

Hope that didn't confuze you..
xeroblood is offline
Send a message via MSN to xeroblood
Gor.d
Junior Member
Join Date: Mar 2004
Location: South Carolina
Old 03-31-2004 , 09:10  
Reply With Quote #76

No, it actually helped alot. Thanks Xeroblood.
Gor.d is offline
Send a message via AIM to Gor.d Send a message via MSN to Gor.d Send a message via Yahoo to Gor.d
Peli
Veteran Member
Join Date: Mar 2004
Location: San Diego, CA
Old 03-31-2004 , 14:28  
Reply With Quote #77

Nevermind
Peli is offline
Send a message via MSN to Peli
Reply


Thread Tools
Display Modes

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 03:29.


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