Scripts 2026-04-05

Agency-Vending: Vending Machines That Actually Sell Things in Your Economy

TDYSKY

TDYSKY

Founder & Lead Developer at Agency Scripts

The Most Underused Prop in GTA V

GTA V is dotted with vending machines that are purely decorative in vanilla FiveM servers. Agency-Vending makes every one of them functional — players walk up, interact, buy food or drinks at reasonable prices, and get appropriate buffs. Simple, ubiquitous, and it makes the map feel alive in a way vanilla doesn't.

Stock That Runs Out

Each machine has individual stock that depletes as players buy items. Empty machines show an "out of stock" state until they're refilled. This seems minor but it creates a new job role: vending route operator. Players who refill machines get a cut of the sales that happen from their stock. Suddenly every prop has economic activity.

Item Variety Per Machine Type

Soda machines sell drinks with minor thirst effects. Snack machines sell food with hunger effects. Coffee kiosks sell hot drinks that clear tiredness. Agency-Vending auto-identifies machine type from the prop model and stocks it appropriately. Zero configuration for standard placements.

Pricing Signals

Prices are intentionally cheaper than restaurant food but more expensive than cooking at home. This creates a sensible economic hierarchy: home > vending > fast food > restaurants. Players naturally gravitate to the option that matches their situation, which is exactly how real purchasing behavior works.

Admin Reporting

Server admins get a weekly summary of vending activity: which machines earn most, which are under-refilled, which neighborhoods have demand gaps. This data is gold for balancing the map and identifying new gameplay opportunities without survey-bothering players.

Installation & Setup

Agency-Vending requires oxmysql for stock tracking per machine. Import vending.sql, drop the resource into your server, and add ensure agency-vending to server.cfg. On first start, the resource scans the map for all native vending machine props and registers them in the database automatically. Zero manual coordinate entry needed for default machine placement.

Items dispensed by machines need to exist in your framework's item registry. The config ships with standard food and drink item names for QBCore and ESX. Custom item names are a one-line change per machine type.

Configuration Options

The config.lua covers both machine behavior and economic settings:

  • Stock per machine — how many units each machine holds before it needs refilling. Default: 50.
  • Restock method — automatic timed restock (simple), player-driven restock (economy role), or admin-only restock.
  • Restocking job requirement — optionally restrict restocking to players in a delivery or vendor job.
  • Profit split — percentage of sales revenue that goes to the player who last restocked a machine.
  • Machine type overrides — manually set a different item list for specific machine prop models.
  • Effect duration — how long food/drink buffs last. Configurable per item type.
  • Out-of-stock visual — toggle the "empty" visual state on machine props.

Framework Compatibility

QBCore and ESX adapters are bundled. For standalone, implement Config.GiveItem(src, item, count) and Config.TakeMoney(src, amount). The machine scanning, stock management, restock economy, and admin reporting are all framework-agnostic.

Why This Matters for Roleplay

Map density is one of the underrated factors in RP server quality. When players can interact with more of the map's existing props — machines, benches, dumpsters, doors — the world feels inhabited rather than theatrical. Agency-Vending is one of the easiest wins in this direction: every vending machine prop becomes an interactive economic node with zero additional work from the server team.

The vending route operator role is perhaps the most interesting emergent gameplay the script enables. A player character who makes their living restocking machines, managing routes, tracking which neighborhoods have high turnover — that's a mundane but legitimate RP role that some players genuinely enjoy. Not every character needs to be a criminal or a cop.

The admin reporting layer is a practical tool for server economy health. If a specific machine location is consistently empty (high demand) but another is always full (low footfall), that's actionable information for placing custom shop NPCs or adjusting player spawn points. The vending data tells you where your players actually spend time.

Frequently Asked Questions

Can I add custom machine locations that aren't native GTA V props?

Yes. Define custom machines in Config.CustomMachines with coordinates, prop model, and item list. This is how you add vending machines inside custom MLO interiors where the native prop scanner can't reach.

Can players rob vending machines?

There's an optional robbery mechanic in config.lua. Enable it and set the pry-open duration, failure chance, and loot range. Successful robberies yield a portion of current stock as items and flag the machine as damaged until a restock occurs. This adds a criminal use case without breaking the economy — the haul per machine is intentionally small.

How does the profit split work when multiple players restock the same machine?

The most recent restocking player owns the profit split on that machine until it runs empty and is restocked again. There's no split between multiple restockers — whoever did the last refill owns the next cycle's earnings. This keeps the accounting simple and creates natural competition between delivery route operators.

Does this work in server-side only (no client resource)?

No. The machine scanning and interaction UI run client-side. Agency-Vending uses both server and client scripts. The server handles stock state and economy transactions; the client handles prop detection, UI rendering, and player proximity triggers.

Requirements

  • FiveM server (QBCore, ESX, or standalone)
  • oxmysql
  • cfx.re account with valid Agency-Vending license
  • Optional: ox_lib (for UI components, has fallback if not present)

Expanding the Vending Economy

The vending machine economy works best when it's one piece of a broader food and drink system rather than the only option. Here's how to layer it effectively:

Home cooking (through a crafting script) should be the cheapest way to get food with the best buff values — but requires ingredients and time. Vending machines are the convenience tier: no preparation, immediate purchase, moderate cost, moderate buffs. Player-run restaurants are the premium tier: the best food buffs, highest cost, requires a player chef. Fast food NPCs sit between vending and restaurants.

When all four tiers exist, players make natural economic decisions based on their situation. A player mid-mission uses a vending machine because they can't stop at a restaurant. A player with time and money goes to a player restaurant for the RP and the buff. The tiering creates meaningful choices across the economy rather than one dominant option.

Agency-Vending also works well as a revenue stream for neighborhood business owners in city RP. A shop owner who "owns the vending route" in their neighborhood has a passive income mechanism and a reason to patrol and defend their territory.

Share this article

Ready to upgrade your server?

Check out our premium FiveM scripts in the Agency Scripts store or join our Discord community for support and updates.