🏢Player Owned Offices

Introduction

This script adds the ability for your players to purchase their very own office

Features of Player-Owned Offices:

  • Ability to Change The Name of the Office.

  • Ability to Change The Name Color.

  • Ability to Change the Style of the Office. (Configurable to change cost)

  • Ability to Add and Remove Props within the Office

  • Ability to Deposit and Withdraw money into an Office Bank.

  • Money Stacks will be displayed within the office depending on how much is stored within the office.

  • Ability to Add and Manage Staff that can also manage the office

  • Ability to Transfer the Office to Other Players (Configurable to disable)

  • Ability for Office Staff to Lock the Office - Preventing anyone from entering until unlocked.

  • Ability for Police Jobs to Access Storage Safes (Configurable Item Requirement too)

  • 4 Separate Office Locations (Arcadius Business Centre, Lom Bank, Maze Bank Building, Maze Bank West)

  • Each Office Location supports unlimited offices, each office location has a separate list.

  • Each Office has access to the rooftop helipad (Good when you add a helicopter garage location to the rooftops)

  • Each Office has the ability for the staff to access the outfit menus to change outfits

  • Each Office is equipped with 2 separate storage safes (safes will physically open for the player to add to immersion)

This is compatible with the following inventory systems:

This is compatible with the following clothing systems:


Installation

  • Download the power_offices 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

-- Resource Used for Inventories
-- Supported Resources: ox_inventory, qb-inventory, qs-inventory, chezza-inventory
inventoryResource = 'qb-inventory'

-- Max storage amount of each stash in the offices
storageAmount = 1000000

-- Max slots of each stash in the offices
storageSlots = 100 

-- Resource Used for Clothing
-- Supported Resources: rcore_clothes, illenium_appearance, qb-clothing
clothingResource = 'illenium_appearance'

-- Office Transfer  
-- This allows you to allow players to transfer their office to another player
enableOfficeTransfers = true

-- config to toggleProps for Renewed-Weaponscarry on enter and exit.
renewedWeapons = true

-- Police Raid Settings
-- This allows you to enable/disable police raids on offices
enablePoliceRaids = true

-- Police Raid Job
-- This allows you to set the jobs that is allowed to start a police raid
policeRaidJobs = {'police'}

-- Police Raid Item 
-- This allows you to set the item that is required to start a police raid
-- This item must already exist in your server
-- Set to false to disable item requirement
policeRaidItem = 'police_stormram'

Editable files

functions.lua

Inventory Compatibility

If you would like to edit the inventory functions, you can edit them in the functions.lua file. Default functions are as follows:

function accessStorageInventory(storageId)
 if enableQBCore then 
  local other = {
   maxweight = storageAmount,
   slots = storageSlots,
  }
  TriggerServerEvent("inventory:server:OpenInventory", "stash", 'p_offices_'..storageId, other)
  TriggerEvent("inventory:client:SetCurrentStash", 'p_offices_'..storageId)
 end 


 if enableESX then 
  if inventoryResource == 'ox_inventory' then 
   exports.ox_inventory:openInventory('stash', {id = 'p_offices_'..storageId, slots = tonumber(storageSlots), weight = tonumber(storageAmount)})
  end 

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

  if inventoryResource == 'chezza-inventory' then 
   TriggerEvent('inventory:openInventory', {type = "stash", id = 'p_offices_'..storageId, title = "Storage Locker", 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", 'p_offices_'..storageId, other)
   TriggerEvent("inventory:client:SetCurrentStash", 'p_offices_'..storageId)
  end 
 end 
end 

Clothing compatibility

If you would like to edit the clothing functions, you can edit them in the functions.lua file. Default functions are as follows:

function openClothingOutfits()
 if clothingResource == 'rcore_clothes' then
  TriggerEvent("rcore_clothes:openOutfits") 
 end

 if clothingResource == 'illenium_appearance' then
  TriggerEvent('illenium-appearance:client:openOutfitMenu')
 end

 if clothingResource == 'qb-clothing' then
  TriggerEvent('qb-clothing:client:openOutfitMenu')
 end
end

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 functions.lua file. Default notifications are as follows:

RegisterNetEvent('offices:notification')
AddEventHandler('offices:notification', function(data)
 local timeout = 5000

 if data.timeout == nil then
  timeout = 5000
 else 
  timeout = data.timeout
 end

 lib.notify({title = data.title, description = data.text, type = data.type, position = 'top-right', duration = timeout})
end)

Last updated

Was this helpful?