|
|
#1 |
|
Guest
Posts: n/a
|
How to get info from another specific player at any time?
In my mod, players will select a target and shoot at it instead of aiming and shooting. I need to be able to save what who/what this target is and be able to draw info about the target at anytime. What is the best way to go about this? I thought about saving the target as a whole copy but I think that would only save the data at that moment and would not update. I think ehandle might be the right way to go, but I don't know how those work at all really. Any help is greatly appreciated.
|
|
|
|
#2 |
![]() Join Date: May 2008
Reputation: 169
Posts: 5,362
|
I think the UserID would be a good way to go.
But to be honest, I don't know if that's the best one. |
|
|
|
|
|
#3 |
![]() Join Date: Jun 2004
Reputation: 489
Posts: 17,360
|
Code:
CBasePlayer* m_pCurTarget = MyGetTargetFunc() You could use an EHandle too, but that makes things a bit more complex without helping you in this situation. |
|
|
|
|
|
#4 |
![]() Join Date: Mar 2008
Reputation: 46
Posts: 646
|
ehandles are not complex varsity, and they're safe.
|
|
|
|
|
|
#5 |
|
Guest
Posts: n/a
|
I've read about EHANDLES on the wiki site, but I'm still not entirely sure how to use them.
The way a target is selected is by the player "shooting" but if no target is selected it will attempt to select whatever is under the crosshair via a traceline. Would I then just do something like EHANDLE pTarget = tr.m_pent; (once it is determined the object hit is another player ofcourse) And to access stuff would just be pTarget->GetPositionFunction() and it would be able to access that player's current position so I can use it for other things? |
|
|
|
#6 |
![]() Join Date: Mar 2008
Reputation: 46
Posts: 646
|
Yeah, and you can cast the ehandle to an actual player class to access stuff other than just cbaseentity.
ie: ToSDKPlayer(m_Ehandle.Get())->SomePlayerOnlyFunction(); |
|
|
|
|
|
#7 |
|
Guest
Posts: n/a
|
OK, great this helps a lot.
|
|
![]() |
|
||||||
| Thread Tools | |
| Display Modes | |
|
|