AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Hooking team_select - the old menu (https://forums.alliedmods.net/showthread.php?t=194033)

portocala 08-24-2012 16:45

Hooking team_select - the old menu
 
Hello,

My server mod is GunGame (respawn).

I use this to hook all possible team menus (I know that only 2-3 of them are usable in case of not using VIP, but just to be sure):

Code:

register_menucmd(register_menuid("#IG_Team_Select_Spect", true), MENU_KEY_1|MENU_KEY_2|MENU_KEY_5|MENU_KEY_6, "select_team_old");
register_menucmd(register_menuid("#Team_Select_Spect", true), MENU_KEY_1|MENU_KEY_2|MENU_KEY_5|MENU_KEY_6|MENU_KEY_0, "select_team_old");
register_menucmd(register_menuid("#IG_Team_Select", true), MENU_KEY_1|MENU_KEY_2|MENU_KEY_5|MENU_KEY_0, "select_team_old");
register_menucmd(register_menuid("#IG_VIP_Team_Select", true), MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_5|MENU_KEY_6|MENU_KEY_0, "select_team_old");
register_menucmd(register_menuid("#IG_VIP_Team_Select_Spect", true), MENU_KEY_1|MENU_KEY_2|MENU_KEY_5|MENU_KEY_0, "select_team_old");

I use this in order to implement some team checks before joining a team. If the chosen option (team) doesn't match my requirements, the command is blocked (return PLUGIN_HANDLED), an informative message appears, and the menu shows up again (engclient_cmd(id, "chooseteam"))

The problem is that in some cases (let's say 1 / 10), the menu appears, the key is pressed (1, 2, 5, 6 - doesn't matter) but the function isn't called.

Under what circumstances the function ("select_team_old") is not hooked to the menu ?

Thank you!

LE: I remember that I've done some tests some time ago and the problem doesn't exist if the server is empty (me being the only player).


All times are GMT -4. The time now is 05:43.

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