Garry's Mod Wiki

GM:PlayerShouldTakeDamage

GM:PlayerShouldTakeDamage

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 ) return ply:Team() != attacker:Team() -- that will return false if attacker and ply is on the same team. end )

Special Pages


Wikis

?

Render Time: 59ms

DB GetPage 30
Generate Html 4
SaveChanges (1) 7
Render Body 0
Render Sidebar 15