Cube Scripts

Lockers

Lockers are groups of numbered personal stashes defined in data/lockers.lua.

Each locker group creates a set of individual lockers a player can claim and open at a fixed location. Access is restricted by job group, and each claimed locker is owned by a single player and backed by its own stash in the database.

Locker definition#

The file returns an array of locker groups.

lua
return {
    {
        name    = 'policelocker',
        label   = 'Police Lockers',
        number  = 50,
        slots   = 70,
        weight  = 70000,
        groups  = shared.police,
        coords  = vec3(458.5975, -990.6593, 30.6896),
        target  = {
            loc     = vec3(458.5975, -990.6593, 30.6896),
            length  = 1.2,
            width   = 5.6,
            heading = 0,
            minZ    = 29.49,
            maxZ    = 32.09,
            label   = 'Access lockers',
        },
    },
}
  • name: string
    • Unique id used to identify the locker group and to build each locker's stash id.
  • label: string
    • Display name shown when opening a locker.
  • number?: number
    • Amount of individual lockers available in the group.
    • Default: 10
  • slots?: number
    • Number of slots in each locker's stash.
    • Default: 50
  • weight?: number
    • Maximum weight of each locker's stash, in grams.
    • Default: 50000
  • groups?: table
    • Key-value pairs of job name and minimum grade required to access the lockers. ({["police"] = 0, ["ambulance"] = 2})
    • jobs is accepted as an alias for groups.
  • distance?: number
    • Interaction distance for the locker location.
    • Default: 10
  • coords?: vector3
    • Location used to open the lockers when ox_target is not enabled.
  • target?: table
    • Zone used to open the lockers when inventory:target is enabled.
    • When targeting is enabled, target.loc is used as the interaction point instead of coords.
    • loc: vector3
    • length: number
    • width: number
    • heading: number
    • minZ: number
    • maxZ: number
    • label: string

Notes#

  • Each locker's stash id is generated as <name>_<lockerId> (e.g. policelocker_1), so changing a group's name after lockers have been claimed will orphan the existing stashes.
  • Ownership and lock state are stored in the ox_lockers table (group, locker_id, owner, owner_name).
Note

groups shares the same format as job restrictions elsewhere in the resource. shared.police resolves to the jobs set through the inventory:police convar.