AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Hook Team Menu (https://forums.alliedmods.net/showthread.php?t=307773)

ish12321 05-24-2018 10:31

Hook Team Menu
 
Code:
RegisterHookChain(RG_HandleMenu_ChooseTeam, "RG_Hook_ChooseTeam", false);
Hello,
I am using this above hook to block team change/force some specific team on some specific conditions.
Recently viewed smiley's pugmod. It uses some another method :
Code:
register_menucmd(-2,MENU_KEY_1|MENU_KEY_2|MENU_KEY_5|MENU_KEY_6,"fnTeamSelect"); register_menucmd(register_menuid("Team_Select",1),MENU_KEY_1|MENU_KEY_2|MENU_KEY_5|MENU_KEY_6,"fnTeamSelect");

Are the two equivalent ? If so, could someone explain me what the -2 in the first line stands for ?

^SmileY 05-24-2018 10:39

Re: Hook Team Menu
 
hehe :D

RegisterHookChain is a new function in reapi on these days?

I do not updated pugMod for newest amxx, but if i understand my functions still hooking only needed keys instead of filter this in RG_Hook_ChooseTeam function. I guess old way is better duo will not use a filter in fulction itself, but only in register part.


Edit:
-2 is the menu id used by VGUI menu (New menu) if i remember.
register_menuid("Team_Select",1) i need to use to hook old menu id that can change if i am not wrong.

Ps. i do not know why, but i preffer to use amxx way is better on my opinion duo compatibility

ish12321 05-24-2018 11:32

Re: Hook Team Menu
 
Could you explain more about new menu and old menu with respect to team change menu.
Also, is -2 general VGUI menu id or VGUI menu id specific to team change menu. Also, can new menu id not change. Is there some way to use newmenu id with register_menuid like we did with old menu. Also, is there any source from which I can get all codes such as "Team_Select" ?

^SmileY 05-24-2018 12:02

Re: Hook Team Menu
 
Quote:

Originally Posted by ish12321 (Post 2593639)
Could you explain more about new menu and old menu with respect to team change menu.
Also, is -2 general VGUI menu id or VGUI menu id specific to team change menu. Also, can new menu id not change. Is there some way to use newmenu id with register_menuid like we did with old menu. Also, is there any source from which I can get all codes such as "Team_Select" ?

Is specific to team change bro, you still need to get menu id on old style menus.
Also what you need to do in first place with these menus?

Since new menus are static on client side, no way to create a new VGUI menu without editing client (that is illegal i guess).

The best way is work with native amx menu or old style menu creating, i do not see any problem with.
But again, i need to know what you trying to do here.

ish12321 05-24-2018 14:03

Re: Hook Team Menu
 
Okay
One more thing
What is difference between chooseteam and jointeam client commands. I've seen many people use those seperately with different actions. Also, is it good to use those or hook vguimenu msg and block that if that msg was of a team choose menu.

ish12321 05-24-2018 14:30

Re: Hook Team Menu
 
Also, is it possible to alter the key selected by the player ?
I want to force player some team. I'm using this because as per what I know if we use cs_set_user_team when player has CS_TEAM_UNASSIGNED, it gives errors. So, I want that when player tries to change team, I change his team as per my will.


All times are GMT -4. The time now is 04:34.

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