Raised This Month: $12 Target: $400
 3% 

Get client ID of player I'm spectating?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Remy Lebeau
Senior Member
Join Date: Dec 2009
Location: Sydney, Australia
Old 09-21-2013 , 04:04   Get client ID of player I'm spectating?
Reply With Quote #1

I've got a HUD for my warsource player. I'd love to use it to show the race info for any player that I'm spectating (while dead or in spec mode).

Is there any way to get the client or user ID of a player that I'm spectating in first person mode?
Remy Lebeau is offline
necavi
Veteran Member
Join Date: Sep 2010
Old 09-21-2013 , 04:09   Re: Get client ID of player I'm spectating?
Reply With Quote #2

I believe that there is a netprop to the effect of m_iSpectateTarget - check SMLib.
necavi is offline
Remy Lebeau
Senior Member
Join Date: Dec 2009
Location: Sydney, Australia
Old 09-21-2013 , 04:32   Re: Get client ID of player I'm spectating?
Reply With Quote #3

Client_GetObserverTarget(client);

Thanks Necavi Shoulda just shoutboxed it to ya ;)
Remy Lebeau is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 09-21-2013 , 07:40   Re: Get client ID of player I'm spectating?
Reply With Quote #4

So another wrapper for native sm call? Okay.
__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.
friagram is offline
Remy Lebeau
Senior Member
Join Date: Dec 2009
Location: Sydney, Australia
Old 09-21-2013 , 17:45   Re: Get client ID of player I'm spectating?
Reply With Quote #5

Quote:
Originally Posted by friagram View Post
So another wrapper for native sm call? Okay.
The only native SM call I can find is native bool:IsClientObserver(client);

I haven't had a look at how smlib implements it, but I'm not going to reinvent the wheel if it's already there!
Remy Lebeau is offline
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 09-21-2013 , 17:51   Re: Get client ID of player I'm spectating?
Reply With Quote #6

PHP Code:
GetEntPropEnt(clientProp_Send"m_hObserverTarget"); 
That's what Client_GetObserverTarget(client) returns... Look here for more observer stuff SMLib offers: https://github.com/bcserv/smlib/blob...ients.inc#L229
__________________
View my Plugins | Donate

Last edited by TnTSCS; 09-21-2013 at 17:54.
TnTSCS is offline
ddhoward
Veteran Member
Join Date: May 2012
Location: California
Old 09-21-2013 , 23:16   Re: Get client ID of player I'm spectating?
Reply With Quote #7

"Client_GetObserverTarget" is a lot easier to remember than "GetEntPropEnt(client, Prop_Send, "m_hObserverTarget");". Although I'd much rather have something like "GetSpecTarget."
__________________

Last edited by ddhoward; 09-21-2013 at 23:32.
ddhoward is offline
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 05:16.


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