Gamemode.PlayerHurt

From GMod Wiki

Revision as of 15:16, 17 February 2011 by BlackVoid (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Event Hook
Hook NamePlayerHurt
SyntaxGM:PlayerHurt( Player victim, Entity Attacker, Number Health Remaining, Number Damage Dealt )
DescriptionCalled when a player has taken damage.
ReturnsNil
Lua StateNewerServer.png
BBCode[b][url=wiki.garrysmod.com/?title=Gamemode.PlayerHurt]Gamemode.PlayerHurt [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]


Example

DescriptionPrints in the chat area when a player takes damage.
Used onNewerServer.png
Code
 
 /*--------------------------------------------------------- 
    Name: gamemode:PlayerHurt( ) 
    Desc: Called when a player is hurt. If the attacker was 
 		  a player then attacker will become a Player instead 
 		  of an Entity. 		  
 ---------------------------------------------------------*/ 
 function GM:PlayerHurt( player, attacker ) 
     player:ChatPrint( "You are being attacked by: " .. attacker:GetName() )
end 
 
OutputN/A


Additional Notes

See Also


Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox