> For the complete documentation index, see [llms.txt](https://tefox-scripts.gitbook.io/tefox-scripts-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tefox-scripts.gitbook.io/tefox-scripts-docs/tefox-scripts-documentation/tefox-idcards/installation.md). Agents can also search and read this documentation through its [MCP server](https://tefox-scripts.gitbook.io/tefox-scripts-docs/~gitbook/mcp).

# Installation

## <mark style="color:red;">**Step 1**</mark>

**• Place the resource inside your resources folder.**

<mark style="color:yellow;">📂</mark> <mark style="color:yellow;background-color:yellow;">resources/tefox-idcards</mark>

## <mark style="color:red;">Step 1</mark>

**• Add this to your server.cfg:**

```lua
ensure tefox-idcards
```

## <mark style="color:red;">Step 3</mark>

**• Add the SQL (ESX):**

```lua
ALTER TABLE users ADD COLUMN citizenid VARCHAR(16) DEFAULT NULL;
CREATE UNIQUE INDEX idx_users_citizenid ON users (citizenid);
```

## <mark style="color:red;">Step 4</mark>

#### <mark style="color:cyan;">**• Items Installation:**</mark>

{% tabs %}
{% tab title="qb-core/shared/items.lua" %}

```lua
-- Card ITEMS
id_card = { 
  name = 'id_card',
  label = 'ID Card',
  weight = 0,
  type = 'item',
  image = 'id_card.png',
  unique = true,
  useable = true,
  shouldClose = false,
  description = 'A card containing all your information to identify yourself'
},

driver_license = { 
  name = 'driver_license',
  label = 'Driver License',
  weight = 0,
  type = 'item',
  image = 'driver_license.png',
  unique = true,
  useable = true,
  shouldClose = false,
  description = 'Permit to show you can drive a vehicle'
},

lawyer_card = { 
  name = 'lawyer_card',
  label = 'Lawyer Card',
  weight = 0,
  type = 'item',
  image = 'lawyer_card.png',
  unique = false,
  useable = true,
  shouldClose = true,
  description = 'Pass exclusive to lawyers'
},

weaponlicense = { 
  name = 'weaponlicense',
  label = 'Weapon License',
  weight = 0,
  type = 'item',
  image = 'weapon_license.png',
  unique = true,
  useable = true,
  shouldClose = true,
  description = 'Weapon License'
},

police_card = { 
  name = 'police_card',
  label = 'Police Card',
  weight = 0,
  type = 'item',
  image = 'police_card.png',
  unique = false,
  useable = true,
  shouldClose = true,
  description = 'Official police identification card'
},

ambulance_card = { 
  name = 'ambulance_card',
  label = 'Ambulance Card',
  weight = 0,
  type = 'item',
  image = 'ambulance_card.png',
  unique = false,
  useable = true,
  shouldClose = true,
  description = 'Medical staff identification card'
},

fib_card = { 
  name = 'fib_card',
  label = 'F.I.B Card',
  weight = 0,
  type = 'item',
  image = 'fib_card.png',
  unique = false,
  useable = true,
  shouldClose = true,
  description = 'Federal Investigation Bureau identification'
},

sheriff_card = { 
  name = 'sheriff_card',
  label = 'Sheriff Card',
  weight = 0,
  type = 'item',
  image = 'sheriff_card.png',
  unique = false,
  useable = true,
  shouldClose = true,
  description = 'Sheriff department identification card'
},

fake_idcard = { 
  name = 'fake_idcard',
  label = 'Fake ID Card',
  weight = 0,
  type = 'item',
  image = 'fake_idcard.png',
  unique = true,
  useable = true,
  shouldClose = false,
  description = 'A forged identification card'
},
```

{% endtab %}

{% tab title="ox\_inventory/data/items.lua" %}

<pre class="language-lua"><code class="lang-lua"><strong>-- Card ITEMS
</strong>    ['id_card'] = {
        label = 'Citizen ID Card',
        weight = 1,
        stack = false,
        close = true,
        description = 'Official citizen identification card'
    },

    ['fake_idcard'] = {
        label = 'Citizen ID Card',
        weight = 1,
        stack = false,
        close = true,
        description = 'Official citizen identification card'
    },

    ['driver_license'] = {
        label = 'Driver License',
        weight = 1,
        stack = false,
        close = true,
        description = 'Official driver license'
    },

    ['weaponlicense'] = {
        label = 'Weapon License',
        weight = 1,
        stack = false,
        close = true,
        description = 'Official weapon license'
    },

    -- =====================
    -- Job Cards
    -- =====================

    ['police_card'] = {
        label = 'Police ID Card',
        weight = 1,
        stack = false,
        close = true,
        description = 'Police department identification card'
    },

    ['sheriff_card'] = {
        label = 'Sheriff ID Card',
        weight = 1,
        stack = false,
        close = true,
        description = 'Sheriff department identification card'
    },

    ['fib_card'] = {
        label = 'F.I.B ID Card',
        weight = 1,
        stack = false,
        close = true,
        description = 'Federal Investigation Bureau identification card'
    },

    ['ambulance_card'] = {
        label = 'EMS ID Card',
        weight = 1,
        stack = false,
        close = true,
        description = 'Emergency medical services identification card'
    },

    ['lawyer_card'] = {
        label = 'Lawyer ID Card',
        weight = 1,
        stack = false,
        close = true,
        description = 'Official lawyer identification card'
    },

</code></pre>

{% endtab %}
{% endtabs %}

## <mark style="color:red;">Step 5</mark>

**• Add item images to the inventory:**

The images are located in the <mark style="color:yellow;background-color:yellow;">tefox-idcards/install/Inventory Images</mark> folder.

Add them to the inventory.

## <mark style="color:red;">Step 6</mark>

**Restart the server:**

## <mark style="color:red;">Step 7</mark>

#### **✨ Target Integration (Highly Recommended)**

Allow Police and Sheriff to physically inspect players' documents using your target system.

💡 Smart Feature: The script automatically checks if the target player actually has the item in their inventory before showing the card to the officer. If they don't have it, the officer will be notified!

You can add multiple options so officers can check different cards (ID, Driver License, Fake ID, etc.) from the same menu. Just make sure the cardType matches the key in your Config.Cards.

#### <mark style="color:blue;">**For qb-target users:**</mark>

Place this inside any of your client scripts (e.g., inside qb-policejob or qb-target configuration):

```lua
exports['qb-target']:AddGlobalPlayer({
    options = {
        -- 1. Inspect Citizen ID Card
        {
            type = "client",
            event = "tefox-idcards:client:OpenCardFromTarget",
            icon = "fas fa-id-card",
            label = "Inspect ID Card",
            cardType = "id", 
            job = {["police"] = 0, ["sheriff"] = 0} 
        },
        -- 2. Inspect Driver License
        {
            type = "client",
            event = "tefox-idcards:client:OpenCardFromTarget",
            icon = "fas fa-car",
            label = "Inspect Driver License",
            cardType = "driver", 
            job = {["police"] = 0, ["sheriff"] = 0} 
        },
        -- 3. Inspect Fake ID
        {
            type = "client",
            event = "tefox-idcards:client:OpenCardFromTarget",
            icon = "fas fa-user-secret",
            label = "Inspect Fake ID",
            cardType = "fake", -- Replace 'fake' with your actual fake ID key from config
            job = {["police"] = 0, ["sheriff"] = 0} 
        }
    },
    distance = 2.0 
})
```

#### <mark style="color:blue;">**For ox\_target users:**</mark>

**Place this inside any of your client scripts:**

```lua
exports.ox_target:addGlobalPlayer({
    -- 1. Inspect Citizen ID Card
    {
        name = 'check_identity',
        icon = 'fa-solid fa-id-card',
        label = 'Inspect ID Card',
        event = 'tefox-idcards:client:OpenCardFromTarget',
        cardType = 'id', 
        groups = {'police', 'sheriff'} 
    },
    -- 2. Inspect Driver License
    {
        name = 'check_driver',
        icon = 'fa-solid fa-car',
        label = 'Inspect Driver License',
        event = 'tefox-idcards:client:OpenCardFromTarget',
        cardType = 'driver', 
        groups = {'police', 'sheriff'} 
    },
    -- 3. Inspect Fake ID
    {
        name = 'check_fake_id',
        icon = 'fa-solid fa-user-secret',
        label = 'Inspect Fake ID',
        event = 'tefox-idcards:client:OpenCardFromTarget',
        cardType = 'fake', -- Replace 'fake' with your actual fake ID key from config
        groups = {'police', 'sheriff'} 
    }
})

```

#### **💡 Developer API (Exports) & Dynamic System:**

Our API is fully dynamic! If you want to integrate the ID cards with Radial Menus, Custom NPCs, or Interaction Scripts, you can use our built-in exports from the open-source client/api.lua file.

You are not limited to just the \[object Object]. You can replace \[object Object] in the exports below with any Card Key defined in your config.lua. (for example: 'driver', 'weapon', 'police', 'sheriff')

<mark style="color:blue;">**Open your own card:**</mark>

```lua
exports['tefox-idcards']:OpenMyCard('id') -- Change 'id' to the desired card key
```

**Inspect another player (For Interaction Scripts):**

```lua
local targetServerId = 1 -- Replace with the actual target's Server ID
exports['tefox-idcards']:ViewPlayerCard('id', targetServerId) -- Change 'id' to the desired card key
```

<mark style="color:blue;">**Open the Fake ID Creation Menu:**</mark>

If you want to allow players to create fake IDs via a custom ped (NPC), target, or command, use this export to open the menu:\*\*

```lua
exports['tefox_documents']:OpenFakeMenu()
```
