Skip to content

GetNearestContainer

The container nearest to a point, within a radius.

GetNearestContainer(x, y, z [, radius])
Parameter Type
x number the point, metres
y number
z number
radius number metres; 0 or none = no limit (optional)

string, number - the container’s key and its distance; nil when none

local key, distance = GetNearestContainer(x, y, z, 3)
if key then SetContainerItems(key, {}) end -- empties the chest the admin stands at

GetContainerPosition · GetNearestDoor · OnPlayerOpenContainer · the Doors and containers group of the index