Toolgun permissions

Hey people !

I have a tow trucker job on my server, and unfortunately I find all the buy/nonbuy able ones shitty and buggy. So I just got a tow truckcar that works and will then allow people to use rope on it instead. However I need help with this cause I can’t allow everyone to use rope, this would turn out badly as you prob. would imagine.

I ask for help to make a code that would only allow certain jobs to be able to target cars with the tool Rope. I have FPP but I can’t seem to make it work for it.

Thanks in advance if anyone can help !

Regards
Holmenlund :slight_smile:

Bumping just 1 time, hoping someone has the answer :slight_smile:

Create a hook for

SANDBOX/CanTool, check if the player’s team is the tow trucker job, if the tool is rope, and if the trace entity is valid and a vehicle. Then return true.

hook.Add

Player:Team

Entity:IsVehicle

Or, because spoonfeeding makes me feel special:



hook.Add( 'CanTool', 'DisableCarRoping', function( ply, tr, tool )
	if tool == "rope" and IsValid( tr.Entity ) and tr.Entity:IsVehicle() then
		return false
	end
end )


That completely stops all players from putting rope on vehicles, no matter the class (you could easily modify this though so only tow truckers were able to rope stuff)