Use on Cars

How would i go about this:
when a player press’s use on a car the cars use function wont be called. Instead my own custom use function gets called.

So far i’ve tried:
PlayerUse
Ent:OnUse
Ent:use

to try and overwrite the cars functions for use.

What im trying to do is make it so that with VU mod when you use the car if thier isnt a driver then your set as driver. Otherwise it will find an empty passanger seat and stick you in that.

Here is one of the things iver tryed plz note its in the format of a wolf admin plugin.



function Plugin:PlayerUse(ply,ent)
		if not ent:IsVehicle() then return true end
		Msg("
 Used Car")
		if not ent:GetDriver() then 
			ply:EnterVehicle(ent)
			Msg("
 Car Driver")
			return false
		end
		if not ent.VehicleTable then return end
		if not ent.VehicleTable.Passengers then return end
		for key,value in pairs(ent.VehicleTable.Passengers) do
			if value.Ent then
				if not value.Ent:GetDriver() then
					ply:EnterVehicle(value.Ent)
					Msg("
 Car Passanger")
					return false
				end
			end
		end
		return true
end


Is ran before player enters vehicle, passes both player and vehicle.

You need to hook your function for it to do anything.
**[Hook.Add

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=Hook.Add)**

As i said thats in the form of a wolf admin plugin. Plugin:HookName autohooks.

You need to hook to PlayerUse else it will not run.

Read before posting, he use it has a plugin for his adminmod which hooks it auto