Perp physgunnable car script

Can anyone make a script that will allow
Me as a owner to physgun players cars right now you can only physgun players



1. rcon_password *****

2. rcon lua_run function _R.Player:CanManipulateEnt(DOES_IT_MATTER) return true end


And you will can be able to pick up NPC/Players/Vehicles/Doors.

Is there anyway to set it so it only Picks uP cars

Use an if statement.

[lua] if ents.Class(DOES_IT_MATTER) == “CarClass thingy” then return true end return false [/LUA]

should probably return if self:IsSuperAdmin too

In PERP/gamemode/sv_hooks.lua

find the function PLAYER:CanManipulateEnt ( Target ) function.

Should look like this:
[lua]function PLAYER:CanManipulateEnt ( Target )
if !self or !self:IsValid() or !self:IsPlayer() then return false; end
if !Target or !Target:IsValid() then return false; end

if self:IsAdmin() and Target:GetClass() == 'prop_vehicle_prisoner_pod' then return true; end
if self:IsAdmin() and Target:GetClass() == 'ent_prop_item' then return true; end
if self:IsAdmin() and Target:GetClass() == 'prop_clock' then return true; end
if self:IsAdmin() and Target:GetClass() == 'prop_thermo' then return true; end
if self:IsAdmin() and Target:GetClass() == 'prop_lamp' then return true; end
if self:IsAdmin() and Target:GetClass() == 'prop_case_beer' then return true; end
if self:IsAdmin() and Target:GetClass() == 'prop_metal_detector' then return true; end

if self:IsVIP() and Target:GetClass() == 'prop_lamp_spot' then return true; end[/lua]

Just add after the If self:IsAdmin() this
[lua]if self:IsOwner() and Target:GetClass() == ‘prop_vehicle_jeep’ then return true; end[/lua]

Thanks :slight_smile:

Does Player:IsOwner( ) exist? Because it could mean his code is completely useless.

No, Only Player:IsSuperAdmin() and Player:IsAdmin()

If you have assmod, it does.

But then players can’t pick up their own cars, like the OP wanted.

Edit i have added


if self:IsAdmin() and Target:GetClass() == 'prop_vehicle_jeep' then return true; end

to allow admins to pick them up and it works thanks guys.

I really don’t get what he wants.