function init()
    vehicle = FindVehicle("EVF")
    lightbar = FindShapes("lightbar")
    isEnabled = false
    for i = 1, #lightbar do
        SetShapeEmissiveScale(lightbar[i], 0)
    end
    click = LoadSound("MOD/extra-scripts/snd/click.ogg")
    click_out = LoadSound("MOD/extra-scripts/snd/click_out.ogg")
end

function tick()
    if GetPlayerVehicle() == vehicle then
        if InputPressed("I") then
            if isEnabled then
                isEnabled = false
                PlaySound(click_out, GetVehicleTransform(vehicle).pos, 0.5)
                for i = 1, #lightbar do
                    SetShapeEmissiveScale(lightbar[i], 0)
                end
            else
                isEnabled = true
                PlaySound(click, GetVehicleTransform(vehicle).pos, 0.5)
                for i = 1, #lightbar do
                    SetShapeEmissiveScale(lightbar[i], 1)
                end
            end
        end
    end
end

function draw()
    if GetPlayerVehicle() == vehicle and not GetBool("hud.disable") then
        UiPush()
            UiAlign("center middle")
            UiTranslate(UiCenter()-900, UiMiddle()+496)

            UiPush()
                UiColor(0,0,0,0.5)
                UiTranslate(127, 0)
                UiImageBox("ui/common/box-solid-6.png", 320, 50, 6, 6)
            UiPop()

            UiFont("regular.ttf", 30)
            UiText("I")
            UiTranslate(140, 2)
            UiColorFilter(1, 1, 1, 0.7)
            UiText("Change lightbar mode")
        UiPop()
    end
end
