HUD
Functions

Vehicle: get Lights

Gets information about all of VCMod lights for this vehicle.

Used in: VCMod Main, VCMod ELS addons.

Server Entity Vehicle:VC_getLights()

Returns

1. Table Vehicles VCMod light data. Structure is: pos ("fl", "fr", "rl", "rr"), isELS, isRunning, isBrake, isFog, isInterior, isBlinker, isReverse, isHighBeam, isLowBeam, isHeadlight, isDamaged.

Example

concommand.Add("vehicle_getAllLightInfo", function()
	local ent = player.GetAll()[1]:GetEyeTraceNoCursor().Entity
	if IsValid(ent) then

		// Lets get all of vehicles light data
		local lights = ent:VC_getLights()

		// Lets count how many running, brake and damaged lights this vehicle has
		local countRunning, countBrake, countDamaged = 0, 0, 0

		for k,v in pairs(lights) do
			local ID = k // This can be used with other VCMod functions

			if v.isRunning then countRunning = countRunning+1 end
			if v.isBrake then countBrake = countBrake+1 end

			if v.isDamaged then countDamaged = countDamaged+1 end // This is the same as: ent:VC_partIsDamaged("lights", ID)
		end

		print("Vehicle you are currently looking at has "..table.Count(lights).." lights, of which are: "..countRunning.." running lights, "..countBrake.." brake brake lights and "..countDamaged.." damaged lights.")
	else
		print("Invalid entity.")
	end
end)
Page modified:
...2018-11-02 09:24:38