Power Scripts
  • ๐Ÿ“„Home
  • ๐ŸšฒBikerack
  • ๐Ÿ“ธBodycams
  • ๐Ÿ“นDashcams V2
  • ๐Ÿ“ฑEncrypted Chat
  • ๐Ÿ”งMechanic Tablet
  • ๐ŸขPlayer Owned Offices
  • ๐ŸšขPlayer Owned Yachts
  • ๐Ÿ Stash Houses
  • ๐Ÿ”’Storage Lockers
  • ๐ŸงนSunset Bleach
  • ๐Ÿ“ฆWarehouses V2
Powered by GitBook
On this page
  • Introduction
  • Installation
  • Configuration
  • Editable files
  • functions.lua
  • server_functions.lua
  • HTML

Was this helpful?

Warehouses V2

PreviousSunset Bleach

Last updated 1 year ago

Was this helpful?

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 and

This script requires

This is compatible with the following inventory systems:

  • (QBCore)

  • (QBCore)

  • (QBCore)

  • (ESX)

  • (ESX)

  • (ESX)

The inventory code can be edited to use any inventory system

This script also has support for QB-Target / OX_Target

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,
}
-- This will show unowned warehouse blips.
enableUnownedBlips = true 

unownedBlip_Color = 5
unownedBlip_Sprite = 40
unownedBlip_Scale = 0.6

-- This will show warehouse blips to the player that owns the unit.
enableOwnedBlips = true 

ownedBlip_Color = 2
ownedBlip_Sprite = 40
ownedBlip_Scale = 0.6

In this section you can edit the language if you need to translate to another language or edit the wording.

Lang = { 
 ['rentWarehouse'] = 'E | Rent Warehouse - $',  
 ['purchaseWarehouse'] = 'E | Purchase Warehouse - $',
 ['enterWarehouse'] = 'E | Enter Warehouse', 
 ['raidWarehouse'] = 'E | Raid Warehouse', 
 ['exitWarehouse'] = 'E | Exit Warehouse',
 ['manageWarehouse'] = 'E | Manage Warehouse',
 ['manageCash'] = 'E | Manage Cash',

 ['warehouseCash'] = 'Warehouse Cash',
 ['currentBalance'] = 'Current Balance: $',
 ['depositCash'] = 'Deposit Cash',
 ['withdrawCash'] = 'Withdraw Cash',

 ['maxStorage'] = 'You have reached the maximum storage capacity for this warehouse.',
 ['purchased_warehouse'] = 'You have purchased this warehouse',
 ['rented_warehouse'] = 'You have rented this warehouse for %s days',
 ['added_key'] = 'You have added a key to this warehouse',
 ['removed_key'] = 'You have removed a key from this warehouse',
 ['terminated_warehouse'] = 'You have terminated this warehouse',
 ['upgraded_warehouse'] = 'You have upgraded this warehouse',
 ['deposited_cash'] = 'You have stored $%s in this warehouse',
 ['withdrew_cash'] = 'You have withdrawn $%s from this warehouse',

 ['raid_webhook'] = 'Warehouse %s | Owner: %s Has Been Raided',

 ['openBox'] = 'Open Storage Box',
 ['not_enough_money'] = 'You do not have enough money',
 ['not_owner'] = 'You do not own this warehouse',
 ['no_access'] = 'You do not have permission to use this command',

 -- Blips 
 ['unownedBlip'] = 'Unowned Warehouse',
 ['ownedBlip'] = 'Owned Warehouse',

 -- Menu Lang
 ['createWarehouse'] = 'Create Warehouse',
 ['warehouseName'] = 'Warehouse Name',
 ['warehouseNameDesc'] = 'Enter the name of the warehouse',
 ['warehouseType'] = 'Rental or One-Time',
 ['warehouseTypeDesc'] = 'Is the warehouse rented or a one-time purchase?',
 ['rental'] = 'Rental',
 ['purchase'] = 'Purchase',
 ['price'] = 'Price', 
 ['priceDesc'] = 'Enter the price of the warehouse',
 ['level'] = 'Warehouse Level',
 ['levelDesc'] = 'Select the starting level of the warehouse',

 ['small'] = 'Small',
 ['medium'] = 'Medium',
 ['large'] = 'Large',

 ['enterPrice'] = 'You must enter a price for the warehouse.',
 ['enterLevel'] = 'You must select a level for the warehouse.',

 ['incorrectPin'] = 'Incorrect Pin Provided',

 -- Manage Warehouses UI 
 ['manageWarehouses'] = 'Manage Warehouses',
 ['warehouseType'] = 'Warehouse Type: ',
 ['currentPrice'] = 'Price: $',
 ['warehouseLevel'] = 'Level: ',
 ['owned'] = 'Owned: ', 
 ['managingWarehouse'] = 'Manage Warehouse #',
 ['moveWarehouse'] = 'Move Warehouse',
 ['moveWarehouseDesc'] = 'Move the warehouse to your current location',
 ['setUnowned'] = 'Set Warehouse Unowned',
 ['setUnownedDesc'] = 'Set the warehouse as unowned',
 ['deleteWarehouse'] = 'Delete Warehouse',
 ['deleteWarehouseDesc'] = 'Delete the warehouse from the database',
 ['tpWarehouse'] = 'Teleport', 
 ['tpWarehouseDesc'] = 'Teleport to the warehouse enterance',
 ['changeName'] = 'Change Name', 
 ['changeNameDesc'] = 'Change the name of the warehouse',
 ['changeLevel'] = 'Change Level',
 ['changeLevelDesc'] = 'Change the level of the warehouse',
 ['changePrice'] = 'Change Price',
 ['changePriceDesc'] = 'Change the rental/purchase price of the warehouse', 

 ['changePin'] = 'Change Pin',
 ['changePinDesc'] = 'Change the current pin on the warehouse',
 ['pin'] = 'New Pin',
 ['pinDesc'] = 'Set Pin to nothing to enable Key access',
}

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


๐Ÿ“ฆ
QBCore
Zap Hosting ESX Pack
ox_lib
qb-inventory
lj-inventory
ox_inventory
ox_inventory
chezza-inventory
qs-inventory