[DarkRP] Nocollide + TDMcars

So I recently found a bug in my server. I have TDM cars and people like to nocollide them and drive through props to get into some bases. The only way I found to disable this is to block the entity in the toolgun options tab of FPP. People are now complaining that they can not customize their cars. This is also causing a problem with admins not being able to remove the cars. I don’t want to check “admins can use toolgun on blocked entities” because they can accidently remove the doors. Any help or advice would be appreciated.

You could edit the no-collide tool to make sure the target entity isn’t a vehicle and accomplish the same goal. I’m curious whether or not if a vehicle gets no-collided by the engine ( can happen to prevent a crash when two vehicles collide with each other ), if those cars could then drive through props.

The players are individually doing it to their own cars

The only way to stop this is by doing what Ace said by adding something like a if trace.Entity:IsVehicle() then return end inside the nocollide stool’s code or you might get lucky and find a toolgun restricting addon that does what you need.

It’s in entities/weapons/gmod_tool/stools/nocollide.lua

CHANGE #1 FIND:
[lua]function TOOL:LeftClick( trace )

if ( !IsValid( trace.Entity ) ) then return end
if ( trace.Entity:IsPlayer() ) then return end[/lua]

CHANGE #1 AFTER:
[lua] if ( trace.Entity:IsPlayer() ) then return end[/lua]

CHANGE #1 ADD:
[lua] if ( trace.Entity:IsVehicle() ) then return end[/lua]

CHANGE #2 FIND:
[lua]function TOOL:RightClick( trace )

if (!trace.Entity ) then return end
if (!trace.Entity:IsValid()) then return end
if (trace.Entity:IsPlayer()) then return end[/lua]

CHANGE #2 AFTER:
[lua] if (trace.Entity:IsPlayer()) then return end[/lua]

CHANGE #2 ADD:
[lua] if (trace.Entity:IsVehicle()) then return end[/lua]

CHANGE #3 FIND:
[lua]function TOOL:Reload( trace )

if (!trace.Entity:IsValid() || trace.Entity:IsPlayer() ) then return false end[/lua]

CHANGE #3 IN LINE AFTER:
[lua] || trace.Entity:IsPlayer()[/lua]

CHANGE #3 INSERT:
[lua] || trace.Entity:IsVehicle()[/lua]

Make those three changes and you should be set.

Will do and let you know!

[editline]20th July 2013[/editline]

Alright Ace, that fixed part of the problem. When using the toolgun you can not nocollide the cars, but when using the context menu (default button “c”) you can still nocollide them

https://github.com/FPtje/DarkRP/blob/master/gamemode/server/gamemode_functions.lua#L343

You can probably add this code to the GM:CanProperty function, but I haven’t tested, or you can just disable the context option by setting the above line to false
[lua]
if (property == “collision” and ent:IsVehicle()) then
return false
end
[/lua]

actually fptje might add this if he reads this post, I could have sworn he disabled vehicles from being no collided by the tool gun but he has missed this.

This work. Thank you to everyone!