๐Ÿ”’Storage Lockers

Introduction

Storage lockers will add the ability for players to buy their own storage lockers which are locked by a personal customizable pin.

This script is written to work with QBCore and Zap Hosting ESX Pack

This resource requires QB-Menu or ESX Menu Default

This is compatible with the following inventory systems:

Features of Storage Lockers:

  • Unlimited Storage Lockers.

  • Lockers can be created/deleted by either staff only or by jobs (editable in config)

  • Lockers can be set as Objects which will automatically be created by the script.

  • Any GTA Object can be used as a locker object, just specify on locker command.

  • Lockers have individual prices storage amounts and slots.

  • Lockers accessible by anyone who knows the locker pin code.

  • Configurable Blips for available lockers and blips to see the players owned lockers

  • Ability for Police to Raid Lockers (Item Requirement can be set in config, can be set to any item.)

  • Players can sell their locker for a partial or full refund (editable in config)


Installation

  • Download the power_storageLocker from Keymaster

  • Run the .sql file in your database.

  • Add the files to your resources folder

  • Ensure that the resource file will start (either ensure your resource in the server.cfg or inside a folder which is started on server start)

  • Edit the config file to your needs

  • Restart your server


Configuration

Select the tab below for your framework to see the configuration options available.

-- Enable Support for QBCore 
enableQBCore = true

QBCoreResourceName = 'qb-core'

-- This supports the following resources: qb-invemtory, lj-inventory, ox_inventory
QBInventory = 'qb-inventory'

-- Enable Target Supprt, Supports QB-Target and OX_Target
enableTarget = true

-- Enable Support for ESX 
enableESX = false

-- ESX Inventory 
-- Compatible with 'ox_inventory' and 'chezza-inventory' and 'mf_inventory'
esxInventory = 'ox_inventory'

-- The position of the menu of the esx menu.
esxMenuPosition = 'top-right'

Editable files

client.lua

Custom Notifications

If you would like to edit the notifications to add your own custom notifications or to match them to your other server notifications, you can edit them in the client.lua file. Default notifications are as follows:

-- You can change the notification here.
RegisterNetEvent('power:locker:notification')
AddEventHandler('power:locker:notification', function(message, type)
 if enableQBCore then 
  TriggerEvent('QBCore:Notify', message, type)
 end 

 if enableESX then 
  TriggerEvent('chat:addMessage', {color = {255, 255, 255}, args = {"^8Warehouse", message}})
 end 
end)

Inventory triggers

function openStorageInventory(storageId, storage, slots) 
 if enableQBCore then 
  if QBInventory == 'ox_inventory' then 
   exports.ox_inventory:openInventory('stash', {id = storageId, owner = false, slots = tonumber(slots), weight = tonumber(storage)})
  else 
   TriggerServerEvent("inventory:server:OpenInventory", "stash", storageId, {maxweight = tonumber(storage), slots = tonumber(slots)})
   TriggerEvent("inventory:client:SetCurrentStash", storageId)
  end 
 end

 if enableESX then 
  if esxInventory == 'ox_inventory' then 
   exports.ox_inventory:openInventory('stash', {id = storageId, slots = tonumber(slots), weight = tonumber(storage)})
  end 

  if esxInventory == 'mf-inventory' then 
   exports["mf-inventory"]:openOtherInventory(storageId)
  end 

  if esxInventory == 'chezza-inventory' then 
   TriggerEvent('inventory:openInventory', {type = "stash", id = storageId, title = "Storage Locker", weight = tonumber(storage), delay = 0, save = true})
  end 

  if esxInventory == 'quasar-inventory' then 
   local other = {}
   other.maxweight = tonumber(storage)
   other.slots = tonumber(80) 
   TriggerServerEvent("inventory:server:OpenInventory", "stash", storageId, other)
   TriggerEvent("inventory:client:SetCurrentStash", storageId)
  end 
 end 
end

HTML

HTML files are able to be edited.

  • index.html

    • Additional language translations can be edited here listed as:

      • Locker Creation
        Locker Price
        Storage Amount
        Storage Slots
        Create Object Locker
        Yes
        No
        Create Object Locker
        Create Locker
        Enter Pin
  • script.js

  • style.css


Last updated

Was this helpful?