Server-side world queries.

Unlike the client's World, this sees everything — the server has no streaming distance, so allVehicles() really is every vehicle in the session.

for (vehicle in World.allVehicles()) {
    if (vehicle.owner == -1) vehicle.delete();   // orphaned, clean it up
}

Static methods

staticallPeds():Array<Ped>

Every ped in the session, including every player's.

staticallProps():Array<Prop>

Every world object in the session.

staticallVehicles():Array<Vehicle>

Every vehicle in the session.

@:value({ radius : 50.0 })staticclosestVehicle(position:Vector3, radius:Float = 50.0):Vehicle

The closest vehicle to position within radius, or null.

staticdeleteOwnEntities():Void

Removes every entity this resource created that is still lying around.

Worth calling from a resource stop handler: server-created entities outlive their resource, so a restart otherwise leaves the previous run's vehicles and props scattered across the map.

@:value({ entityType : 1 })staticentitiesInRadius(position:Vector3, radius:Float, entityType:Int = 1, ?models:Array<Int>):Array<Entity>

Entities of one type within radius of position, nearest first.

Parameters:

entityType

1 peds, 2 vehicles, 3 objects.

models

Restrict to these model hashes, or leave null for any.