• Print

Author Topic: [Help] Staff On Duty Restriction  (Read 5796 times)

0 Members and 1 Guest are viewing this topic.

Offline Ganged

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
[Help] Staff On Duty Restriction
« on: July 31, 2017, 09:19:08 am »
Hello everyone, I have a problem. I have recently searched for a script that doesn't let any staff member to no-clip out of duty.

I have found a script and it worked however, it causes the rest of the ULX commands to not work.

My versions are:
ULX v3.70 and ULib v2.60 (I had to restart my server without the code to actually be able to find out the version)

I don't get any LUA errors, or if there was to be one it would be unhandled. ( Unhandled Lua Refresh: [NAME:autorun/server/nodie.lua] [TYPE:] )

The Script:
Code: Lua
  1. // Makes admins not noclip out of duty. COMMAND: Ulx No-clip
  2. hook.Add("ULibCommandCalled", "PreventNoclip", function(ply, cmd, args)
  3.         if ( cmd == "ulx noclip" && ply:Team() == TEAM_STAFF ) then
  4.                 return true
  5.         else
  6.                 return false
  7.         end
  8. end)

I really appreciate your help.
Thanks.

Offline jay209015

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 934
  • Karma: 62
    • Dev-Solutions
Re: [Help] Staff On Duty Restriction
« Reply #1 on: July 31, 2017, 01:53:19 pm »
Simple logic error.

Code: Lua
  1. if ( cmd == "ulx noclip" && ply:Team() == TEAM_STAFF ) then
  2.                 return true
  3.         else
  4.                 return false
  5.         end
  6.  

When you return, you're not allowing other commands to see the event.
Drop the `else return false`
« Last Edit: August 01, 2017, 08:22:59 am by jay209015 »
An error only becomes a mistake when you refuse to correct it. --JFK

"And thus the downfall of the great ULX dynasty was wrought not by another dynasty, but the slow and steady deterioration of the leaders themselves, followed by the deprecation of the great knowledge they possessed." -Gmod, Chapter 28, verse 34 -- Stickly

Offline monkeymacman

  • Newbie
  • *
  • Posts: 44
  • Karma: 13
Re: [Help] Staff On Duty Restriction
« Reply #2 on: August 05, 2017, 11:38:17 am »

Simple logic error.

Code: Lua
  1. if ( cmd == "ulx noclip" && ply:Team() == TEAM_STAFF ) then
  2.                 return true
  3.         else
  4.                 return false
  5.         end
  6.  

When you return, you're not allowing other commands to see the event.
Drop the `else return false`
then wouldn't it still run no matter what? It should be
Code: Lua
  1. if cmd == "ulx noclip" && not ply:Team() == TEAM_STAFF then
  2.         return false
  3. end
  4.  

  • Print