AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Items being purchased when a user selects menu option (https://forums.alliedmods.net/showthread.php?t=47142)

Geesu 11-10-2006 21:03

Items being purchased when a user selects menu option
 
Basically sometimes if the user is in a buyzone and opens one of my menus (from war3ft).. such as shopmenu, changerace...

The menu will execute correctly when they select an option, but sometimes it will also purchase an item and i have NO idea why, such as a smokegrenade....

Can anyone shed some light on why this is happening?

Thanks,
Josh

Orangutanz 11-10-2006 21:19

Re: Items being purchased when a user selects menu option
 
What menus are you using, the new type or old school?
Also do you know if the buy menu was open prior to your menu?

Geesu 11-10-2006 21:31

Re: Items being purchased when a user selects menu option
 
Buy menu not open...

And old-school menus... but I register them like this:

Code:
/*     Description: Function will register all menus for all languages */ public LANG_SetMenus() {     new iTotalLanguages = get_langsnum();     new lang[3], menu[128];     new curMenuId = -1, highestMenuId = -1;     new iLang, iMenu;     // Loop through every menu     for ( iMenu = 0; iMenu < TOTAL_MENUS; iMenu++ )     {         // Register the menu names for each language         for ( iLang = 0; iLang < iTotalLanguages; iLang++ )         {             get_lang ( iLang, lang );             if ( lang_exists( lang ) )             {                 formatex ( menu, 127, "%L", lang, MENU_NAMES[iMenu] );                 curMenuId = register_menuid ( menu );                 if ( curMenuId > highestMenuId )                 {                     register_menucmd ( curMenuId, 1023, MENU_CALLBACK[iMenu] );                     highestMenuId = curMenuId;                 }             }         }// End language loop     }// End menu loop }

Orangutanz 11-10-2006 21:41

Re: Items being purchased when a user selects menu option
 
Put in a menu tracer, so it dumps out the menu id when an action happens. I read in another post you had a similar problem with the radio activating.

Having a guess it might be something like your menu title is similar/matches the buy equipment title, which causes a conflict I think. I'm pretty certain I had a odd problem like this ages ago and I had to change my menu title.

[edit]
Download SHP Tools in my sig:
hook_msg "ShowMenu"

It'll intercept any menus and dump the info into your server console/logfile.

Geesu 11-10-2006 22:20

Re: Items being purchased when a user selects menu option
 
So how do I actually start this? I did hook_msg "ShowMenu" as well as logfile 1, and i see log files no where :/

Josh

Orangutanz 11-10-2006 23:12

Re: Items being purchased when a user selects menu option
 
Those are actually CVARs, not client/server commands.

Geesu 11-10-2006 23:31

Re: Items being purchased when a user selects menu option
 
So how do I start it?

Orangutanz 11-11-2006 06:35

Re: Items being purchased when a user selects menu option
 
Depending on your setup:

HLDS:
hook_msg "ShowMenu"
logfile 1

Ingame itself:
amx_rcon hook_msg "ShowMenu"
amx_rcon logfile 1

Also there is a problem with the precompiled amxx file be best to compile the script yourself until its fixed.

Geesu 11-11-2006 11:02

Re: Items being purchased when a user selects menu option
 
I did this on server console:

hook_msg "ShowMenu"
logfile 1

and nothing (and I compiled it myself)

Orangutanz 11-12-2006 09:41

Re: Items being purchased when a user selects menu option
 
Did you open any menus after you setup your tracker?

type: listent in server console: if that fails then you couldn't of setup something correctly.


Note:
Something will only happen if ShowMenu is being sent, doesn't work on internal plugins yet! The purpose was to see if ShowMenu is being sent when you purchase something (ie buy, buyequip, radio1/2/3 menus etc) which is where your getting a conflict.


All times are GMT -4. The time now is 20:17.

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