Vehicle Scripts
ds-4x4script
🚗 ds-4x4script – Full Reworked
ds-4x4script is a customizable drivetrain system for FiveM servers. Players can switch between FWD, RWD, AWD, and 4WD in real time, with optional automatic 4WD for suitable vehicles.
Fully compatible with ESX, QBCore, and QBox, with support for multiple notification and menu systems, plus a modern Built-in UI with themes and movable HUD/menu.
✨ Features
🔹 Switch drive modes: FWD, RWD, AWD, 4WD with correct drive bias
🔹 Automatic 4WD toggle for all non-bike vehicles (bikes, boats, planes, helicopters, trains excluded)
🔹 NUI HUD showing current drive mode; Edit UI to move HUD/menu and change size
🔹 Design themes – Default, Light, Blue, Carbon, and many more; customizable look
🔹 Menu: Built-in, qb-menu, or ox_lib
🔹 Notifications: Built-in, ox_lib, qbcore, qbox, esx, okokNotify, mythic_notify
🔹 Storage: JSON (
data/modesaves/) or MySQL (oxmysql) for drive modes and UI positions🔹 Per-vehicle saved drive modes; persists after server restart
🔹 Multi-framework: Auto-detects ESX, QBCore, or QBox
🔹 Localization: EN, DE, ES, FR, IT, PT, PL, NL, TR, RU, CS, SV, NO, DA, FI, JA, ZH, KO
⚙️ Installation
Place the ds-4x4script folder into your resources directory (e.g.
[scripts]/ds-4x4script).Add to your
server.cfg:
ensure ox_lib
ensure oxmysql # only if using MySQL storage
ensure ds-4x4script
- If using MySQL storage: run the SQL files in your database:
sql/ds_drivetrain_modes.sqlsql/ds_drivetrain_ui_players.sql
- Configure the script in
config/main/config.lua(framework, locale, storage, notifications, etc.).
🔧 Configuration
All options are in config/main/config.lua.
Framework
Config.Framework = "auto" -- Options: "auto", "esx", "qbcore", "qbox"
"auto" – Automatically detects ESX, QBCore, or QBox (recommended)
"esx" / "qbcore" / "qbox" – Force a specific framework
Locale
Config.Locale = "en" -- e.g. "en", "de", "es", "fr", "it", "pt", "pl", "nl", "tr", "ru", "cs", "sv", "no", "da", "fi", "ja", "zh", "ko"
Storage
Config.Storage = "json" -- "json" (file in data/modesaves/) or "oxmysql" (MySQL, requires oxmysql)
Default settings
Config.DefaultMode = "4WD" -- Default when no save: "RWD", "FWD", "AWD", "4WD"
Config.DefaultAutoFourWD = false -- Auto 4WD for all non-excluded vehicles
Menu system
Config.Menu = {
System = "Built-in" -- Options: "Built-in", "ox_lib", "qb-menu"
}
Notifications
Config.Notifications = "Built-in" -- Options: "Built-in", "ox_lib", "qbcore", "qbox", "esx", "okokNotify", "mythic_notify"
Config.NotifyDuration = 5000 -- Duration for Built-in toasts (ms)
🎮 Usage
Command:
/drivemenuKeybind: F6 (default)
Open the menu while driving (as driver) to switch drive modes or toggle automatic 4WD.
Use Edit UI to move the HUD and menu and change their size; use Design to choose a theme.
📋 Requirements
Framework: ESX, QBCore, or QBox
Dependencies:
ox_lib (required)
oxmysql (optional; only if
Config.Storage = "oxmysql")qb-menu (optional; only if using qb-menu for the menu)
🛠️ Framework support
ESX – Auto-detected when
es_extendedis runningQBCore – Auto-detected when
qb-coreis runningQBox – Auto-detected when
qbx_coreis running
Use Config.Notifications and Config.Menu.System to match your preferred notification and menu systems.
📝 Notes
Drive mode is saved per vehicle plate and persists across restarts.
Motorcycles, bicycles, boats, planes, helicopters, and trains are excluded from automatic 4WD.
Saved drive mode is applied automatically when entering a vehicle.
With Built-in menu, players can move and resize the HUD and menu and save their positions.