ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Server events
  3. onPedDamage

Event

onPedDamage

A ped (NPC) took damage.

Handler

addEventHandler("onPedDamage", root, function(attacker, weapon, bodypart, loss) ... end)

Parameters

attackerelement
The attacker or false.Different type in MTA:SA: float loss
weaponint
Weapon or cause.Not in MTA:SA
bodypartint
Body part.Not in MTA:SA
lossfloat
Health lost.Not in MTA:SA

Differences from MTA:SA

  • Parameters in a different colour differ from MTA:SA.

In MTA:SA

function(float loss)

Source

source is the ped.

Example

addEventHandler("onPedDamage", root, function(attacker)
    if attacker and getElementType(attacker) == "player" then
        outputChatBox("Nie bij przechodniów!", attacker)
    end
end)

See also