General > Developers Corner

How to make it so players can only ulx noclip if they are a certain job?

(1/1)

Taylorr<3/only.fans:
First, ignore my name its a joke. So I have ulx usergroups for tmods, moderators, and modplus and I want to know how to only allow them to (ulx) noclip themselves when they are playing as the job I made called "Moderator on Duty". Basically I want my staff members to also be able to roleplay but I dont wanna have to risk them abusing their noclip powers during rp. I don't want them to be able to toggle noclip on others just themselves. Keep in mind I don't mean the Sandbox noclip, I mean the ulx noclip. I tried the sandbox one and I had too many problems with it. Here is the code I tried with the sbox noclip:

adminJobs = {["TEAM_MODERATOR"] = true}
hook.Add( "PlayerNoClip", "noclipThing", function( ply )return ply:Team() == TEAM_MODERATOR
end )
hook.Add("PlayerShouldTakeDamage", "godmodeAdmin", function(ply, ent)returnnot (ply:Team() == TEAM_MODERATOR)
end)

Taylorr<3/only.fans:
That script I added also has godmode with it

An Error Has Occurred!

array_keys(): Argument #1 ($array) must be of type array, null given

[0] Board index

Go to full version