0Resmon
0Resmon
0Resmon
  • 0Resmon Documentation
  • What is FiveM Escrow ?
  • Open Source and Escrow
  • 0R Lib
  • 0R RESOURCES
    • 0R House Robbery
      • ⚠️Important
      • 📁Required Items
      • ⚙️Configuration
    • 0R Manageable Casino
      • Required Dependencies
      • Required Item
      • Required Job
      • Base Configuration
    • 0R HolsterAnim
      • OX Inventory
      • QB Inventory
    • 0R Drug Business
      • Installation
      • Configuration
    • 0R Multicharacterv2
      • Installation
      • Configuration
    • 0R ATM Robbery
      • Installation
      • Configuration
    • 0R HEIST
      • DUI
        • Installation
        • Configuration
        • Exports
      • Vangelico
        • Installation
        • Configuration
        • Exports
      • Pacific Bank
        • Installation
        • Configuration
        • Exports
    • 0R Garbage
      • Installation
      • Configuration
    • 0R Gungame
      • Installation
      • Configuration
      • Exports
    • 0R Paintball-v2
      • Installation
      • Configuration
      • Exports
    • 0R Hud V3
      • Installation
      • Configuration
      • Exports
      • Events
    • 0R Apartments - V2
      • Installation
      • Configuration
    • 0R PixelHouse
      • Installation
      • Configuration
      • Exports
      • DLC
    • 0R Caravan
      • Installation
      • Configuration
    • 0R Multicharacter
      • Installation
    • 0R Houses
      • Integrators and Exports
      • Installation
    • 0R Casino
    • 0R Motels
      • Installation
      • Configuration
    • 0R VIP System
      • Installation
      • Configuration
    • 0R IDCard
      • Installation
      • Configuration
    • 0R IDCard V2
      • Installation
    • 0R Pausemenu
      • Installation
    • 0R Studio
      • Installation
    • 0R Handcuff System
      • Installation Handcuff
    • 0R Easy Time
      • 0R Easytime
    • 0R Lockpick
      • Installation
    • 0R Target
      • Installation
    • 0R Textui
      • Installation
    • 0R Fishing
    • 0R Carplay
    • 0R Hacking Mini Game
  • S4 Resources
    • ILLEGAL CARAVAN
      • Adaptations
    • s4-time
      • First Install
      • Exports
      • Config Var's
    • Illegal Phone
      • Installing, Faq & Features
      • Voice Script Adaptation
      • Other Phone Integrations
      • Task's - Location Messages
      • Data sharing
    • Breathalyser
      • API
    • Res Audio
      • Installation
      • Configuration
    • S4 Housing (BETA)
      • Claim
      • Installation
      • Permissions
      • Add House
      • Adaptation (Wardrobe)
      • Adaptation (Stash)
      • Adaptation (Garage)
    • S4 House
      • Installation
    • S4 Report System V2
      • Installation
      • Why videos not uploading?
    • S4 Health System V2
      • Installation
      • Adapting Custom Ambulance Job
      • Bleeding Adjustment
      • How To Add Custom Items
      • Required Items
    • pizza
    • s4-adminmenu
      • First Install
      • Adaptations
      • Video Recording Adaptation
  • KIBRA RESOURCES
    • Kibra Mechanics
      • Installation
      • Configuration
    • Kibra SmartPad
      • Installation
      • Configuration
    • Kibra Vehicleshops
      • Installation
      • Configuration
    • Kibra Core
      • Installation
    • Kibra Dispatch
      • Installation
      • Exports And Configure
  • BP RESOURCES
    • BP MAPUI
      • Config Settings
      • Exports, Events
      • Test Command
    • BP DRONE
      • Config Settings
    • BP INVENTORY
      • 🧠Installation
      • 🪶Config Settings
        • 🪁Config_items.lua settings
        • 🚕Config_vehicle.lua settings
      • ⚔️Export and Events
      • 👕Clothing Settings
      • 🏹Weapon settings
    • 👕BP CLOTHING V4
      • 🧠Installation-c
      • 🪶Config Settings
        • 🎓Char Create Config
        • 🎓Clothing Store Config
        • 🎓Barber Store Config
        • 🎓Tattoo Store Config
      • ⚔️Export and Events
      • 🤪Character creation settings
    • BP GARAGE
      • 🧠Installation
      • 🪶Config Settings
      • ⚔️Export and Events
      • ❓What is JSON files
      • 🖱️Commands
  • FRKN Resources
    • Frkn Racing
      • 🧠Installation
      • ⚔️Features Overview
      • 🪶Config Settings
      • 🏆Items
    • Frkn Camera System
      • 🧠Installation
      • ⚔️Usage
      • 🪶Config Settings
      • 🏆Items
    • Frkn Tuning System
      • 🧠Installation
      • ⚔️Usage
      • 🪶Config Settings
      • 🏆Items
    • Frkn Doorlock V2
      • 🧠Installation
      • 🪶Config Settings
      • ⚔️Commands
    • ⛪Frkn Bank Heist
      • Installation
      • 🛠️Config Information
      • Script Usage
    • 🎭Frkn Hack System
      • Installation
      • Config Information
      • 🛠️PH Panel Introduction
        • 💰PH Robbery Contracts
        • 📜PH Hire Contracts
        • 🙅‍♂️PH Group Members
        • 📢PH Announcements
      • 🔓Crack App Introduction
      • 🛜Salty App Introduction
      • 🕶️Dark Store App Introduction
      • ⛏️Miner App Introduction
      • 🔗Miner Extension App Introduction
      • 🚁Drone App Introduction
      • 💳Wallet App Introduction
      • 🗒️Note App Introduction
      • 🏦Bank Heist
    • Frkn Minigame Pack
      • Riddle Minigame
      • Xox Minigame
      • Stick Minigame
      • Letter Minigame
    • Lab Pet V3
      • 🧠Installation
      • 🪶Config Settings
      • ⏸️Usage Description
    • Frkn Money Washing
      • 🧠Installation
      • 🪶Config Settings
      • ⚔️Commands
      • 🏆Items
    • Frkn Deathscreen V3
      • 🧠Installation
      • 🪶Config Settings
    • Frkn Doorlock
      • 🧠Installation
      • 🪶Config Settings
      • ⚔️Commands
    • Frkn DrawText
      • 🧠Installation
      • 🪶Config Settings
      • ⚔️Export and Events
    • Frkn Fuel Station V4
      • 🧠Installation
      • 🪶Config Settings
      • ⚔️Export and Events
    • Frkn Death Screen V2
      • 🧠Installation
      • 🪶Config Settings
      • ⚔️Export and Events
    • Frkn Craft V2
      • 🧠Installation
      • 🪶Config Settings
      • ⚔️Export and Events
  • Wais Resoucres
    • ⚒️Wais Jobpack
      • ⚙️How to set it up
      • 🎛️Framework settings
      • 🗂️Install Jobs / Items
      • 🪚Job Settings
        • 🍕Pizza Delivery
        • 🗞️News Delivery
        • 🌭Mobile Hotdog
        • 🦺Forklifter
        • ☘️Gardener
        • 🚚Trucker
        • ⚒️Roadhelper
        • 🚌Bus Driver
        • 🔥Fire Department
        • 🦅Hunting
        • 👨‍🦯Detectorist
        • 🚗Project Car
        • 🤿Diver
        • 🧑‍🌾Farmer
        • 👨‍🔧Electrician
      • ❓FAQ / Errors / Questions
      • ❓Error: syntax error near '<\1>'
      • ❓How To Do
    • 🎹Wais Studio
      • 🔌Installation
        • 🔑Create API Key
        • 🎛️Framework settings
        • 📹Streaming Settings
      • 🎶Create, Settings Studio
      • ❓FAQ / Errors
      • 📚Handbook
    • 🎭Wais Club
      • ⚙️How to set it up
      • 🎛️Framework settings
      • 🔮Add / Edit Club Things
      • 🔦Spotlight Creator
      • 💃Npc Creator
      • 🔐YouTube API Stuff
      • ❓FAQ / Errors / Questions
      • ❓Error: syntax error near '<\1>'
    • Wais Multicharacterv2
      • ⚙️How to set it up
      • 📒Installation ESX
      • 🔮Installation QBCore
        • 💡Old QBCore Adapt
        • 💡New QBCore Adapt
      • ✨Installation Qbx
        • 💡Integration Qbx_core
      • 🏡Apartment Integration
      • 🔄Bringing old characters
      • 📜Starer Items
      • 🔑Slot Actions
      • 🔐Discord Authenticator
      • 🛒Tebex Authenticator
      • 🌏Spawnselector / Spawn
      • 📦Hide / Open Another UI'S
      • 📋Change Language
      • ❓Kicked For Explotation
    • Wais Bodycamv2
      • ⚙️How to set it up
      • 🎛️Installation Items
      • 🌟Adapt Framework
      • 🙋‍♂️Add Job
      • 🗺️Badge Things
      • 📸Screen Recording
      • 📷Prop System
      • 📃Change Language
      • ❓How to?
    • Wais Evidence
      • ⚙️How to set it up
      • 🔩Installation Items
      • 🏓Adapt Framework
      • 🔫Weapon Things
      • 👮Add Job
      • 📋Change Language
      • 🎯Errors / Questions
    • Wais Hudv5
    • Wais Rhud
  • Stache Resources
    • Stache Phone
      • 📱Installations
      • ⚙️Configuration
      • 🛠️Custom App
      • 📖S.S.S.
  • GENIUN RESOURCES
    • 0R Clothing
      • ⚙️Installation
      • 🛠️Configration
      • 🧰Exports & Callbacks
      • 📸How to take photos of clothes?
