GetNearestSmartObject
The nearest free seat, bed or work spot.
The first of GetSmartObjects(x, y, z, radius, use, true).
Syntax
Section titled “Syntax”GetNearestSmartObject(x, y, z [, radius, use])| Parameter | Type | |
|---|---|---|
x |
number | metres |
y |
number | metres |
z |
number | metres |
radius |
number | metres (10 when not given) (optional) |
use |
string | nil | an activity, a kind or a helper class (optional) |
Returns
Section titled “Returns”table | nil - the object’s table as GetSmartObjects gives it; nil when none is free in reach
Example
Section titled “Example”local spot = GetNearestSmartObject(1260, 1080, 26, 30, "work")if spot then SetActorUse(peasant, spot.key) endSee also
Section titled “See also”GetSmartObjects · SetActorUse · the Actor life group of the index
