Skip to content

setFoliageSurface

Client-side

Available in Neon, not standard MTA

Changes which GTA surface type a foliage patch grows, rebuilding the native triangle.

Syntax

bool setFoliageSurface(foliage theFoliage, int surface)

Arguments

theFoliagefoliage

Foliage element.

surfaceint

Surface ID from 0 through 255 with plant properties defined.

Returns

true when the surface was accepted and the patch rebuilt; false for an out-of-range surface or one with no plant properties.

Ownership and lifecycle

A foliage element belongs to the resource that created it and joins its element group, so stopping the resource removes its patches without explicit cleanup. Every setter rebuilds the native triangle atomically and rolls back to the previous state when the new combination is rejected.

Important behavior
  • The rebuild is atomic: a rejected surface leaves the patch on its previous one.

OOP aliases

  • foliage:setSurface(surface)
  • foliage.surface

Where this comes from

RELATED NEON APIS

Continue exploring

Read the system guide →