Garry's Mod Wiki

Garry's Mod Wiki

  boolean GM:PlayerShouldTakeDamage( Player ply, Entity attacker )

Description

Returns true if the player should take damage from the given attacker.

Applying damage from this hook to the player taking damage will lead to infinite loop/crash.

Arguments

1 Player ply
The player
2 Entity attacker
The attacker

Returns

1 boolean
Allow damage

Example

Block damages between two players on the same team.

hook.Add( "PlayerShouldTakeDamage", "AntiTeamkill", function( ply, attacker ) if ply:Team() == attacker:Team() then return false -- that will block damage if attacker and ply is on the same team. end end )

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated four times a day. Edits and history are not available.

Last Parsed: Loading...