> For the complete documentation index, see [llms.txt](https://builderx.rlib.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://builderx.rlib.io/developers/hooks/builderx_pl_ondamage.md).

# builderx.pl.ondamage

🟥 𝗦𝗘𝗥𝗩𝗘𝗥

`builderx.pl.ondamage(` [**ᵖˡᵃʸᵉʳ**](https://wiki.facepunch.com/gmod/Player) attacker,   [**ᵖˡᵃʸᵉʳ**](https://wiki.facepunch.com/gmod/Player) victim,   [**ⁿᵘᵐᵇᵉʳ**](https://wiki.facepunch.com/gmod/number) damage`)`

## ▸ Parameters

&#x20;     ***`ply`**`    ``attacker`*\
&#x20;                         player object (player doing damage)

&#x20;     ***`ply`**`    ``victim`*\
&#x20;                         player object (player injured)

&#x20;     ***`int`**`    ``damage`*\
&#x20;                         returns total damage attacker has done in build mode

## ▸ Description

&#x20;      Runs when player in build mode deals damage to another player (or kills).

&#x20;      Will not run if block damage settings enabled because there won't be damage to report.

## ▸ Example

{% tabs %}
{% tab title="Example 1" %}

```lua
local function your_hook( attacker, victim, damage )

    // your custom hook function here

end
hook.Add( 'builderx.pl.ondamage', 'your_hook_id', your_hook )
```

{% endtab %}

{% tab title="Example 2" %}

```lua
hook.Add( 'builderx.pl.ondamage', 'your_hook_id', function( attacker, victim, damage )

    // your custom hook function here

end )
```

{% endtab %}

{% tab title="Example 3" %}

```lua
local function your_hook( attacker, victim, damage )
    print( attacker )
    print( victim )
    print( damage )
end
hook.Add( 'builderx.pl.ondamage', 'your_hook_id', your_hook )

-- print returns --

Player [1][player_name]
Player [3][Bot03]
19
```

{% endtab %}

{% tab title="Example 4" %}

```lua
local function your_hook( attacker, victim, damage )

    // your custom hook function here

end
rhook.new.rlib( 'builderx_mode_ondamage', your_hook )
```

{% endtab %}
{% endtabs %}
