> For the complete documentation index, see [llms.txt](https://documentation.rcore.cz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://documentation.rcore.cz/paid-resources/rcore_tattoos/api/server.md).

# Server

All server-side events for `rcore_tattoos`.

***

## Events

<details>

<summary>getPlayerTattoosByIdentifier</summary>

Returns a table of player's tattoos by their identifier.

* The identifier is the one you use in the `rcore_tattoos` database table.
* This event is mainly used for integrations. You can pass the player tattoos to the `setPedTattoos` client event to apply tattoos to a ped in multichar for example.

```lua
---@param identifier string
---@param cb function

TriggerEvent('rcore_tattoos:getPlayerTattoosByIdentifier', identifier, cb)
```

Example:

```lua
TriggerEvent('rcore_tattoos:getPlayerTattoosByIdentifier', 'license:1234567890abcdef', function(tattoos)
    -- do something with the tattoos
end)
```

</details>

<details>

<summary>addPlayerTattoo</summary>

Adds a tattoo to player's body without deducting their money and passes `true/false` to callback depending on success.

```lua
---@param playerId number
---@param tattooName string
---@param tattooIdentifier string
---@param expiration? number
---@param opacity? number
---@param cb function

TriggerEvent('rcore_tattoos:addPlayerTattoo', playerId, tattooName, tattooIdentifier, expiration, opacity, cb)
```

</details>

<details>

<summary>removePlayerTattoo</summary>

Removes a tattoo on player's body and passes `true/false` to callback depending on success.

```lua
---@param playerId number
---@param tattooIdentifier string
---@param cb function

TriggerEvent('rcore_tattoos:removePlayerTattoo', playerId, tattooIdentifier, cb)
```

</details>

<details>

<summary>buyTattoo</summary>

Same as adding a tattoo, but this will go through the buying process (removing player money etc.) and passes `true/false` to callback depending on success.

```lua
---@param playerId number
---@param tattooName string
---@param tattooIdentifier string
---@param expiration? number
---@param opacity? number
---@param cb function

TriggerEvent('rcore_tattoos:buyTattoo', playerId, tattooName, tattooIdentifier, expiration, opacity, cb)
```

</details>

<details>

<summary>getPlayerTattoos</summary>

Returns a table of player's tattoos.

```lua
---@param playerId number
---@param cb function

TriggerEvent('rcore_tattoos:getPlayerTattoos', playerId, cb)
```

</details>

<details>

<summary>getTattooPriceByName / getTattooPriceByIdentifier</summary>

Returns the price of the given tattoo as a number.

```lua
---@param tattooName string
---@param cb function
TriggerEvent('rcore_tattoos:getTattooPriceByName', tattooName, cb)

---@param tattooIdentifier string
---@param cb function
TriggerEvent('rcore_tattoos:getTattooPriceByIdentifier', tattooIdentifier, cb)
```

Example with callback:

```lua
TriggerEvent('rcore_tattoos:getTattooPriceByName', 'TAT_AR_001', function(price)
    print('The tattoo price is $' .. price)
end)
```

**Console output:**

```
The tattoo price is $300
```

</details>

<details>

<summary>openTattooMenuForPlayer</summary>

Opens the tattoo shop UI for a player. Also available on the client - see [Client API](/paid-resources/rcore_tattoos/api/client.md#opentattoomenuforplayer).

```lua
---@param playerId number
---@param onlyPreview? bool  - open the shop as a preview shop (only browsing tattoos)
---@param part? string       - body part to open the menu for: head, body, left_arm, right_arm, left_leg, right_leg (nil = whole menu)
---@param cb function

TriggerEvent('rcore_tattoos:openTattooMenuForPlayer', playerId, onlyPreview, part, cb)
```

</details>

<details>

<summary>getTattooCollectionByName</summary>

Returns the collection of the tattoo from given name.

```lua
---@param tattooName string - name of the tattoo (e.g. `TAT_AR_001`)
---@param cb function

TriggerEvent(triggerName('getTattooCollectionByName'), tattooName, cb)
-- returns > mpchristmas2017_overlays
```

</details>

<details>

<summary>getTattooNameHashByName</summary>

Returns name hashes of the tattoo from given name.

```lua
---@param tattooName string - name of the tattoo (e.g. `TAT_AR_001`)
---@param cb function

TriggerEvent(triggerName('getTattooNameHashByName'), tattooName, cb)
-- returns > {
--     ["hashMale"] = MP_Christmas2017_Tattoo_007_M,
--     ["hashFemale"] = MP_Christmas2017_Tattoo_007_F,
-- }
```

</details>
