Property
Installation
-- 5 steps · 5 code blocks · 1 min read
Installing this resource is like any other resource only verified that you have the required dependencies
01step
Connect via this site: https://keymaster.fivem.net/ with your CFX account to which your purchase was made on the store https://www.var-fivem.com/
02step

Go to the Granted Assets category and download the most recent version of the Property Creator
03step
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"

04step
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
05step
To resolve the issue where you get stuck inside a property after leaving the server and reconnecting, follow these steps.
1.10.10 - Core.SavePlayer
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
1.10.1 - Core.SavePlayer
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
Property:CanSave
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)