Ulysses
General => Developers Corner => Topic started by: MangeGamerZ 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??
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
-
Straight Gmod LUA
(http://wiki.garrysmod.com/favicon.ico) Player:GetUserGroup (http://wiki.garrysmod.com/page/Player/GetUserGroup)
or slightly better due to less writing needed
(http://wiki.garrysmod.com/favicon.ico) Player:IsUserGroup (http://wiki.garrysmod.com/page/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
(http://ulyssesmod.net/favicon.ico)Player:CheckGroup (http://ulyssesmod.net/docs/files/lua/ulib/shared/sh_ucl-lua.html#Player:CheckGroup)
-
Using table.HasValue (https://wiki.garrysmod.com/page/table/HasValue) and then checking the User's group using that table, like how DarkRP customChecks work (http://wiki.darkrp.com/index.php/Donator_Job_configuration#Customcheck_with_multiple_groups)(Multiple groups, Example 2) would probably work. I'm new to LUA but I try.