Var-Documentation
  • 📚Var Documentation
  • 🌎Theme / Translate
    • Change theme
    • Change language
  • 🔓For open source
    • Change UI
  • 👕Clothes Shop
    • Installation
    • 🔩Configuration
      • 🏳️Blips/Marker
      • 📚Translate
      • 📷Change cam and pos
  • 🃏Casino
    • Installation
    • 🔩Configuration
      • 🏳️Main config
      • 🏇Horse
      • 🎡Lucky Whell
      • 📚Translate
  • 🕺Emote
    • Installation
    • 🔩Configuration
      • 🏳️Main config
      • 💃Emote List
      • 📚Translate
  • ⚔️Crew
    • Installation
    • 🪛Export
  • 👮Alert Job
    • Installation
    • 🪛Server Export
  • 🔐Pin Code
    • Installation
    • 🪛Export
  • 🏢Society Manager
    • Installation
    • 🪛Export
    • 🔩Configuration
      • 📚Translate
      • 💵Max salary
      • 📜Last invoice
  • 🏘️Property
    • Installation
    • 🔩Configuration
      • 📚Translate
      • 🖼️Add interior
  • 💈Barber shop
    • Installation
    • 🔩Configuration
      • 🔓Change menu (Open source)
      • 🏳️Blips
      • 📚Translate
      • ✂️Add shop
  • 🛒Shop with basket
    • Installation
    • 🔩Configuration
      • 🍏Item/Category config
      • 🏳️Blips/Marker
      • 📚Translate
      • ➕Add shop
  • 🖋️Tattoo shop
    • Installation
    • 🔩Configuration
      • ✏️Edit Tattoo
      • 🏳️Blips/Marker
      • 📚Translate
      • ➕Add shop
  • 🏡Gardener Job
    • Installation
    • 🔩Configuration
      • ℹ️Change pos farm
      • 🏳️Blips
      • 📚Translate
  • 🏧Heist ATM
    • Installation
    • 🔩Configuration
      • 💰Event money
      • 📚Translate
      • 👮Police alert
  • 🏦Heist Fleeca
    • Installation
    • 🔩Configuration
      • 📚Translate
      • 📍Pos Fleeca Heist
  • 🏙️Poster Job
    • Installation
    • 🔩Configuration
      • ℹ️Change pos farm
      • 🖼️Change poster texture
      • 🏳️Blips/Marker
      • 📚Translate
  • 🖼️Loading Screen
    • Installation
    • ⚙️Configuration
  • 🏦Bank
    • Installation
    • 🔩Configuration
      • 🧍‍♂️Ped
      • 🏳️Blips
      • 📚Translate
      • 🚩Add Bank Pos
      • 🏢Society
  • 🚘AutoCarDealer
    • Installation
    • 🔩Configuration
      • ➕Add Vehicles
      • 📚Translate
      • 🏳️Blips
      • 📍Coords
  • 📸Character Creator
    • Installation
    • 🔩Configuration
      • 📚Translate
      • 😃Expression
      • ⚙️Spawn
  • 👥Multi Character
    • Installation
    • 🔩Configuration
      • 📚Translate
      • 📸Change Character Creator
      • ⚙️Commands
  • 📝Bill
    • Installation
    • 🔩Configuration
      • 📚Translate
      • #️⃣Control
Powered by GitBook
On this page
  • Step 1
  • Step 2
  • Step 3
  • Step 4
  • Step 5
  1. Property

Installation

PreviousLast invoiceNextConfiguration

Last updated 5 months ago

Installing this resource is like any other resource only verified that you have the required dependencies

Step 1

Connect via this site: with your CFX account to which your purchase was made on the store

Step 2

Step 3

As this script requires a database you must insert the SQL into it, if you have some problems with SQL insertion please import it directly by the button import and click on the button "choose a file"

Step 4

Once the download is complete, unzip the file and drag it into the resources folder of your server

If you added the resource while your server was already running, remember to do the refresh command and then ensure the resource

refresh
ensure Var-Property

Step 5

To resolve the issue where you get stuck inside a property after leaving the server and reconnecting, follow these steps.

Replace the function "Core.SavePlayer" -> es_extended/server/functions.lua by this one

function Core.SavePlayer(xPlayer, cb)
    if not xPlayer.spawned then
        return cb and cb()
    end

    updateHealthAndArmorInMetadata(xPlayer)

    local parameters = {
        json.encode(xPlayer.getAccounts(true)),
        xPlayer.job.name,                      
        xPlayer.job.grade,                     
        xPlayer.group,                         
        json.encode(xPlayer.getInventory(true)),
        json.encode(xPlayer.getLoadout(true)),  
        json.encode(xPlayer.getMeta()),         
        xPlayer.identifier,                     
    }

    local sql = "UPDATE `users` SET `accounts` = ?, `job` = ?, `job_grade` = ?, `group` = ?, `inventory` = ?, `loadout` = ?, `metadata` = ? WHERE `identifier` = ?"

    if not ServerSavePlayers[xPlayer.identifier] then
        local playerPosition = json.encode(xPlayer.getCoords(false, true))
        table.insert(parameters, 5, playerPosition)
        sql = "UPDATE `users` SET `accounts` = ?, `job` = ?, `job_grade` = ?, `group` = ?, `position` = ?, `inventory` = ?, `loadout` = ?, `metadata` = ? WHERE `identifier` = ?"
    end

    MySQL.prepare(
        sql,
        parameters,
        function(affectedRows)
            if affectedRows == 1 then
                print(('[^2INFO^7] Saved player ^5"%s^7"'):format(xPlayer.name))
                TriggerEvent("esx:playerSaved", xPlayer.playerId, xPlayer)
            end
            if cb then
                cb()
            end
        end
    )
end

Replace the function "Core.SavePlayer" -> es_extended/server/functions.lua by this one :

function Core.SavePlayer(xPlayer, cb)
    local parameters = {
        json.encode(xPlayer.getAccounts(true)),
        xPlayer.job.name,
        xPlayer.job.grade,
        xPlayer.group,
        json.encode(xPlayer.getInventory(true)),
        json.encode(xPlayer.getLoadout(true)),
        json.encode(xPlayer.getMeta()),
        xPlayer.identifier
    }

    local sql = 'UPDATE `users` SET `accounts` = ?, `job` = ?, `job_grade` = ?, `group` = ?, `inventory` = ?, `loadout` = ?, `metadata` = ? WHERE `identifier` = ?'

    if not ServerSavePlayers[xPlayer.identifier] then
        table.insert(parameters, 5, json.encode(xPlayer.getCoords()))
        sql = 'UPDATE `users` SET `accounts` = ?, `job` = ?, `job_grade` = ?, `group` = ?, `position` = ?, `inventory` = ?, `loadout` = ?, `metadata` = ? WHERE `identifier` = ?'
    end

    MySQL.prepare(
        sql,
        parameters,
        function(affectedRows)
            if affectedRows == 1 then
                print(('[^2INFO^7] Saved player ^5"%s^7"'):format(xPlayer.name))
                TriggerEvent('esx:playerSaved', xPlayer.playerId, xPlayer)
            end
            if cb then
                cb()
            end
        end
    )
end

And add this event where you want in es_extended/server/functions.lua

ServerSavePlayers = {}

RegisterServerEvent("Property:CanSave")
AddEventHandler("Property:CanSave", function(bool, identifier)
	ServerSavePlayers[identifier] = bool
end)
🏘️
https://keymaster.fivem.net/
https://www.var-fivem.com/
Go to the Granted Assets category and download the most recent version of the Property Creator
Page cover image