# Setup

#### **Setting Up the Script**

1. First things first: if you want to change the language, you can do so by modifying the `language.lua` file and directly editing the HTML file. This allows you to translate the entire script into your preferred language.
2. Specify your server type here. For **QB**, **ESX** (QBbox users, write **QB)**.<br>

   <figure><img src="https://1034396727-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBXIsRWbAXJHBnjtE4Gxk%2Fuploads%2F0NU4FG7f71Q89N3kcUxR%2Fimage.png?alt=media&#x26;token=35412c48-f4bf-41c2-a517-19ef9e1a542f" alt="" width="375"><figcaption></figcaption></figure>
3. To configure the ID card settings, you can start by adjusting the animation for how the ID is displayed. You also have the option to set the ID to automatically disappear after a certain amount of time or allow users to press the "E" key to manually hide the license. Additionally, you can enable metadata-based ID cards, which assign unique IDs containing information about the person who owns them. \
   This feature ensures that if someone steals another person's ID, the information displayed will still belong to the original owner. *Please note that your inventory system must support metadata for this feature to work. If it doesn't, you should disable this option by setting it to false.*<br>

   <figure><img src="https://1034396727-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBXIsRWbAXJHBnjtE4Gxk%2Fuploads%2F1Ga5qaABmj24uQjh4NQW%2Fimage.png?alt=media&#x26;token=b2a0398b-0126-4ddf-a0de-03edc8a03c2f" alt="" width="563"><figcaption></figcaption></figure>
4. You can choose from three profile picture modes: **Studio**, **Auto**, and **None**. Each mode is detailed within the config, allowing you to select the one that best suits your needs. If you opt for Studio mode, you can further configure it to support a **greenscreen** mode for background-free images.<br>

   <figure><img src="https://1034396727-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBXIsRWbAXJHBnjtE4Gxk%2Fuploads%2FkoOcXVwZnMjEA3bIXAxx%2Fimage.png?alt=media&#x26;token=cd19174b-f827-42e0-b7b0-5e4e7714eab1" alt="" width="563"><figcaption></figcaption></figure>
