Full GTA Online mod support. GlobalState sync. Proximity-loaded peds. Server-verified transactions. Zero bullshit.
NPC mechanic peds, animated repairs, 60+ mod types, vehicle weapons, neon, wheels, colors โ all proximity-loaded, zero CNetObj overhead.
Built on ox_lib ยท ox_inventory ยท ox_target ยท oxmysql
Built by Red Dragon Elite | SerpentsByte
- Overview
- Features
- Dependencies
- Installation
- Configuration
- How It Works
- Admin System
- Developer API
- Database
- Performance
- Troubleshooting
- Changelog
- License
RDE Mechanic is a production-grade vehicle mechanic and tuner system for FiveM. Admins spawn NPC mechanic peds at any location โ players interact via ox_target to repair or fully tune their vehicle. Mechanic positions are synced via GlobalState and peds are proximity-loaded client-side โ zero server entities, zero CNetObj limits, instant sync for late-joining players with zero join-events needed.
The tuning menu covers every GTA Online mod type: engine, brakes, transmission, suspension, armor, turbo, body parts, wheels (15 types + 190 sport variants), paint (primary, secondary, pearlescent, wheel, interior, dashboard), neon, window tint, livery, interior mods, extras, and vehicle weapons. Prices are validated server-side. Transactions are protected by rate limiting and cooldowns.
| Feature | Generic Mechanic Scripts | RDE Mechanic |
|---|---|---|
| Sync method | Network events per player | โ GlobalState โ instant, zero join-events |
| Ped loading | All peds always loaded | โ Proximity-based LOD |
| Server entities | 1 per mechanic ped | โ Zero โ client-side local peds |
| CNetObj usage | 1 per ped | โ 0 |
| Mod coverage | Limited | โ All 60+ GTA Online mod types |
| Vehicle weapons | โ | โ MG, Missiles, Flamethrower, Minigun, Railgun, Laser |
| Price validation | Client-side | โ Server-side exploit-proof |
| Dynamic pricing | โ Fixed | โ Class multipliers (22 classes) |
| Tuning session | Closes after buy | โ Persistent โ menu stays open |
| Wheel selection | Basic | โ 15 types, 190 sport names, native label fallback |
| Color system | Basic | โ 166 colors, 7 categories, pearlescent + wheel |
| Multi-language | โ | โ EN + DE built-in |
| Nostr logging | โ | โ rde_nostr_log integration |
| Anti-exploit | โ | โ Rate limit + cooldown + server validation |
| ox_core | Required | โ Optional โ works without it |
| Performance | Variable | โ < 0.01ms idle |
- NPC Mechanic Peds โ Spawned by admins at any location, persistent across restarts via MySQL, proximity-loaded client-side
- Animated Repairs โ Mechanic walks to vehicle, opens hood, plays repair animation with sparks, closes hood and walks back to post
- Dynamic Repair Pricing โ Base price + damage multiplier + vehicle class multiplier (22 GTA vehicle classes)
- Full Tuning Menu โ All 60+ GTA Online mod types organized in 7 categories with Lucide icons
- Vehicle Weapons โ Machine Gun, Missiles, Flamethrower, Minigun, Railgun, Laser โ toggle-based, server-priced
- Wheel System โ 15 wheel types, 190 Sport variants with native GTA label fallback
- Color System โ 166 colors across 7 categories (Classic, Matte, Metallic, Utility, Worn, Special, Chrome), plus pearlescent, wheel, interior, dashboard
- Neon Lights โ 14 preset neon colors, enable/disable, RGB display in menu
- Window Tint โ 6 tint options
- Extras โ Dynamic extra detection per vehicle
- Persistent Tuning Session โ Menu reopens after every purchase, only closed explicitly with X
- GlobalState Sync โ Single
GlobalState.rde_mechanicskey replaces all per-player join events. Late-joining players auto-receive full mechanic state, norequestSyncneeded - Proximity Loading โ Client proximity loop reads GlobalState every tick, spawns peds within
renderDistance, despawns beyonddespawnDistanceโ hysteresis prevents flicker - Client-Side Peds โ Zero server entities, zero CNetObj limits, no network entity spawning
- Server-Side Price Validation โ Client sends mod type + vehicle class, server calculates and validates final price โ no spoofing
- StateBag Coordination โ
rde:repairing,rde:tuner,rde:busyprevent double-repairs and menu conflicts - Rate Limiting โ Max 15 purchases/minute per player, configurable
- Ground Detection โ
GetGroundZFor_3dCoord+PlaceObjectOnGroundProperlyfor correct ped placement - Async Model Streaming โ
lib.requestModelbefore spawn, never blocks - ox_lib Vehicle Properties โ
lib.getVehicleProperties/lib.setVehiclePropertiesfor correct mod persistence
- Multi-Language โ English + German built-in, easily expandable
- Lucide Icons โ Clean, consistent icon set throughout all menus
- Smart Notifications โ Contextual feedback with color-coded icons via ox_lib
- Debug Mode โ
/debugmechanicsshows GlobalState count vs. locally spawned count - Blip System โ Configurable map blip per mechanic
- Sound Effects โ Hood open/close, purchase confirmation
- Repair Particles โ Wrench sparks during repair animation
| Resource | Required | Notes |
|---|---|---|
| oxmysql | โ Required | Mechanic position persistence |
| ox_lib | โ Required | UI, callbacks, notifications, context menus |
| ox_inventory | โ Required | Money item (money) for transactions |
| ox_target | โ Required | Ped interaction |
Optional:
| Resource | Notes |
|---|---|
| ox_core | Group-based admin checking โ not required |
| rde_nostr_log | Event logging โ auto-detected, silent if missing |
cd resources
git clone https://github.com/RedDragonElite/rde_mechanic.git rde_mechanicensure oxmysql
ensure ox_lib
ensure ox_inventory
ensure ox_target
ensure rde_mechanic
# Optional
ensure ox_core
# Optional: ACE admin permissions
add_ace group.admin rde.mechanic.admin allow
add_ace group.superadmin rde.mechanic.admin allowOrder matters.
rde_mechanicmust start after all its dependencies.
The rde_mechanics table is created automatically on first start. No manual SQL import needed.
Edit config.lua to adjust language, prices, distances, proximity ranges, and admin permissions.
restart rde_mechanic
In-game as admin: /mechanics โ Create Mechanic โ spawns at your current position.
Config.DefaultLanguage = 'en' -- 'en' or 'de'
Config.Debug = {
enabled = false,
logRepairs = true,
logPurchases = true,
logAdminActions = true,
}Config.Performance = {
renderDistance = 150.0, -- spawn ped within this range
despawnDistance = 200.0, -- despawn beyond this (50m hysteresis gap)
proximityTick = 1000, -- check interval in ms
maxVisibleMechanics = 20, -- cap on simultaneously rendered peds
}Config.Distances = {
interactionRange = 8.0,
vehicleDetectionRange = 5.0,
repairPositionOffset = 2.5,
minMechanicDistance = 25.0,
maxMenuDistance = 10.0,
}Config.Repair = {
basePrice = 500,
pricePerDamage = 0.5,
maxPrice = 10000,
engineHealthThreshold = 950.0,
bodyHealthThreshold = 950.0,
minRepairTime = 5000,
maxRepairTime = 30000,
damageTimeMultiplier = 10,
}Config.Security = {
maxPurchasesPerMinute = 15,
repairCooldown = 5,
mechanicSpawnCooldown = 60,
validatePricesServerSide = true, -- never disable this
}Config.Admin = {
acePermission = 'rde.mechanic.admin',
oxGroups = { 'admin', 'superadmin', 'moderator', 'owner', 'dev' },
}- Walk up to a mechanic ped โ ox_target activates within interaction range
- Repair Vehicle โ Mechanic walks over, opens hood, animates with sparks, repairs progressively, closes hood, returns to post. Price scales with damage and vehicle class
- Modify Vehicle โ Opens the full 7-category tuning menu. Menu stays open after every purchase
- Pay with cash โ
moneyitem via ox_inventory
/mechanicsโ Admin panel โ Create Mechanic at current position/debugmechanicsโ GlobalState count vs. spawned count (F8 console)
โโโโโโโโโโโโโโโโโโโ GlobalState.rde_mechanics โโโโโโโโโโโโโโโโโโโโ
โ SERVER โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ CLIENT โ
โ โ โ โ
โ โข MySQL DB โ โ โข Proximity โ
โ โข BroadcastM() โ โ Loop (1s) โ
โ โข Price valid. โ โ โข SpawnMechanic โ
โ โข Rate limit โ โ โข DespawnMechanicโ
โ โข Admin auth โ โ โข ox_target โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ
Server stores data only โ no entities, no network peds.
One GlobalState:set('rde_mechanics', flat, true) on every create/delete.
Client proximity loop reads GlobalState every tick and handles all spawning.
Late-joining players need zero special handling โ GlobalState is always current.
Admin creates mechanic
โ Server: DB insert โ BroadcastMechanics() โ GlobalState updated
โ All clients: proximity loop sees new ID on next tick
โ Nearby clients: SpawnMechanic() โ local ped + blip + ox_target
โ Far clients: ID noted, ped spawns when player gets close
Player joins server
โ Proximity loop starts
โ GlobalState.rde_mechanics already populated โ no event needed
โ First tick: all nearby mechanics spawn automatically
Admin access is verified server-side via two methods:
add_ace group.admin rde.mechanic.admin allowConfig.Admin.oxGroups = { 'admin', 'superadmin', 'moderator', 'owner', 'dev' }Every admin action (create, delete) is validated server-side before execution.
-- Read all mechanic positions
local mechanics = GlobalState.rde_mechanics
-- Returns: { ['1'] = { x, y, z, heading, model }, ['2'] = { ... }, ... }CREATE TABLE IF NOT EXISTS rde_mechanics (
id INT AUTO_INCREMENT PRIMARY KEY,
coords_x FLOAT NOT NULL,
coords_y FLOAT NOT NULL,
coords_z FLOAT NOT NULL,
heading FLOAT NOT NULL,
model VARCHAR(50) DEFAULT 's_m_m_autoshop_01',
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
INDEX idx_coords (coords_x, coords_y, coords_z)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;All positions loaded on server start, pushed to GlobalState. Zero per-player DB queries.
| Aspect | Traditional Approach | RDE Mechanic |
|---|---|---|
| Entity type | Server-side network peds | โ Client-side local peds |
| CNetObj usage | 1 per mechanic ped | โ 0 |
| Sync on join | Network event per player | โ GlobalState โ automatic |
| Rendering | All peds always loaded | โ Proximity-based LOD |
| Mechanic Peds | Client Impact | Server Impact |
|---|---|---|
| 10 | Negligible | < 0.01ms |
| 50 | Negligible (only nearby spawned) | < 0.01ms |
| 100 | < 0.5% FPS | < 0.02ms |
- Zero server entities โ Client creates local peds, no server overhead
- Proximity culling โ Only peds within
renderDistanceare spawned - Hysteresis โ 50m gap between render/despawn prevents flicker
- GlobalState โ Single statebag update replaces N network events (N = player count)
- 1s tick โ Static NPCs don't need sub-second proximity checks
Mechanic peds not spawning after server restart?
Check that oxmysql starts before rde_mechanic. Enable Config.Debug.enabled = true and look for GlobalState broadcast โ X mechanics in txAdmin console.
Mechanic spawns but immediately despawns?
Player is outside renderDistance. Check Config.Performance โ renderDistance must be less than despawnDistance.
ox_target options not showing?
Ensure ox_target starts before rde_mechanic. Use /debugmechanics to confirm ped exists locally.
Repair animation but vehicle stays broken?
If buyer โ vehicle owner, server relays applyRepair to the owner. Verify both players are in the same session. Check F8 for network errors.
Price validation mismatch warnings in console?
Enable debug to see Price mismatch messages. Server auto-corrects to the real price โ no action needed unless mismatches are frequent.
Admin target not showing?
Admin status checked via lib.callback on target hover. Verify ACE or ox_core group config. If ox_core is not running, only ACE is checked.
| Command | Access | Description |
|---|---|---|
/mechanics |
Admin | Open admin panel โ create mechanic at current position |
/debugmechanics |
Debug | Print GlobalState count and locally spawned peds |
- GlobalState sync โ replaced per-player
requestSync/syncMechanicsevents entirely - Proximity loading โ client-side spawn/despawn loop with configurable render/despawn distance and hysteresis
- Zero server entities โ peds are local-only, zero CNetObj overhead
- Late-join zero-event โ joining players auto-receive mechanic state from GlobalState
Config.Performanceblock added (renderDistance, despawnDistance, proximityTick, maxVisibleMechanics)DespawnMechanic()โ correct cleanup for local peds + removed ox_target on despawndebugmechanicsupdated โ shows GlobalState count vs. spawned count- fxmanifest version bumped to 2.0.0
- Initial release
- NPC mechanic peds with animated 6-phase repair sequence
- Full 60+ mod type tuning menus with Lucide icons
- Server-side price validation + rate limiting + cooldowns
- StateBag coordination for repair conflict prevention
- Vehicle weapons support (MG, Missiles, Flamethrower, Minigun, Railgun, Laser)
- Multi-language EN + DE
- Nostr logging integration
- MySQL persistence with auto-table creation
- Fork the repository
- Create a feature branch:
git checkout -b feature/your-feature - Commit:
git commit -m 'Add your feature' - Push:
git push origin feature/your-feature - Open a Pull Request
Guidelines: follow existing Lua conventions, comment complex logic, test on a live server before PR, update docs if adding features.
###################################################################################
# #
# .:: RED DRAGON ELITE (RDE) - BLACK FLAG SOURCE LICENSE v6.66 ::. #
# #
# PROJECT: RDE_MECHANIC v2.0.0 (VEHICLE MECHANIC & TUNER FOR FIVEM) #
# ARCHITECT: .:: RDE โง Shin [โณ แแ
แฑแแ
แพแแ แแแแ
โฝ] ::. | https://rd-elite.com #
# ORIGIN: https://github.com/RedDragonElite #
# #
# WARNING: THIS CODE IS PROTECTED BY DIGITAL VOODOO AND PURE HATRED FOR LEAKERS #
# #
# [ THE RULES OF THE GAME ] #
# #
# 1. // THE "FUCK GREED" PROTOCOL (FREE USE) #
# You are free to use, edit, and abuse this code on your server. #
# Learn from it. Break it. Fix it. That is the hacker way. #
# Cost: 0.00โฌ. If you paid for this, you got scammed by a rat. #
# #
# 2. // THE TEBEX KILL SWITCH (COMMERCIAL SUICIDE) #
# Listen closely, you parasites: #
# If I find this script on Tebex, Patreon, or in a paid "Premium Pack": #
# > I will DMCA your store into oblivion. #
# > I will publicly shame your community. #
# > I hope your server lag spikes to 9999ms every time you blink. #
# SELLING FREE WORK IS THEFT. AND I AM THE JUDGE. #
# #
# 3. // THE CREDIT OATH #
# Keep this header. If you remove my name, you admit you have no skill. #
# You can add "Edited by [YourName]", but never erase the original creator. #
# Don't be a skid. Respect the architecture. #
# #
# 4. // THE CURSE OF THE COPY-PASTE #
# This code uses GlobalState, proximity loading, and server-side validation. #
# If you just copy-paste without reading, it WILL break. #
# Don't come crying to my DMs. RTFM or learn to code. #
# #
# -------------------------------------------------------------------------- #
# "We build the future on the graves of paid resources." #
# "REJECT MODERN MEDIOCRITY. EMBRACE RDE SUPERIORITY." #
# -------------------------------------------------------------------------- #
###################################################################################
TL;DR:
- โ Free forever โ use it, edit it, learn from it
- โ Keep the header โ credit where it's due
- โ Don't sell it โ commercial use = instant DMCA
- โ Don't be a skid โ copy-paste without reading won't work anyway
rde_mechanic/
โโโ fxmanifest.lua # Resource manifest
โโโ config.lua # All configuration, languages, prices, categories
โโโ client.lua # GlobalState listener, proximity loop, ped management, tuning menus
โโโ server.lua # GlobalState broadcast, DB, price validation, economy, admin
โโโ LICENSE # RDE Black Flag Source License v6.66
โโโ README.md # You're reading it
| ๐ GitHub | RedDragonElite |
| ๐ Website | rd-elite.com |
| ๐ต Nostr (RDE) | RedDragonElite |
| ๐ต Nostr (Shin) | SerpentsByte |
| ๐ด RDE Sleep | rde_sleep |
| ๐ฎ RDE Props | rde_props |
| ๐ช RDE Doors | rde_doors |
| ๐ฏ RDE Skills | rde_skills |
| ๐ก RDE Nostr Log | rde_nostr_log |
When asking for help, always include:
- Full error from server console or txAdmin
- Your
server.cfgresource start order - ox_lib / ox_inventory / ox_target versions
- Output of
/debugmechanicsin-game
"We build the future on the graves of paid resources."
REJECT MODERN MEDIOCRITY. EMBRACE RDE SUPERIORITY.
๐ Made with ๐ฅ by Red Dragon Elite