GetNearestContainer
The container nearest to a point, within a radius.
Syntax
Section titled “Syntax”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) |
Returns
Section titled “Returns”string, number - the container’s key and its distance; nil when none
Example
Section titled “Example”local key, distance = GetNearestContainer(x, y, z, 3)if key then SetContainerItems(key, {}) end -- empties the chest the admin stands atSee also
Section titled “See also”GetContainerPosition · GetNearestDoor · OnPlayerOpenContainer · the Doors and containers group of the index
