Minor formatting change to stash guide

This commit is contained in:
Linden committed 2022-03-04 10:12:37 +11:00
1 parent 6470d98a9d
commit 0a351cc450
1 file changed
+3 -8
+3 -8
View File
@@ -4,8 +4,6 @@ title: Creating 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.
:::info
| Argument | Type | Optional | Explanation |
---------- | -------- | -------- | ----------- |
id | string | no | A unique name to identify the stash in the database |
@@ -22,9 +20,8 @@ The owner field will set permissions for stash access, with stashes registering
- string: The stash explicitly belongs to the given owner, usually a player identifier
You can set the stash coordinates to prevent the stash from being opened if the player isn't close enough.
:::
## Example ##
## Example
Below the value is hardset, but it could be loaded from the database (especially if there are unknown fields, i.e. owner)
```lua
@@ -39,7 +36,6 @@ owner = 'char1:license'
AddEventHandler('onServerResourceStart', function(resourceName)
if resourceName == 'ox_inventory' or resourceName == GetCurrentResourceName() then
Wait(0)
exports.ox_inventory:RegisterStash(stash.id, stash.label, stash.slots, stash.weight, stash.owner)
end
end)
@@ -66,11 +62,10 @@ end
end)
-- Client
local ox_inventory = exports.ox_inventory
if ox_inventory:openInventory('stash', property.id) == false then
TriggerServerEvent('ox:loadStashes')
ox_inventory:openInventory('stash', property.id)
end
```
For our actual implementation of esx_property support, you can refer to these files:
- [client](https://github.com/overextended/esx-legacy/blob/main/%5Besx_addons%5D/esx_property/client/main.lua#L588-L619)
- [server](https://github.com/overextended/esx-legacy/blob/main/[esx_addons]/esx_property/server/main.lua#L62-L151)