# 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.command = "minesgame"

Config.getPlayerName = function (src,user_id)
    return GetPlayerName(src) or 'Unknown';
end

Config.getUserBalance = function (user_id)
  if not user_id then return 0 end;
  return vRP.getBankMoney{user_id}
end

Config.giveUserReward = function (user_id,amount)
  if not user_id then return 0 end;
  return vRP.giveBankMoney{user_id,amount}
end

Config.tryPayBet = function (user_id,amount)
  if not user_id then return 0 end;
  local src = vRP.getUserSource({user_id});
  if not src then return 0 end;
  local maxBet = 1000;
  if amount > maxBet then return vRPclient.notify(src,{'Nu poti plasa un bet mai mare decat '..maxBet.."$",'error'}) end;
  return vRP.tryBankPayment{user_id,amount}
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/functions.lua*

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

Config = {}
Config.command = "minesgame" --open minigame
Config.maxBet = 100000 -- max bet

Config.getPlayerName = function(src)
  return GetPlayerName(src) or 'Unknown';
end

Config.getUserBalance = function(src)
  if not src then return 0 end;
  local Player = QBCore.Functions.GetPlayer(src)
  return Player.PlayerData.money.bank or 0;
end

Config.giveUserReward = function(src, amount)
  if not src then return 0 end;
  local Player = QBCore.Functions.GetPlayer(src)
  return Player.Functions.AddMoney('bank', amount, 'minesgame reward');
end

Config.tryPayBet = function(src, amount)
  if not src then return 0 end;
  local Player = QBCore.Functions.GetPlayer(src);
  if amount > Config.maxBet then
    return Config.NotifyFunction(Lang.Notify['maximum_amount'][1]:format(Config.maxBet),
      Lang.Notify['no_inventory_space'][2], src);
  end
  return Player.Functions.RemoveMoney('bank', amount, 'place minesgame bet');
end

Config.NotifyFunction = function(msg, type, source)
  if source then
    TriggerClientEvent('QBCore:Notify', source, msg, type) -- server side
  else
    QBCore.Functions.Notify(msg, type)                     -- client side
  end
end

Lang = {}
Lang.Notify = {
  ['no_money'] = { "You don't have the money to bet", 'error' },
  ['maximum_amount'] = { "You cann't place a bet more than %s", 'error' },
}
```

{% 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_minesgame/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.
