Raised This Month: $ Target: $400
 0% 

[CSGO] Hooking Spectator


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
PartialCloning
Senior Member
Join Date: Dec 2015
Old 03-19-2016 , 00:15   [CSGO] Hooking Spectator
Reply With Quote #1

I'm trying to run a few checks when a player starts spectating a different player but I can't find a reliable method to hook it. The events do not seem to be called, and spec_next/prev do not work if you're in first person mode and you use your mouse to switch targets. Are there any other commands/events associated with spectating?

Last edited by PartialCloning; 03-19-2016 at 17:42. Reason: Changing title to include [CSGO]
PartialCloning is offline
Grey83
Veteran Member
Join Date: Dec 2014
Location: Ukraine
Old 03-19-2016 , 07:40   Re: Hooking Spectator
Reply With Quote #2

Try to look for the desired function in the code of this plugin
__________________
Grey83 is online now
blaacky
Senior Member
Join Date: Oct 2012
Old 03-19-2016 , 14:52   Re: Hooking Spectator
Reply With Quote #3

If the game supports the SendProxy manager you can hook the "m_hObserverTarget" netprop change in clients.

spec_next should work, however you might need to wait 1 tick in order to see the actual change. Or you might be able to predict what the player's next observer target is. I believe it is always the next living client index and it loops around to 0 whenever it hits the highest client index and on spec_prev it's the other way around

Last edited by blaacky; 03-19-2016 at 14:54.
blaacky is offline
PartialCloning
Senior Member
Join Date: Dec 2015
Old 03-19-2016 , 17:46   Re: Hooking Spectator
Reply With Quote #4

Quote:
Originally Posted by Grey83 View Post
Try to look for the desired function in the code of this plugin
It runs a timer to check the target the player is aiming at.

Quote:
Originally Posted by blaacky View Post
If the game supports the SendProxy manager you can hook the "m_hObserverTarget" netprop change in clients.

spec_next should work, however you might need to wait 1 tick in order to see the actual change. Or you might be able to predict what the player's next observer target is. I believe it is always the next living client index and it loops around to 0 whenever it hits the highest client index and on spec_prev it's the other way around
Sendproxy is crashing the server even when I only use the provided examples in the thread's main page. But it prettymuch checks the value of the netprop on every frame and reports back when it changes.

As for spec_next / spec_prev they're not called if you're spectating on first person mode and you use your mouse buttons to change your target.
PartialCloning is offline
blaacky
Senior Member
Join Date: Oct 2012
Old 03-19-2016 , 19:56   Re: [CSGO] Hooking Spectator
Reply With Quote #5

I guess it's a CS:GO thing because it works for me in CS:S. Do you want to make it so spectators can't spectate others or something like that? If that's the case I recommend hooking SetTransmit with SDKHooks and blocking information that way. If that doesn't work I don't know :/

EDIT: Actually you can try checking for a change in the buttons parameter for IN_ATTACK under OnPlayerRunCmd. And if the player changes observertarget without changing their buttons parameter (spec_next in console) you can punish them

Last edited by blaacky; 03-19-2016 at 20:02.
blaacky is offline
Reply



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 07:28.


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