# Tattoo permissions

{% hint style="info" %}
If you previously used permissions directly in .json files, you can still keep it there, however it is recommended to use approach described below for any new permissions.
{% endhint %}

Tattoo permissions are used to limit certain tattoos to players only with some job or identifier.

* **Example usage 1**: Tattoo of gang symbol only available in shop, if you have `gang` job
* **Example usage 2**: VIP tattoo available only for one (or more) player(s) with certain identifier

\
👉 Job permissions working only with **ESX/QBCore** or if you have made your [custom framework integration](https://documentation.rcore.cz/paid-resources/rcore_tattoos/framework). Identifier permissions are working standalone.

### Where?

Permissions can be easily configured in `rcore_tattoos/config_permissions.lua`

### Example

This is just an example, whole process described below if needed

```lua
ConfigPermissions = {
    MP_Airraces_Tattoo_001_M = { -- tattoo hashMale or hashFemale, up to you
        -- Limit tattoo to players with certain jobs
        jobs = {
            { -- Available for 'police' job, from grade 1 
              name = "police",
              grade = 1
            },
            { -- Also avaiable for 'taxi' job, any grade
              name = "taxi"
            },
        },

        -- Limit tattoo to certain players
        identifiers = {
            'db123456abcdefghij7890', -- example identifier
        },
    },
}
```

## How to configure permission of a tattoo?

When you open the config specified above, you will see something like this:

```lua
ConfigPermissions = {
    ...
}
```

Each tattoo that should be allowed only to certain players must be defined here. As an identifier, use `hashMale` or `hashFemale` of the tattoo, which can be found in the .json file the tattoo is at (in `rcore_tattoos/assets/tattooLists/*.json`)

{% hint style="warning" %}
Pay attention to all quotation marks and commas, because if you miss some, your config could not work properly.
{% endhint %}

So first we define the tattoo we want to restrict:

```lua
ConfigPermissions = {
    MP_Airraces_Tattoo_001_M = {

    },
}
```

Then you can specify either a job limitation, or identifier.. or both!

### Job

In the example provided, you can see we added `jobs` to the permissions and then defined two jobs that the player must have to see the tattoo in the shop.\
You can define as many jobs, as you want.

* `name` - name of the job (the same name you put into /setjob etc.)
* `grade` - *optional*
  * if used, the tattoo will only be available from that grade, *(see job 1.)*
  * if not, tattoo will be available with any grade in that job *(see job 2.)*

```lua
ConfigPermissions = {
    MP_Airraces_Tattoo_001_M = {
        jobs = {
            {
                name = 'police',
                grade = 1,
            },
            {
                name = 'taxi',
            },
        },
    },
}
```

### Identifier

In the example provided, you can see we added `identifiers` to the permissions and defined two identifiers.\
The tattoo will only be available for the two players with those identifiers

**❗ Important**

* one identifier = one player
* you can use as many identifiers as you want
* the identifier you define here must be same you use in your users/players database
* For ESX use the **player license**, for QB/QBOX use the **citizenid**
* also pay attention if the identifier has prefix or not, also configured in `Config.LicenseWithoutPrefix` in config.lua

```lua
ConfigPermissions = {
    MP_Airraces_Tattoo_001_M = {
        identifiers = {
            'db123456abcdefghij7890e',
            'db2222aaaabbbcccddddeee',
        },
    },
}
```

\
\
🎉 **Great job!** You should now be able to make restricted tattoos!
