Drive-by System
This is a step-by-step installation guide, configuration preview, and full explanation of all settings for legends_driveby.
If you lack programming experience, ensure you read each step thoroughly without skipping, as all documentation is essential!
Before submitting a support ticket or following the guides in this documentation, please make sure that you are running the latest version of the resource.
What is legends_driveby?
legends_driveby is an advanced drive-by shooting system (V2) that allows passengers in vehicles to lean out and shoot with realistic positioning. Players can toggle drive-by mode with a keybind, allowing them to aim and shoot from their vehicle seat with proper body positioning and camera control.
Key Features
- Realistic Positioning - Players lean out of their seats with configurable offsets per vehicle
- POV Camera Control - Optional forced first-person view during drive-by for immersion
- Vehicle Whitelist/Blacklist - Control which vehicles can use the drive-by system
- Vehicle Class Blocking - Automatically block motorcycles, planes, helicopters, etc.
- Per-Vehicle Offsets - Configure unique positioning for specific vehicle models
- FiveM Keymapping - Players can customize their keybind in FiveM settings
- Standalone - No dependencies required
Need help? Join our Discord (opens in a new tab) for support!
FAQ
How do I add a custom lean offset for an add-on vehicle that does not fit the defaults?
Open config.lua and append an entry to Config.VehicleOffsets keyed by the vehicle model name (hash or spawn name). Provide per-seat offsets for x, y, z lean distance and rotation. The resource falls back to the class-based default when no explicit entry matches, so you only override the vehicles that look wrong.
How do I block driveby for specific weapons (RPGs, miniguns)?
Populate Config.BannedWeapons with weapon hashes or GetHashKey() strings. The client checks the hash before entering the driveby stance and simply refuses to draw. Useful for keeping rocket launchers out of drive-by play while leaving pistols and SMGs enabled.
Does driveby work from the back seat of 4-door vehicles and for passengers?
Yes. All four seats are wired up when a Config.VehicleOffsets entry includes seat 1, 2 and 3 alongside the driver (0). For vehicles without explicit back-seat offsets the resource falls back to the class default, so most 4-door sedans work without any extra config.
Why does my character rubber-band back into the seat occasionally?
That is caused by another script calling ClearPedTasks or TaskLeaveVehicle during the lean animation. Check the conflict list in config.lua and add the offending resource name. legends_driveby re-enters the driveby task on the next frame, so the visual jitter is cosmetic, not a mechanical bug.
How do I tune the max lean distance for realism vs. cinematic style?
Each vehicle entry has a leanScale multiplier (default 1.0). Raise it for cinematic gang RP or lower it to keep drivebys looking grounded. Global Config.MaxLeanScale caps every vehicle so a single setting can clamp outliers.