# Functions

{% tabs %}
{% tab title="vRP" %}
Functions are made for a basic **Dunko vRP base**. If your functions are not matching please edit \
vRP. functions from *config/config.lua*

```lua
Config = {}

Config.getPlayerMoney = function(user_id)
    if user_id then
        local playerMoney = {
            cash = vRP.getMoney { user_id },
            bank = vRP.getBankMoney { user_id },
        }
        return playerMoney;
    end
end

Config.getPlayerSurvival = function(user_id)
    if user_id then
        local vitals = {
            food = math.ceil(100 - vRP.getHunger { user_id }),
            drink = math.ceil(100 - vRP.getThirst { user_id }),
        }
        return vitals;
    end
end

```

{% endtab %}

{% tab title="QBCore" %}
Functions are made for a basic **QBCore Server base**. If your functions are not matching please edit QBCore.Functions from *config/config.lua*

```lua
local QBCore = exports['qb-core']:GetCoreObject()

Config = {}

Config.getPlayerMoney = function(source) -- from sever side;
    if source then
        local Player = QBCore.Functions.GetPlayer(source)
        if Player then
            local cashMoney = Player.PlayerData.money.cash;
            local bankMoney = Player.PlayerData.money.bank;
            local playerMoney = {
                cash = cashMoney,
                bank = bankMoney,
            }
            return playerMoney;
        end
    end
end

Config.getPlayerSurvival = function(source) -- from client side
    if source then
        local Player = QBCore.Functions.GetPlayer(source)
        if Player then
            local vitals = {
                food = math.ceil(Player.PlayerData.metadata.hunger),
                drink = math.ceil(Player.PlayerData.metadata.thirst)
            }
            return vitals;
        end
    end
end
```

{% endtab %}

{% tab title="ESX" %}

{% 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://axero-scripts.gitbook.io/axr-documentation/resources/axr_hudv1/functions.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.
