Skip to content

A3D_GetMaterialFlags

imshooter edited this page Oct 17, 2026 · 1 revision

Find what the game says of a surface, such as whether bullets pass through it or it is sand, glass or stairs.

native A3D_MATERIAL:A3D_GetMaterialFlags(material);

Parameters

Parameter Description
material Surface to read.

Returns

  • The flags of the surface.
  • A3D_MATERIAL:0 when there is no such surface, or the database has no surfaces.

Remarks

Each flag is a column of surfinfo.dat that is not zero for the surface. Surfaces lists the flags of every surface. The ones scripts use most:

Flag Meaning
A3D_MATERIAL_SHOOT_THROUGH Bullets pass through, as through a chain fence.
A3D_MATERIAL_SEE_THROUGH Sight passes through, as through a fence or glass.
A3D_MATERIAL_GLASS The surface is glass.
A3D_MATERIAL_STAIRS The surface is a step of stairs.
A3D_MATERIAL_SAND The surface is sand.
A3D_MATERIAL_WATER The surface is water, such as a fountain.
A3D_MATERIAL_NO_SPRINT Players cannot sprint on it.
A3D_MATERIAL_CLIMBABLE Players can climb it.

Example

A shot that goes through chain fences and stops at the first wall.

stock bool:GetShotEnd(Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2, &Float:endX, &Float:endY, &Float:endZ) {
    new
        Float:x[16],
        Float:y[16],
        Float:z[16],
        A3D_HIT:types[16],
        hitids[16],
        materials[16],
        count = A3D_RayCastAll(x1, y1, z1, x2, y2, z2, x, y, z, types, hitids, materials)
    ;

    for (new i; i != count; ++i) {
        if ((A3D_GetMaterialFlags(materials[i]) & A3D_MATERIAL_SHOOT_THROUGH) != A3D_MATERIAL:0) {
            continue;
        }

        endX = x[i];
        endY = y[i];
        endZ = z[i];

        return true;
    }

    return false;
}

Related

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