# setLightEnabled (Cliente)

> Enciende o apaga una luz sin destruirla.

- **Plataforma**: MY Multiplayer (MYMP)
- **Tipo**: Función Lua
- **Lado**: Cliente
- **Categoría**: Luces
- **URL**: https://wiki.mymp.gg/es/setLightEnabled

## Sintaxis

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

## Parámetros

| Nombre | Tipo | Descripción |
| --- | --- | --- |
| `light` | `light` | La luz. |
| `enabled` | `bool` | `true` para encenderla, `false` para apagarla. |

## Retorno

`true` si cambió. Con un argumento incorrecto, registra un aviso y devuelve `false`.

## Ejemplo

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

## Ver también

- [isLightEnabled (Cliente)](https://wiki.mymp.gg/es/isLightEnabled.md): Dice si una luz está encendida.
- [createPointLight (Cliente)](https://wiki.mymp.gg/es/createPointLight.md): Crea una luz que ilumina en todas las direcciones desde un punto. La luz solo existe en este cliente.
- [destroyElement (Compartido)](https://wiki.mymp.gg/es/destroyElement.md): Destruye un elemento y todos sus hijos. Antes de desaparecer, cada uno dispara onElementDestroy en el servidor u onClientElementDestroy en el cliente.
