QBCore | Advanced Pedestrian Interaction for Police

Description

ac-pedinteraction is a police–pedestrian interaction system designed for immersive patrol roleplay on QBCore servers.

The script allows police officers to interact with ambient pedestrians anywhere in the world using qb-target or ox_target.
Each NPC is handled server-side and receives its own generated identity, inventory state, and behavior, ensuring that interactions cannot be repeated or abused.

This resource was created to make patrols feel more alive without relying on static NPCs or scripted locations.

Important notice

I want to clarify that this resource is designed for QBCore only.

Newer versions of ox_inventory no longer support QBCore and are intended for QBox or ESX. Using this resource with QBox or newer ox_inventory versions may cause errors.

Apologies for not clearly stating this earlier. This has now been added to avoid confusion.


Features

  • Police-only interactions with ambient pedestrians
  • Server-side NPC ownership using NetIDs (prevents double interaction abuse)
  • Generated ID cards with in-game rendered portraits
  • Randomized NPC inventories (legal & illegal items)
  • Frisk system with configurable outcomes
  • Arrest system with multiple scenarios
  • NPCs may flee when illegal items are found
  • Optional taser-based suspect stopping
  • Supports qb-target and ox_target
  • Supports qb-inventory and ox_inventory

Gameplay Example

  1. Officer targets a pedestrian
  2. Interaction menu opens
  3. Officer checks ID or frisks NPC
  4. If illegal items are found:
  • NPC may attempt to flee
  • Officer must stop the suspect
  • Arrest removes the NPC from the world

All behaviors can be configured or disabled depending on server policy.


Requirements

  • QBCore
  • qb-menu
  • qb-target or ox_target
  • qb-inventory or ox_inventory

Configuration

The resource is fully configurable:

  • Select target system (qb-target / ox_target)
  • Select inventory system (qb-inventory / ox_inventory)
  • Configure:
    • NPC item pools
    • Legal and illegal items
    • Generated name pools
    • NPC behavior (fleeing, arrest outcomes)

Performance

  • Targets are only created within interaction range
  • NPC data is cached per entity
  • All critical logic is server-authoritative

Optimized for live servers.


Preview


Distribution

This resource is free and immediately available.

(No Discord or account requirement to use the resource.)


Required Information (Code Resource)

Code is accessible Yes
Subscription-based No
Lines (approximately) ~900
Requirements & dependencies QBCore, qb-menu, qb-target / ox_target
Support Yes

Assets Information

Assets are accessible Yes
Subscription-based No
Polygons (model and LOD) N/A
Texture size and amount 1x YTD (106 KB)
Requirements & dependencies None
Support Yes
9 Likes

nice this will go great with SDC_AIPullover thanks for release …

1 Like

have you thought about making a script were the npc cops can pull you over chase you and issue warrants?

1 Like

@AlexCarton
Able to talk and see ped ID but unable to arrest once they run and get tased

I am actually looking in to that idea right now.

1 Like

Thanks for the report.

Could you provide a short video or a clear step-by-step reproduction? This will help me identify whether it’s a task/state issue or a network sync problem.

this looks really cool! Suggestion to cuff the ped and take them to a station for drop off instead of them disappearing :slight_smile:

1 Like

I use the setup for qbx with ox target and ox_inventory
I get this errors

^1SCRIPT ERROR: native a11700682f3ad45c: invalid lua type in __data^7
^3> NetworkGetNetworkIdFromEntity^7 (^5NetworkGetNetworkIdFromEntity.lua^7:10)
^3> handler^7 (^5@ac-pedinteraction/client.lua^7:125)
^3> handler^7 (^5@ac-pedinteraction/client.lua^7:119)
^3> ref^7 (^5@ac-pedinteraction/client.lua^7:52)
^3> callback^7 (^5@ox_target/client/main.lua^7:439)

Also the list of items, its a bit strange?

because of the empty spaces, like " Water bottle", shouldnt that be “water_bottle”.

        { name = "Water Bottle", qty = 2, legal = true },
        { name = "Cigarettes", qty = 5, legal = true },
        { name = "Joint", qty = 1, legal = false },
        { name = "Phone", qty = 1, legal = true },
        { name = "Pocketwatch", qty = 1, legal = true },
        { name = "Wallet", qty = 1, legal = true },
        { name = "Pistol", qty = 1, legal = false },
        { name = "Bag of cocaine", qty = 1, legal = false },
        { name = "Coins", qty = 10, legal = true },
        { name = "Pocketknife", qty = 1, legal = true },
        { name = "Ring", qty = 1, legal = true },
        { name = "Sandwich", qty = 1, legal = true },
        { name = "Flashlight", qty = 1, legal = true },
        { name = "First aid kit", qty = 1, legal = true },
        { name = "Cigar", qty = 2, legal = true },
        { name = "Forged ID card", qty = 1, legal = false },
        { name = "Energy bar", qty = 1, legal = true },
        { name = "Lockpick", qty = 1, legal = false },
        { name = "Meth baggie", qty = 2, legal = false },
        { name = "Stolen credit card", qty = 3, legal = false },
        { name = "Prescription pills", qty = 1, legal = false },
        { name = "Crowbar", qty = 1, legal = true },
        { name = "Watch", qty = 1, legal = true },
        { name = "Keys", qty = 1, legal = true },
        { name = "Flash drive", qty = 1, legal = true },
        { name = "Bloody rag", qty = 1, legal = false },
        { name = "Bag of weed", qty = 1, legal = false },
        { name = "Bottle of whiskey", qty = 1, legal = true },
        { name = "Camera", qty = 1, legal = true },
        { name = "Knife", qty = 1, legal = false },
        { name = "Crowbar", qty = 1, legal = true },
        { name = "Screwdriver", qty = 1, legal = true },
        { name = "USB with bank data", qty = 1, legal = false },
        { name = "Taser cartridge", qty = 2, legal = true },
        { name = "Box of ammo", qty = 1, legal = false },
        { name = "Handcuffs", qty = 1, legal = false },
        { name = "Spray paint can", qty = 1, legal = true },
        { name = "Fake badge", qty = 1, legal = false },
        { name = "Gold chain", qty = 1, legal = true },
        { name = "Bandana", qty = 1, legal = true },
        { name = "Burner phone", qty = 1, legal = false }

Thanks for the report.

Apologies for the confusion — this resource is built specifically for QBCore, not QBox.

Newer versions of ox_inventory no longer support QBCore, which causes these errors when used with this script.

I’ve updated the post description to clarify this.

Great script. Thanks for the release :facepunch:

1 Like

Is esx version coming?

how do i get this to work for ox-inventory and ox_target? its not working for me