> For the complete documentation index, see [llms.txt](https://docs.t1ger.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.t1ger.net/resources/t1ger-mechanic-system/shop-account.md).

# Shop Account

The resource offers a custom account system that is standalone and not dependent on frameworks.

### Get Shop ID

You can get the player's mechanic shop id with this export:

```lua
local src = source
local shopID = exports['t1ger_mechanicsystem']:GetPlayerMechId(src)
-- src(INT): player server id
```

### Add Account Money

{% hint style="warning" %}
Requires: Mechanic Shop ID (use exports to get the ID based on player's server id or player's job name)
{% endhint %}

```lua
exports['t1ger_mechanicsystem']:PlusMechanicAccount(shopId, amount)
-- shopId(INT): mechanic shop id
-- amount(INT): amount of money to add to the account
```

### Remove Account Money

{% hint style="warning" %}
Requires: Mechanic Shop ID (use exports to get the ID based on player's server id or player's job name)
{% endhint %}

```lua
exports['t1ger_mechanicsystem']:MinusMechanicAccount(shopId, amount)
-- shopId(INT): mechanic shop id
-- amount(INT): amount of money to add to the account
```

### Usage - Example #1

Here's an example to easily add/remove money from a mechanic shop:

<pre class="language-lua"><code class="lang-lua"><strong>local src = source -- player server id
</strong><strong>local amount = 5000 -- how much should be added/removed? 
</strong>
-- export to get the shop id based on player server id:
local shopId = exports['t1ger_mechanicsystem']:GetPlayerMechId(src)

-- add money:
exports['t1ger_mechanicsystem']:PlusMechanicAccount(shopId, amount)

-- remove oney:
exports['t1ger_mechanicsystem']:MinusMechanicAccount(shopId, amount)
</code></pre>

### Usage - Example #2

Here's an alternative example using TriggerEvent (similar to esx\_addonaccount)

```lua
local playerJob = 't1mechanic' -- add function/export to get the player's job here. 
local amount = 5000 -- how much should be added/removed? 

TriggerEvent('mechanicsystem:server:getPlayerMechanicShop', playerJob, function(mechanicShop)
    -- remove money:
    if mechanicShop.account >= amount then
        exports['t1ger_mechanicsystem']:MinusMechanicAccount(mechanicShop.id, amount)
    else
        print("not enough money")
    end
    
    -- add money:
    exports['t1ger_mechanicsystem']:PlusMechanicAccount(mechanicShop.id, amount)
end)
```
