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

Function

getPedTarget

ServerPedsIdentical to MTA:SA

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