Skip to content

GetSmartObjects

The level’s seats, beds and work spots around a point.

Every smart object of the server’s level within radius metres (at most 500 m, 256 of them), the nearest first. use narrows them to an activity, a kind or the game’s helper class; the kinds are "sit", "lie", "work", "wait", "lean", "pray", "eat", "drink", "talk", "dance" and "cheer". freeOnly leaves out the ones an actor uses. Empty without the tables export of this version (re-export).

GetSmartObjects(x, y, z [, radius, use, freeOnly])
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)
freeOnly boolean true = only the free ones (optional)

table - {{key =, activity =, kind =, helper =, x =, y =, z =, yaw =, distance =, user =}, ...}: the key SetActorUse takes, the activity done there, its kind, the game’s helper class, the place (metres, yaw degrees), the distance and the actor using it (nil = free)

local x, y, z = GetPlayerPos(pid)
for _, o in ipairs(GetSmartObjects(x, y, z, 15, "sit")) do
SendClientMessage(pid, COLOR_WHITE, string.format("%s %.0f m %s", o.activity, o.distance, o.user and "taken" or "free"))
end

GetNearestSmartObject · SetActorUse · the Actor life group of the index