Skip to content

A3D_GetMaterialName

imshooter edited this page Oct 17, 2026 · 1 revision

Find the name the game gives a surface, such as TARMAC or GRASS_SHORT_LUSH.

native bool:A3D_GetMaterialName(material, name[], size = sizeof (name));

Parameters

Parameter Description Default
material Surface, as the natives that hit something give it.
name[] The name.
size Room in name. sizeof (name)

Returns

  • true when the name was written.
  • false when there is no such surface, or the database has no surfaces.

Remarks

The names are those of surfinfo.dat, such as TARMAC, GRASS_SHORT_LUSH or WOOD_SOLID. Surfaces lists all 179. Players carry PED and vehicles CAR.

A ColAndreas database has no surfaces, and the native returns false.

Example

Tells a player what they stand on.

stock TellGround(playerid) {
    new
        Float:x,
        Float:y,
        Float:z,
        Float:hitX,
        Float:hitY,
        Float:hitZ,
        A3D_HIT:type,
        hitid,
        material,
        name[32],
        message[64]
    ;

    GetPlayerPos(playerid, x, y, z);

    if (!A3D_RayCast(x, y, z, x, y, z - 3.0, hitX, hitY, hitZ, type, hitid, material, .flags = A3D_COLLIDE_MAP)) {
        return;
    }

    if (!A3D_GetMaterialName(material, name)) {
        return;
    }

    format(message, sizeof (message), "You stand on %s.", name);
    SendClientMessage(playerid, -1, message);
}

Related

  • A3D_GetMaterialFlags: Find what the game says of a surface, such as whether bullets pass through it or it is sand, glass or stairs.
  • A3D_RayCast: Find the first thing a segment between two points hits.

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