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

Function

getPedAttackTarget

ServerPedsTrilogy Hub only

Returns the element an NPC is currently attacking (set with setPedAttackTarget or picked by an aggressive NPC after being hurt). Returns false when the NPC is not fighting.

Syntax

element getPedAttackTarget(ped ped)

Arguments

pedped
The NPC.

Returns

The attack target, or false.

Example

local target = getPedAttackTarget(ped)
if target then outputChatBox("NPC atakuje " .. getElementType(target)) end

See also