GetPlayerTargetPlayer
Description:
Function GetPlayerTargetPlayer check who a player is aiming at.
Function GetPlayerTargetPlayer was added in 0.3d and will not work in earlier versions! |
|
Parameters:
(playerid)
int | playerid | The ID of the player to get the target of. |
Return Values:
The ID of the target player, or INVALID_PLAYER_ID if none.
Examples:
public OnPlayerUpdate(playerid) { // Store the ID new targetplayer = GetPlayerTargetPlayer(playerid); if(GetPlayerTeam(targetplayer) == GetPlayerTeam(playerid) && targetplayer != INVALID_PLAYER_ID) { GameTextForPlayer(playerid, "~R~do not shoot at team-mates!", 5000, 3); } }
Related Functions
The following functions may be useful, as they are related to this function in one way or another.
- GetPlayerTargetActor: Gets the ID of an actor which is aimed by certain player.
- GetPlayerCameraFrontVector: Get the player's camera front vector.
Related Callbacks
The following callbacks might be useful as well, as they are related to this callback in one way or another.
- OnPlayerGiveDamage: This callback is called when a player gives damage.
- OnPlayerTakeDamage: This callback is called when a player takes damage.