How to remove a vehicle a player has in eyetrace when he press something?
[lua]local function RemoveOnPress( ply, key )
if key == IN_USE then
local trace = ply:GetEyeTrace()
if trace.Entity:IsValid() then
if trace.Entity:IsVehicle() then
trace.Entity:Remove()
end
end
end
end
hook.Add( "KeyPress", "RemoveOnPress", RemoveOnPress )[/lua]
This should work, change the key to what ever you want?
Sorry, you need to Log In to post a reply to this thread.