Raised This Month: $ Target: $400
 0% 

Help!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
clubz
Junior Member
Join Date: Dec 2004
Old 01-30-2005 , 06:35   Help!
Reply With Quote #1

Ok, im getting into making plugins and such. I wanna start making /buy menus at certain areas like the 7-11, etc.. I think thats a NPC. Can anyone help? Any tutorials, or can someone maybe teach me?


Thanks,
Kyle
clubz is offline
Send a message via AIM to clubz
Peli
Veteran Member
Join Date: Mar 2004
Location: San Diego, CA
Old 01-30-2005 , 13:28  
Reply With Quote #2

AMX Mod / AMX Mod X Menu tutorial by Xeroblood. This is a really useful tutorial , but if you want the actual code , here it is. :
Code:
#include <amxmodx> public plugin_init() {     register_clcmd( "say /menu","ShowMenu", -1, "Shows The menu" )     register_menucmd(register_menuid("\yFirst Menu:"), 1023, "MenuCommand" )     return PLUGIN_CONTINUE } public ShowMenu( id ) {     new szMenuBody[256]     new keys     format( szMenuBody, 255, "\yFirst Menu:^n" )     add( szMenuBody, 255, "^n\w1. First Option" )     add( szMenuBody, 255, "^n\w2. Second Option" )     add( szMenuBody, 255, "^n\w3. Third Option" )     add( szMenuBody, 255, "^n\w4. Fourth Option" )     add( szMenuBody, 255, "^n\w5. Fifth Option" )     add( szMenuBody, 255, "^n\w6. Sixth Option" )     add( szMenuBody, 255, "^n\w7. Seventh Option" )     add( szMenuBody, 255, "^n\w8. Eighth Option" )     add( szMenuBody, 255, "^n\w9. Ninth Option" )     add( szMenuBody, 255, "^n^n\w0. Exit" )     keys = (1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<7|1<<8|1<<9)         show_menu( id, keys, szMenuBody, -1 )     return PLUGIN_CONTINUE } public MenuCommand( id, key ) {     client_print( id, print_console, "[AMX] Key=%d", key )     client_print( id, print_chat, "[AMX] Key=%d", 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 EXIT" )     }     return PLUGIN_HANDLED }
Peli is offline
Send a message via MSN to Peli
clubz
Junior Member
Join Date: Dec 2004
Old 01-30-2005 , 15:46  
Reply With Quote #3

Hey thanks for the code. But, how would I put it at a certain location, like the diner or 7-11?

Thanks,
Kyle
clubz is offline
Send a message via AIM to clubz
Peli
Veteran Member
Join Date: Mar 2004
Location: San Diego, CA
Old 01-30-2005 , 19:45  
Reply With Quote #4

Well that gets more advanced , like making a model and putting it in an origin and making it accessable only there. I don't know how to do that sorry.
Peli is offline
Send a message via MSN to Peli
Da Bishop
Senior Member
Join Date: Aug 2004
Location: Chester County PA
Old 01-30-2005 , 20:39  
Reply With Quote #5

Thats actually a messy code. The command
Code:
add()

is a bad way to do it.
__________________
Anything that is done can only be done better by urself - since life is a opinion make it the way urs feel its best

~live by it
Da Bishop is offline
Send a message via MSN to Da Bishop
Peli
Veteran Member
Join Date: Mar 2004
Location: San Diego, CA
Old 01-30-2005 , 20:42  
Reply With Quote #6

Then how do you think he should do it?
Peli is offline
Send a message via MSN to Peli
twistedeuphoria
Veteran Member
Join Date: Jul 2004
Old 01-30-2005 , 21:31  
Reply With Quote #7

If you go down on that topic theres an example by freecode (I think) that uses format().
__________________
twistedeuphoria is offline
Johnny got his gun
Veteran Member
Join Date: Jan 2004
Location: Tokyo
Old 01-31-2005 , 02:28  
Reply With Quote #8

I prefer defining the keys like this. Makes reading them alot easier IMO.

Code:
#define MENUBUTTON1             (1<<0) #define MENUBUTTON2             (1<<1) #define MENUBUTTON3             (1<<2) #define MENUBUTTON4             (1<<3) #define MENUBUTTON5             (1<<4) #define MENUBUTTON6             (1<<5) #define MENUBUTTON7             (1<<6) #define MENUBUTTON8             (1<<7) #define MENUBUTTON9             (1<<8) #define MENUBUTTON0             (1<<9) #define MENUSELECT1             0 #define MENUSELECT2             1 #define MENUSELECT3             2 #define MENUSELECT4             3 #define MENUSELECT5             4 #define MENUSELECT6             5 #define MENUSELECT7             6 #define MENUSELECT8             7 #define MENUSELECT9             8 #define MENUSELECT0             9

Then, if we take above example...

Code:
keys = (1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<7|1<<8|1<<9) // Changes to keys = MENUBUTTON1|MENUBUTTON2|MENUBUTTON3|MENUBUTTON4|MENUBUTTON5|MENUBUTTON6|MENUBUTTON7|MENUBUTTON8|MENUBUTTON9|MENUBUTTON0

And in the same manner we replace the #s with MENUSELECT?s in the switch/case in the function called by the menu.
Johnny got his gun is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 01-31-2005 , 16:18  
Reply With Quote #9

As a matter of fact, in amxconst.inc:

Code:
/* Menu keys */ #define MENU_KEY_1      (1<<0) #define MENU_KEY_2      (1<<1) #define MENU_KEY_3      (1<<2) #define MENU_KEY_4      (1<<3) #define MENU_KEY_5      (1<<4) #define MENU_KEY_6      (1<<5) #define MENU_KEY_7      (1<<6) #define MENU_KEY_8      (1<<7) #define MENU_KEY_9      (1<<8) #define MENU_KEY_0      (1<<9)

They already have defines for you.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Peli
Veteran Member
Join Date: Mar 2004
Location: San Diego, CA
Old 01-31-2005 , 19:50  
Reply With Quote #10

Thanks Bishop , Johnny and Avalanche.
Peli is offline
Send a message via MSN to Peli
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 19:23.


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