ULX

Author Topic: Can someone help me change this code?  (Read 1382 times)

0 Members and 1 Guest are viewing this topic.

Offline MangeGamerZ

  • Newbie
  • *
  • Posts: 4
  • Karma: -3
Can someone help me change this code?
« on: December 31, 2017, 01:41:14 AM »
Hello I'm using someones script that blocks People from picking up Vehicle but i want it to use ULX Ranks can someone help me Change it??


Code: [Select]
function limitVicPickup(ply, ent)
     if(ent:IsVehicle()) then -- Checks if the entity being picked up is a vehicle
          if not (ply:IsSuperAdmin()) then -- if the player picking the entity up isn't superadmin
               return false -- Don't let the player pick it up
          end
     end
end
hook.Add("PhysgunPickup", "limitVehiclePickup", limitVicPickup) -- Registers the hook so the function gets called

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Can someone help me change this code?
« Reply #1 on: December 31, 2017, 08:47:01 AM »
Straight Gmod LUA
Player:GetUserGroup
or slightly better due to less writing needed
Player:IsUserGroup

or even super-duper MOAR better to prevent having to write 5 "or" statements looking for each group specifically you want checked that already inherit each other, our very own ULib group check
Player:CheckGroup
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline [?] The Last Centurion

  • Newbie
  • *
  • Posts: 23
  • Karma: 2
Re: Can someone help me change this code?
« Reply #2 on: January 01, 2018, 04:32:09 PM »
Using table.HasValue and then checking the User's group using that table, like how DarkRP customChecks work(Multiple groups, Example 2) would probably work. I'm new to LUA but I try.