Raised This Month: $32 Target: $400
 8% 

Hook auto balanced player


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
bibu
Veteran Member
Join Date: Sep 2010
Old 03-29-2017 , 05:59   Hook auto balanced player
Reply With Quote #1

I'm trying to hook the event, when a player gets auto team balanced next round (mp_autoteambalance 1). So far I can hook the message "Teams will be autobalanced next round". But I'm unable to hook that player, even though I tried to cache the team and check it.
In the console, you can tell if the player got auto balanced like this:

Quote:
bibu is joining the Counter-Terrorist force (auto)
__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.
bibu is offline
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 03-29-2017 , 06:07   Re: Hook auto balanced player
Reply With Quote #2

have you tried register_logevent? it might work
jimaway is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 03-29-2017 , 08:00   Re: Hook auto balanced player
Reply With Quote #3

Looks like you are looking for `void CBasePlayer::SwitchTeam()`. You can hook it using Orpheu or Okapi.

A workaround would be to hook "TextMsg" message, check if param 2 is either "#Game_join_terrorist_auto" or "#Game_join_ct_auto", then search for a player with the name that's stored in param 3 using find_player().

Last edited by klippy; 03-29-2017 at 08:00.
klippy is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 03-29-2017 , 08:39   Re: Hook auto balanced player
Reply With Quote #4

You can get a variable with get_ent_data at CBasePlayer (I guess), soo you can set it to disable or enable it when Auto-Team balance logevent is displayed.
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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