#include "../../config/events.lua"

function init()
    trigger = FindTrigger()
    shape = FindShape()
end

function tick(dt)
    if shape > 0 then
        if IsShapeBroken(shape) then
            TriggerEvent(EVENTS.WAIT_EVENT)
            shape = 0
        end
    elseif trigger > 0  then
        local handle = GetPlayerVehicle()
        if handle and IsVehicleInTrigger(trigger, handle) then
            TriggerEvent(EVENTS.WAIT_EVENT)
            trigger = 0
        end
    end
end