# Banking Scripts

> This is a little guide on how to connect **AV Business with a banking script**, for this guide I'm using Renewed Banking and TeamsGG Banking, this means only these 2 resources are compatible? **NO**. I'm using them as example, you can make your own resource compatible by using the exports.

{% hint style="info" %}
Society exports can be found in **av\_laptop/server/editable/exports.lua**
{% endhint %}

{% tabs %}
{% tab title="Renewed" %}

### Get Society Funds

* This export returns the current funds from society, replace the function with your banking export like this:

```lua
-- Returns society money or false
function getSociety(name)
    if not name then print('[ERROR] Function getSociety received NULL as argument') return end
    return exports['Renewed-Banking']:getAccountMoney(name) -- EXAMPLE with RB
end
```

### Add Society Funds

* This export adds funds for society and will add logs for Business APP > Bank tab

```lua
function addSociety(src, job, amount, name, description)
    if avBusiness then -- Optional but highly recommended to keep it
        --This export adds the log for Bank tab + add income for monthly goal
        exports['av_business']:addMoney(name, job, amount, description)
    end
    -- You can add your banking exports here:
    exports['Renewed-Banking']:addAccountMoney(job,amount) -- EXAMPLE with RB
end
```

### Remove Society Funds&#x20;

* This export removes society funds.

```lua
function removeSociety(src, job, amount, name, description)
    if avBusiness then
        -- Add logs for Bank tab in Business APP
        exports['av_business']:removeMoney(name, job, amount, description)
    end
    exports['Renewed-Banking']:removeAccountMoney(job,amount) -- EXAMPLE with RB
end
```

{% endtab %}

{% tab title="TGG" %}

### Get Society Funds

* This export returns the current funds from society, replace the function with your banking export like this:

```lua
-- Returns society money or false
function getSociety(name)
    if not name then print('[ERROR] Function getSociety received NULL as argument') return end
    local account = exports['tgg-banking']:GetSocietyAccount(name)
    return account and account['balance'] or 0
end
```

### Add Society Funds

* This export adds funds for society and will add logs for Business APP > Bank tab

```lua
function addSociety(src, job, amount, name, description)
    if avBusiness then -- Optional but highly recommended to keep it
        --This export adds the log for Bank tab + add income for monthly goal
        exports['av_business']:addMoney(name, job, amount, description)
    end
    exports['tgg-banking']:AddSocietyMoney(job, amount)
end
```

### Remove Society Funds&#x20;

* This export removes society funds.

```lua
function removeSociety(src, job, amount, name, description)
    if avBusiness then
        -- Add logs for Bank tab in Business APP
        exports['av_business']:removeMoney(name, job, amount, description)
    end
    exports['tgg-banking']:RemoveSocietyMoney(job, amount)
end
```

{% endtab %}

{% tab title="OKOK" %}

### Get Society Funds

* This export returns the current funds from society, replace the function with your banking export like this:

```lua
-- Returns society money or false
function getSociety(name)
    if not name then print('[ERROR] Function getSociety received NULL as argument') return end
    local account = exports['okokBanking']:GetAccount(name)
    return account or 0
end
```

### Add Society Funds

* This export adds funds for society and will add logs for Business APP > Bank tab

```lua
function addSociety(src, job, amount, name, description)
    if avBusiness then -- Optional but highly recommended to keep it
        --This export adds the log for Bank tab + add income for monthly goal
        exports['av_business']:addMoney(name, job, amount, description)
    end
    exports['okokBanking']:AddMoney(job, amount)
end
```

### Remove Society Funds&#x20;

* This export removes society funds.

```lua
function removeSociety(src, job, amount, name, description)
    if avBusiness then
        -- Add logs for Bank tab in Business APP
        exports['av_business']:removeMoney(name, job, amount, description)
    end
    exports['okokBanking']:RemoveMoney(job, amount)
end
```

{% endtab %}
{% endtabs %}
