Queries against the world as this client sees it.

Everything here is limited to what is streamed in. A client only has entities within a few hundred metres of the player, so allVehicles() means "vehicles I can currently see", never "vehicles on the server". For server-wide queries, ask the server.

var nearest = World.closestVehicle(LocalPlayer.coords(), 20.0);
if (nearest != null) nearest.repair();

Static methods

staticallPeds():Array<Ped>

Every ped streamed in on this client, players included.

staticallProps():Array<Prop>

Every world object streamed in on this client.

staticallVehicles():Array<Vehicle>

Every vehicle streamed in on this client.

@:value({ includePlayers : false, radius : 10.0 })staticclosestPed(position:Vector3, radius:Float = 10.0, includePlayers:Bool = false):Ped

The nearest ped to position within radius, or null.

Scans the streamed-in ped pool rather than calling GET_CLOSEST_PED, whose output parameter isn't reachable through the generated externs, and which can't exclude the player asking.

@:value({ flags : 70, radius : 10.0 })staticclosestVehicle(position:Vector3, radius:Float = 10.0, ?model:Hash, flags:Int = 70):Vehicle

The nearest vehicle to position within radius, or null.

Parameters:

model

Restrict to one model, or leave null for any.

flags

The game's search flags; 70 (the default) finds ordinary drivable vehicles including wrecks.

@:value({ useZ : true })staticinlinedistance(from:Vector3, to:Vector3, useZ:Bool = true):Float

Straight-line distance between two points.

@:value({ poolName : "CPed" })staticentitiesInRadius(position:Vector3, radius:Float, poolName:String = "CPed"):Array<Entity>

Every entity of the given pool within radius of position, nearest first.

@:value({ includeWater : false })staticgroundZ(position:Vector3, includeWater:Bool = false):Null<Float>

The ground height under position, or null when the collision there isn't streamed in.

Always check for null before using the result as a spawn height — a 0 fallback puts things at sea level, usually under the map.

staticpool(poolName:String):Array<Int>

Raw handles from one of the game's entity pools: "CPed", "CVehicle", "CObject" or "CPickup".

@:value({ includeWater : false })staticsnapToGround(position:Vector3, includeWater:Bool = false):Vector3

position snapped down onto the ground, or unchanged when the ground height can't be determined.