- Documentation
- Server functions
- getPedTarget
Function
getPedTarget
Returns the element a ped is aiming at (a player, an NPC or a vehicle), as reported by the player's game. Returns false when the ped is not aiming at any element.
Syntax
element getPedTarget(ped ped)Arguments
pedped- A player or an NPC.
Returns
The target element, or false.
Example
local target = getPedTarget(player)
if target and getElementType(target) == "player" then outputChatBox("Ktoś do ciebie celuje!", target) end
See also
isPedAimingChecks whether a ped is aiming a weapon (holding the right mouse button or aiming on a gamepad). The state comes from the player's game and refreshes several times per second.getPedAimTargetReturns the world point a ped is aiming at, as reported by the player's game. Returnsfalsewhen the game has not sent an aim point yet.