GetAttachedLights - GalaxHD551/lightstreamer GitHub Wiki

Description

This function gives you lights that are currently attached to an entity

Syntax

lr.GetAttachedLights(attachtype, id)

Parameters

  • attachtype

    The AttachType.

  • id

    The entity identifier.

Return Value

  • Returns a table of attached lights.

Exemple

lr = ImportPackage("lightstreamer")

AddEvent("OnPlayerEnterVehicle", function(playerid, vehicle, seat)
        local ALight = lr.GetAttachedLights(ATTACH_VEHICLE, vehicle)
	AddPlayerChat(player, "There are "..#ALight.." attached to that vehicle.")
        if #ALight > 0 then
                for k, v in pairs(ALight) do
                        lr.SetLightColor(v, RGB(0, 0, 255))
                end
        end 
end)