# setLightEnabled (Cliente)

> Liga ou desliga uma luz sem destruí-la.

- **Plataforma**: MY Multiplayer (MYMP)
- **Tipo**: Função Lua
- **Lado**: Cliente
- **Categoria**: Luzes
- **URL**: https://wiki.mymp.gg/pt/setLightEnabled

## Sintaxe

```lua
bool setLightEnabled(light light, bool enabled)
```

## Parâmetros

| Nome | Tipo | Descrição |
| --- | --- | --- |
| `light` | `light` | A luz. |
| `enabled` | `bool` | `true` para ligar, `false` para desligar. |

## Retorno

`true` se mudou. Com um argumento errado, registra um aviso e devolve `false`.

## Exemplo

```lua
local light = createPointLight(2495.1, -1687.4, 14.5, 12)
bindKey("l", "down", function()
    setLightEnabled(light, not isLightEnabled(light))
end)
```

## Veja também

- [isLightEnabled (Cliente)](https://wiki.mymp.gg/pt/isLightEnabled.md): Diz se uma luz está ligada.
- [createPointLight (Cliente)](https://wiki.mymp.gg/pt/createPointLight.md): Cria uma luz que ilumina em todas as direções a partir de um ponto. A luz existe só neste cliente.
- [destroyElement (Compartilhado)](https://wiki.mymp.gg/pt/destroyElement.md): Destrói um elemento e todos os seus filhos. Antes de sumir, cada um dispara onElementDestroy no servidor ou onClientElementDestroy no cliente.
