A world object on the server — crates, props, placeable scenery.

Named Prop rather than Object to stay clear of Haxe's own namespace and of the fivem.server.natives.Object extern.

Server-created props are visible to everyone and persist without a client nearby, which is what you want for anything gameplay-relevant. Purely decorative props are cheaper spawned client-side.

Static methods

staticcreate(model:Hash, position:Vector3):Prop

staticcreateNoOffset(model:Hash, position:Vector3):Prop

Spawns a prop with its origin exactly at position, skipping the game's model-offset correction — the form to use when restoring props from saved coordinates.

Constructor

new(handle:Int)

Inherited Variables

Defined by Entity

read onlyattachedTo:Entity

The entity this one is attached to, or null.

read onlycreatorResource:String

The resource that created the entity, if any.

read onlyexists:Bool

frozen:Bool

finalhandle:Int

The server-side entity handle.

heading:Float

read onlyhealth:Int

Current health. Read-only on the server — health is simulated by the owning client, so setting it means sending that client an event.

read onlymaxHealth:Int

read onlymodel:Int

read onlynetId:Int

The network ID — the entity reference to send to clients — or 0 if the entity has none yet.

Guarded, because the underlying native raises rather than returning a sentinel:

script error in native ...: Tried to access invalid entity: 131333

An entity the server just created is orphaned until a client comes into scope for it: it has a handle, but no network ID and no owner. A stale handle behaves the same way. Both cases read as 0 here instead of taking down the handler that asked.

The existence check alone is not sufficient — the native has been reported to raise even when DoesEntityExist says otherwise — so the call itself is also caught.

read onlyowner:Int

The server ID of the client that currently owns this entity, or -1 when nobody does.

Ownership decides which client simulates the entity, and therefore who must be told to change its health, tasks or physics.

rotation:Vector3

Rotation in degrees as (pitch, roll, yaw).

routingBucket:Int

The routing bucket this entity lives in.

Buckets are the server's instancing mechanism: entities and players in different buckets can't see or interact with each other at all. Bucket 0 is the default world.

read onlyspeed:Float

Speed in metres per second.

read onlystate:StateBag

The entity's replicated state bag.

read onlytype:EntityType

Inherited Methods

Defined by Entity

delete():Void

Deletes the entity. Unlike on the client this always works — the server is authoritative and doesn't need to negotiate ownership first.

inlinedistanceTo(point:Vector3):Float

inlinedistanceToEntity(other:Entity):Float

toString():String

@:value({ timeoutMs : 5000 })waitUntilNetworked(timeoutMs:Int = 5000):Bool

Blocks until the entity is registered on the server and has a network ID, returning whether it got one before timeoutMs elapsed.

Server-created entities do not exist immediately — they stay orphaned until a client is in scope. Anything that needs the network ID (sending it to a client, writing a state bag) has to wait for this first, which is what the create helpers do for you.

Returns false if no client ever comes into scope, or if the model was not valid for the entity type.