5. This script can be used with both the target system <mark style="color:green;">(</mark>[<mark style="color:green;">qb-target</mark>](https://github.com/qbcore-framework/qb-target)<mark style="color:green;">,</mark> [<mark style="color:green;">ox\_target</mark>](https://github.com/overextended/ox_target/releases)<mark style="color:green;">)</mark> and text UI ([<mark style="color:green;">ox\_lib</mark>](https://github.com/overextended/ox_lib/releases/tag/v3.25.0))<br>

   <figure><img src="https://1034396727-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBXIsRWbAXJHBnjtE4Gxk%2Fuploads%2FYSltBozsFkdUEHYC3NbX%2Fimage.png?alt=media&#x26;token=aae9e593-6232-46e6-80b0-069d261ce8c4" alt="" width="563"><figcaption></figcaption></figure>
6. Configure access to the License Creator, which is used to create live in-game licenses. You can set up the command name using the '`creatorCommand'` parameter. Additionally, you can restrict access to this command by specifying criteria such as Discord user ID, Steam ID, FiveM ID, Ace permissions, or specific jobs, ensuring that only authorised users can create licenses.<br>

   <figure><img src="https://1034396727-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBXIsRWbAXJHBnjtE4Gxk%2Fuploads%2FQ146sPB9sZMY9IO48RHx%2Fimage.png?alt=media&#x26;token=3b12b750-ef14-4d6f-98ae-9f7d5af25118" alt="" width="563"><figcaption></figcaption></figure>
7. License Checker settings allow you to configure the command used for checking and verifying issued licenses, similar to the License Creator. You can restrict access to this command by specifying identifiers such as Discord user ID, Steam ID, FiveM ID, Ace permissions, or specific jobs. This setting is particularly useful for allowing emergency units to verify the licenses of players in-game.<br>

   <figure><img src="https://1034396727-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBXIsRWbAXJHBnjtE4Gxk%2Fuploads%2Fy0UoUYob2zWanspaZB9M%2Fimage.png?alt=media&#x26;token=f4881305-92c1-4196-8a93-986c4932c3f0" alt="" width="563"><figcaption></figcaption></figure>
8. In the Fake/Forge ID Creator settings, you can enable or disable the system as needed. You can specify the item name using the '`itemName'` parameter for the fake or forged ID, and even add multiple locations where this menu can be accessed. If you prefer not to use it in this way, you can configure it to suit your needs by using the events provided in the Events and Exports section below. This flexibility allows you to tailor the system to your specific requirements.<br>

   <figure><img src="https://1034396727-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBXIsRWbAXJHBnjtE4Gxk%2Fuploads%2FnPRuBa7FZ17fV5QpE3h0%2Fimage.png?alt=media&#x26;token=9573fb94-9ae9-45b8-88fa-2ece71be616d" alt="" width="563"><figcaption></figcaption></figure>
9. In this section, you can configure the License Collection menu, where players can collect their issued licenses. You can add multiple locations for this menu, as shown in the configuration. Additionally, you can specify which types of licenses will be displayed for collection in the menu, such as Public ID, Job ID, or Worker ID. This allows you to customise the menu to display only the relevant licenses for players at certain locations.<br>

   <figure><img src="https://1034396727-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBXIsRWbAXJHBnjtE4Gxk%2Fuploads%2FzKgJNelQqrllppeteZi7%2Fimage.png?alt=media&#x26;token=3f77fa63-8d71-4ef7-8209-0b1097de1d17" alt="" width="563"><figcaption></figcaption></figure>
10. In this section, you can configure the Job Management panel. You can create multiple management panels as needed, as shown in the configuration. Specify the minimum job rank required to access each management panel and add the same panel to various locations if necessary. Additionally, you can enable job badges for specific jobs and customise them by changing the logo, theme colour, custom backgrounds, price, and item name of the job badge. These job panels are essential for allowing certain jobs to issue specific public licenses that were created using the License Creator in-game.<br>

    <figure><img src="https://1034396727-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBXIsRWbAXJHBnjtE4Gxk%2Fuploads%2F8826cY1o6TzxmPqRKbDt%2Fimage.png?alt=media&#x26;token=320dd1a8-7d30-418c-a58d-bec97e8b1aee" alt="" width="563"><figcaption></figcaption></figure>
11. In this section, you can add Worker IDs by specifying the job name, item name, title, logo, theme colour, and price. You can add an unlimited number of Worker IDs, similar to job badges and public licenses. Worker IDs are required for certain jobs and do not require management to issue or revoke them.<br>

    <figure><img src="https://1034396727-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBXIsRWbAXJHBnjtE4Gxk%2Fuploads%2FLxBxt9OKmszxLaZB5JQs%2Fimage.png?alt=media&#x26;token=b2af8d33-8ee7-416e-9348-3dcf91557164" alt="" width="563"><figcaption></figcaption></figure>

\
⚠️ **Note**: Remember to put all license items on your server after creating them. For example, the Job Badges Item from the config and the License Inventory Item from the Creator UI. These items must be on your server for you to be able to use them<br>

<figure><img src="https://1034396727-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBXIsRWbAXJHBnjtE4Gxk%2Fuploads%2Fyc4EDpfiDFxnLlWEotC1%2Fimage.png?alt=media&#x26;token=38b325b8-d9e9-4efb-a4f8-353a189d5299" alt="" width="563"><figcaption><p>Creator UI Example: You must create Item name in your server</p></figcaption></figure>

#### **Events and Exports&#x20;***<mark style="color:blue;">**(Only for Dev Purpose)**</mark>*

#### Client Side

1. <pre class="language-lua" data-title="Creator Panel 
   Opens the main UI for creating new license templates"><code class="lang-lua">TriggerEvent('cs:identity:creatorUI')
   </code></pre>
2. <pre class="language-lua" data-title="Job Management Panel
   Opens the management interface for a specific job (e.g., &#x27;police&#x27;)"><code class="lang-lua">TriggerEvent('cs:identity:managerUI', job_name)
   </code></pre>
3. ```lua
   TriggerEvent('cs:identity:cardMenu', {PublicID=true,JobID=true,WorkerID=true})
   ```
4. <pre class="language-lua" data-title="Fake/Forge ID Menu
   Opens the interface for crafting illegal/fake identifications"><code class="lang-lua">TriggerEvent('cs:identity:fakeCreator')
   </code></pre>
5. <pre class="language-lua" data-title="License Checker Menu
   Used by police or officials to check the licenses of nearby players."><code class="lang-lua">TriggerEvent('cs:identity:idCheck')
   </code></pre>
6. <pre class="language-lua" data-title="Capture Studio Photo
   An export that puts the player in a studio session and returns photo URL"><code class="lang-lua">local photoURL = exports['cs_license']:GetStudioPhoto()
   -- Returns the URL of the captured image
   </code></pre>
7. <pre class="language-lua" data-title="Check License Status
   Check if the local player has a specific license"><code class="lang-lua">local hasLicense = exports['cs_license']:CheckID(license_item_name)
   --For job badges, use the job name in place of "license_item_name"
   </code></pre>
8. <pre class="language-lua" data-title="Fetch Profile Picture
   Returns the URL of the player&#x27;s stored profile picture"><code class="lang-lua">local pic = exports['cs_license']:fetchPic(Player_ID)  --Player_ID is optional
   </code></pre>

### Server Side

1. <pre class="language-lua" data-title="Check License Status
   Check if a specific player has a license issued"><code class="lang-lua">exports['cs_license']:CheckID(Player_ID, license_item_name)
   --For job badges, use the job name in place of "license_item_name"
   </code></pre>
2. <pre class="language-lua" data-title="Give License Item
   Gives the physical item to the player
   Note: If the license is &#x22;issue-based,&#x22; the player must have it registered; otherwise, this export will not function. Instead, use the RegisterCard export for such cases"><code class="lang-lua">exports['cs_license']:GiveCard(Player_ID, license_item_name, studioMode)
   --For job badges, use the job name in place of "license_item_name"
   </code></pre>
3. <pre class="language-lua" data-title="Issue/Register License
   Registers a license to a player&#x27;s identifier in the database"><code class="lang-lua">exports['cs_license']:RegisterCard(Player_ID, license_item_name, expireDays, addItem)

   -- Player_ID: Server ID
   -- license_item_name: Item name (or Job Name for badges)
   -- expireDays: Number of days until expiry (or false for permanent)
   -- addItem: [boolean] Automatically give the item after registration
   </code></pre>
4. <pre class="language-lua" data-title="Revoke License
   Removes an issued license from the database."><code class="lang-lua">exports['cs_license']:RevokeCard(Player_ID, license_item_name) 
   --For job badges, use the job name in place of "license_item_name"
   </code></pre>
5. <pre class="language-lua" data-title="Give Worker ID
   Gives a worker-specific ID item based on the Config.WorkerID settings"><code class="lang-lua">exports['cs_license']:GiveWorkerCard(Player_ID, worker_job_name)
   </code></pre>
6. <pre class="language-lua" data-title="Fetch Profile Picture
   Returns the URL of the player&#x27;s stored profile picture"><code class="lang-lua">local pic = exports['cs_license']:fetchPic(Player_ID)
   </code></pre>
7. <pre class="language-lua" data-title="Fetch All Player Licenses
   Returns a table of every license a player currently holds"><code class="lang-lua">local licenses = exports['cs_license']:GetPlayerLicenses(identifier)

   -- Returns: {{license = "id_card", isPublic = true, expireDate = "Date", issueDate = "Date", heading = "Heading"}}
   </code></pre>
8. <pre class="language-lua" data-title="Fetch Job-Manageable Licenses
   Returns a list of licenses that a specific job is authorized to issue/manage"><code class="lang-lua">local list = exports['cs_license']:GetAllowedLicense(job)

   -- Returns: {{name = "Driver License", license = "driver_license"}}
   </code></pre>
