Page 1 of 1
Issue with HoldingPlayerInGrabID
Posted: Thu Jul 25, 2019 12:33 am
by Qunas
How can I use HoldingPlayerInGrabID, if it is not even the same as UserID or UserIdentifier. What I want to do, is to get IPlayer object, that other player is holding and I can't figure out how. To me HoldingPlayerInGrabID, CaughtByPlayerInGrabID etc. seem to be some random numbers, that I can't use.
Please, help me out with this.
Here is screenshot of some dubugging

Re: Issue with HoldingPlayerInGrabID
Posted: Thu Jul 25, 2019 9:47 am
by Gurt
HoldingPlayerInGrabID refers to the player ID - not the User ID. IUser is not to be confused with IPlayer.
Use Game.GetPlayer(IPlayer.HoldingPlayerInGrabID) to get the player instance.
Bots spawned in a map for example have no IUser bound to them.
Code: Select all
IPlayer grabbedPlayer = Game.GetPlayer(IPlayer.HoldingPlayerInGrabID);
if (grabbedPlayer != null) {
// grabbedPlayer.UniqueID
}
IPlayer.HoldingPlayerInGrabID refers to the IPlayer.UniqueID which is inherited from IObject.
(Note: IUser.UserID is the same as IUser.UserIdentifier)
Re: Issue with HoldingPlayerInGrabID
Posted: Thu Jul 25, 2019 2:47 pm
by Qunas
Thank you! I shoud've searched better for this in documentetion.
Gurt wrote: ↑Thu Jul 25, 2019 9:47 am
(Note: IUser.UserID is the same as IUser.UserIdentifier)
Yea, I see that
And now I see how IDs can be used with Game.GetPlayer() or Game.GetActiveUser()
Thx with that.