Skip to content

A3D_GetStats

imshooter edited this page Oct 17, 2026 · 1 revision

What the component has done since the server started.

native bool:A3D_GetStats(&active, &updates, &Float:milliseconds);

Parameters

Parameter Description
&active Bodies awake now: moving physics objects, zones, and the players, vehicles and actors in motion.
&updates Object updates sent to players.
&Float:milliseconds Time spent simulating and sending updates.

Returns

  • true when the numbers were written.

Remarks

updates counts the object changes sent since the server started, one for each move, stop or placement of an object, whatever the number of players who receive it.

milliseconds is the time spent simulating and working out the updates, without the callbacks the component calls. Read it twice and divide the difference by the seconds between the reads to get the cost per second. See Performance.

Example

Prints what the component spent in the last minute.

static
    gLastUpdates,
    Float:gLastMilliseconds
;

forward @Stats_Print();
public @Stats_Print() {
    new
        active,
        updates,
        Float:milliseconds
    ;

    A3D_GetStats(active, updates, milliseconds);
    printf("3DAndreas: %i bodies awake, %i updates and %.1f ms in the last minute", active, updates - gLastUpdates, milliseconds - gLastMilliseconds);
    gLastUpdates = updates;
    gLastMilliseconds = milliseconds;

    return 1;
}

public OnGameModeInit() {
    SetTimer("@Stats_Print", 60000, true);

    return 1;
}

Related

  • A3D_SetSyncError: Set how far the object players see may stray from the body before a new move is sent.
  • A3D_IsMoving: Whether a moving physics object is awake.

Home

Guides

Reference

Functions

Creating objects
Motion
Placement
Behaviour
Display and data
Rays
Shapes
Players, vehicles and actors
Map probes
Screen
Map objects
Water
Models and surfaces
Rotations and offsets
Vehicles
Callbacks

Clone this wiki locally