Skip to main content
Robbing a downed player normally means taking whatever you can carry. data/looting.lua lets you put rules on that: keep certain items out of a robber’s hands entirely, and cap how much of something they can walk away with. Nothing changes until you add rules. The file ships with an empty list.

What the rules apply to

Exactly one thing: a player dragging an item out of another player’s open inventory. That matters more than it sounds. Everything else that moves items uses the ox_inventory exports, which never pass through this check, so all of the following keep working untouched:
  • Admin menus taking or giving items
  • Evidence lockers and confiscate on arrest
  • Death drop scripts clearing an inventory
  • Shops, crafting, and any job script that adds or removes items
You do not need to add exceptions for those. They are outside the check by design, not by a list that someone has to keep current.

The file

data/looting.lua
That example does three things. Police weapons stay on a downed officer but another officer can recover them. Cash can be taken off anyone up to 10,000, while police confiscate without a limit. Marked bills are police only.

Rule fields

whenVictim and exempt use the same group format as stashes and shops:
Where more than one rule covers the same item, the most restrictive one wins. Rule order in the file never matters, so you cannot break a rule by adding another one above it.

How limits are counted

This is the part worth understanding before you set a number. A limit belongs to the victim, not to the robbery. When someone takes 4,000 off a player with a 10,000 cap, that player has 6,000 left in the pot, and it stays that way for the rest of the window no matter who does the next robbery. That closes the two obvious ways round a cap:
  • Robbing the same person again a minute later draws from the same 6,000
  • Three people robbing together share one pot, they do not get 10,000 each
window is how long that lasts, in minutes. Being revived does not reset it, or downing someone twice would hand out a fresh allowance.
Budgets are held in memory, so a server restart clears them. For a window measured in minutes that is usually fine, but a player robbed just before a restart can be robbed again for the full amount afterwards.

Things it cannot do

  • Only inventory items. If your server keeps cash as a framework account rather than an item, it never passes through the inventory and a limit cannot reach it.
  • Not a replacement for a robbery script. These are rules about what can be taken, not about how the robbery is performed.

Messages

Refused actions tell the player why, using cannot_loot_item and cannot_loot_amount from your locale file. Both are translated in every shipped language.