GE Lua Documentation

Press F to search!

isVehicleInPursuit

Definition


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

local function isVehicleInPursuit(id, targetId) -- returns the pursuit status of a vehicle (targetId is optional, to filter the suspect)
  id = id or be:getPlayerVehicleID(0)

  local state, isPolice = false, false
  local traffic = gameplay_traffic.getTrafficData()
  local currVeh = traffic[id]
  if currVeh then
    if currVeh.roleName == 'police' then
      isPolice = true
      if currVeh.role.targetPursuitMode > 0 then
        if targetId then
          state = currVeh.role.targetId == targetId
        else
          state = true
        end
      end
    elseif currVeh.roleName == 'suspect' then
      if currVeh.pursuit.mode > 0 then
        state = true
      end
    end
  end

  return state, isPolice
end

Callers