• Disabling Noclip if not correct job
    1 replies, posted
Hi all, On my server people who are in the group "admin" can use noclip when not on the correct job "Admin on Duty". I have tried to disable it but it does not work and admins can still use noclip on other jobs. Here's the code I made: [CODE] hook.Add( "PlayerNoClip", "RestrictNoclip", function(ply) if ply:GetUserGroup() == "superadmin" or ply:GetUserGroup() == "community" return true end if !team.GetName( ply:Team() ) == "Admin On Duty" then return false end end) [/CODE] Thanks, Computer600
In your post you say the job is [b]Admin on Duty[/b] but in your code it says [b]Admin On Duty[/b]. Lua is case sensitive, so you need to make sure that the case is correct. Alternatively, you can just use [b]string.lower[/b], which is what I did because I don't know which version of the job's name is correct. You shouldn't use string.lower if you know the exact case of the string. [lua]hook.Add( "PlayerNoClip", "RestrictNoclip", function(ply) return string.lower(team.GetName(ply:Team())) == "admin on duty" or ply:IsUserGroup("superadmin") or ply:IsUserGroup("community") end)[/lua] If you're going to use string.lower then you need to make the string to check for all lowercase.
Sorry, you need to Log In to post a reply to this thread.