Skip to content

Crime ​

Every crime is timed by the server: the client gets a token and the durations, the result only counts after the time has passed, and the alarm goes off on the server. Owners can't rob their own machines. Every crime can be switched off in Config.Crime or in np_admin's Resource settings.

Key (crowbar in hand) At a machine
hold E Pry the cash box open
hold G Smash the machine

Letting go of the key cancels; started from the np_menu or target option, walking away or dying cancels. The crowbar is the crowbar item, or WEAPON_CROWBAR in hand (Config.Crime.breakIn.weapons).

Break-in ​

Noise bar

  1. Hold E with a crowbar. Prying takes breakIn.seconds (20 s), 1.8 × longer with a reinforced lock.
  2. A noise bar fills over noiseSeconds (14 s), or alarmNoiseSeconds (6 s) with an alarm upgrade. At 100 % the alarm goes off: the owner gets an alert with a GPS point, and the police are told (see Dispatch).
  3. When prying finishes you take 40–80 % of the cash box (breakIn.loot) in cash.

Alarm

Conditions: the box holds at least minCash ($50), the machine's cooldown (cooldownMinutes, 30) has passed, and at least Config.Crime.minPolice police are on duty (0 by default). City machines can be broken into (cityMachines); their box refills with a small float (cityFloat, $40–160) when the city restocks them. A city machine that was registered less than Config.World.claimBreakInMinutes (30) ago can't be pried open.

Vandalism ​

Hold G with a crowbar for vandalism.seconds (8 s). The machine is out of order until the owner repairs it at the service door: they pay repairCost ($400, less with insurance), or anyone with restock rights uses a vending_repairkit. The owner gets an alert. With an alarm upgrade the alarm goes off almost at once. Cooldown 20 minutes per machine.

Upgrades ​

Owners buy upgrades at the service door (Upgrades):

Upgrade Price Effect
Reinforced lock $1,800 Prying takes pryFactor (1.8) × longer
Alarm $1,200 The noise bar fills in 6 s instead of 14 s; vandalism sets it off at once
Camera $1,500 The thief is named in the owner's log, and the alert mentions the camera
Insurance $900 + $150 a week Pays back cover (60 %) of a break-in loss, and 60 % off repairs. The weekly fee is added to the rent

Skimming ​

Off by default (Config.Crime.skimming.enabled = false). A vending_skimmer on a player machine's card reader takes share (15 %) of its card sales; the share is paid to whoever installed it with the hourly card settlement. Each time the owner opens the service door there is a findChance (35 %) that they find and remove it.

To install one, carry a vending_skimmer to a player machine that takes card payments. The prompt shows Hold E to install a card skimmer (also an np_menu option). Hold for skimming.seconds (6 s); letting go or walking away cancels it. The server checks again (skimming enabled, someone else's machine, card payments on, nearby, item carried) and uses up the item. A machine with card payments off refuses it.

Minigames (np_minigames) ​

With np_minigames started and Config.Minigames.enabled on (the default), the crime flows are skill games that np_minigames plays and judges on the server (exports.np_minigames:Play, with the machine as the maxMove anchor). The cash box opens only on np_minigames' own verdict, never on anything the client sends.

Use Game (default)
breakIn lockpick, medium Prying the cash box. The noise bar keeps filling during the game: finish before it and no alarm goes off
reinforced drill, hard The same behind a reinforced lock (enabled = false: the breakIn game for every machine)
skimming wires, medium Installing a card skimmer instead of the progress bar. A failed game keeps the skimmer
vandalism power, easy, off Smashing the machine. Off by default: a hold isn't really a skill
shake power, easy, off Shaking a jammed machine: the game decides instead of Config.Jams.shakeChance. Off by default: a good player always gets the item

A failed game (snapped pick, overheated drill, walked off …) sets the alarm off when failAlarm is on; giving up with Esc never does, the same as letting go of E. The server keeps its own checks around every game: the machine, the distance, the crowbar, cooldowns, the token.

lua
-- shared/config/19_minigames.lua
Config.Minigames = {
  enabled = true,
  maxMove = 2.5,               -- metres from the machine before the game fails with 'moved'
  breakIn = { enabled = true, game = 'lockpick', difficulty = 'medium', opts = {} },
  reinforced = { enabled = true, game = 'drill', difficulty = 'hard', opts = {} },
  failAlarm = true,
  vandalism = { enabled = false, game = 'power', difficulty = 'easy', opts = {} },
  skimming = { enabled = true, game = 'wires', difficulty = 'medium', opts = {} },
  shake = { enabled = false, game = 'power', difficulty = 'easy', opts = {} },
}

Without np_minigames, or with Config.Minigames.enabled = false, every flow works as described above: hold E / G against the server timer, the progress bar, the shake chance roll.

Dispatch ​

When an alarm goes off, np_vending tells the police in this order:

  1. Config.Crime.dispatch(src, data) when you set it;
  2. np_drugs' Dispatch export when it runs (it routes to ps-, cd-, qs- or core_dispatch);
  3. otherwise a toast with a GPS point for every on-duty player of Config.Crime.policeJobs.
lua
-- shared/config/16_crime.lua
Config.Crime.dispatch = function(src, data)
  -- data = { kind = 'breakin' | 'vandalism', coords, machine, code, label, street? }
  exports['ps-dispatch']:CustomAlert({ coords = data.coords, message = 'Vending machine alarm ' .. data.code, code = '10-90' })
end

Other resources can stop a break-in before it starts with the onBreakIn hook, and react to np_vending:server:breakIn and np_vending:server:alarm (Events).