HUD
Functions

Vehicle: get Truck

Allows us to get the main truck attached to this vehicle. Do note, that trailers can be attached to other trailers. This would get the main vehicle.

Used in: VCMod Main addon.

Shared Entity Vehicle:VC_getTruck()

Returns

1. Entity The truck that this trailer is attached to. If we are not attached to anything, returns the trailer entity itself.

2. Integer CurTime() of when it was attached.

Example

concommand.Add("vehicle_getTruck", function()
	local ent = player.GetAll()[1]:GetEyeTraceNoCursor().Entity
	if IsValid(ent) then
		local truck, attach_time = ent:VC_getTruck()
		if IsValid(truck) then
			print("This trailer is being dragged by "..truck:VC_getName().." since "..(CurTime()-attach_time).." seconds ago.")
		else
			print("This trailer is not attached to any trucks!")
		end
	else
		print("Invalid entity.")
	end
end)
Page modified:
...2019-02-11 04:26:42