Raised This Month: $ Target: $400
 0% 

Weapon Menu Plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Peli
Veteran Member
Join Date: Mar 2004
Location: San Diego, CA
Old 04-02-2004 , 14:39   Weapon Menu Plugin
Reply With Quote #1

Hello I am working on a Weapon Menu Plugin for practice. Maybe I will release it if there isn't one already. I need you guys to look over it for errors and tell me what I did wrong and explain it please , Okay here is the plugin :

Code:
#include <amxmodx> public plugin_init() {     register_plugin( "Weapon Menu", "1.0", "Peli" )     register_clcmd( "say /menu","ShowMenu", -1, "Shows a weapon menu" )     register_menucmd(register_menuid("\yWeapon Menu:"), 1023, "MenuCommand" )         return PLUGIN_CONTINUE } public ShowMenu( id ) {     new szMenuBody[256]     new keys     format( szMenuBody, 255, "\yWeapon Menu:^n" )     add( szMenuBody, 255, "^n\w1. AK47" )     add( szMenuBody, 255, "^n\w2. AK47" )     add( szMenuBody, 255, "^n\w3. AK47" )     add( szMenuBody, 255, "^n\w4. AK47" )     add( szMenuBody, 255, "^n\w5. AK47" )     add( szMenuBody, 255, "^n\w6. AK47" )     add( szMenuBody, 255, "^n\w7. AK47" )     add( szMenuBody, 255, "^n\w8. AK47" )     add( szMenuBody, 255, "^n\w9. AK47" )     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, "I gave you an ak47" )         case 1: client_print( id, print_chat, "I gave you an ak47" )         case 2: client_print( id, print_chat, "I gave you an ak47" )         case 3: client_print( id, print_chat, "I gave you an ak47" )         case 4: client_print( id, print_chat, "I gave you an ak47" )         case 5: client_print( id, print_chat, "I gave you an ak47" )         case 6: client_print( id, print_chat, "I gave you an ak47" )         case 7: client_print( id, print_chat, "I gave you an ak47" )         case 8: client_print( id, print_chat, "I gave you an ak47" )                 case 9: client_print( id, print_chat, "I gave you an ak47" )                 case 9: client_print( id, print_chat, EXIT )     }     return PLUGIN_HANDLED }
Peli is offline
Send a message via MSN to Peli
dragonchaos
Member
Join Date: Mar 2004
Old 04-02-2004 , 15:53  
Reply With Quote #2

Code:
add( szMenuBody, 255, "^n\w1. "AK47" )
should be
Code:
add( szMenuBody, 255, "^n\w1. AK47" )
(an extra quote was added next to AK47, note the weird coloring in the post.

Code:
client_print( id, print_chat, "give_item("weapon_ak47")" )
i would assume this cannot work.
Code:
client_print( id, print_chat, "I gave you an AK-47" ) give_item( id, "weapon_ak47" )

you also may want to add ammo, but that would be something else
dragonchaos is offline
Old 04-04-2010, 11:34
r4ndomz
This message has been deleted by Exolent[jNr]. Reason: Don't revive dead threads.
Old 04-04-2010, 12:13
matsi
This message has been deleted by Exolent[jNr]. Reason: Don't revive dead threads.
Peli
Veteran Member
Join Date: Mar 2004
Location: San Diego, CA
Old 04-02-2004 , 15:56  
Reply With Quote #5

Thanks , Fixed it
Edit : How can I make this into a Rifle only plugin? How would I make it so this menu pops up when someone presses "B" as their regular buying menu? Any help would be much appreciated.
Peli is offline
Send a message via MSN to Peli
Peli
Veteran Member
Join Date: Mar 2004
Location: San Diego, CA
Old 04-02-2004 , 23:28  
Reply With Quote #6

Anyone know?
Peli is offline
Send a message via MSN to Peli
knekter
Senior Member
Join Date: Mar 2004
Location: PA
Old 04-03-2004 , 15:23   well
Reply With Quote #7

well you could add a command like this:

Code:
client_putinserver(id) {     client_cmd(id,"bind b 'say /menu'")     return PLUGIN_CONTINUE } client_disconnect(id) {     client_cmd(id,"bind b buy")     return PLUGIN_CONTINUE }

hope this helps
__________________
More updates for Matrix Mod!
knekter is offline
Send a message via AIM to knekter Send a message via MSN to knekter
Peli
Veteran Member
Join Date: Mar 2004
Location: San Diego, CA
Old 04-03-2004 , 18:28  
Reply With Quote #8

Thanks Okay , with that in there , how would it look after I put a cvar to make it on and off , to first check if the cvar is 1 then the rest of the code. How would it look?
Peli is offline
Send a message via MSN to Peli
QwertyAccess
Veteran Member
Join Date: Feb 2004
Location: Enjiru Layer
Old 04-03-2004 , 19:27   Re: well
Reply With Quote #9

Quote:
Originally Posted by knekter
well you could add a command like this:

Code:
client_putinserver(id) {     client_cmd(id,"bind b 'say /menu'")     return PLUGIN_CONTINUE } client_disconnect(id) {     client_cmd(id,"bind b buy")     return PLUGIN_CONTINUE }

hope this helps
didnt think client_disconnect would be able to bind b to buy in time while they disconnect..
__________________
QwertyAccess is offline
knekter
Senior Member
Join Date: Mar 2004
Location: PA
Old 04-03-2004 , 23:04   k
Reply With Quote #10

Code:
register_cvar("amx_buymenu","1") client_putinserver(id) {     if(get_cvar_num("amx_buymenu")==0)     {         return PLUGIN_HANDLED     }     client_cmd(id,"bind b 'say /menu'")     return PLUGIN_CONTINUE } client_disconnect(id) {     if(get_cvar_num("amx_buymenu")==0)     {         return PLUGIN_HANDLED     }     client_cmd(id,"bind b buy")     return PLUGIN_CONTINUE }
__________________
More updates for Matrix Mod!
knekter is offline
Send a message via AIM to knekter Send a message via MSN to knekter
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 22:31.


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