# Banking V3

Supported on [ESX](https://github.com/esx-framework) and [QB](https://github.com/qbcore-framework) servers.

<details>

<summary>SQL Structure</summary>

* We've made a SQL Structure separated of default QB/ESX banking scripts to avoid incompatibility problems, so, you need to go on `_SQLS` and run the `if-banking.sql`, you also need to run specific SQL for your Framework which is on the folder.

</details>

<details>

<summary>Change Open Method</summary>

You can alternate to use Marker or Target.

* Marker:
  * Draws a marker + help text on Bank Locations
  * Shows a help text when near to ATM Props
  * No need of external resources
  * Less optimisation (impacts on resource perfomance when near to a bank/atm)
* Target:
  * Shows a target on Bank Locations and on ATM Props
  * Needs a external resource ([ox\_target](https://github.com/overextended/ox_target) or [qb-target](https://github.com/qbcore-framework/qb-target))
  * Better optimisation than with Marker (doesn't impacts on resource peformance)

</details>

<details>

<summary>Create Card Items</summary>

* You need to create the card items on your server (`lscard_gray`, `lscard_black`, `lscard_blue`) and (`mazecard_gray`, `mazecard_black`, `mazecard_blue`).
  * ESX: Just run the SQL file.
  * QBCore: Go to your framework folder like `qb-core/shared/items.lua` and create the items (must be unique and useable).
  * If you have a inventory and want to it shows the card details, check this example:

    * Go to your inventory script like `qb-inventory/html/js/script.js`, search for the `FormatItemInfo` function, and adds to it:<br>

      ```javascript
      } else if ((itemData.name).includes("lscard") || (itemData.name).includes("mazecard")) {
          $(".item-info-title").html('<p>'+itemData.label+'</p>')
          var str = ""+ itemData.info.cardNumber + "";
          var res = str.slice(12);
          var cardNumber = "************" + res;
          $(".item-info-description").html('<p><strong>Card Holder: </strong><span>' + itemData.info.name + '</span></p><p><strong>Citizen ID: </strong><span>' + itemData.info.identifier + '</span></p><p><strong>Card Number: </strong><span>' + cardNumber + '</span></p>');
      ```

    or just search to `itemData.name == "visa" || itemData.name == "mastercard"` and change to `(itemData.name).includes("lscard") || (itemData.name).includes("mazecard")`.

</details>

<details>

<summary>Discord Webhook</summary>

We provides a webhook system for the transactions.

On each transaction performed, the script sends a message to the configured webhook.

The message contains: `player character name + player game name + transaction details + date`.

</details>

<details>

<summary>Transactions Implementation</summary>

You can create a transaction using: `exports['if-bankingv1']:addBankStatement(identifier, amountDeposited, amountWithdrawn, statementDescription)`

Note: The script listens for ESX/QB money exchange events, and if a "reason" is found, it automatically creates a transaction.

</details>

<details>

<summary>Translations</summary>

The script has a Translation system, you can create a new language if needed.

</details>


---

# 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://if-developments.gitbook.io/docs/resources/banking-v3.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.
