Gamemode.PlayerNoClip

From GMod Wiki

Jump to: navigation, search
Event Hook
Hook NamePlayerNoClip
SyntaxGM:PlayerNoClip( Player ply )
DescriptionCalled when a player tries to switch noclip mode
ReturnsBoolean
Lua StateNewerShared.png
BBCode[b][url=wiki.garrysmod.com/?title=Gamemode.PlayerNoClip]Gamemode.PlayerNoClip [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]


Examples

DescriptionDisables modifying noclip state for everybody but admins.
Used onNewerShared.png
Code
local function DisableNoclip( objPl )
	return objPl:IsAdmin()
end
hook.Add("PlayerNoClip", "DisableNoclip", DisableNoclip)
OutputN/A
DescriptionShows a message when any player tries to go into noclip.
Used onNewerShared.png
Code
function GM:PlayerNoClip( pl )
 
	local oldstate = pl:GetMoveType()
 
	if oldstate != MOVETYPE_NOCLIP then
 
		if CLIENT and IsFirstTimePredicted() then
 
			pl:PrintMessage(HUD_PRINTTALK, "You can't turn into a ghost!")
 
		end
 
		return false
 
	end
 
	return true
 
end
OutputN/A


Additional Notes

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox