AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   The VGUI hates me - register_menucmd woes (https://forums.alliedmods.net/showthread.php?t=2697)

VVildo 06-14-2004 00:12

The VGUI hates me - register_menucmd woes
 
Hi all,

I just got into scripting and I'm trying to do some stuff when someone tries to buy an AWP/autosniper (basically customize SuicideDog's Drop AWP with Team Limit and Win limit 0.4 to my likings). What I have no works perfectly fine with the Old-style menus, but doesn't do anything when I have the VGUI enabled. This really irks me because I'm basically just copy/pasting code. Can anyone tell what I'm doing wrong?

Here's the plugin_init:
Code:
public plugin_init(){     register_plugin("MYTEST","0.05","CherryRain")     register_menucmd(-31,(1<<4),"menu_awp")     register_menucmd(-31,(1<<5),"menu_awp")     register_menucmd(register_menuid("BuyRifle", 1),(1<<4),"menu_awp")     register_menucmd(register_menuid("BuyRifle", 1),(1<<5),"menu_awp")     register_clcmd("drop","handle_drop")     register_cvar("awplimit","0")     return PLUGIN_CONTINUE }

and then the menu_awp function:
Code:
public menu_awp(id,key) {     if (get_cvar_num("awplimit")!=1) return PLUGIN_CONTINUE     new team = get_user_team(id)     client_print(id,print_chat,"[CR]: Team=%d ID=%d Key=%d", team, id, key)     client_print(id,print_chat,"[CR]: NO GUN FOR YOU")     client_cmd(id,"slot1;wait;wait;wait;drop")         return PLUGIN_CONTINUE }

From what I can gather the register_menuid() function is what makes the old-style menus work (and those actually work :) ). The register_menucmd lines say which menu (-31 is the menu for rifles right?) and which button (1<<4 is option 5 and 1<<5 is option 6) for the VGUI menus.

One thing I don't understand is the difference between 'return PLUGIN_CONTINUE' and 'return PLUGIN_HANDLED'...is this the source of my problem?

I'm terribly sorry for having my first post be a question, but this has stumped me all night.


All times are GMT -4. The time now is 14:49.

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