Entities, Pools, and World
Working with client-side entities, pools, world state, and stream-aware entity access.
Entities, Pools, and World
Use this page when you are working with client-side RAGE-compatible entities, pools, synced entity data, and world state.
Use `netId` for cross-side vehicle references
When you send a vehicle to the server, pass vehicle.netId instead of vehicle.id. The id value is local to the current side, so it will not work reliably on the other side.
atRemoteIdAsync
Use atRemoteIdAsync() when an entity may not be streamed yet and you need to safely get its remote ID.
const remoteId = await entity.atRemoteIdAsync();
console.log(remoteId);Prefer async lookup for streamed entities
Direct remote-ID access can fail when an entity is not streamed yet. Prefer atRemoteIdAsync() in async flows.
mp.objects.new
On the client side, mp.objects.new accepts an isNetwork option to control whether the object is synced with other clients.
isNetwork: truecreates a networked object that can stream in and out for other clients.isNetwork: falsekeeps the object local to the current client, so it will not stream in or out for other players.
const object = mp.objects.new(
mp.joaat('prop_beachball_02'),
new mp.Vector3(0, 0, 72),
{
isNetwork: true,
},
);Vehicle handling fields
vehicle.getHandling(field) and vehicle.setHandling(field, value) resolve the correct underlying native automatically from the field name, using the GTA CHandlingData Hungarian-notation prefix:
vec…fields (for examplevecCentreOfMassOffset,vecInertiaMultiplier) are vectors —getHandlingreturns anmp.Vector3, andsetHandlingaccepts anmp.Vector3, a{ x, y, z }object, or a[x, y, z]array.n…fields (for examplenInitialDriveGears) are integers.- Everything else (the
f…fields, for examplefInitialDriveMaxFlatVel,fSteeringLock) is a float.
const force = vehicle.getHandling('fInitialDriveForce'); // number
const com = vehicle.getHandling('vecCentreOfMassOffset'); // mp.Vector3
vehicle.setHandling('fInitialDriveForce', 0.5);
vehicle.setHandling('vecCentreOfMassOffset', new mp.Vector3(0, 0, -0.2));Vector fields extend the RAGE:MP surface
RAGE:MP types getHandling as number | string and does not return a usable Vector3 for vec… fields. This bridge returns a real mp.Vector3 for them so you can read and write CHandlingData vectors directly; numeric and string values behave the same as on RAGE:MP. str… flag fields are read as floats (rarely needed).