Overview
drs_vehcontrol is a standalone-first vehicle utility with a class-aware touchscreen for occupants and a nearby smart key fob for the last vehicle driven. It covers ordinary vehicle systems, specialized road/marine/air controls, optional provider bridges, validated synchronized state, and a public integration API.
Requirements
- Base
- FiveM; no mandatory framework dependency
- Resource name
- Must remain drs_vehcontrol
- Shared state
- OneSync and networked vehicles
- Optional
- Qbox, QBCore, ox_lib, vehicle keys, San Andreas Radio
Installation
Place the resource in the server resources directory with the exact drs_vehcontrol folder name.
Start any optional framework, key, notification, or San Andreas Radio resources before drs_vehcontrol.
Review config.lua for commands, controls, passengers, restricted classes, key checks, synchronization, and aircraft behavior.
Start the resource, test U and K, then validate representative road, marine, aircraft, addon, and remote-fob behavior before production use.
Configuration
Set locale, commands, and keys
Keep the folder name drs_vehcontrol. Commands and registered key mappings can be changed in config.lua; players can then rebind them through FiveM settings. Included locales are en, cs, de, es, fr, nl, pt-br, and tr.
Config.Locale = 'en'
Config.Command = 'vehcontrol'
Config.DefaultKey = 'U'
Config.KeyFob.Command = 'keyfob'
Config.KeyFob.DefaultKey = 'K'Choose controls and passenger permissions
Config.Controls enables engine, locks, doors, windows, seats, radio, hazards, interior light, cruise, autopilot, anchor, landing gear, trailer, roof, and extras independently. Passengers are allowed by default only for the configured doors, seats, and windows actions. Headlights and turn signals are intentionally not included.
03Tune cruise safety
Set minimum and maximum speed, limiter behavior, steering correction, collision cancellation, adaptive following distance, recovery rate, and optional QB/Qbox cruise-resource conflict detection. Cruise cancels on configured braking, damage, collision, seat, engine, and control conditions.
04Configure plane and helicopter assistance
Autopilot requires a waypoint, supported aircraft, driver control, a running vehicle, minimum height, and plane speed where applicable. Planes maintain a terrain-aware orbit near arrival; helicopter waypoint travel uses bounded horizontal and vertical controllers. Utility Hover captures a fixed helicopter position, heading, world height, and surface clearance.
Select key ownership behavior
Standalone mode can allow fob use without keys. Auto and explicit providers support Qbox, QB, QS, Wasabi, 0r, MSK, Dusa, Renewed, runtime registration, or a custom Config.KeyFob.HasKey function. Start the selected resource first and test its exact API.
Config.KeyFob.RequireKey = true
Config.KeyFob.KeyProvider = 'auto'
Config.KeyFob.MaxDistance = 35.0Restrict classes and correct addon models
Config.RestrictedVehicleClasses disables the UI by GTA class. Config.VehicleOverrides can enable or hide controls, fob actions, doors, windows, seats, extras, labels, and fob range for a lowercase spawn name or model hash when native detection is wrong.
Configure network synchronization
Networked auxiliary state uses a server-owned entity state bag with state-name filtering, entity and player-distance validation, rate limiting, and an optional server CanUpdate policy. OneSync and networked vehicles are required.
Config.NetworkSync = {
Enabled = true,
StateBagName = 'drs_vehcontrol',
ServerValidationDistance = 50.0,
ServerRateLimit = 100,
States = {
anchor = true,
hazards = true,
interiorLight = true,
radio = true,
windows = true
}
}Select notifications and optional radio audio
Notification providers include standalone, auto, QB, Qbox, ox_lib, and custom. When san_andreas_radio is running, the Radio control also sends its synchronized power event. Qbox audio can play fob sounds when available, with native FiveM audio as fallback.
Usage and validation
Open the touchscreen in a supported vehicle
Press U or run /vehcontrol. The resource resolves the vehicle, class, seat, available doors/windows/seats/extras, current state, and any per-model override before presenting controls. Normal driving or flight input remains available while the touchscreen is open.
Use the nearby smart key fob
After driving a vehicle, stand within the configured range and press K or run /keyfob. The fob rechecks entity existence, distance, network control, model permissions, and ownership after its click animation before the action executes.
Operate specialized classes
Lower a boat anchor only below the configured speed and in a safe position; control retractable landing gear where supported; detach an attached trailer; operate roofs and extras; and treat all aircraft assistance as a tested opt-in feature.
Personalize the interfaces
The touchscreen Settings page stores accent color, UI brightness, photo darkness, position, and 65–100% scale locally. The fob can move independently and cycles through 62–116% scale.
Diagnose a custom model
Enable Config.Debug and run /vehcontroldebug in or near the last vehicle. The F8 output reports model, class, network, key provider, override, controls, doors, windows, seats, extras, and synchronized state.
Control coverage
Everyday controls
Engine, lock state, individual doors and windows, all-window actions, seats, radio power, hazards, interior light, cruise, convertible roofs, and model extras are resolved against seat permissions and vehicle capabilities.
Marine, air, and commercial controls
Boats can expose anchoring, supported aircraft can expose landing gear and experimental waypoint/hover assistance, and vehicles with an attached trailer expose a detach action.
Remote fob behavior
Class-matched fob frames wrap engine, locking, trunk, window, panic, locate, and expanded actions when the current vehicle and configured ownership policy allow them.
Validation and shared state
Action validation
Cooldowns, seat permissions, entity validation, distance, key ownership, model capability, network control, and the post-animation fob recheck limit unsafe or stale actions. Core validation remains active even when optional cooldown enforcement is disabled.
State-bag ownership
The server sanitizes allowed patches before writing the drs_vehcontrol state bag. Config.NetworkSync.CanUpdate can add server-side job, key, or ownership policy without moving authority to the client.
Troubleshooting
The touchscreen does not open
Confirm ensure drs_vehcontrol completed, the player is inside a supported class, Config.RestrictedVehicleClasses allows it, and /vehcontrol produces no client or NUI error.
The fob reports no key or no signal
Confirm the target is the last vehicle driven, move within Config.KeyFob.MaxDistance, start the selected key provider first, and verify its provider name or custom API. Use standalone with RequireKey=false only when unrestricted remote use is intended.
Controls open but another resource wins
Identify any resource continuously writing the same engine, cruise, radio, window, hazard, or light state. Disable the conflicting drs_vehcontrol control or synchronized-state entry so one resource remains authoritative.
Aircraft assistance cancels or behaves poorly
Verify the waypoint, altitude, plane speed, supported class, engine, damage, driver seat, manual-input thresholds, controller Enabled values, terrain clearance, and handling data. Disable the feature for models that do not pass controlled in-game testing.
Reference
Client exports
Open and close either interface, query the current UI and vehicle state, manage the last vehicle, inspect diagnostics, write allowed synchronized state, or register a runtime key check.
exports.drs_vehcontrol:Open()
exports.drs_vehcontrol:Close()
exports.drs_vehcontrol:Toggle()
exports.drs_vehcontrol:OpenKeyFob()
exports.drs_vehcontrol:CloseKeyFob()
local isOpen = exports.drs_vehcontrol:IsOpen()
local openState = exports.drs_vehcontrol:GetOpenState()
local vehicleState = exports.drs_vehcontrol:GetVehicleState()
local fobState = exports.drs_vehcontrol:GetKeyFobState()
local diagnostics = exports.drs_vehcontrol:GetVehicleDiagnostics(vehicle)
local lastVehicle = exports.drs_vehcontrol:GetLastVehicle()
exports.drs_vehcontrol:SetLastVehicle(vehicle)
exports.drs_vehcontrol:SetSyncedState(vehicle, { hazards = true })
exports.drs_vehcontrol:RegisterKeyCheck(function(vehicle, plate, modelName)
return true
end)
exports.drs_vehcontrol:ClearKeyCheck()Client events and action feed
The public client events open or close the interfaces, set the last vehicle, or run diagnostics. drs_vehcontrol:client:action emits the completed action with vehicle, network id, plate, and action-specific details for companion integrations.
TriggerEvent('drs_vehcontrol:client:open')
TriggerEvent('drs_vehcontrol:client:close')
TriggerEvent('drs_vehcontrol:client:openKeyFob')
TriggerEvent('drs_vehcontrol:client:setLastVehicle', netId)
TriggerEvent('drs_vehcontrol:client:debug')
AddEventHandler('drs_vehcontrol:client:action', function(payload)
print(payload.action, payload.vehicle, payload.netId, payload.plate)
end)Server state exports
Server resources can apply an allowed synchronized-state patch or read the current sanitized state using an entity or network id.
exports.drs_vehcontrol:SetVehicleState(vehicleOrNetId, {
hazards = true,
interiorLight = false,
radio = true,
windows = { [0] = false, [1] = false }
})
local state = exports.drs_vehcontrol:GetVehicleState(vehicleOrNetId)- No framework dependency is declared in the manifest. Qbox, QBCore, ox_lib, key providers, Qbox audio, and San Andreas Radio are optional bridges.
- The public main branch identifies version 1.3.2 but currently has no GitHub tag or release. Pin the tested commit used by your server.
- The DrSnyder No-Resale License permits free use, modification, and sharing while prohibiting resale, paid packs, paid bundles, and removal of the license notice.
- Interface scale, position, accent, brightness, and photo visibility are stored locally per player rather than as server configuration.