# Installation

{% hint style="info" %}
Installing this resource is like any other resource only verified that you have the required dependencies
{% endhint %}

## Step 1

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/>

## Step 2

<figure><img src="https://4276650587-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVpsT0CEZ6FFjUJ4WIhHY%2Fuploads%2F9VLJQrER0vR95r1E5YVB%2Fimage.png?alt=media&#x26;token=a96d3707-655a-41ce-901a-016a4e1feb5d" alt=""><figcaption><p>Go to the Granted Assets category and download the most recent version of the Property Creator</p></figcaption></figure>

## 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"

<figure><img src="https://4276650587-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVpsT0CEZ6FFjUJ4WIhHY%2Fuploads%2F9fd2CBiY3xZ3gfZLALMR%2Fimage.png?alt=media&#x26;token=89542b79-b6e1-42a5-bff6-0ad8949e3a71" alt=""><figcaption></figcaption></figure>

## Step 4

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

{% hint style="warning" %}
If you added the resource while your server was already running, remember to do the refresh command and then ensure the resource
{% endhint %}

```powershell
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.

{% tabs %}
{% tab title="1.10.10  - Core.SavePlayer" %}
Replace the function "Core.SavePlayer" -> es\_extended/server/functions.lua by this one&#x20;

```lua
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
```

{% endtab %}

{% tab title="1.10.1  - Core.SavePlayer" %}
Replace the function "Core.SavePlayer" -> es\_extended/server/functions.lua by this one :

```lua
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
```

{% endtab %}

{% tab title="Property:CanSave" %}
And add this event where you want in es\_extended/server/functions.lua

```lua
ServerSavePlayers = {}

RegisterServerEvent("Property:CanSave")
AddEventHandler("Property:CanSave", function(bool, identifier)
	ServerSavePlayers[identifier] = bool
end)

```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.var-fivem.com/property/installation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
