Raised This Month: $ Target: $400
 0% 

Trying...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
smallwimpyboy
Senior Member
Join Date: Aug 2005
Location: United States
Old 09-29-2005 , 17:44   Trying...
Reply With Quote #1

Ive been trying to figure out menus and i got this code off the tour. part of froums but it all works just none of the abilitys work i set them just they dont work
Code:
#include <amxmodx> #include <amxmisc> #include <fun> #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) public plugin_init() {     register_plugin("abilitys", "0.1", "smallwimpyboy")     new keys = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)     register_menucmd(register_menuid("Choose ability"), keys, "giveStuff")     register_clcmd("say /giveme", "showStuffMenu") } public showStuffMenu(id) {     new menu[192]     new keys = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)     format(menu, 191, "^n1. Invisabilty^n2. Steroids^n3. Wings^n4. Visibale^n5. GIANT")     show_menu(id, keys, menu)     return PLUGIN_HANDLED } public giveStuff(id, key) {         if (key==0)     {          set_user_rendering(id,kRenderFxGlowShell,0,0,0,kRenderTransAlpha,0)     }     if (key==1) {          set_user_health(id,1000)     }     if (key==2) {          set_user_gravity(id,0.3)     }     if (key==3) {          set_user_rendering(id,kRenderFxGlowShell,0,0,0,kRenderTransAlpha,255)     }     if (key==4) {       set_user_rendering(id,kRenderFxExplode,255)     } }
Its this part that dont work
Code:
public giveStuff(id, key) {         if (key==0)     {          set_user_rendering(id,kRenderFxGlowShell,0,0,0,kRenderTransAlpha,0)     }     if (key==1) {          set_user_health(id,1000)     }     if (key==2) {          set_user_gravity(id,0.3)     }     if (key==3) {          set_user_rendering(id,kRenderFxGlowShell,0,0,0,kRenderTransAlpha,255)     }     if (key==4) {       set_user_rendering(id,kRenderFxExplode,255)     } }
Please help
ive never made amenu b4
smallwimpyboy is offline
Send a message via AIM to smallwimpyboy Send a message via MSN to smallwimpyboy
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 09-29-2005 , 18:13  
Reply With Quote #2

Look at this line:

Code:
register_menucmd(register_menuid("Choose ability"), keys, "giveStuff")
You registered the menuid based on the string "Choose ability". This means that your menu has to either start with "Choose ability", or the title has to be "Choose ability". Most people would opt for the first option, but I myself prefer the second option because it makes your plugin_init cleaner, sometimes more readable, and lets you change the menu text however you want without changing the register_menucmd line.

So we will modify the show_menu line so that it has a unique title (this isn't actually displayed in game, it's just an internal thing).

Code:
show_menu(id, keys, menu, -1, "Choose ability")
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
smallwimpyboy
Senior Member
Join Date: Aug 2005
Location: United States
Old 09-29-2005 , 19:01  
Reply With Quote #3

Thanks
smallwimpyboy is offline
Send a message via AIM to smallwimpyboy Send a message via MSN to smallwimpyboy
pdoubleopdawg
Senior Member
Join Date: Aug 2005
Old 09-29-2005 , 19:30  
Reply With Quote #4

A bit offtopic, but register_menu is a nice shortcut through that. FuncWiki it.
pdoubleopdawg is offline
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 09-29-2005 , 20:10  
Reply With Quote #5

all it does is take what you put in it and execute register_menucmd(register_menuid(....)......)
look in your amxmisc.inc file
Xanimos is offline
Send a message via AIM to Xanimos Send a message via MSN to Xanimos
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 11:02.


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