AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   'chooseteam' or 'jointeam' (https://forums.alliedmods.net/showthread.php?t=162932)

Diegorkable 07-24-2011 17:41

'chooseteam' or 'jointeam'
 
when someone logs ingame, there's a menu of team selection that is displayed when you type in console 'chooseteam' or 'jointeam'. After player logs in and he gets that menu, he selects a team. is there any way to detect when he's doing that? (picking a team at log in)

wrecked_ 07-24-2011 18:41

Re: 'chooseteam' or 'jointeam'
 
http://wiki.amxmodx.org/Half-Life_1_...vents#VGUIMenu

Each predefined menu has a unique id. Hook this event and have it print a message containing the menu id. You can use this to get the different ids for whatever menu you need to block or hook.

Returning PLUGIN_HANDLED in the hook function will block whatever menu is being called. Be careful, blocking the team choosing menus can cause server crashes in some cases.

http://wiki.amxmodx.org/Half-Life_1_...vents#ShowMenu could also be useful depending on what you're doing.

Diegorkable 07-24-2011 19:12

Re: 'chooseteam' or 'jointeam'
 
You know what, IGNORE WHAT I ASKED FOR.
There's a bug in CS that if you use the command amx_team or set some user's team before he picks a team by himself from the 'chooseteam' menu, he gets bugged and he has no zoom or lower bar(with HP, armor, bullets etc...), he has to choose a team from the 'chooseteam' menu in first place and only then cs_set_user_team or amx_team commands will work on him properly without bugs.

I want in my script that when someone logs in, it closes the 'chooseteam' menu(that i already did and it works), and instead of that sets him in the team I want, but the problem is that he gets bugged cuz he hasnt picked a team yet! And also I blocked 'chooseteam' menu so even if he tried to pick it wouldnt work cuz the command doesnt work.

Can you help me find an alternative on how to do that? (set someone in a team when you close his chooseteam menu and sets him in a team without him picking a team, which cause the bugs all the time...)

wrecked_ 07-24-2011 19:23

Re: 'chooseteam' or 'jointeam'
 
This plugin will help you identify the id of whatever menu you want when it comes up on a player's screen.

Code:
#include <amxmodx> public plugin_init() {     register_message( get_user_msgid( "VGUIMenu" ), "MessageVGUIMenu" ) } public MessageVGUIMenu( msgid, dest, id ) {     new str[4]     num_to_str( get_msg_arg_int( 1 ), str, 3 )         log_amx( str )     client_print( 0, print_chat, str ) }

Let's say you find that the menu id you want to detect is 99. You would then do something like this:

Code:
#include <amxmodx> public plugin_init() {     register_message( get_user_msgid( "VGUIMenu" ), "MessageVGUIMenu" ) } public MessageVGUIMenu( msgid, dest, id ) {     if( get_msg_arg_int( 1 ) == 99 )     {         // the menu has been detected     } }

EDIT: Threads stick around after they're solved for a reason. Other people may be having this issue and may be searching for a solution. A solution was given above, but now you're trying to make this into a 2nd thread for the same issue you're trying to address in another thread. Please organize these threads.

Diegorkable 07-24-2011 19:49

Re: 'chooseteam' or 'jointeam'
 
I still don't get what you tell me, you're not comprehensive. What is this ID 99? how do I know which ID has the menu of picking a team? all you show me is a code that does it and i dont know how to continue it cuz im really confused.

fysiks 07-24-2011 20:20

Re: 'chooseteam' or 'jointeam'
 
Quote:

Originally Posted by Diegorkable (Post 1517750)
I still don't get what you tell me, you're not comprehensive. What is this ID 99? how do I know which ID has the menu of picking a team? all you show me is a code that does it and i dont know how to continue it cuz im really confused.

He gave you that code as a tool. He didn't do anything for you. It will print the IDs of the menus when they happen. The 99 was hypothetical.

Diegorkable 07-25-2011 06:36

Re: 'chooseteam' or 'jointeam'
 
ahhh ok, sorry im just confused as hell.
but i have a dilemma about it, I want to block for everyone the 'chooseteam' and 'jointeam' command so they can't join a team during the match, and what if someone logs in the middle of a match? he won't be able then to get in a team.... so I can cs_set_user_team him automatically to the team that has less members, right? well wrong cuz if you set someone's team before he picks a team by himself, he simply gets bugged really hard and wierd things happen to him like getting stuck, having no weapon, have no bar HP.

Can anyone help me think of an alternative?

fysiks 07-25-2011 06:58

Re: 'chooseteam' or 'jointeam'
 
Well, how does Exolent's plugin work then?

Diegorkable 07-25-2011 07:20

Re: 'chooseteam' or 'jointeam'
 
I tried to read it, still many functions I don't understand, i'm not that expert to read his high-leveled scripting, functions i've never used, but I get the whole idea, he's detecting if someone's at the chooseteam menu, and if the auto team join is on 1 he gets auto moved, but i dont understand how is he doing that....

wrecked_ 07-25-2011 16:07

Re: 'chooseteam' or 'jointeam'
 
Quote:

Originally Posted by Diegorkable (Post 1518007)
I tried to read it, still many functions I don't understand, i'm not that expert to read his high-leveled scripting, functions i've never used, but I get the whole idea, he's detecting if someone's at the chooseteam menu, and if the auto team join is on 1 he gets auto moved, but i dont understand how is he doing that....

You will spend less time looking into it and understanding each function one by one than you will trying to find an alternative, messy solution.


All times are GMT -4. The time now is 01:08.

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