SetLightAttached - GalaxHD551/lightstreamer GitHub Wiki

Description

Attaches a light to another entity.

Syntax

lr.SetLightAttached(lightid, attachtype, attachid[, x, y, z, rx, ry, rz, SocketName])

Parameters

  • lightid

    The light identifier from CreateLight.

  • attachtype

    The AttachType.

  • attachid

    The identifier of the other entity you want to attach to.

  • x

    Relative X location.

  • y

    Relative Y location.

  • z

    Relative Z location.

  • rx (optional)

    Relative pitch rotation.

  • ry (optional)

    Relative yaw rotation.

  • rz (optional)

    Relative roll rotation.

  • SocketName (optional)

    Socket where to attach to PlayerBones or VehiclesBones . Can be empty.

Return Value

  • Returns true on success, false on error.

Exemple

lr = ImportPackage("lightstreamer")

function cmd_light(player)
	local x, y, z = GetPlayerLocation(player)
        lightid = lr.CreateLight("POINTLIGHT", x, y, z)
        lr.SetLightAttached(lightid, ATTACH_PLAYER, player, -20, 0, -10, 90)
	
end
AddCommand("light", cmd_light)