If you're reading this right now, I expect you to know something about how lua and Gmod works together. I'm recoding a fading door addon with wire support, on a DarkRP Gmod server. I'm having problems with restricting the wire support to a specific DarkRP job. To make it easy on myself, i started off with trying to restrict it to the TEAM_GANG job. This is the bit of code I changed.
local function customCheck(pl)
return table.HasValue({TEAM_GANG}, pl:Team())
end
local function dooEet(pl, Ent, stuff)
if Ent.isFadingDoor then
if Ent.fadeDeactivate then Ent:fadeDeactivate() end
RemoveKeys(Ent)
else
Ent.isFadingDoor = true
Ent.fadeActivate = fadeActivate
Ent.fadeDeactivate = fadeDeactivate
Ent.fadeToggleActive = fadeToggleActive
Ent:CallOnRemove("Fading Doors", RemoveKeys)
if WireLib and customCheck(pl) then
doWireInputs(Ent)
doWireOutputs(Ent)
Ent.fadeTriggerInput = Ent.fadeTriggerInput or Ent.TriggerInput
Ent.TriggerInput = TriggerInput
if !Ent.IsWire then
if !Ent.fadePreEntityCopy and Ent.PreEntityCopy then Ent.fadePreEntityCopy = Ent.PreEntityCopy end
Ent.PreEntityCopy = PreEntityCopy
if !Ent.fadePostEntityPaste and Ent.PreEntityCopy then Ent.fadePostEntityPaste = Ent.PostEntityPaste end
Ent.PostEntityPaste = PostEntityPaste
end
end
end
Ent.fadeUpNum = numpad.OnUp(pl, stuff.key, "Fading Door onUp", Ent)
Ent.fadeDownNum = numpad.OnDown(pl, stuff.key, "Fading Door onDown", Ent)
Ent.fadeToggle = stuff.toggle
Ent.fadeReversed = stuff.reversed
Ent.fadeKey = stuff.key
Ent.fadeCanDisableMotion = stuff.CanDisableMotion
Ent.fadeDoorMaterial = stuff.DoorMaterial
Ent.fadeDoorOpenSound = stuff.DoorOpenSound
Ent.fadeDoorLoopSound = stuff.DoorLoopSound
Ent.fadeDoorCloseSound = stuff.DoorCloseSound
if stuff.reversed then Ent:fadeActivate() end
duplicator.StoreEntityModifier(Ent, "Fading Door", stuff)
return true
end
I only added the customCheck function
local function customCheck(pl)
return table.HasValue({TEAM_GANG}, pl:Team())
end
And checked for the team here
if WireLib and customCheck(pl) then
This removed access from all jobs and didn't give access to the TEAM_GANG job either. I do not see why this is not working and I can't find another way to do this, so I am kinda stuck.
If you want the whole code, I have it pasted into a pastebin. Link: https://pastebin.com/UrkyK8e2