Powered by GitBook
On this page
  • Client Exports
  • Server Exports
  1. 0R RESOURCES
  2. 0R PixelHouse

Exports

Client Exports

-- Exports the function "GetPlayerHouseId". This function returns the house ID of the player's current house.
-- If the player is inside a house, it gets the house ID of that house. Otherwise, it returns nil.
---@return number | nil
local function GetPlayerHouseId()
    return Client.Player?.inHouse?.houseId
end

-- Exports the function "GetPlayerHouse". This function returns the house the player is currently in.
-- If the player is inside a house, it gets the information of that house. Otherwise, it returns nil.
---@return InHouseType | nil
local function GetPlayerHouse()
    return Client.Player?.inHouse
end

-- Defines a local function "GetPlayerHouses". This function returns the houses owned by the player.
-- If the player owns any houses, it gets the list of those houses. Otherwise, it returns nil.
local function GetPlayerHouses()
    return Client.Player?.ownedHouses
end

-- Updates the specified indicator for a given house by adding or subtracting the provided value.
-- The `houseId` parameter specifies the ID of the house.
-- The `indicator` parameter specifies which indicator to update (e.g., "electricity", "power", "gas", or "water").
-- The `value` parameter specifies the amount to add to (positive value) or subtract from (negative value) the current indicator value.
-- The function returns the updated indicator value.
---@param houseId number
---@param indicator "electricity"|"power"|"gas"|"water"
---@param value number
---@return number
local function UpdateHouseIndicator(indicator, value)
    if Client.Player.inHouse then
        local response = Client.Functions.CallbackAwait(_e("Server:UpdateIndicator"),
            indicator, value, Client.Player.inHouse.houseId)
        if response.error then
            Client.Functions.SendNotify(locale("error", response.error), "error")
            return false
        end
        return true
    end
