Skip to content

A3D_SetExtra

imshooter edited this page Oct 17, 2026 · 1 revision

Keep a number on a physics object, such as the item it stands for.

native bool:A3D_SetExtra(Physic:physicid, slot, value);

Parameters

Parameter Description
Physic:physicid Physics object to change.
slot Slot of the number, from 0 to 7.
value Number to keep.

Returns

  • true when the number was kept.
  • false when physicid is not a physics object, or slot is out of range.

Remarks

Every physics object holds eight numbers, from slot 0 to 7, which start at 0 and are cleared when the object is destroyed. They let a callback find what an object stands for without a search, such as the item it is, the player who threw it or a streamer object.

A tagged value is kept with _: and read back with its tag.

Example

Gives a thrown item back to its owner when it stops.

#define THROWN_ITEM 0
#define THROWN_BY 1

stock Physic:ThrowItem(playerid, itemid, Float:x, Float:y, Float:z) {
    new Physic:item = A3D_CreateBox(1271, 0.7, 0.8, 0.7, x, y, z, 0.0, 0.0, 0.0, 10.0);

    A3D_SetExtra(item, THROWN_ITEM, itemid);
    A3D_SetExtra(item, THROWN_BY, playerid);

    return item;
}

public A3D_OnStopped(Physic:physicid, Float:x, Float:y, Float:z) {
    new message[64];

    format(message, sizeof (message), "Your item %i landed.", A3D_GetExtra(physicid, THROWN_ITEM));
    SendClientMessage(A3D_GetExtra(physicid, THROWN_BY), -1, message);

    return 1;
}

Related

  • A3D_GetExtra: Read a number kept on a physics object with A3D_SetExtra.
  • A3D_OnCollided: A moving physics object hit something faster than its collision speed.
  • A3D_OnStopped: A moving physics object came to rest, or fell below 3dandreas.floor and was stopped there.

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