Raised This Month: $51 Target: $400
 12% 

Menu thing


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Smokey485
Senior Member
Join Date: Dec 2004
Location: Newt 'Ellin
Old 01-29-2005 , 02:04   Menu thing
Reply With Quote #1

give me a full code of making a menu with 9 options.. and on all of em theres client_cmds(just show me where to put the client command code u dont have to put em there)
Smokey485 is offline
Send a message via AIM to Smokey485 Send a message via MSN to Smokey485
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 01-29-2005 , 03:07   Re: Menu thing
Reply With Quote #2

http://djeyl.net/forum/index.php?showtopic=27288
__________________
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-29-2005 , 14:38  
Reply With Quote #3

Here is the code from the link Avalanche gave , it is Xeroblood's tutorial to make menus , works for AMX Mod and AMX Mod X. All you have to do is change #include <amxmod> to #include <amxmodx> but I did that for you , I added comments where you put the client commands , and where you put the messages you want when that client uses that command. :
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 Name" )     add( szMenuBody, 255, "^n\w2. Second Option Name" )     add( szMenuBody, 255, "^n\w3. Third Option Name" )     add( szMenuBody, 255, "^n\w4. Fourth Option Name" )     add( szMenuBody, 255, "^n\w5. Fifth Option Name" )     add( szMenuBody, 255, "^n\w6. Sixth Option Name" )     add( szMenuBody, 255, "^n\w7. Seventh Option Name" )     add( szMenuBody, 255, "^n\w8. Eighth Option Name" )     add( szMenuBody, 255, "^n\w9. Ninth Option Name" )     add( szMenuBody, 255, "^n^n\w0. Exit Option Name" )     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:            // Put your client message hereclient_print( id, print_chat, "Text")            // Put your client command here         case 1:            // Put your client message hereclient_print( id, print_chat, "Text")            // Put your client command here         case 2:            // Put your client message hereclient_print( id, print_chat, "Text")            // Put your client command here         case 3:            // Put your client message hereclient_print( id, print_chat, "Text")            // Put your client command here         case 4:            // Put your client message hereclient_print( id, print_chat, "Text")            // Put your client command here         case 5:            // Put your client message hereclient_print( id, print_chat, "Text")            // Put your client command here         case 6:            // Put your client message hereclient_print( id, print_chat, "Text")            // Put your client command here         case 7:            // Put your client message hereclient_print( id, print_chat, "Text")            // Put your client command here         case 8:            // Put your client message hereclient_print( id, print_chat, "Text")            // Put your client command here         case 9:            // Put your client message hereclient_print( id, print_chat, "Text")            // Put your client command here     }     return PLUGIN_HANDLED }
Peli is offline
Send a message via MSN to Peli
MistaGee
Senior Member
Join Date: Aug 2004
Location: Germany (Fulda)
Old 03-03-2005 , 09:18  
Reply With Quote #4

btw: the author of the linked tutorial didn't tell us why you can also use
Code:
new keys = 1023
instead of
Code:
new keys=(1<<0|1<<1|1<<2|1<<3|..|1<<9)
Well this is quite easy:

With the above code you set bits. Written side by side, this looks as following:
Code:
Keys: 9 8 7 6 5 4 3 2 1 0
Bits: 1 1 1 1 1 1 1 1 1 1
This way makes clear that these bits represent a binary number, which, "translated" into the decimal system, is equal to 1023.

Let's see what happens if u only need keys 0-4:
Code:
Keys: 9 8 7 6 5 4 3 2 1 0
Bits: 0 0 0 0 0 1 1 1 1 1
The corresponding decimal value for this would be 31.

I think it's a lot easier using the bitwise notation cuz u won't lose the overview there, just wanted to give a hint...
__________________
Ich hab nie behauptet dass ich kein Genie bin!
Mumble-Django: A web interface for Mumble
MistaGee is offline
Send a message via ICQ to MistaGee
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 03-04-2005 , 19:12  
Reply With Quote #5

Coo, thanks.
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 03-05-2005 , 09:27  
Reply With Quote #6

@MistaGee:

I understand BitWise operations fully, the question I had (way back then) was not "Why is the number 1023", but more like "Why do we even need keys there, when the show_menu() function ultimately ignores them and uses its own keys anyway"...
(Nice explanaition tho! But you didn't explain the math to them! ;))


Also, please don't use that code bit containing the add() functions.. use this instead:
Code:
public ShowMenu( id ) {     new szMenuBody[256]     new keys     new len = format( szMenuBody, 255, "\yFirst Menu:^n" )     len += format( szMenuBody[len], 255-len, "^n\w1. First Option Name" )     len += format( szMenuBody[len], 255-len, "^n\w2. Second Option Name" )     len += format( szMenuBody[len], 255-len, "^n\w3. Third Option Name" )     len += format( szMenuBody[len], 255-len, "^n\w4. Fourth Option Name" )     len += format( szMenuBody[len], 255-len, "^n\w5. Fifth Option Name" )     len += format( szMenuBody[len], 255-len, "^n\w6. Sixth Option Name" )     len += format( szMenuBody[len], 255-len, "^n\w7. Seventh Option Name" )     len += format( szMenuBody[len], 255-len, "^n\w8. Eighth Option Name" )     len += format( szMenuBody[len], 255-len, "^n\w9. Ninth Option Name" )     len += format( szMenuBody[len], 255-len, "^n^n\w0. Exit Option Name" )     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 }

Just replace the same function from above with this one..
xeroblood is offline
Send a message via MSN to xeroblood
MistaGee
Senior Member
Join Date: Aug 2004
Location: Germany (Fulda)
Old 03-05-2005 , 10:06  
Reply With Quote #7

Quote:
Originally Posted by xeroblood
@MistaGee:

I understand BitWise operations fully
sorry bout that d00d

Quote:
Originally Posted by xeroblood
the question I had (way back then) was not "Why is the number 1023", but more like "Why do we even need keys there, when the show_menu() function ultimately ignores them and uses its own keys anyway"...
isn't life one big question? :]

Quote:
Originally Posted by xeroblood
(Nice explanaition tho! But you didn't explain the math to them! ;))
Here it comes:
To get a decimal number out of a binary do the following:
for example: 1101010
decimal = 1*2^7 + 1*2^6 + 0*2^5 + 1*2^4 + 1*2^3 + 0*2^2 + 1*2^1 + 0*2^0 = 26

or just ask your calc.exe in scientific mode (can be switched via menu "View")
__________________
Ich hab nie behauptet dass ich kein Genie bin!
Mumble-Django: A web interface for Mumble
MistaGee is offline
Send a message via ICQ to MistaGee
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 03-05-2005 , 10:43  
Reply With Quote #8

(..double-post..)
xeroblood is offline
Send a message via MSN to xeroblood
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 03-05-2005 , 10:44  
Reply With Quote #9

Quote:
Originally Posted by MistaGee
decimal = 1*2^7 + 1*2^6 + 0*2^5 + 1*2^4 + 1*2^3 + 0*2^2 + 1*2^1 + 0*2^0 = 26
GJ!!! That was almost *10100111001* !!!!
xeroblood is offline
Send a message via MSN to xeroblood
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 03-05-2005 , 12:09  
Reply With Quote #10

Noooo, not math!!

xero, read your gmail =].
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x 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 19:22.


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