end

---Get available houses
---@return table
local function GetAvailableHouses()
    local defaultHouses = Client.Functions.GetDefaultHouses()
    local soldHouses = Client.Functions.GetSoldHouses()

    local soldHousesIds = {}
    for _, house in pairs(soldHouses) do
        if house ~= nil then
            table.insert(soldHousesIds, house.houseId)
        end
    end
    local availableHouses = {}
    for _, house in pairs(defaultHouses) do
        if house ~= nil and not lib.table.contains(soldHousesIds, house.houseId) then
            table.insert(availableHouses, house)
        end
    end
    return availableHouses
end

---@param houseId number
---@param houseType "square"|"rectangle"|"furnished"|nil
local function PurchaseHouse(houseId, houseType)
    if not houseId then return false end
    if not houseType then
        houseType = "furnished"
    end
    Client.Functions.Callback(_e("Server:PurchaseHouse"), function(response)
        if not response.error then
            Client.Functions.SendNotify(locale("house_purchased", houseId), "success")
            return true
        else
            Client.Functions.SendNotify(locale("error", response.error), "error")
            return false
        end
    end, houseId, houseType)
end

exports("GetPlayerHouseId", GetPlayerHouseId)
exports("GetPlayerHouse", GetPlayerHouse)
exports("GetPlayerHousePlacedFurnitures", function()
    if Client?.Player?.inHouse then
        return Client?.Player?.Furniture?.createdFurnitures
    end
    return {}
end)
exports("GetPlayerHouses", GetPlayerHouses)
exports("UpdateHouseIndicator", UpdateHouseIndicator)
exports("GetAvailableHouses", GetAvailableHouses)
exports("PurchaseHouse", PurchaseHouse)

Server Exports

local function GetHouseById(houseId)
    return Server.SoldHouses[houseId]
end

-- Updates the specified indicator for a given house by adding or subtracting the provided value.
-- The `houseId` parameter specifies the ID of the house.
-- The `indicator` parameter specifies which indicator to update (e.g., "electricity", "power", "gas", or "water").
-- The `value` parameter specifies the amount to add to (positive value) or subtract from (negative value) the current indicator value.
-- The function returns the updated indicator value.
---@param houseId number
---@param indicator "electricity"|"power"|"gas"|"water"
---@param value number
---@return number
local function UpdateHouseIndicator(houseId, indicator, value)
    if not Utils.DefaultHouses[houseId] then
        return false
    end
    if not Config.Indicators[indicator] then
        return false
    end
    local House = Server.SoldHouses[houseId]
    if not House?.indicators[indicator] or (House.indicators[indicator] + value < 0) then
        return false
    end
    return Server.Functions.UpdateHouseIndicator(indicator, value, houseId)
end

---@param houseId number
---@param indicator "electricity"|"power"|"gas"|"water"
---@return number
local function GetHouseIndicatorValue(houseId, indicator)
    local House = Server.SoldHouses[houseId]
    if House then
        local indicator = House.indicators?[indicator]
        if indicator then
            return indicator
        end
    end
    return 0
end

local function GetAvailableHouses()
    local defaultHouses = Utils.DefaultHouses
    local soldHouses = Server.SoldHouses

    local soldHousesIds = {}
    for _, house in pairs(soldHouses) do
        if house ~= nil then
            table.insert(soldHousesIds, house.houseId)
        end
    end
    local availableHouses = {}
    for _, house in pairs(defaultHouses) do
        if house ~= nil and not lib.table.contains(soldHousesIds, house.houseId) then
            table.insert(availableHouses, house)
        end
    end
    return availableHouses
end

exports("GetHouseById", GetHouseById)
exports("UpdateHouseIndicator", UpdateHouseIndicator)
exports("GetAvailableHouses", GetAvailableHouses)
PreviousConfigurationNextDLC

Last updated 10 months ago