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

Function

setPedAggressive

ServerPedsTrilogy Hub only

Turns an NPC's aggression on or off. When an aggressive NPC gets hurt by someone (a player or another ped), it starts attacking the attacker on its own, as if a script called setPedAttackTarget. A non-aggressive NPC (the default) takes damage and does not react. Works only for NPCs (ped), not for players.

Syntax

bool setPedAggressive(ped ped, bool on)

Arguments

pedped
An NPC (a ped element).
onbool
true = aggressive, false = passive.

Returns

true on success.

Example

local bouncer = createPed(164, 1833.5, -1682.4, 13.5, 90)
setPedAggressive(bouncer, true)

See also