Skip to content

A3D_GetWaterLevel

imshooter edited this page Oct 17, 2026 · 1 revision

Find the height of the water at a point of the map.

Where two pools cover the point, the higher one counts. Past the edges of the map lies the sea at 0.0, as in the game. The level is that of calm water, without waves.

native bool:A3D_GetWaterLevel(Float:x, Float:y, &Float:level);

Parameters

Parameter Description
Float:x Point on the X axis.
Float:y Point on the Y axis.
&Float:level Height of the surface of the water.

Returns

  • true when water covers the point.
  • false when no water covers it, or the database has no water.

Remarks

The water is the 307 polygons of water.dat in the map database. The level ignores what stands over the point, so a point under a roof or inside a building near a pool still gets the level of the pool. A3D_IsPointInWater checks that the point really is in the water.

A call costs about 0.2 microseconds.

Example

Puts a boat on the water where a player stands on a pier.

stock SpawnBoatHere(playerid) {
    new
        Float:x,
        Float:y,
        Float:z,
        Float:level
    ;

    GetPlayerPos(playerid, x, y, z);

    if (!A3D_GetWaterLevel(x, y, level)) {
        return INVALID_VEHICLE_ID;
    }

    return CreateVehicle(473, x, y, level + 0.5, 0.0, -1, -1, 60);
}

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