Pivity

Physgun props DarkRP

Last read Never
#1

Hello I have set all my ulx ranks properly but there is one thing that is not working as it should. My admins can physgun my props / higher ranked people's props, I have tried many things in Falco's Prop Protection and ULX Perms nothing seemed to work.

But there is one thing that might cause that to happen, I have a script that allows certain ranks to physgun their vehicles. Anyways here is the code:

local function NoPhysgunCars(ply,ent)

if !ply:IsUserGroup("owner") then
if !ply:IsUserGroup("superadmin") then
if !ply:IsUserGroup("admin") then
if !ply:IsUserGroup("dadmin") then
if !ply:IsUserGroup("dsuperadmin") then

if ent:IsVehicle() then
return false
end
end
end
end
end
end
end
hook.Add("PhysgunPickup", "NoPhysgunCars", NoPhysgunCars)

Any help is appreciated! Thank you.

Funny x 1Dumb x 1
#2

pretty sure instead of spamming if you can use tables

Optimistic x 2
#3
if table.HasValue({"owner", "superadmin", "admin", "dadmin", "dsuperadmin"}, ply:GetUserGroup) then
-- code

end

Winner x 1
#4

`[ERROR] lua/autorun/physgunvehicles.lua:3: function arguments expected near ')'

  1. unknown - lua/autorun/physgunvehicles.lua:0`
local function NoPhysgunCars(ply,ent)

if table.HasValue({"owner", "superadmin", "admin", "dadmin", "dsuperadmin"}, ply:GetUserGroup) then


if ent:IsVehicle() then
return false
end
end
end

hook.Add("PhysgunPickup", "NoPhysgunCars", NoPhysgunCars)

#5

You missed the argument brackets after GetUserGroup, It's meant to be ply:GetUserGroup().

#6
ByAuthor.at 19th of February 2017 21:47:15

if table.HasValue({"owner", "superadmin", "admin", "dadmin", "dsuperadmin"}, ply:GetUserGroup) then -- code endGood answer and good way to accomplish this but a more efficient way would be to store the user groups names at a key and make the value true

Read here: https://wiki.garrysmod.com/page/Tables:_Bad_Habits

#7

I have fixed it using this

local function NoPhysgunCars(ply,ent)

if table.HasValue({"user", "noaccess", "moderator", "vip", "vip+", "vip_moderator", "vip+_moderator", "admin", "dadmin", "dmoderator", "dsuperadmin", "vip_superadmin", "vip+_superadmin", "vip++_superadmin", "vip_admin", "vip+_admin", "vip++_admin"}, ply:GetUserGroup()) then



if ent:IsVehicle() then
return false
end
end
end
hook.Add("PhysgunPickup", "NoPhysgunCars", NoPhysgunCars)

but I had to enter the ranks that aren't allowed to physgun vehicles, and the ones that are allowed to physgun cars are allowed to pickup each others props.

I have also tried this and it did not work:

if (ent:GetClass():lower() == "prop_vehicle_jeep") then return false

Thanks in advance

Users viewing this thread
Nobody