world-vehicles
world-vehicles
world-vehicles lets mp.vehicles.new create server-side vehicles anywhere on the map, even where no player is nearby — the way it works on RAGE:MP.
Side
Default
Enable name
bridge_world_vehiclesNeeds
Why it exists
On FiveM, a server-created entity needs a client to own and stream it. Plain CreateVehicle returns 0 when no player is within ~424 units of the spawn point, so mp.vehicles.new would return null for vehicles spawned far from everyone. RAGE:MP has no such limit. This plugin closes that gap.
Enable it
The plugin is off by default. Turn it on by adding one line to the bridge resource (recommended) or to your gamemode resource manifest.
fx_version 'cerulean'
game 'gta5'
ragemp_bridge 'library'
bridge_world_vehicles 'yes'fx_version 'cerulean'
game 'gta5'
server_scripts {
'@ragemp-fivem-bridge/server.js',
'server/index.js',
}
bridge_world_vehicles 'yes'On start you will see a log line confirming the mode:
[plugin:world-vehicles] enabled (setter=yes)Use it
Nothing changes in your code. Call mp.vehicles.new with any position — including one far from every player.
// Spawns even with no players anywhere near Sandy Shores.
const veh = mp.vehicles.new('adder', new mp.Vector3(1850.0, 3680.0, 34.2), {
heading: 90.0,
numberPlate: 'WORLD',
});
console.log(veh.id, veh.netId); // a real vehicle, networked once it settlesWhen a player later drives into range, the engine streams the vehicle in and assigns that client as the controller automatically — you never assign controllers by hand.
Aircraft, boats and other types
The primary path uses CreateVehicleServerSetter, which needs the vehicle type. Common models are detected automatically, but for anything unusual pass an explicit vehicleType.
mp.vehicles.new('dinghy', waterPos, { vehicleType: 'boat' });
mp.vehicles.new('buzzard', heliPad, { vehicleType: 'heli' });Valid types: automobile, bike, boat, heli, plane, submarine, trailer, train, blimp. The default is automobile.
How it works
Primary — server setter. When CreateVehicleServerSetter is available (OneSync), the vehicle is created directly, with no player required, and persisted with orphan mode KeepEntity so the server keeps it while it has no owner.
Fallback — proximity retry. When the setter is unavailable, the vehicle is queued at its position and created the moment a player enters range. mp.vehicles.new returns a pending VehicleMp immediately; its handle is bound when it actually spawns.
Resolution events. On the fallback path the bridge fires vehicleSpawnResolved (success) or vehicleSpawnFailed (abandoned after ~60s with no player ever arriving).
mp.events.add('vehicleSpawnResolved', (veh) => {
console.log('deferred vehicle is now live:', veh.id, veh.netId);
});Persistence (orphan mode)
While enabled, world vehicles default to orphan mode 2 (KeepEntity) so the server does not delete them when no client owns them. Pass orphanMode explicitly to override per vehicle.
mp.vehicles.new('adder', pos, { orphanMode: 0 }); // let the engine clean it up normallyDisable it
Because it is opt-in, simply remove (or comment out) the bridge_world_vehicles line. Without the plugin, mp.vehicles.new behaves exactly as before: vehicles spawned with no nearby player return null with a warning.