# Framework

{% hint style="warning" %}
For experienced **DEVELOPERS** only!
{% endhint %}

## Config File

Start by setting the framework to other:

```lua
Config.Framework = 3 --[ 1 = ESX / 2 = QBCore / 3 = Other ]
```

Make sure the following values are left empty:

```lua
Config.FrameworkTriggers = {
    notify = '',
    object = '',
    resourceName = '',
}

Config.FrameworkSQLTables = {
    table = '',
    identifier = '',
}
```

## Database File

Open the `rcore_gangs/server/database/api.lua` file. When you start this resource for the first time a thread will automatically create all the necessary tables, however the default collation for these tables is set to `utf8mb4_general_ci`. Please make sure that's the collation you use for the table where you'll store the gang members, otherwise change it to your currently used collation on the following line:

```lua
-- You can find this in your file by searching the following piece of code
local collation = SQL.Scalar('SELECT TABLE_COLLATION FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = @tableName', { ['@tableName'] = Config.FrameworkSQLTables.table }) or 'utf8mb4_general_ci'
```

Once that's done you'll need to make changes to certain functions which communicate with tables outside this resource. These functions share one thing in common which is the fact that they execute dynamically edited sql queries with the help of the config. The way this needs to be edited is to get rid of `Config.FrameworkSQLTables.table` and `Config.FrameworkSQLTables.identifier` variables.

```lua
-- Config.FrameworkSQLTables.table - This variable represents a table name where the player data is stored
-- Config.FrameworkSQLTables.identifier - This variable represents a column name which is used as an identifier

-- The following functions utilize these variables and need to be edited
SQL.InsertGang
SQL.DeleteGang
SQL.SetPlayerGang
SQL.GetGangMembers
```

## Framework Files

Lastly the most crucial part is to integrate client/server framework files. These files are located in `rcore_gangs/client/framework/framework_other.lua` and `rcore_gangs/server/framework/framework_other.lua`. This is where you connect your framework with the resource using bridge functions which are described in JSDoc. You can get a good idea on what to do from the other framework files. Here's the most used function for example:

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

```lua
-- Gets a unique player identifier typically used in the database
-- @returns {string | number} identifier - The identifier
Framework.GetPlayerId = function()
end
```

{% endtab %}

{% tab title="Server" %}

```lua
-- Gets a unique player identifier typically used in the database
-- @param {number} source - The player's server identifier
-- @returns {string | number} identifier - The identifier
Framework.GetPlayerId = function(source)
end
```

{% endtab %}
{% endtabs %}
