Gamemode.GetFallDamage

From GMod Wiki

Revision as of 00:31, 5 December 2011 by Land (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Event Hook
Hook NameGetFallDamage
SyntaxGM:GetFallDamage( Player player, Number FallSpeed )
DescriptionCalled when a player takes fall damage
ReturnsHow much damage the player should take
Lua StateNewerServer.png
BBCode[b][url=wiki.garrysmod.com/?title=Gamemode.GetFallDamage]Gamemode.GetFallDamage [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]


Examples

DescriptionActual default Source engine calculation.
Used onNewerServer.png
Code
function GM:GetFallDamage( ply, speed )
	if GetConVarNumber("mp_falldamage") == 1 then
		speed = speed - 580
		return speed * (100/(1024-580))
	end
	return 10
end
OutputCorrect fall damage when mp_falldamage = 1.
DescriptionInstantly kills you when hitting the ground, even when you fell from a very small distance.
Used onNewerServer.png
Code
function GM:GetFallDamage( ply, speed )
 
	return ply:Health()
 
end
OutputInstant death when hitting the ground.
DescriptionActs almost like realistic fall damage.
Used onNewerServer.png
Code
function GM:GetFallDamage( ply, speed )
 
	return ( speed / 8 )
 
end
OutputFall damage becomes fall speed divided by 8.


Additional Notes


Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox