- Documentation
- Server functions
- setPedAimTarget
Function
setPedAimTarget
Stores the point a ped should aim at. The value is for scripts: getPedTargetEnd (and indirectly getPedTargetCollision) returns it, but the game itself does not turn the ped's weapon that way.
Syntax
bool setPedAimTarget(ped ped, float x, float y, float z)Arguments
pedped- A player or an NPC.
xfloat- Target X coordinate (or a
Vector3). yfloat- Target Y coordinate.
zfloat- Target Z height.
Returns
true on success.
Example
setPedAimTarget(sniper, 2495, -1687, 14)
See also
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.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.