sg-robnpc

Paid

A FiveM script that allows players to rob NPCs at gunpoint. Supports both QBCore and Qbox frameworks with qb-inventory and ox_inventory.

QBCore / QBoxPurchase

Overview

A FiveM script that allows players to rob NPCs at gunpoint. Supports both QBCore and Qbox frameworks with qb-inventory and ox_inventory.

Features

  • Rob any NPC by aiming a weapon at them
  • NPCs put their hands up when threatened
  • Configurable cooldown between robberies
  • Police requirement system
  • Randomized loot rewards with configurable chances
  • Progress bar during robbery
  • NPCs flee after being robbed

Installation

1

Download & Place

Download and place in your resources folder

2

Add to server.cfg

ensure sg-robnpc
3

Configure

Configure config.lua to your liking

Framework Setup

For QBCore

In fxmanifest.lua:

  • Keep '@qb-core/client/main.lua' uncommented in client_scripts
  • Comment out '@qbx_core/modules/lib.lua' in shared_scripts

For Qbox

In fxmanifest.lua:

  • Comment out '@qb-core/client/main.lua' in client_scripts
  • Uncomment '@ox_lib/init.lua' in shared_scripts
  • Uncomment '@qbx_core/modules/lib.lua' in shared_scripts

Inventory Support

The script auto-detects your inventory system. You can also manually set it in config.lua:

Config.Inventory = 'auto' -- Auto-detect (default)
Config.Inventory = 'ox_inventory' -- Force ox_inventory
Config.Inventory = 'qb-inventory' -- Force qb-inventory

Configuration

Config.Framework = 'auto' -- 'auto', 'qbcore', or 'qbox'
Config.Inventory = 'auto' -- 'auto', 'qb-inventory', or 'ox_inventory'
Config.CooldownTime = 60 -- Seconds between robberies
Config.RobDistance = 3.0 -- Distance to initiate robbery
Config.RequiredPolice = 0 -- Minimum police online

Rewards

Configure loot in Config.Rewards:

Config.Rewards = {
    {item = "cash", min = 100, max = 500, chance = 100},
    {item = "goldbar", min = 1, max = 2, chance = 20},
    -- Add more items...
}

Usage

  1. Equip any weapon
  2. Aim at an NPC within range
  3. NPC will put their hands up
  4. Press E to start robbing
  5. Wait for the progress bar to complete

Dependencies

  • QBCore or Qbox framework
  • qb-inventory or ox_inventory
  • ox_lib (If using QBox)

Credits

Author: sgMAGLERA