ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Server functions
  3. getPedTargetCollision

Function

getPedTargetCollision

ServerPedsIdentical to MTA:SA

Traces a ped's line of fire (from getPedTargetStart to getPedTargetEnd) and returns the first point where it hits a building, vehicle, ped or object. Returns false when nothing is in the way.

Syntax

float, float, float getPedTargetCollision(ped ped)

Arguments

pedped
A player or an NPC.

Returns

The hit's x, y, z, or false.

Example

local hx, hy, hz = getPedTargetCollision(player)
if hx then createExplosion(hx, hy, hz, 12) end

See also