HUD
Functions

Vehicle: get Attached To

Allows us to get the entity this trailer is attached to (not the main truck vehicle). This is different than VC_getTruck(), since trailers can be attached to other trailers.

Used in: VCMod Main addon.

Shared Entity Vehicle:VC_getAttachedTo()

Returns

1. Entity The entity that this trailer is attached to.

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

Example

concommand.Add("vehicle_getAttachedTo", function()
	local ent = player.GetAll()[1]:GetEyeTraceNoCursor().Entity
	if IsValid(ent) then
		local atc, attach_time = ent:VC_getAttachedTo()
		if IsValid(atc) then
			print("This trialer is being dragged by "..atc:VC_getName().." since "..(CurTime()-attach_time).." seconds ago.")
		else
			print("This trailer is not attached to any vehicle!")
		end
	else
		print("Invalid entity.")
	end
end)
Page modified:
...2019-02-10 23:16:19