GE Lua Documentation

Press F to search!

releaseVehicle

Definition


-- @/lua/ge/extensions/gameplay/police.lua:388

local function releaseVehicle(id, showMessages) -- unfreezes controls and lets a vehicle continue after an arrest
  local obj = getObjectByID(id)
  if not obj then return end

  local veh = gameplay_traffic.getTrafficData()[id]
  if not veh then
    obj:queueLuaCommand('controller.setFreeze(0)')
    return
  end

  if showMessages and be:getPlayerVehicleID(0) == id then
    ui_message('ui.traffic.driveAway', 5, 'traffic', 'traffic')
  end

  extensions.hook('onPursuitAction', id, 'release', veh.pursuit)

  local tempIds = {}
  for pid, p in pairs(policeVehs) do
    if p.role.targetId == id then
      table.insert(tempIds, pid)
    end
  end
  setPursuitMode(0, id, tempIds)
end

Callers

@/lua/ge/extensions/gameplay/police.lua
        if (pursuit.timers.arrest <= -5 or not veh.role.flags.freeze) then
          releaseVehicle(id, gameplay_traffic.showMessages)
        end