📦Warehouses V2
Introduction
Empower your players with the option to own or rent their very own warehouse, offering boundless storage capacity. With three customizable levels—small, medium, and large—your players can effortlessly store many items, expanding their gaming experience like never before.
This script is written to work with QBCore and Zap Hosting ESX Pack
This script requires ox_lib
Key Features:
Limitless Warehousing: Players can enjoy the luxury of unlimited storage space.
In-game Warehouse Creation: Initiate warehouse construction effortlessly with the /createwarehouse command.
Flexible Pricing and Levels: Set rental rates and default levels upon warehouse creation, offering players flexibility.
Rentable or Purchasable Options: Cater to diverse player preferences by offering both rental and purchase choices.
Upgradable Storage Boxes: Each level features separate containers with individual inventories, ensuring efficient organization.
Storable Cash: Cash storage, editable within the configuration settings, The visual representation of cash objects varies depending on the stored amount, enhancing immersion.
Key Management: Players can easily manage access keys for their warehouses.
Police Raids: Introduce thrilling gameplay dynamics with the ability for police raids on warehouses.
Warehouse Management UI: A user-friendly interface enables seamless management of rent and warehouse levels, enhancing player convenience.
Passcode Entry: Ability to allow your players to disable key access and use a passkey instead.
Installation
Download the power_warehouses_v2 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.
-- QBCore Support
enableQBCore = true
-- ESX Support
enableESX = false
-- Enabling this will send a discord message anytime a unit is raided, if true you must set the webhook in server_functions.lua file
raidDiscordLog = false
-- Only the owner can terminate the storage contract.
ownerOnlyTerminate = true
-- Only the owner can manage keys to the storage unit.
ownerOnlyKeys = true
-- Use Target System for Interactions / QB-Target or OX-Target Required
useTarget = false
-- Enable Passcode System - Allowing owners to switch between key and passcode access
enablePasscode = true
-- Use Target System only for the Storage Boxes
useTargetForBoxesOnly = true
-- This will set the amount of days over 0 that people will keep their units, example -7 will give players a week to pay the rent before deletion.
-- 0 will result in the storage unit being removed as soon as the days remaining hit 0.
expiryGrace = -3 -- 3 days after the rent is due before its deleted
-- Resource Used for Inventories
-- Supported Resources: ox_inventory, qb-inventory, qs-inventory, chezza-inventory, mf-inventory
inventoryResource = 'qb-inventory'
-- Max storage amount of each box in the warehouse
storageAmount = 1000000
-- Max slots of each box in the warehouse
storageSlots = 100
-- Staff Only Add Warehouse Command
-- You can also grant the following ACE permission to allow staff to add warehouses: warehouse.create
-- You can also grant the following ACE permission to allow staff to delete warehouses: warehouse.delete
staffOnlyCommands = true
-- This allows players with the following jobs to create / delete warehouses
-- The above staffOnlyCommands must be set to false for this to work
warehouseCommandJobs = {
['realestate'] = true,
}
-- Command to Create New Warehouses
createWarehouseCommand = 'createwarehouse'
-- Command to Delete Warehouses
deleteWarehouseCommand = 'deletewarehouse'
-- Command to Manage Warehouses
manageWarehousesCommand = 'managewarehouses'
-- The price it costs to add another box to the warehouse per level
upgradeCost = {
[1] = 1000,
[2] = 2000,
[3] = 2500,
}
-- This lets you add a rent increase multiplier per level
rentIncrease = {
[1] = 1.0,
[2] = 1.5,
[3] = 2.0,
}
-- This allows you to set a restriction on the max nuumber of boxes a player can upgrade their warehouse to
-- Level 1 is under 6 boxes,
-- Level 2 is under 21 boxes,
-- Level 3 is under 37 boxes
maxStorageBoxes = 21
-- This allows you to disable warehouse upgrades, if you want to keep the warehouse at a set level however allow players to upgrade the storage boxes
-- This means created warehouses cannot be upgraded to new levels
disableWarehouseUpgrades = false
-- The max amount of cash a player can store in their warehouse per level
maxCashStorage = {
[1] = 10000,
[2] = 20000,
[3] = 30000,
}
Editable files
functions.lua
Inventory Compatibility
If you would like to edit the inventory to add your own custom inventory, you can edit the functions in the funtions.lua file. Default inventory support is as follows:
function accessStorageInventory(storageId)
if enableQBCore then
if inventoryResource == 'ox_inventory' then
exports.ox_inventory:openInventory('stash', {id = storageId, slots = tonumber(storageSlots), weight = tonumber(storageAmount)})
elseif inventoryResource == 'qb-inventory' then
TriggerServerEvent("inventory:server:OpenInventory", "stash", storageId, {maxweight = storageAmount, slots = storageSlots})
TriggerEvent("inventory:client:SetCurrentStash", storageId)
end
end
if enableESX then
if inventoryResource == 'ox_inventory' then
exports.ox_inventory:openInventory('stash', {id = storageId, slots = tonumber(storageSlots), weight = tonumber(storageAmount)})
end
if inventoryResource == 'mf-inventory' then
exports["mf-inventory"]:openOtherInventory(storageId)
end
if inventoryResource == 'chezza-inventory' then
TriggerEvent('inventory:openInventory', {type = "stash", id = storageId, title = "Storage Box", weight = tonumber(storageAmount), delay = 0, save = true})
end
if inventoryResource == 'quasar-inventory' then
local other = {}
other.maxweight = tonumber(storageAmount)
other.slots = tonumber(storageSlots)
TriggerServerEvent("inventory:server:OpenInventory", "stash", storageId, other)
TriggerEvent("inventory:client:SetCurrentStash", storageId)
end
end
end
QBCore Compatibility and Notifications
if enableQBCore then
local QBCore = exports['qb-core']:GetCoreObject()
function getCharacterID()
local char = QBCore.Functions.GetPlayerData().citizenid
return char
end
function isPolice()
local job = QBCore.Functions.GetPlayerData().job.name
if job == 'police' then
return true
else
return false
end
end
function notify(message)
TriggerEvent('QBCore:Notify', message)
end
end
ESX Compatibility and notifications
if enableESX then
local ESX = exports['es_extended']:getSharedObject()
function getCharacterID()
local char = ESX.GetPlayerData().identifier
return char
end
function isPolice()
local job = ESX.GetPlayerData().job.name
if job == 'police' then
return true
else
return false
end
end
function notify(message)
TriggerEvent('esx:showNotification', message)
end
end
server_functions.lua
Discord Webhook
If you would like to add a discord webhook, you can add it to the server_functions.lua. Be sure to change the CHANGEME to your webhook URL.
discordWebhook = 'https://discord.com/WEBHOOK/CHANGE/ME'
function discordMessage(message)
if raidDiscordLog then
PerformHttpRequest(discordWebhook, function(Error, Content, Head) end, 'POST', json.encode({username = 'Warehouse Logs', content = message}), {['Content-Type'] = 'application/json'})
end
end
QBCore Compatibility
if enableQBCore then
local QBCore = exports['qb-core']:GetCoreObject()
function getCharacterID(source)
local player = QBCore.Functions.GetPlayer(source)
local identifier = player.PlayerData.citizenid
return identifier
end
function getCharacterName(source)
local player = QBCore.Functions.GetPlayer(source)
local name = player.PlayerData.charinfo.firstname .. ' ' .. player.PlayerData.charinfo.lastname
return name
end
function getMoney(source)
local player = QBCore.Functions.GetPlayer(source)
local money = player.PlayerData.money['cash']
return money
end
function getBank(source)
local player = QBCore.Functions.GetPlayer(source)
local bank = player.PlayerData.money['bank']
return bank
end
function addMoney(source, amount)
local player = QBCore.Functions.GetPlayer(source)
player.Functions.AddMoney('cash', amount)
end
function removeBank(source, amount)
local player = QBCore.Functions.GetPlayer(source)
player.Functions.RemoveMoney('bank', amount)
end
function removeMoney(source, amount)
local player = QBCore.Functions.GetPlayer(source)
player.Functions.RemoveMoney('cash', amount)
end
function notify(source, message)
TriggerClientEvent('QBCore:Notify', source, message)
end
function isStaff(source)
if QBCore.Functions.HasPermission(source, 'admin') or IsPlayerAceAllowed(source, 'command') then
return true
else
return false
end
end
function getJob(source)
local player = QBCore.Functions.GetPlayer(source)
local job = player.PlayerData.job.name
return job
end
end
ESX Compatibility
if enableESX then
local ESX = exports['es_extended']:getSharedObject()
function getCharacterID(source)
local identifier = ESX.GetPlayerFromId(source).identifier
return identifier
end
function getCharacterName(source)
local name = ESX.GetPlayerFromId(source).name
return name
end
function getMoney(source)
local xPlayer = ESX.GetPlayerFromId(source)
local money = xPlayer.getMoney()
return money
end
function addMoney(source, amount)
local xPlayer = ESX.GetPlayerFromId(source)
xPlayer.addMoney(amount)
end
function getBank(source)
local xPlayer = ESX.GetPlayerFromId(source)
local bank = xPlayer.getAccount('bank').money
return bank
end
function removeBank(source, amount)
local xPlayer = ESX.GetPlayerFromId(source)
xPlayer.removeAccountMoney('bank', amount)
end
function removeMoney(source, amount)
local xPlayer = ESX.GetPlayerFromId(source)
xPlayer.removeMoney(amount)
end
function notify(source, message)
TriggerClientEvent('esx:showNotification', source, message)
end
function isStaff(source)
local xPlayer = ESX.GetPlayerFromId(source)
if xPlayer.getGroup() == 'admin' then
return true
else
return false
end
end
function getJob(source)
local xPlayer = ESX.GetPlayerFromId(source)
local job = xPlayer.job.name
return job
end
end
HTML
HTML files are able to be edited.
index.html
Additional language translations can be edited here listed as:
Enter Pin Storage Level Upgrade Level Warehouse Passcode Change Passcode Storage Keys Switch to Passcode Add Key New Key Key Name City ID Add Key Cancel Information Days Remaining Warehouse Keys Warehouse Level Stored Cash Storage Rent Add 7 Days Add 28 Days
script.js
style.css
devices.css
Last updated
Was this helpful?