• How to make noclip allowed for admins.
    7 replies, posted
I'm trying to code it so only admins can noclip. I'm thinking I have to use the PlayerNoclip hook, but I'm not sure how to use it. Any help is appreciated.
[lua]local function DisableNoclip( ply ) return ply:IsAdmin() end hook.Add("PlayerNoClip", "DisableNoclip", DisableNoclip)[/lua]
[QUOTE=Hyper Iguana;35463828][lua]local function DisableNoclip( ply ) return ply:IsAdmin() end hook.Add("PlayerNoClip", "DisableNoclip", DisableNoclip)[/lua][/QUOTE] I'd figure it would be that easy. Thanks a lot man, I really appreciate it. [editline]7th April 2012[/editline] [QUOTE=Hyper Iguana;35463828][lua]local function DisableNoclip( ply ) return ply:IsAdmin() end hook.Add("PlayerNoClip", "DisableNoclip", DisableNoclip)[/lua][/QUOTE] How would I also code it so that when non-admins try to noclip, a message shows in their chat box< "You must be admin in order to noclip?"
[lua] local function DisableNoclip( ply ) if( IsValid(ply) and ply:IsPlayer() )then if( ply:IsAdmin() )then return true; else ply:ChatPrint("You must be admin in order to noclip?"); return false; end end end hook.Add("PlayerNoClip", "DisableNoclip", DisableNoclip) [/lua] Although you might want to tinker with returning false for that hook as if you are using another admin mod, it might use another method for determining if someone is an admin.
[QUOTE=Capatcha;35471566][lua] local function DisableNoclip( ply ) if( IsValid(ply) and ply:IsPlayer() )then if( ply:IsAdmin() )then return true; else ply:ChatPrint("You must be admin in order to noclip?"); return false; end end end hook.Add("PlayerNoClip", "DisableNoclip", DisableNoclip) [/lua] Although you might want to tinker with returning false for that hook as if you are using another admin mod, it might use another method for determining if someone is an admin.[/QUOTE] Thanks man, you're awesome.
Nvm
edit: nvm... I was looking for rust xd
Why aren't you using ulx or something, it would save you a lot of effort :/
Sorry, you need to Log In to post a reply to this thread.