NR_PoliceJob

Prisoner Transport System — a comprehensive script for QBX/QBCore that enables police officers to transport NPC prisoners to Bolingbroke Penitentiary.

Features

Dependencies

Resource Description Required
qbx_core Core framework Yes
ox_target Interaction system Yes
ox_lib Utility library Yes
Dispatch system Configured for Kartik MDT (easily adaptable) Yes

Installation

Step 1: Download

Download the resource and extract it to your resources folder:

server/
  └── resources/
      └── [nightrider]/
          └── NR_PoliceJob/

Step 2: server.cfg

Add the resource to your server configuration:

ensure NR_PoliceJob

Step 3: Configuration

Edit config.lua to match your server setup.

Step 4: Restart

Restart your server to load the resource.

⚠️ Dependencies

Make sure qbx_core, ox_target, ox_lib, and your dispatch system are all started before this resource.

How It Works

1. Mission Assignment

Every 15 minutes (configurable), the system checks for on-duty police officers. If officers are available, one is randomly selected and assigned a prisoner transport mission. A dispatch notification is sent with the prisoner's location.

2. Prisoner Pickup

The officer responds to the GPS marker showing the prisoner location. Two NPCs spawn at the location: a fellow officer and a handcuffed prisoner. The officer uses ox_target to interact with the prisoner and select "Escort Prisoner".

3. Vehicle Placement

Once escorted, the prisoner is attached to the officer. The fellow officer NPC walks away. The GPS updates to show Bolingbroke Penitentiary as the destination. The officer can place the prisoner in any nearby vehicle's passenger seat — ox_target options appear on vehicles within 10 meters.

4. Transport to Prison

The officer drives the prisoner to Bolingbroke Penitentiary. When within 50 meters, a booking officer NPC spawns at the prison. The officer must be close enough to interact with the booking officer.

5. Completion

The officer exits the vehicle and interacts with the booking officer. The system validates the transport (distance, time, proper sequence). The officer receives payment (default: $350) and all NPCs are cleaned up naturally.

Configuration

Basic Settings

Config.PoliceJob = "police"      -- Job name for police
Config.DispatchInterval = 15     -- Minutes between automatic dispatches
Config.RewardAmount = 350        -- Payment for completed transports

NPC Models

Config.OfficerModel = "s_m_y_cop_01"        -- Pickup location officer
Config.PrisonerModel = "s_m_y_prisoner_01"  -- Prisoner NPC
Config.BookingOfficerModel = "s_m_m_prisguard_01" -- Prison officer

Spawn Locations

15 pre-configured locations across the map. Add more by editing Config.SpawnLocations in config.lua:

Config.SpawnLocations = {
    vec4(x, y, z, heading),
    -- Add more locations
}

Timer Settings

Adjust server-side constants in server.lua:

local COOLDOWN_TIME = 60          -- Cooldown between missions (seconds)
local TRANSPORT_TIMEOUT = 1800    -- Mission timeout (seconds)
local SPAM_PROTECTION_TIME = 2    -- Anti-spam delay (seconds)
local MIN_TRANSPORT_TIME = 10     -- Minimum transport duration (seconds)

Dispatch Integration

The script is configured for Kartik MDT. To use a different dispatch system, modify the export on client.lua line 443:

-- Current (Kartik MDT)
exports['kartik-mdt']:CustomAlert(dispatchData)

-- Example for other systems
TriggerEvent('your-dispatch:alert', dispatchData)

Anti-Exploit Features

Protection Description
Distance validation Player must be near the prisoner to pick up and near the prison to complete
Minimum transport time Must wait at least 10 seconds between pickup and completion
Spam protection 1-second delay between interactions, 2-second delay between server events
State validation Ensures proper mission sequence (pickup, vehicle, completion)
Cooldown system 60-second cooldown between manual mission starts
Timeout system Auto-cancels missions after 30 minutes of inactivity

Mission Cancellation

Missions are automatically cancelled when:

Troubleshooting

NPCs not spawning

Ensure the NPC models are valid and ox_target is running.

No dispatch notifications

Check your dispatch system integration on client.lua line 443. Make sure the export matches your MDT resource.

Mission won't complete

Verify you're within 50 meters of the prison and the prisoner is in the vehicle.

Cooldown issues

Default 60-second cooldown between manual mission starts. Adjust COOLDOWN_TIME in server.lua if needed.

Support

Need help? Join our Discord server for community support and updates.