Author Topic: How to make it so players can only ulx noclip if they are a certain job?  (Read 297 times)

0 Members and 1 Guest are viewing this topic.

Offline Taylorr<3/only.fans

  • Newbie
  • *
  • Posts: 6
  • Karma: 0
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)

« Last Edit: July 04, 2020, 09:24:34 AM by Taylorr<3/only.fans »

Offline Taylorr<3/only.fans

  • Newbie
  • *
  • Posts: 6
  • Karma: 0
That script I added also has godmode with it

Online $VDFOREVER

  • Newbie
  • *
  • Posts: 9
  • Karma: 0
Code: Lua
  1. function playershouldtakedamage( victim )
  2.         if victim:Team() == TEAM_ADMIN or victim:Team() == TEAM_MODERATR  then
  3.                 return false -- do not damage the player(if it's necessary)
  4.         end
  5. end
  6. hook.Add( "PlayerShouldTakeDamage", "staffgod", playershouldtakedamage)
  7.  
  8. hook.Add("PlayerNoClip", "MoDNoClip", function(ply)
  9.    if IsValid(ply) and (ply:Team() == TEAM_ADMIN  or ply:Team() == TEAM_MODERATR) then
  10.        return true
  11.    end
  12. end)
  13.  
I hope I understood correctly (addons\darkrpmodification\lua\darkrp_modules\staffgod\staff.lua)
« Last Edit: July 09, 2020, 08:56:25 AM by $VDFOREVER »