> For the complete documentation index, see [llms.txt](https://docs.av-scripts.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.av-scripts.com/laptop-pack/racing/installation/permissions.md).

# Permissions

> This permissions functions are located in **server/editable/permissions.lua**

> This file allows you to configure specific permissions, including the ability to create events and new tracks.
>
> Both functions must return a Boolean (true/false) indicating whether the user has access to the feature.
>
> Each function has its own permissions check:
>
> * **isAdmin(playerId)** = Returns true/false if player is Admin, using the Fivem ACE Permissions native.
> * **createTracks table** = There's a table in the same file, where you can add your players Framework identifier and/or Rockstar License to allow them to use the function.

<figure><img src="/files/U3MFshF5e62zgDXBLCXE" alt=""><figcaption></figcaption></figure>

{% tabs %}
{% tab title="Create Tracks" %}

> This permission allows the player to register new circuits.

```lua
function CanCreateTracks(playerId,laptopSerial) -- Player can create new tracks, return true/false
    dbug("CanCreateTracks(playerId, laptopSerial)", playerId, laptopSerial)
    local res = isAdmin(playerId) -- run the default admin check
    if res then return true end -- if player is admin return true, no need to run any extra code

    local characterIdentifier = exports['av_laptop']:getIdentifier(playerId) -- Character Framework identifier
    local license = GetPlayerIdentifierByType(playerId, "license") -- Player rockstar license
    if createTracks[characterIdentifier] or createTracks[license] then
        return true
    end
    -- EXAMPLE CHECKING IF PLAYER HAVE X ITEM
    -- Will return true/false if player have item gold_dongle with him
    --[[
        return exports['av_laptop']:hasItem(playerId, "gold_dongle")
    ]]--

    -- EXAMPLE CHECKING IF LAPTOP CONTAINER HAVE X ITEM, ONLY WORKS WITH ox and origen inventory !
    --[[
        return exports['av_laptop']:hasDevice(laptopSerial, "gold_dongle")
    ]]--
    return false
end
```

{% endtab %}

{% tab title="Create Events" %}

> This permission allows players to create new events.

```lua
function CanCreateRaces(playerId,laptopSerial) -- Player can create new events (races), return true/false
    dbug("CanCreateRaces(playerId, laptopSerial)", playerId, laptopSerial)
    local res = isAdmin(playerId) -- run the default admin check
    if res then return true end -- if player is admin return true, no need to run any extra code

    local characterIdentifier = exports['av_laptop']:getIdentifier(playerId) -- Character Framework identifier
    local license = GetPlayerIdentifierByType(playerId, "license") -- Player rockstar license
    if createEvents[characterIdentifier] or createEvents[license] then
        return true
    end
    -- EXAMPLE CHECKING IF PLAYER HAVE X ITEM
    -- Will return true/false if player have item gold_dongle with him
    --[[
        return exports['av_laptop']:hasItem(playerId, "gold_dongle")
    ]]--

    -- EXAMPLE CHECKING IF LAPTOP CONTAINER HAVE X ITEM, ONLY WORKS WITH ox and origen inventory !
    --[[
        return exports['av_laptop']:hasDevice(laptopSerial, "gold_dongle")
    ]]--
    return false
end
```

{% endtab %}
{% endtabs %}
