Entity.GetGroundEntity

From GMod Wiki

Revision as of 20:20, 24 July 2010 by Willox303 (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Function
Syntax Entity:GetGroundEntity( )
Description:
Returns the entity that the entity is resting on top of. Make sure to use Entity:IsValid on the returned entity. If the returned entity isn't valid, the original entity wasn't sitting on anything.
Returns: Entity
In Object: Entity
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Entity.GetGroundEntity]Entity.GetGroundEntity [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionIf a player falls on the world, kill them
Used onNewerShared.png
Code
function TheFloorIsLava( ply )
	local ent = ply:GetGroundEntity()
 
	if ent:IsWorld() then
		ply:Kill()
		ply:ChatPrint( "The floor is lava!" )
	end
end
 
hook.Add( "OnPlayerHitGround", "TheFloorIsLava", TheFloorIsLava)
OutputKills a player if the object they fall on is the world.


Additional Notes

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox