Skip to content

A3D_CreateZone

imshooter edited this page Oct 17, 2026 · 1 revision

Create a box shaped zone that reports moving physics objects entering and leaving it.

A zone stops nothing. A3D_OnEntered and A3D_OnLeft are called in the script that created it. An object that comes to rest inside the zone stays inside it until it moves out.

native Physic:A3D_CreateZone(
    Float:sizeX,
    Float:sizeY,
    Float:sizeZ,
    Float:x,
    Float:y,
    Float:z,
    Float:rx = 0.0,
    Float:ry = 0.0,
    Float:rz = 0.0,
    worldid = -1
);

Parameters

Parameter Description Default
Float:sizeX Size on the X axis.
Float:sizeY Size on the Y axis.
Float:sizeZ Size on the Z axis.
Float:x Position on the X axis.
Float:y Position on the Y axis.
Float:z Position on the Z axis.
Float:rx Rotation on the X axis. 0.0
Float:ry Rotation on the Y axis. 0.0
Float:rz Rotation on the Z axis. 0.0
worldid Virtual world it watches, or -1 for every world. -1

Returns

  • The zone.
  • INVALID_PHYSIC_ID when a size is not positive, or the world is full.

Remarks

A zone stops nothing and no query finds it. It only reports moving physics objects. Players, vehicles, actors and static objects never enter it.

A3D_OnEntered is called when an object starts to overlap the zone and A3D_OnLeft when it stops. An object that comes to rest inside a zone stays inside it, and its next move calls nothing until it leaves. A zone created over an object already inside calls A3D_OnEntered at the next step. The calls come after the step that saw the change, in the script that created the zone. The collision flags of the object do not matter, a zone sees every moving object of its world.

Use zones for goals, pockets, baskets and the edges of a play area.

Example

Counts the goals of a ball game.

static
    Physic:gGoal,
    gGoals
;

public OnGameModeInit() {
    gGoal = A3D_CreateZone(1.0, 7.3, 2.4, 1750.0, -2500.0, 13.75);

    return 1;
}

public A3D_OnEntered(Physic:zoneid, Physic:physicid) {
    if (zoneid != gGoal) {
        return 1;
    }

    new message[32];

    format(message, sizeof (message), "Goal number %i!", ++gGoals);
    SendClientMessageToAll(-1, message);

    return 1;
}

Related

  • A3D_CreateZoneSphere: Create a sphere shaped zone that reports moving physics objects entering and leaving it.
  • A3D_OnEntered: A moving physics object entered a zone.
  • A3D_OnLeft: A moving physics object left a zone.
  • A3D_DestroyObject: Destroy a physics object, a static object or a zone, and the global object that shows it.

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
Routes
Route display
Walking
Callbacks

Clone this wiki locally