Custom Stashes

We can set up custom stashes from outside the resource utilising the exported RegisterStash function.

Firstly, we need to define the stashes properties.

Stash properties

  • id: string

    • Unique name to identify the stash in the database.

  • label: string

    • Display name when viewing the stash.

  • slots: number

    • Number of slots the stash will have.

  • weight: number

    • Maximum weight of the stash inventory.

  • owner?: string or boolean

    • true: Each player has their own unique stash, but can request to open the stash of another player

    • false: Only a single stash exists and is shared between all players

    • string: The stash explicitly belongs to the given owner, usually a player identifier

  • groups?: table

    • Key-value pairs of job name and minimum grade to be able to access the stash. ({["police"] = 0, ["ambulance"] = 2})

    • name: string

    • grade: number

  • coords?: vector3 or table

    • You can set the stash coordinates to prevent the stash from being opened if the player isn't close enough.

    • Vector or table containing the coordinates of the stash.

Example

Below the value is hardset, but it could be loaded from the database (especially if there are unknown fields, i.e. owner)

The following sample is based on esx_property's db data.

Example Resource

We put together an example resource showcasing how to properly utilise the stash API:

Last updated