- Documentation
- Server functions
- getPedAimTarget
Function
getPedAimTarget
Returns the world point a ped is aiming at, as reported by the player's game. Returns false when the game has not sent an aim point yet.
Syntax
float, float, float getPedAimTarget(ped ped)Arguments
pedped- A player or an NPC.
Returns
The target's x, y, z, or false.
Example
local x, y, z = getPedAimTarget(player)
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.getPedTargetEndReturns the end point of a ped's line of fire: the target set withsetPedAimTarget, or when none, a point 100 m ahead of the ped in the direction it faces.setPedAimTargetStores the point a ped should aim at. The value is for scripts:getPedTargetEnd(and indirectlygetPedTargetCollision) returns it, but the game itself does not turn the ped's weapon that way.