FiveM Script Docs
General server guides and documentation for all SWR Entertainment FiveM scripts.
Installing a FiveM Resource
General Guide
Follow these steps to install any FiveM resource, including SWR scripts, on your server.
Steps
- 1Download the resource
.zipfrom your Tebex receipt, the release page, or wherever the script was provided. - 2Extract the archive. Confirm the extracted folder contains a
fxmanifest.luaor__resource.luaat its root. That is your resource folder. - 3Move the resource folder into your server's
resourcesdirectory. You can organise scripts in sub-folders (e.g.resources/[swr]). - 4Open
server.cfgand add anensureline for the resource. The name must match the folder name exactly. - 5Save
server.cfgand restart your server (or runensure <resource-name>in the server console to hot-reload without a full restart).
Example server.cfg entry
ensure swr_cve_v2
fxmanifest.lua are the most common cause.cfx-swr-vending - Documentation
Vending Machine Script
Prop-triggered, NUI-based vending machines for FiveM. Players walk up to a machine, press E, and get a branded menu to purchase items. Includes custom audio, post-purchase animations, multiplayer proximity sound, and deep per-machine configurability from a single config.lua.
Requirements
- FiveM server running artifact 2802 or newer (cerulean fx_version).
- Lua 5.4 enabled (lua54 'yes' is set in the manifest).
- An emote resource that registers /e <name> (compatible with rpemotes-reborn and dpemotes).
- Framework: ESX (es_extended), QBCore (qb-core), or Standalone (no dependency).
Installation
- 1Drop the
cfx-swr-vendingfolder into your server'sresourcesdirectory. - 2Add to
server.cfg:ensure cfx-swr-vending. - 3Open
config.luaand set framework and money account. - 4ESX / QBCore only: ensure item names in each machine's
itemstable exist in your inventory. - 5Restart the resource or reboot the server.
Config.Framework = 'esx' -- or 'qb' or 'standalone' Config.MoneyAccount = 'cash' -- or 'bank'
Standalone / Custom Economy
When Config.Framework = 'standalone', the server fires a net event instead of touching any economy:
TriggerEvent('swr-vending:standaloneGive', source, itemName, price)Listen to this event in your own resource to charge money and give the item however your server handles it.
Configuration Reference
All settings live in config.lua. The file is excluded from CFX asset escrow so it remains editable after purchase.
General
| Key | Default | Description |
|---|---|---|
Config.InteractDistance | 1.6 | Metres from a machine before prompt appears. |
Config.InteractKey | 38 | GTA control index used to open menu (38 = E). |
Config.Use3DPrompt | true | Show floating 3D text when in range. |
Config.PlayAnimation | true | Play post-purchase animations. |
Config.PlayGrabAnimation | true | Play reach-and-grab animation before emote. |
Config.EmoteCommand | 'e' | Emote chat command prefix. |
Config.Framework | 'standalone' | 'esx', 'qb', or 'standalone'. |
Config.MoneyAccount | 'cash' | 'cash' or 'bank' for ESX/QBCore. |
Config.PurchaseCooldown | 0 | Minimum ms between purchases per player; 0 disables. |
Audio
| Key | Default | Description |
|---|---|---|
Config.AudioRadius | 20.0 | Radius for nearby players to hear purchase sound. |
Config.PurchaseVolume | 0.5 | Volume (0.0 to 1.0) for purchasing player. |
Config.NearbyMaxVolume | 0.5 | Max nearby volume with linear fade to 0 at edge. |
Audio plays through NUI (browser Audio API). Place custom mp3 files in html/sound/ and register each file in fxmanifest.lua under files {}.
Prompt / 3D Text
| Key | Default | Description |
|---|---|---|
Config.PromptOffsetZ | 0.85 | Height above prop Z origin for prompt text. |
Config.PromptKeyHint | '[E]' | Blue hint prefix; set empty string to hide. |
Config.PromptFont | 4 | GTA font index. |
Config.PromptScale | 0.34 | Prompt text scale. |
Config.PromptTextColor | {255,255,255,215} | Text RGBA color. |
Config.PromptBoxColor | {0,0,0,150} | Background box RGBA color; alpha 0 disables box. |
Grab Animation (global defaults)
| Key | Default | Description |
|---|---|---|
Config.GrabAnimDict | 'mini@sprunk' | Animation dictionary. |
Config.GrabAnimClip | 'plyr_buy_drink_pt1' | Clip name. |
Config.GrabAnimDuration | 3500 | Milliseconds to hold the clip. |
Config.GrabAnimBlendIn | 8.0 | TaskPlayAnim blend-in rate. |
Config.GrabAnimBlendOut | -8.0 | TaskPlayAnim blend-out rate. |
Config.GrabAnimStopBlend | 3.0 | StopAnimTask blend-out speed. |
Config.GrabFaceDuration | 800 | Duration for TaskTurnPedToFaceEntity. |
Config.GrabFaceWait | 700 | Wait time while turn completes. |
Scan / Detection Intervals
| Key | Default | Description |
|---|---|---|
Config.ScanInterval | 800 | ms between scans when no machine is near. |
Config.NearbyInterval | 250 | ms between scans when machine is nearby. |
Machine Configuration
Each entry in Config.Machines represents a brand. Add, remove, or rename brands freely. The resource auto-builds prop to brand lookup at startup.
Required fields
| Field | Description |
|---|---|
props | List of model hashes (`prop_name`) used to identify this machine in world. |
items | List of { label, item, price } products shown in menu. |
Appearance
| Field | Description |
|---|---|
header | Image filename from html/images used as brand banner. |
accent | Hex color string for machine theme in NUI menu. |
subtitle | Text shown in menu header and world prompt. |
Prompt overrides (optional)
| Field | Description |
|---|---|
promptText | Override 3D prompt text independent of subtitle. |
promptHeight | Override Config.PromptOffsetZ for this machine only. |
interactDistance | Override Config.InteractDistance for this machine only. |
Audio (optional)
| Field | Description |
|---|---|
sound | mp3 filename in html/sound; nil or omitted means no sound. |
Choice screen (optional)
| Field | Default | Description |
|---|---|---|
showChoice | true | Shows Drink it / Hold it screen after item pick. |
defaultAction | 'hold' | Used when showChoice is false: 'drink' or 'hold'. |
Animations (optional)
| Field | Description |
|---|---|
emotes | { drink = 'emoteName', hold = 'emoteName' }. Omitted keys do not fire emote. |
emoteDelay | Delay in ms after grab animation ends before emote runs. |
grabAnim | Per-machine override for dict, clip, duration, blendIn, blendOut, stopBlend. |
Broadcast (optional)
| Field | Description |
|---|---|
broadcast | String or string table sent to global chat. %s becomes buyer name. |
Full machine example
['mybrand'] = {
props = { `prop_vend_soda_01` },
items = {
{ label = 'My Drink', item = 'mydrink', price = 5 },
{ label = 'Diet Drink', item = 'dietdrink', price = 4 },
},
header = 'mybrand.png',
accent = '#ff6600',
subtitle = 'The best drink in Los Santos',
promptText = 'Grab a drink',
promptHeight = 1.0,
interactDistance = 2.0,
sound = 'vendingmachine.mp3',
showChoice = true,
defaultAction = 'drink',
emotes = { drink = 'soda2', hold = 'soda' },
emoteDelay = 0,
grabAnim = {
dict = 'mini@sprunk',
clip = 'plyr_buy_drink_pt1',
duration = 3500,
blendIn = 8.0,
blendOut = -8.0,
stopBlend = 3.0,
},
broadcast = {
'%s is thirsty!',
'%s grabbed a drink.',
},
},Adding a new machine brand
- 1Create a brand image and place it in
html/images/. - 2Add a new entry to
Config.Machinesinconfig.lua. - 3For custom sound, add mp3 to
html/sound/and register it infxmanifest.luaunderfiles {}. - 4Ensure
itemnames exist in your inventory system. - 5Run
ensure cfx-swr-vendingin server console.
Adding custom audio
- 1Place mp3 files in
html/sound/. - 2Register each file explicitly in
fxmanifest.lua. - 3Set
sound = 'mysound.mp3'on the machine entry inconfig.lua.
files {
'html/sound/vendingmachine.mp3',
'html/sound/coffee.mp3',
'html/sound/mysound.mp3',
}Multiplayer behavior: purchaser hears at Config.PurchaseVolume. Nearby players inside Config.AudioRadius hear with linear falloff.
Notifications
The script uses GTA native feed notifications. To replace with your framework notify, edit swr-vending:notify at the bottom of client.lua.
RegisterNetEvent('swr-vending:notify', function(message, kind)
-- Replace this block with your framework notify export/event
BeginTextCommandThefeedPost('STRING')
AddTextComponentSubstringPlayerName(message)
end)Troubleshooting
| Issue | Checklist |
|---|---|
| Menu does not open | Confirm prop hash is listed in machine props, range is within interact distance, and config has no startup errors. |
| No sound plays | Verify mp3 exists in html/sound and is explicitly listed in fxmanifest files, then inspect NUI DevTools for file/audio errors. |
| Nearby players do not hear sound | Increase audio radius and ensure nearby players have interacted at least once to prime NUI audio context. |
| Emote does not play | Start emote resource before this resource, verify EmoteCommand and exact emote names, and account for emoteDelay. |
| Items not given or money not deducted | Validate framework mode and item names against your inventory definitions; inspect framework errors in server console. |
| Cooldown not working | Purchase cooldown is milliseconds, memory-only, and resets on resource restart. |
| Grab animation looks wrong | Set per-machine grabAnim overrides for non-soda props. |
| config.lua encrypted after escrow | Ensure escrow_ignore includes config.lua in fxmanifest and re-upload through Tebex. |
Net events reference
| Event | Side | Arguments | Description |
|---|---|---|---|
swr-vending:purchase | Server receive | brand, itemIndex | Client purchase confirmation. |
swr-vending:purchaseSuccess | Client receive | - | Fired on successful transaction to trigger animations. |
swr-vending:notify | Client receive | message, kind | Displays success or error notifications. |
swr-vending:nearbySound | Client receive | soundFile, volume | Instructs nearby clients to play purchase audio. |
swr-vending:standaloneGive | Server receive | source, item, price | Standalone handoff for external economy/inventory. |
Clearing FiveM Cache
General Guide
Clearing your FiveM cache resolves texture glitches, loading failures, and outdated script errors that persist after a server update.
Steps
- 1Fully close FiveM. Open Task Manager and confirm no FiveM processes are still running.
- 2Press
Win + R, paste the path below, and press Enter. - 3Inside that folder, open
FiveM.appthen open thecachesubfolder. - 4Delete all subfolders and files inside
cache. You can leave the emptycachefolder itself in place. - 5Relaunch FiveM. The cache will rebuild automatically on startup. This may take a few extra minutes on first load.
Cache folder path
%localappdata%\FiveM\FiveM.app\cache
priv or any folder outside of cache. Doing so may require you to re-link your FiveM account.Updating Server Artifacts
General Guide
FiveM server artifacts are the core server binaries. Keeping them up to date ensures compatibility with new game builds and security patches.
Steps
- 1Visit the artifacts page for your OS and download the latest recommended build.
- 2Stop your FiveM server completely before making any file changes.
- 3Back up your current artifact files by copying them to a separate folder. This lets you roll back if something breaks.
- 4Extract the new artifact files into your server root directory, overwriting the existing binaries.
- 5Start your server and verify the updated version number appears in the server console output.
Artifact download links
Windows: https://runtime.fivem.net/artifacts/fivem/build_server_windows/master/ Linux: https://runtime.fivem.net/artifacts/fivem/build_proot_linux/master/
SWR Fire Notify
Fire & EMS Station Tone-Out + Bay Door System
Fire and EMS station tone-out and bay door system for Night ERS. When a player accepts a fire or EMS callout, tones go out at the nearest station that serves that department and that station's bay doors open automatically. Tones are fully positional 3D: they play at the station's coords with distance fade and stereo pan, so any player near the station hears them too.
- Fire callouts → fire tone at the nearest station with
services.fire = true - EMS callouts → EMS tone at the nearest station with
services.ems = true - A call needing both departments tones both (each at its own nearest station)
- Doors at every toned station swing open and stay open until commanded closed
How It Works
Night ERS fires a server event when a callout is accepted: ErsIntegration::OnAcceptedCalloutOffer. This resource listens to that event, no edits to ERS are needed. On accept: match the callout to fire/EMS → find the nearest station serving each → every client near that station plays the tone positionally → the station's bay doors open for everyone.
Framework Modes
| Mode | Trigger | Command Restrictions |
|---|---|---|
'ers' | Night ERS callout accept (default) | None |
'esx' | Night ERS callout accept | Door/test commands limited to Config.AllowedJobs (ESX jobs) |
'qbcore' | Night ERS callout accept | Same, via QBCore jobs |
'standalone' | Any SmartFires callout, no ERS needed | None |
In standalone mode the fire tone plays and doors open at the station nearest to the fire itself the moment a SmartFires callout spawns. Set Config.SmartFiresAnyFire = true to also activate for every fire SmartFires creates; the station cooldown is then the only spam limiter.
Requirements
- Night ERS (for
ers/esx/qbcoremodes) or SmartFires (standalonemode). That's it. No xsound or other audio resource needed.
Installation
- 1Copy the folder into your
resourcesdirectory (e.g.resources/[local]/cfx-swr-fire-notify). - 2Put your tone files in
html/sounds/: .ogg recommended (or .mp3). Ships expectingfd-tone.ogg(fire),ems-tone.ogg(EMS) andtest-tone.ogg(test command). - 3Open
config.lua: set your stations inConfig.Stations(vector4 coords withservices = { fire = ?, ems = ? }), confirm tone filenames inConfig.Departments.*.tones, and tune volume / distance settings. - 4Register your bay doors in-game using
/registerdoors(see Station Bay Doors below). - 5Add to
server.cfg:ensure night_ers ensure cfx-swr-fire-notify
Commands
| Command | What it does |
|---|---|
/teststationtones | 3D test tone at your nearest station (pre-shift readiness check). |
/openbay [bay number] | Open one bay door at your nearest station. |
/openallstationdoors | Open every door at your nearest station. |
/closeallstationdoors | Close every door at your nearest station. |
/registerdoors | Toggle door-registration mode (see Station Bay Doors below). |
/stoptones | Instantly silence every tone on your client. |
/tonesdiag | Dump audio engine state including each tone's live volume/pan. |
Command names are configurable in config.lua.
Test Tone (Pre-Shift Readiness)
Run /teststationtones at your station. It plays Config.TestTone positionally at your nearest station, exactly like a real callout tone, so any crew near the station hears it too. Walk toward/away and turn around to hear the distance fade and stereo pan, then tune with Config.AudibleDistance, Config.FullVolumeDistance and Config.FalloffExponent.
Config.AudibleDistance of the station. If a tone seems silent, you are too far away.Trigger the same test from your own resource:
-- Server side (you have the player's server id):
exports['cfx-swr-fire-notify']:TestStationTones(playerId)
-- Client side (from a readiness UI/button):
TriggerServerEvent('swr-fire-notify:testStationTones')Station Bay Doors
Bay doors auto-open at the toned station on callout accept (Config.OpenDoorsOnAccept) and stay open until commanded closed. States sync to every player including late joiners. Doors are held closed and locked by default.
- 1Run
/registerdoorsto toggle registration mode. - 2Stand near the station, aim at the bay door, and fire an empty weapon (0 ammo, loaded weapons are refused).
- 3A ready-to-paste line prints to the F8 console with the station auto-filled:
{ station = 2, door = 0, model = -1420538493, coords = vector3(1189.42, -1481.30, 35.01) }, -- SET door = bay number! - 4Change
door = 0to the bay number you want (that's the[bay number]for/openbay), paste the line intoConfig.Doors, restart the resource. - 5If a door opens the wrong direction, add
ratio = -1.0to its line.
Audio File Format
Export from Audacity: File > Export > Export as OGG (recommended) or Export as MP3. Lowercase filenames, no spaces, into html/sounds/, then list them in the relevant department's tones array. Multiple files = random pick each tone-out. .ogg, .mp3 and .wav all decode through the Web Audio API. .ogg is the best size/quality trade-off.
Key Config Options
| Option | Meaning |
|---|---|
Config.Framework | 'ers' / 'esx' / 'qbcore' / 'standalone' (see Framework Modes above). |
Config.AllowedJobs | ESX/QBCore: jobs allowed to use door and test commands. |
Config.SmartFiresAnyFire | standalone: activate for every fire, not just SmartFires callouts. |
Config.Stations | vector4 stations + services = { fire, ems } flags. |
Config.Departments.<dept>.tones | Tone filename(s) in html/sounds/. Multiple = random each time. |
Config.Departments.<dept>.calloutIds | Callout IDs for that department (pre-filled from Night ERS). |
Config.Volume | Volume at the station (0.0–1.0). |
Config.AudibleDistance | How far (m) the tone carries before fading to silence. |
Config.FullVolumeDistance | Within this many metres of the station = full volume; fade starts beyond it. |
Config.FalloffExponent | Fade curve steepness. 1 = linear, higher = quicker drop-off. |
Config.StationCooldown | Seconds before the same station+dept can tone again. |
Config.OpenDoorsOnAccept | Auto-open the toned station's bay doors on callout accept. |
Config.Doors | Bay door list: paste lines from /registerdoors. |
Config.TestTone | Sound file used by /teststationtones. |
Config.OnlyRequiredFlag | true = match departments only by ERS's required flags, ignore id lists. |
Config.UseCalloutLocation | true = nearest station to the incident instead of the player. |
Config.Debug | Verbose logging (server console + F8) for setup/troubleshooting. |
First-Time Setup Tip
Config.Debug = true, accept a fire/EMS callout in-game, and watch the server console. It prints the exact calloutData your ERS sends, which department(s) matched, and which station was chosen. Turn it off once setup is confirmed.Troubleshooting
- No sound at all? Confirm filenames in
Config.Departments.*.tonesexactly match files inhtml/sounds/. A missing file prints atone "..." failedline in F8./tonesdiagshould reportrunning. - Tone seems silent? You are outside
Config.AudibleDistance; all tones are positional. - Wrong callouts toning? Adjust department
calloutIdslists, or setConfig.OnlyRequiredFlag = trueto trust only ERS's flags. - Station tones for wrong department? Fix its
servicesflags. - Fade feels too gradual or abrupt? Raise/lower
Config.FalloffExponentand adjustConfig.FullVolumeDistance. - Door won't budge / moves wrong way? Re-register it, or add
ratio = -1.0to its entry inConfig.Doors. - /registerdoors says "No door object hit"? Aim at the center of the door panel (not the frame/wall) within ~40m and fire again.
Escrow
fxmanifest.lua is Cfx.re asset-escrow ready: config.lua, html/sounds/** and documentation stay open/editable after upload; scripts get encrypted when processed by the Cfx.re portal.
CVE V2
Coming SoonCommercial Vehicle Enforcement V2
CVE V2 is the next generation of our Commercial Vehicle Enforcement script. It introduces enhanced weigh station mechanics, full DOT inspection workflows, a configurable violation and fine system, and deep framework integration, built for realistic LEO and DOT roleplay on any FiveM server.
In Development
Full documentation, configuration reference, and installation guide will be published here when CVE V2 releases. Join our Discord to be notified first.
AI Towing V2
Coming SoonAI Towing V2
AI Towing V2 is a complete rebuild of our original AI Towing script. V2 features smarter NPC dispatch logic, multi-vehicle tow support, fully configurable tow zones and cooldowns, and native integration with popular FiveM frameworks like ESX and QBCore.
In Development
Full documentation, configuration reference, and installation guide will be published here when AI Towing V2 releases. Join our Discord to be notified first.
Can't find what you need? Ask in our community.
Join Discord