M MY Multiplayer: Wiki
Lado
Tipo

getVehicleLightState

Compartilhado

Devolve se uma ou mais luzes de um veículo estão quebradas.

int|table|false getVehicleLightState(vehicle vehicle, int|string|table light)

Parâmetros

NomeTipoDescrição
vehiclevehicleO veículo.
lightint|string|tableQual luz: o número (0 farol esquerdo, 1 farol direito, 2 lanterna traseira direita, 3 lanterna traseira esquerda), o nome do frame (headlight_l, headlight_r, taillight_r, taillight_l), um grupo (all, front_lights, rear_lights, left_lights, right_lights), -1 para todas ou uma tabela com vários deles.

Retorno

O estado (0 funcionando, 1 quebrada). Quando foram pedidas várias luzes (um grupo, -1 ou uma tabela), uma tabela de nome do frame → valor. false se o veículo não tem uma das luzes pedidas.

Exemplo

addCommandHandler("farol", function(player)
    local vehicle = getPedOccupiedVehicle(player)
    if vehicle and getVehicleLightState(vehicle, 0) == 1 then
        setVehicleLightState(vehicle, 0, 0)
    end
end)

Veja também