# Home

Here you will find all documentations of jaksam's scripts, some pages may require coding knowledge

## How to use the documentations

Most of the scripts will have a folder named **integrations**, where you can add the integration code at the bottom of the files. So most of the times, you will only need to add your code inside these files, not in other scripts

Be sure to read carefully the comments, they will explain you everything you need above the lines of code

Integrations files:

* `integrations/cl_integrations.lua` - Here there will be the code for **client side** scripts, as for example replacing the notifications or progress bar (usually here you can insert the code from `Client` category of the documentations)
* `integrations/sh_integrations.lua` - Here there will be the code that will run **both on client side and server side**, usually there will be the external scripts names, so you will be able to edit the names if your server uses a different name than the default one
* `integrations/sv_integrations.lua` - Here there will be the code for **server side** scripts (usually here you can insert the code from `Server` category of the documentations)

If you are looking for an option that you can't find in normal config/settings, probably it will be inside the integrations files


# How to update the scripts

Here you can know how to update scripts without losing any changes

1. Go to [FiveM keymaster](https://keymaster.fivem.net/asset-grants) to update the script (simply download it again)
2. If your existing script has a `current_config.json` file, keep it to save your changes and use it in the new updated version
3. Check the updates channels to be aware of any database changes

{% hint style="danger" %}
Do **NOT** keep `default_config.json` file, always use the one included in the latest download
{% endhint %}

{% hint style="info" %}
If the version you're updating doesn't have `current_config.json`, you'll need to set up the config files again after the update.
{% endhint %}

{% hint style="info" %}
The version you download from FiveM Keymaster, will **always** be the latest version available
{% endhint %}


# Fix server crash on script start

If your server crashes when starting the script, it means you are using an old version of `mysql-async` script

Fixing this issue, is very simple and fast, you have 2 options

## Installing OxMySQL (strongly recommended)

Installing **OxMySQL** to replace `mysql-async` is recommended since it will improve your server performance, and it also have compatibility with `mysql-async` script, allowing you an easy replace. Check [this page](https://overextended.github.io/docs/oxmysql/) for the installation of it

## Installing the updated mysql-async (not recommended)

To update your `mysql-async` script, you only have to install [this](https://github.com/brouznouf/fivem-mysql-async) script instead of your current `mysql-async`, be sure to rename the script folder to **mysql-async**


# Issues with items

It may happen that if you have particular inventories, item addition or removal causes errors in server console

In this case, to try fixing the issue try doing the following steps:

## Step 1

1. Go in the script folder in `integrations/sv_integrations.lua` file
2. Set this option from

```lua
SKIP_ITEM_EXISTS_CHECK = false
```

to

```lua
SKIP_ITEM_EXISTS_CHECK = true
```

## Step 2

1. If the script has a `default_config.json` file, edit this option in the `"server"` section from

```json
"canAlwaysCarryItem": false,
```

to

```json
"canAlwaysCarryItem": true,
```

Example screenshots:

Before:

<figure><img src="https://3735039044-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFH9TH8An8XLjMiOMvVGb%2Fuploads%2Fgit-blob-686c8ec9943710fca4b0fe41fc30c4d5c3b28aa9%2Fcan_always_carry_item_before.jpg?alt=media" alt=""><figcaption></figcaption></figure>

After:

<figure><img src="https://3735039044-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFH9TH8An8XLjMiOMvVGb%2Fuploads%2Fgit-blob-7f773ae3d01b10dd56faa3495358efd06d48c180%2Fcan_always_carry_item_after.jpg?alt=media" alt=""><figcaption></figcaption></figure>

2\. If the script has `current_config.json` file (which is a different file from the previous one), edit again the option `canAlwaysCarryItem` to true

Example screenshots:

Before:

<div align="center"><figure><img src="https://3735039044-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFH9TH8An8XLjMiOMvVGb%2Fuploads%2Fgit-blob-eeb4b24107b8b6a45f5736a7c2290c049b7db43d%2Fcurrent_config_can_always_carry_before.jpg?alt=media" alt=""><figcaption></figcaption></figure></div>

After:

<figure><img src="https://3735039044-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFH9TH8An8XLjMiOMvVGb%2Fuploads%2Fgit-blob-d6e0192893f6d73d906815e61a376bb1618e5440%2Fcurrent_config_can_always_carry_after.jpg?alt=media" alt=""><figcaption></figcaption></figure>

### What to do if I don't have canAlwaysCarryItem option?

If you don't have the `canAlwaysCarryItem` option, you simply need to add it, be sure to add it at the **beginning** of the `server` part

Example

Before:

<figure><img src="https://3735039044-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFH9TH8An8XLjMiOMvVGb%2Fuploads%2Fgit-blob-ef9ce7abb5b167e59b2f71e63cb8e00baf795bda%2Fno_can_always_carry_item_before.jpg?alt=media" alt=""><figcaption></figcaption></figure>

After:

<figure><img src="https://3735039044-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFH9TH8An8XLjMiOMvVGb%2Fuploads%2Fgit-blob-3ce50c9f4057bce91da5094aacc1977792a28c5e%2Fno_can_always_carry_item_after.jpg?alt=media" alt=""><figcaption></figcaption></figure>

## Step 3

The item you are working on, must exist to be used in the scripts. To be sure the item exist, you can try to give it to yourself

Creating the item depends on your framework and/or on your inventory, so creating it will be up to you


# Manually set ESX shared object

On ESX, it may happen for many reason that you encounter the following error error (in F8 console or in server console)

<figure><img src="https://3735039044-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFH9TH8An8XLjMiOMvVGb%2Fuploads%2Fgit-blob-6752a51b3e99b99dfe80c8c8d983fd5f5f2ad792%2Fesx_shared_object_error.png?alt=media" alt=""><figcaption></figcaption></figure>

This usually happens because the script cannot find the *ESX shared object* of your `es_extended` script automatically

To solve the issue, you have to find the shared object name of your `es_extended` script in the file `es_extended/client/common.lua`

This is an example of what you can find (you may have something else)

<figure><img src="https://3735039044-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFH9TH8An8XLjMiOMvVGb%2Fuploads%2Fgit-blob-0fe8ddd60648d3cd40a091346121702107242720%2Fesx_shared_object_example.png?alt=media" alt=""><figcaption></figcaption></figure>

After you found your *ESX shared object* name, you can manually set it in the files `integrations/sv_integrations.lua` **and** `integrations/cl_integrations.lua`, replacing the `nil` with the name of your shared object **(between double quotes)**

**Do not** replace the left side, only replace the right side

An example:

<figure><img src="https://3735039044-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFH9TH8An8XLjMiOMvVGb%2Fuploads%2Fgit-blob-416049e0e1b87091ef9235ffa445190c9c82e4f2%2Fedited_shared_object.png?alt=media" alt=""><figcaption></figcaption></figure>


# Common FAQ

This page contains common FAQ shared for all scripts, if your issue is not in this page, be sure to check the FAQ of the script you are having issues with

<details>

<summary>Crash</summary>

Crashes can be caused by 2 things:

* You have to whitelist these objects models in your anticheat:`L1_1`• `GetHashKey('L1_1')`• `2116969379`
* If you still experience crashes after whitelisting those objects models in your anticheat, you can refer to [this page](/jaksams-scripts/fix-server-crash-on-script-start)

*If you don't know how to whitelist objects models in your anticheat, ask to your anticheat creator*

</details>

<details>

<summary>Attempted to index a nil value (field 'ESX')</summary>

If you have this error, it means the script couldn't retrieve the shared object of ESX.

This error might be caused by other errors you have in your server/F8 console, which happens before it does.

If you don't have any other error before that one, you can refer to [this page](/jaksams-scripts/manually-set-esx-shared-object)

</details>

<details>

<summary>How to fix "missing menu_default" error</summary>

To fix the error, simply read the installation tutorial of the script

</details>

<details>

<summary>Objects/Props not spawning</summary>

If the props don't spawn, it's very probably an issue with your anticheat

Be sure to whitelist all the props in your anticheat, if you don't know how, ask to your anticheat creator

</details>

<details>

<summary>Can't receive ANY item</summary>

If you have already tried with different items and you can't receive any of them, check [this page](/jaksams-scripts/issues-with-items)

</details>

<details>

<summary>Can't receive WEAPONS ONLY</summary>

If only weapons cause issues but items work fine, these are the possible reasons:

* On ESX, it's most likely because your server doesn't support the standard ESX method `xPlayer.addWeapon`
* On QBCore, it may be that your inventory is changing the default behaviour of qb-inventory

This is not an issue which depends on the script, but on your framework/inventory and cannot be solved by us, the standard methods must work

</details>

<details>

<summary>How to replace default notifications</summary>

To replace the notifications of any script, you can refer to the documentation of the script, it has events that allows you to disable the default one and call an external one

*Note: external scripts integration is completely down to you*

</details>

<details>

<summary>How to replace the default progress bar</summary>

To replace the progress bar of any script, you can refer to the documentation of the script, it has events that allows you to disable the default one and call an external one

*Note: external scripts integration is completely down to you*

</details>

<details>

<summary>Scripts transfers</summary>

Scripts can be transferred one time only through the FiveM keymaster, by using the side button instead of “Download”. There are no manual revoke or manual transfers in any situation at all

</details>

<details>

<summary>Refunds</summary>

Purchases in jaksam’s store are final, this applies for any situation, wrong framework, wrong accounts, etc. So in case of refunds, unfortunately we cannot help with them at all

</details>


# Nexus Terms

This page will describe the few rules Nexus has, and some information you'll find useful

## What is Nexus?

Nexus is a project by jaksam's scripts that enables server administrators to share and import script data among different servers

## What will be stored?

In simple terms, we store as little sensitive information as possible. Primarily, we save script data, which is non-sensitive. Below is a list of the information that is stored. Please note that this list may be updated, and it is your responsibility to check it periodically

* **Script Version**: The version of the script you are using
* **Shared Script Data**: The specific script data you actively choose to share (e.g., in Jobs Creator, this would be the job data)
* **Server IP**: Stored securely as an SHA256 hash, making it unreadable
* **Player Information**: Includes your player nickname and player identifier
* **Server License:** Only a small part and stored securely as an SHA256 hash, making it unreadable (So even before encryption, the small part sent won't be usable by anyone)

## Rules

The rules are straightforward: exercise good judgment when interacting with the platform. Specifically, refrain from using offensive language in the descriptions of the content you share or in similar contexts. Misuse of Nexus features may result in a Nexus ban. However, you'll still be able to use the script without limitations; only the Nexus features may be restricted, based on the script developer's discretion


# LICENSE

License for the documentation

Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License

By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions.

Section 1 – Definitions.

```
Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image.
Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights.
Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements.
Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material.
Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License.
Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license.
Licensor means the individual(s) or entity(ies) granting rights under this Public License.
NonCommercial means not primarily intended for or directed towards commercial advantage or monetary compensation. For purposes of this Public License, the exchange of the Licensed Material for other material subject to Copyright and Similar Rights by digital file-sharing or similar means is NonCommercial provided there is no payment of monetary compensation in connection with the exchange.
Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them.
Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world.
You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning.
```

Section 2 – Scope.

```
License grant.
    Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to:
        reproduce and Share the Licensed Material, in whole or in part, for NonCommercial purposes only; and
        produce and reproduce, but not Share, Adapted Material for NonCommercial purposes only.
    Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions.
    Term. The term of this Public License is specified in Section 6(a).
    Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material.
    Downstream recipients.
        Offer from the Licensor – Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License.
        No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material.
    No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i).

Other rights.
    Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise.
    Patent and trademark rights are not licensed under this Public License.
    To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties, including when the Licensed Material is used other than for NonCommercial purposes.
```

Section 3 – License Conditions.

Your exercise of the Licensed Rights is expressly made subject to the following conditions.

```
Attribution.

    If You Share the Licensed Material, You must:
        retain the following if it is supplied by the Licensor with the Licensed Material:
            identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated);
            a copyright notice;
            a notice that refers to this Public License;
            a notice that refers to the disclaimer of warranties;
            a URI or hyperlink to the Licensed Material to the extent reasonably practicable;
        indicate if You modified the Licensed Material and retain an indication of any previous modifications; and
        indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License.
    For the avoidance of doubt, You do not have permission under this Public License to Share Adapted Material.
    You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information.
    If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable.
```

Section 4 – Sui Generis Database Rights.

Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material:

```
for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database for NonCommercial purposes only and provided You do not Share Adapted Material;
if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material; and
You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database.
```

For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights.

Section 5 – Disclaimer of Warranties and Limitation of Liability.

```
Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You.
To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You.

The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability.
```

Section 6 – Term and Termination.

```
This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically.

Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates:
    automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or
    upon express reinstatement by the Licensor.
For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License.
For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License.
Sections 1, 5, 6, 7, and 8 survive termination of this Public License.
```

Section 7 – Other Terms and Conditions.

```
The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed.
Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License.
```

Section 8 – Interpretation.

```
For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License.
To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions.
No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor.
Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority.
```


# Home

{% hint style="danger" %}
If the scripts work and as soon as you restart the server a few times they stop working, then you have a virus in your server. We can't help you in that case
{% endhint %}

Here you will find the solutions to common errors when using mine scripts due FiveM Escrow system

To verify if your error is caused by the FiveM asset escrow, you can simply restart the script and check **both** in **F8 console** and in **server console** (txAdmin) for errors

## <mark style="color:yellow;">How to know if my error is caused by FiveM escrow system?</mark>

To understand if something in a script is not working because of the FiveM asset escrow system, do this:

1. Restart the script causing issues, using the command `ensure your_script_name` in txAdmin console or restarting the script the way you usually do

   <figure><img src="https://3735039044-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFH9TH8An8XLjMiOMvVGb%2Fuploads%2Fgit-blob-9c34abf0c951d6a78c2da981a035ba805e41fdd0%2Ff8_restart.gif?alt=media" alt=""><figcaption><p>in-game F8 restart example</p></figcaption></figure>

   <figure><img src="https://3735039044-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFH9TH8An8XLjMiOMvVGb%2Fuploads%2Fgit-blob-e910d8e5571294de8eb2d8d624472e6ba6473824%2Fserver_restart.gif?alt=media" alt=""><figcaption><p>server console restart example</p></figcaption></figure>
2. Check the txAdmin console (server console) **and** the F8 in-game console, looking for errors
3. If there is any error similar to the ones in the [images below](#examples-of-the-errors-caused-by-the-fivem-escrow-system), your issue **is caused by the FiveM asset escrow system**

### Examples of the errors caused by the FiveM Escrow system

<figure><img src="https://3735039044-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFH9TH8An8XLjMiOMvVGb%2Fuploads%2Fgit-blob-23ee8070ba477d20c50130bc45657241e9e0ef6b%2Ferror_parsing.png?alt=media" alt=""><figcaption><p><strong>Solution -></strong> <a href="/fivem-escrow-system-errors/error-parsing-script-...-less-than-1-greater-than"><strong>here</strong></a></p></figcaption></figure>

<figure><img src="https://3735039044-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFH9TH8An8XLjMiOMvVGb%2Fuploads%2Fgit-blob-f884bf9f73027d04464d697b03914321d8030276%2Ferror_parsing_2.png?alt=media" alt=""><figcaption><p><strong>Solution -></strong> <a href="/fivem-escrow-system-errors/error-parsing-script-...-less-than-1-greater-than"><strong>here</strong></a></p></figcaption></figure>

<figure><img src="https://3735039044-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFH9TH8An8XLjMiOMvVGb%2Fuploads%2Fgit-blob-cdd63c66c88a890b8e2d3e795cd2fb044d706600%2Ffailed_to_verify_protected_resource.png?alt=media" alt=""><figcaption><p><strong>Solution -></strong> <a href="/fivem-escrow-system-errors/failed-to-verify-protected-resource"><strong>here</strong></a></p></figcaption></figure>

<figure><img src="https://3735039044-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFH9TH8An8XLjMiOMvVGb%2Fuploads%2Fgit-blob-18edea0d0ba2f9b6bf3f9a2e3eff2a1b0d95767b%2Flack_entitlement.jpg?alt=media" alt=""><figcaption><p><strong>Solution -></strong> <a href="/fivem-escrow-system-errors/you-lack-the-required-entitlement"><strong>here</strong></a></p></figcaption></figure>

## Solutions

If you can't start / use a script, here's a list of possible reasons/solutions:

* If the scripts work and as soon as you restart the server a few times they stop working, then you have a virus in your server. We can't help you in that case. Please read [What to do if nothing is fixing the errors](/fivem-escrow-system-errors/what-to-do-if-nothing-is-fixing-the-errors)
* **Minimum** server artifacts version 4752
* OneSync has to be enabled
* **Don't** use FileZilla, use [WinSCP](https://winscp.net/eng/download.php) instead of it
* Use the correct license key generated by the same account where you downloaded the script

It's **strongly** suggested to read all the pages carefully, since these fixes are tested by many users and they are supposed to work, if none of the pages helps you to fix the errors, please read [here](/fivem-escrow-system-errors/what-to-do-if-nothing-is-fixing-the-errors)

\
\
\
You can find all mine scripts [here](https://jaksam1074-fivem-scripts.tebex.io/)


# Error parsing script ... <\1>

Error message **example**:\
`Error parsing script @jobs_creator/server/markers/job_shop.lua in resource jobs_creator: @jobs_creator/server/markers/job_shop.lua:1: syntax error near '<\1>'`

## Possible reasons

* You are transferring the folder to the VPS file by file, please upload the .zip file and extract it **after** it is already on your VPS (so drag and drop the zip file and **not** the folder)
* You may have to clear the **server** caches
* The download was corrupted, try doing a new clean install
* You have a virus on your server that is modifying other script files (very likely if everything else hasn't fixed it)

## How to verify my server version?

To verify what server version your server is currently using, you have to use the following command in your FiveM server console: `version`

### Example

<figure><img src="https://3735039044-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFH9TH8An8XLjMiOMvVGb%2Fuploads%2Fgit-blob-6e41df20d1be96f2415585d67832045a797598ea%2Fversion_example.jpg?alt=media" alt=""><figcaption></figcaption></figure>

## How to update my server version?

To update your server version, you have to download the new [server artifacts](https://runtime.fivem.net/artifacts/fivem/build_server_windows/master/) and to extract and replace them in your server folder

This is the **official** [FiveM guide](https://docs.fivem.net/docs/server-manual/setting-up-a-server/) to update your server

## My server version is already updated, but I have the error

If you have the error even if your server version is not the issue, then you have to check [here](/fivem-escrow-system-errors/failed-to-verify-protected-resource)


# Failed to verify protected resource

Error message example:\
`[svadhesive] Failed to verify protected resource jobs_creator`

## Possible reasons

* You don't have `.fxap` file in the script folder
* You are using **Filezilla**
* Your server hosting is using **Filezilla** to upload the script
* You are transferring the folder to the VPS file by file, please upload the .zip file and extract it **after** it is already on your VPS (so drag and drop the zip file and **not** the folder)
* The download was corrupted, try doing a new clean install

## Solutions

1. Download the script again from [FiveM keymaster](https://keymaster.fivem.net/)
2. Upload the script using [WinSCP](https://winscp.net/eng/download.php) *instead of* Filezilla
3. Restart the server


# You lack the required entitlement

Error message example:\
`You lack the required entitlement to use script_name`

## Reason

All scripts which are using the FiveM escrow system, are linked to your FiveM account (the account you used on Tebex).

In order to work, the script(s) require to run in a server which is using a server key created by the same FiveM account you used on Tebex.

## What is a server key?

* The server key is the key that can be generated in [FiveM keymaster](https://keymaster.fivem.net/)
* The server key it's **not** a script key
* A FiveM server can use only **1** server key

### Example of a server key in server.cfg

`sv_licenseKey "27ztq5g2pcjua67q4xywujkuzh5m7j4a"`

## How to verify my server key?

To verify what server key your server is currently using, you have to use the following command in your FiveM server console: `sv_licenseKey`

### Example:

<figure><img src="https://3735039044-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFH9TH8An8XLjMiOMvVGb%2Fuploads%2Fgit-blob-28930b6c009f7253294228fd82b8040534aa8ade%2Fexample_server_key.jpg?alt=media" alt=""><figcaption></figcaption></figure>

## How to verify if I am using the correct server key?

To verify if you are using the correct **server key**, follow these steps:

1. Use the command `sv_licenseKey` in your FiveM server console
2. Take note of the **server key** you are currently using
3. Go to [FiveM keymaster](https://keymaster.fivem.net/)
4. Verify if in the account which you are logged in [FiveM keymaster](https://keymaster.fivem.net/) owns the script(s) you are trying to use. If the script is not there, it means you used a different account on Tebex, or you have transferred the script to another account\
   **Example with** [**Jobs Creator script**](https://forum.cfx.re/t/jobs-creator-4-6-esx-in-game-job-creation-menu-without-server-restart/2667762)

   <figure><img src="https://3735039044-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFH9TH8An8XLjMiOMvVGb%2Fuploads%2Fgit-blob-72ca8f414f7f3689bd34de981c4d54c7261f5c50%2Fexample_purchased_assets.jpg?alt=media" alt=""><figcaption></figcaption></figure>
5. If the account you are using in [FiveM keymaster](https://keymaster.fivem.net/) owns the script(s), you have to verify if the **server key** your server is using, it's generated by the same account

   <figure><img src="https://3735039044-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFH9TH8An8XLjMiOMvVGb%2Fuploads%2Fgit-blob-0d48806638d5bdad3b688ceb025a5e723436264f%2Fkeymaster_keys_list.jpg?alt=media" alt=""><figcaption></figcaption></figure>

## My server key is generated by someone else that's not me, what can I do?

You have 2 options:

* Generate a key from your account and to use it
* Transfer the script ownership to the other account

## How to transfer the script to another account?

To transfer the script to another account, you can head to:

[FiveM keymaster](https://keymaster.fivem.net/) -> **Purchased assets** tab -> **Transfer to another account** red button

**Note: cfx.re decided that the scripts can be transferred only 1 time, so you won't be able to transfer the script again**

## ZAP-Hosting server key

If you are using a Zap-Hosting server, you do **not** have to enter your server key in server.cfg, but directly in their website

[Here there is the official guide of ZAP hosting for it](https://zap-hosting.com/guides/docs/en/fivem_licensekey/)

Example screenshot:

<figure><img src="https://3735039044-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFH9TH8An8XLjMiOMvVGb%2Fuploads%2Fgit-blob-72a0742ea70588ef42bc9f7909b84dd76efc3a2a%2Fzap_hosting_custom_key.png?alt=media" alt=""><figcaption></figcaption></figure>


# What to do if nothing is fixing the errors

## I followed all steps but nothing is working, what can I do?

If you have followed all steps, then you just have a virus in your server. Try creating a clean server with only the default framework scripts and jaksam's scripts

### How to verify if I have a virus in my server?

Open the file which is being mentioned by jaksam's script with **notepad**, scroll down to the bottom. If there is partially readable code (for example "`local...`"), that's a virus added by something else, because normally the entire file would be encrypted. In this case, you'll have to solve that issue before being able to use any script


# Home

This is the official Jobs Creator documentation

* Official [FiveM post](https://forum.cfx.re/t/jobs-creator-esx-in-game-jobs-creation-menu-without-server-restart/2667762/253)
* Tebex [page](https://jaksam1074-fivem-scripts.tebex.io/)


# Installation

## Installation

The installation of the script is extremely easy

{% hint style="danger" %}
Do NOT use **FileZilla** to upload the files, otherwise the script will NOT work

Use [WinSCP](https://winscp.net/eng/download.php) instead
{% endhint %}

{% tabs %}
{% tab title="ESX" %}

## Installation

1. Download the script and extract it in your resources
2. Add this code in your auto start (example: server.cfg)

```
add_unsafe_worker_permission jobs_creator # Allows jobs_creator to automatically install itself
ensure jobs_creator
```

3. The script will **automatically** setup the database, in case it doesn't, you can manually run the files in `jobs_creator/sql/` folder

## Adding the items - Optional

To add the premade items, you only have to run the file `jobs_creator/sql/items_limit.sql` **or** `jobs_creator/sql/items_weight.sql` depending on your server, if it uses the limit or the weight

{% hint style="info" %}
The latest version of ESX uses **weight**
{% endhint %}

{% hint style="warning" %}
If it doesn't work, be sure to use the latest version of the official ESX with the dependencies
{% endhint %}
{% endtab %}

{% tab title="QBCore" %}

## Installation

1. Download the script and extract it in your resources
2. Add this code in your auto start (example: server.cfg)

```
add_unsafe_worker_permission jobs_creator # Allows jobs_creator to automatically install itself
ensure jobs_creator
```

3. The script will **automatically** setup the database, in case it doesn't, you can manually run the files in `jobs_creator/sql/` folder
4. Download and extract the script [menu\_default (clickable link)](https://drive.google.com/file/d/1Ezz-d50NIKQZeZJ-RgyclvNG7qC4Nfu8/view?usp=sharing) in your resources, **without renaming it**, and add it to auto start (example: server.cfg)

## Adding the items - Optional

To add the new items, you have to edit `qb-core/shared/items.lua` file and add at the bottom of the table the following code

```lua
	['fixkit'] = {['name'] = 'fixkit', ['label'] = 'Fixkit', ['weight'] = 500, ['type'] = 'item', ['image'] = 'your_image.png', ['unique'] = false, ['useable'] = false, ['shouldClose'] = false, ['combinable'] = nil},
	['medikit'] = {['name'] = 'medikit', ['label'] = 'Medikit', ['weight'] = 500, ['type'] = 'item', ['image'] = 'your_image.png', ['unique'] = false, ['useable'] = false, ['shouldClose'] = false, ['combinable'] = nil},
	['sponge'] = {['name'] = 'sponge', ['label'] = 'Sponge', ['weight'] = 500, ['type'] = 'item', ['image'] = 'your_image.png', ['unique'] = false, ['useable'] = false, ['shouldClose'] = false, ['combinable'] = nil},
	['handcuffs'] = {['name'] = 'handcuffs', ['label'] = 'Handcuffs', ['weight'] = 500, ['type'] = 'item', ['image'] = 'your_image.png', ['unique'] = false, ['useable'] = false, ['shouldClose'] = false, ['combinable'] = nil},
	['lockpick'] = {['name'] = 'lockpick', ['label'] = 'Lockpick', ['weight'] = 500, ['type'] = 'item', ['image'] = 'your_image.png', ['unique'] = false, ['useable'] = false, ['shouldClose'] = false, ['combinable'] = nil},
	['bandage'] = {['name'] = 'bandage', ['label'] = 'Bandage', ['weight'] = 500, ['type'] = 'item', ['image'] = 'your_image.png', ['unique'] = false, ['useable'] = false, ['shouldClose'] = false, ['combinable'] = nil},
```

#### Screenshot example

<figure><img src="https://3735039044-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFH9TH8An8XLjMiOMvVGb%2Fuploads%2Fgit-blob-4e7e867c1b653f91968cde606b215cf901c5c44c%2Fqb_core_jobs_creator_items.jpg?alt=media" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %}
If it doesn't work, be sure to use the latest version of the official QBCore with the dependencies
{% endhint %}
{% endtab %}
{% endtabs %}

You are ready to go! Enjoy the script 😁

## Optional step

After the database is setup correctly, you can delete the files in `jobs_creator/sql/` folder, so the script won't try to setup the database each time you start the script


# FAQ

This page has FAQs related **ONLY to this script**, be sure to also check [Common FAQ](/jaksams-scripts/common-faq) for other issues

<details>

<summary>How to change animations</summary>

[This is a list of usable animations](https://alexguirre.github.io/animations-list/)

* Bigger text is the animation dictionary
* Smaller text is animation name

[This is the list of usable scenarios](https://wiki.rage.mp/index.php?title=Scenarios)

The main difference between scenarios and animations, is that usually a scenario have a object attached to animation

*It's not possible to use external animations*

**Note: not all animations in the lists work**

</details>

<details>

<summary>How to lock jobs vehicles</summary>

To lock vehicle you have 2 possibilities:

1. You use the events and exports from the script documentation to integrate your own car lock script
2. You can use **jaksam's Vehicles Keys** which has Jobs Creator integration included

*Note: external scripts integration is completely down to you*

</details>

<details>

<summary>How does Jobs Creator handles salaries/wages?</summary>

Jobs Creator doesn't handle the salaries, this is because the framework script does it

* For ESX, `es_extended` and `esx_society` scripts handle the salaries
* For QBCore, `qb-core` handles the salaries

So you will be able to **define** the salaries in Jobs Creator, but it will be the framework giving money

</details>

<details>

<summary>How to fix "Couldn't create marker" error</summary>

This issue is caused by something wrong in `job_data` table of the database

Possible solutions:

1. Delete `job_data` table from the database and restart the script/server
2. The `id` column of the `job_data` table doesn't have **AUTO INCREMENT** as default value, you have to make it that the default value of that column is **AUTO INCREMENT**

</details>

<details>

<summary>Why outfits features don't work?</summary>

If outfits features don't work, it's because you don't have the dependencies to use them

* On ESX, you must have `esx_skin` and `skinchanger` scripts installed
* On QBCore, you must have `qb-clothing` script installed

Jobs Creator has integration for [**illenium-appearance**](https://github.com/iLLeniumStudios/illenium-appearance) that should work on both frameworks

</details>

<details>

<summary>Weapon upgrader doesn't work</summary>

In case the weapon upgrader marker doesn't work, these are 2 possible reasons:

1. You are using an addon weapon, but you didn't configure it properly in `es_extended` script
2. Your inventory edits the standard behavior of **ESX/QBCore**, so in this case you must use your own inventory instead of Jobs Creator to use weapons components and tints

</details>

<details>

<summary>Edit vehicles labels in garages</summary>

Jobs Creator retrieves the vehicles labels through FiveM natives, so to have custom labels, you'll have to configure them in your addon vehicle script.

In FiveM forums there are multiple guides on how to configure addon vehicles display names

</details>


# Modules

Modules are an easy way for Jobs Creator to replace certain default features (notify, progress bar, stash, logs)

To choose an existing module, you open /jobscreator menu, go in settings, choose it. As easy as that

### How to create a custom module?

Creating a module is extremely easy:

1. Navigate to `jobs_creator/_modules` folder
2. Choose the module type you want to create (logs, progressbar, stash, etc.)
3. Duplicate an existing module and use it as a template


# Replacing default scripts names

In case your server uses different script names than the default ones, you can edit those names directly in the in-game menu settings. This is perfect when you rename a script for any reasons, and its exports are untouched

Note that the script you select must use the same export in order to work properly


# Replacing default events names

In case your server uses different event names than the default ones, you can edit those names in `jobs_creator/integrations/cl_integrations.lua` **and** `jobs_creator/integrations/sv_integrations.lua`

Example of default ones:

```lua
EXTERNAL_EVENTS_NAMES = {
    ["esx:getSharedObject"] = nil,
    
    ["esx_skin:save"] = "esx_skin:save",

    ["esx_billing:sendBill"] = "esx_billing:sendBill",

    ["jsfour-idcard:open"] = "jsfour-idcard:open",

    ["esx_license:removeLicense"] = "esx_license:removeLicense",
    ["esx_license:addLicense"] = "esx_license:addLicense",
}
```

\
Example of edited ones:

```lua
EXTERNAL_EVENTS_NAMES = {
    ["esx:getSharedObject"] = "gamemode:getSharedObject",
    
    ["esx_skin:save"] = "my_skin_script:save",

    ["esx_billing:sendBill"] = "billing_ui:sendBill",

    ["jsfour-idcard:open"] = "jsfour-idcard:open",

    ["esx_license:removeLicense"] = "licenses:removeLicense",
    ["esx_license:addLicense"] = "licenses:addLicense",
}
```


# Updating script from old versions

This section will explain how to update the script from old versions\
\
You'll have to follow **all steps** from your *current version* to the *newer one*

A **backup** is always suggested before doing these steps

### 3.5 Update - to do if your version is older than 3.5

Add the following code in `jobs_creator/integrations/sv_integrations.lua` and use the command in the server console or in game (there will be an output when you use the command)

```lua
RegisterCommand('updateRecipes', function(playerId)
    if(playerId == 0 or isAllowed(playerId)) then
        MySQL.Async.fetchAll('SELECT id, data FROM jobs_data WHERE type="crafting_table"', {}, function(results)
            for k, result in pairs(results) do
                local markerId = result.id

                if(result.data) then
                    local data = json.decode(result.data)

                    local newData = {}

                    local anythingChanged = false

                    if(data.craftablesItems) then
                        for itemName, craftingData in pairs(data.craftablesItems) do
                            if(not craftingData.recipes) then
                                anythingChanged = true
                            end

                            newData[itemName] = {
                                recipes = craftingData,
                                animations = {}
                            }
                        end
                    end

                    local markerData = {
                        craftablesItems = newData
                    }

                    if(anythingChanged) then
                        print("Updating marker ID: " .. markerId)
                        MySQL.Async.execute("UPDATE jobs_data SET data=@newData WHERE id=@markerId", {
                            ['@newData'] = json.encode(markerData),
                            ['@markerId'] = markerId
                        })
                    else
                        print("Marker ID " .. markerId .. " doesn't need to update")
                    end
                end
            end
        end)
    end
end)
```

### 3.8 Update - to do if your version is older than 3.8

Run this query in the database to convert old job shop items

```
ALTER TABLE job_shop ADD COLUMN IF NOT EXISTS `item_type` VARCHAR(50) NOT NULL AFTER item_name;
UPDATE job_shop SET item_type = "item_standard";
```

### 3.11 Update - to do if your version is older than 3.11

Add the following code in `jobs_creator/integrations/sv_integrations.lua` and use the command in the server console or in game (there will be an output when you use the command)

```lua
RegisterCommand('updateHarvest', function(playerId)
    if(playerId == 0 or isAllowed(playerId)) then
        MySQL.Async.fetchAll('SELECT id, data FROM jobs_data WHERE type="harvest"', {}, function(results)
            for k, result in pairs(results) do
                local markerId = result.id
                local data = json.decode(result.data)

                local anythingChanged = false

                if(data) then
                    if(data.itemQuantity) then
                        data.itemMinQuantity = data.itemQuantity
                        data.itemMaxQuantity = data.itemQuantity
                        data.itemQuantity = nil

                        anythingChanged = true
                    end
                end

                if(anythingChanged) then
                    print("Updating marker ID: " .. markerId)
                    MySQL.Async.execute("UPDATE jobs_data SET data=@newData WHERE id=@markerId", {
                        ['@newData'] = json.encode(data),
                        ['@markerId'] = markerId
                    })
                else
                    print("Marker ID " .. markerId .. " doesn't need to update")
                end
            end
        end)
    end
end)
```

### 3.14 Update - to do if your version is older than 3.14

Run this query in the database to convert old database tables and to create the new one

```
CREATE TABLE IF NOT EXISTS `jobs_wardrobes` (
    `id` INT(11) NOT NULL AUTO_INCREMENT,
    `identifier` VARCHAR(100) NOT NULL COLLATE 'utf8mb4_general_ci',
    `label` VARCHAR(50) NOT NULL COLLATE 'utf8mb4_general_ci',
    `outfit` LONGTEXT NOT NULL DEFAULT '' COLLATE 'utf8mb4_bin',
    PRIMARY KEY (`id`) USING BTREE,
    INDEX `identifier` (`identifier`) USING BTREE
);

RENAME TABLE 
    job_armory TO jobs_armories,
    job_garage TO jobs_garages,
    job_shop TO jobs_shops;
```

### 3.16 Update - to do if your version is older than 3.16

Add the following code in `jobs_creator/integrations/sv_integrations.lua` and use the command in the server console or in game (there will be an output when you use the command)

```lua
RegisterCommand('updateShops', function(playerId)
    if(playerId == 0 or isAllowed(playerId)) then
        MySQL.Async.fetchAll('SELECT id, data FROM jobs_data WHERE type="shop"', {}, function(results)
            for k, result in pairs(results) do
                local markerId = result.id
                local data = json.decode(result.data)

                local anythingChanged = false

                if(data and data.itemsOnSale) then
                    for itemName, itemData in pairs(data.itemsOnSale) do
                        if(type(itemData) == "number") then
                            data.itemsOnSale[itemName] = {
                                price = itemData
                            }
                            
                            anythingChanged = true
                        end
                    end
                end

                if(anythingChanged) then
                    print("Updating marker ID: " .. markerId)
                    MySQL.Async.execute("UPDATE jobs_data SET data=@newData WHERE id=@markerId", {
                        ['@newData'] = json.encode(data),
                        ['@markerId'] = markerId
                    })
                else
                    print("Marker ID " .. markerId .. " doesn't need to update")
                end
            end
        end)
    end
end)
```

### 3.18 Update - to do if your version is older than 3.18

Add the following code in `jobs_creator/integrations/sv_integrations.lua` and use the command in the server console or in game (there will be an output when you use the command)

```lua
RegisterCommand('updateHarvest2', function(playerId)
    if(playerId == 0 or isAllowed(playerId)) then
        MySQL.Async.fetchAll('SELECT id, data FROM jobs_data WHERE type="harvest"', {}, function(results)
            for k, result in pairs(results) do
                local markerId = result.id
                local data = json.decode(result.data)

                local anythingChanged = false

                if(data) then
                    if(data.itemName or data.itemMinQuantity or data.itemMaxQuantity) then

                        data.harvestableItems = {
                            {
                                name = data.itemName,
                                minQuantity = data.itemMinQuantity,
                                maxQuantity = data.itemMaxQuantity,
                                time = data.itemTime,
                                chances = 100
                            }
                        }

                        data.itemMinQuantity = nil
                        data.itemMaxQuantity = nil
                        data.itemTime = nil
                        data.itemName = nil

                        anythingChanged = true
                    end
                end

                if(anythingChanged) then
                    print("Updating marker ID: " .. markerId)
                    MySQL.Async.execute("UPDATE jobs_data SET data=@newData WHERE id=@markerId", {
                        ['@newData'] = json.encode(data),
                        ['@markerId'] = markerId
                    })
                else
                    print("Marker ID " .. markerId .. " doesn't need to update")
                end
            end
        end)
    end
end)
```

### 4.0 Update - to do if your version is older than 4.0

**After running the server and the script is started**, run this query in the database

```
UPDATE jobs_data SET grades_type="minimumGrade" WHERE grades_type IS NULL;
```

Add the following code in `jobs_creator/integrations/sv_integrations.lua` and use **both commands** in the server console or in game (there will be an output when you use the command)

```lua
RegisterCommand('updateHarvest3', function(playerId)
    if(playerId == 0 or isAllowed(playerId)) then
        MySQL.Async.fetchAll('SELECT id, data FROM jobs_data WHERE type="harvest"', {}, function(results)
            for k, result in pairs(results) do
                local markerId = result.id
                local data = json.decode(result.data)

                local anythingChanged = false

                if(data) then
                    if(data.itemTool and not data.itemToolLoseProbability) then
                        data.itemToolLoseProbability = 100
                        anythingChanged = true
                    end
                end

                if(anythingChanged) then
                    print("Updating marker ID: " .. markerId)
                    MySQL.Async.execute("UPDATE jobs_data SET data=@newData WHERE id=@markerId", {
                        ['@newData'] = json.encode(data),
                        ['@markerId'] = markerId
                    })
                else
                    print("Marker ID " .. markerId .. " doesn't need to update")
                end
            end
        end)
    end
end)

RegisterCommand('updateMarkets', function(playerId)
    if(playerId == 0 or isAllowed(playerId)) then
        MySQL.Async.fetchAll('SELECT id, data FROM jobs_data WHERE type="market"', {}, function(results)
            for k, result in pairs(results) do
                local markerId = result.id
                local data = json.decode(result.data)

                local anythingChanged = false

                if(data and data.items) then
                    for itemName, itemData in pairs(data.items) do
                        if(itemData.price) then
                            itemData.maxPrice = itemData.price
                            itemData.minPrice = itemData.price
                            itemData.price = nil

                            anythingChanged = true
                        end
                    end
                end

                if(anythingChanged) then
                    print("Updating marker ID: " .. markerId)
                    MySQL.Async.execute("UPDATE jobs_data SET data=@newData WHERE id=@markerId", {
                        ['@newData'] = json.encode(data),
                        ['@markerId'] = markerId
                    })
                else
                    print("Marker ID " .. markerId .. " doesn't need to update")
                end
            end
        end)
    end
end)
```

### 8.0 Update - to do if your version is older than 8.0

Add the following code in `jobs_creator/integrations/sv_integrations.lua`, save and restart the script, and finally use **the command** in the **server console**

```lua
-- CONVERT FROM 7.11 to 8.0
RegisterCommand("upgrade_to_8", function(playerId)
    if(playerId ~= 0) then return end -- Only for server console

    local conversionCount = 0

    print("^3Converting to 8.0^7")

    local results = MySQL.Sync.fetchAll("SELECT * FROM jobs_data WHERE type='shop' OR type='market' OR type='harvest' OR type='process' OR type='crafting_table'")

    print("^3Automatically verifying " .. #results .. " markers^7")

    for i=1, #results do
        local currentMarker = results[i]
        local markerData = json.decode(currentMarker.data)
        local hasToUpdate = markerData and true or false

        if(currentMarker.type == "shop" and hasToUpdate) then
            local newItemsOnSale = {}
            markerData.itemsOnSale = markerData.itemsOnSale or {}

            if(#markerData.itemsOnSale == 0) then
                for itemName, content in pairs(markerData.itemsOnSale) do
                    local object = { label = itemName, type = itemName:sub(1, #"WEAPON") == "WEAPON" and "weapon" or "item", metadata = nil, name = itemName }
                    content.object = object

                    table.insert(newItemsOnSale, content)
                end

                markerData.itemsOnSale = newItemsOnSale
            else
                hasToUpdate = false -- Already using the array, so it's already using 8.0
            end
        elseif(currentMarker.type == "market" and hasToUpdate) then
            local newItems = {}
            markerData.items = markerData.items or {}

            if(#markerData.items == 0) then
                for itemName, content in pairs(markerData.items) do
                    local object = { label = itemName, type = itemName:sub(1, #"WEAPON") == "WEAPON" and "weapon" or "item", metadata = nil, name = itemName }
                    content.object = object

                    table.insert(newItems, content)
                end

                markerData.items = newItems
            else
                hasToUpdate = false -- Already using the array, so it's already using 8.0
            end

        elseif(currentMarker.type == "harvest" and hasToUpdate) then
            local newHarvestableItems = {}
            markerData.harvestableItems = markerData.harvestableItems or {}

            for i=1, #markerData.harvestableItems do
                local harvestableItem = markerData.harvestableItems[i]

                if(harvestableItem.name and hasToUpdate) then
                    local object = { label = harvestableItem.name, type = harvestableItem.name:sub(1, #"WEAPON") == "WEAPON" and "weapon" or "item", metadata = nil, name = harvestableItem.name }

                    harvestableItem.object = object
                    harvestableItem.name = nil
                    harvestableItem.itemTool = nil

                    table.insert(newHarvestableItems, harvestableItem)
                else
                    hasToUpdate = false
                end
            end

            if(hasToUpdate) then
                if(markerData.itemTool) then                    
                    local toolObject = { label = markerData.itemTool, type = markerData.itemTool:sub(1, #"WEAPON") == "WEAPON" and "weapon" or "item", metadata = nil, name = markerData.itemTool }
                    markerData.itemTool = toolObject
                end
                markerData.harvestableItems = newHarvestableItems
            end
        elseif(currentMarker.type == "process" and hasToUpdate) then
            if(markerData.itemToAddName) then
                local itemToAdd = { label = markerData.itemToAddName, type = markerData.itemToAddName:sub(1, #"WEAPON") == "WEAPON" and "weapon" or "item", metadata = nil, name = markerData.itemToAddName }
                local itemToRemove = { label = markerData.itemToRemoveName, type = markerData.itemToRemoveName:sub(1, #"WEAPON") == "WEAPON" and "weapon" or "item", metadata = nil, name = markerData.itemToRemoveName }

                markerData.itemToAddName = nil
                markerData.itemToRemoveName = nil

                markerData.itemToAdd = itemToAdd
                markerData.itemToRemove = itemToRemove
            else
                hasToUpdate = false 
            end
        elseif(currentMarker.type == "crafting_table" and hasToUpdate) then
            local newCraftablesItems = {}
            markerData.craftablesItems = markerData.craftablesItems or {}

            if(#markerData.craftablesItems == 0) then
                local foundAnything = false
                for itemName, content in pairs(markerData.craftablesItems) do
                    local resultObject = { label = itemName, type = itemName:sub(1, #"WEAPON") == "WEAPON" and "weapon" or "item", metadata = nil, name = itemName }
                    content.resultObject = resultObject

                    local newRecipes = {}
                    for ingredientName, ingredientContent in pairs(content.recipes) do
                        local ingredientObject = { label = ingredientName, type = ingredientName:sub(1, #"WEAPON") == "WEAPON" and "weapon" or "item", metadata = nil, name = ingredientName }
                        ingredientContent.object = ingredientObject

                        table.insert(newRecipes, ingredientContent)
                    end

                    content.recipes = newRecipes

                    table.insert(newCraftablesItems, content)

                    foundAnything = true
                end

                if(foundAnything) then
                    markerData.craftablesItems = newCraftablesItems
                else
                    hasToUpdate = false
                end
            else
                hasToUpdate = false -- Already using the array, so it's already using 8.0
            end 
        end

        if(hasToUpdate) then
            print("UPDATING MARKER ", currentMarker.id)
            currentMarker.data = json.encode(markerData)

            local affectedRows = MySQL.Sync.execute("UPDATE jobs_data SET data=@data WHERE id=@id", {
                ["@data"] = currentMarker.data,
                ["@id"] = currentMarker.id
            })
    
            if(affectedRows > 0) then
                conversionCount = conversionCount + 1
            end 
        end
    end

    if(conversionCount > 0) then
        print("^2Converted ^3" .. conversionCount .. "^2 markers successfully, restart the script!^7")
    else
        print("^3No markers to convert^7")
    end
end)
```


# QBCore Jobs Injection

## Do I have to manually add code?

Usually you are not required to add any code. Despite this, different scripts start order may cause other scripts to not recognize Jobs Creator jobs on QBCore

## How can I fix this?

The solution is very easy, you can add the following event client side and server side in the script that is not recognizing the Jobs Creator jobs

```lua
-- jaksam's Jobs Creator integration
AddEventHandler('jobs_creator:injectJobs', function(jobs)
    -- Assign the new jobs to the QBCore object, the following line depends on how your script is structured
    QBCore.Shared.Jobs = jobs 
end)
```


# Client

This events/exports are client side


# Notifications


# Replace default notifications

Used to show the normal notifications, for example `"You are not on duty"`. These are the normal notifications, not TextUI, but the process is the same for both

## How to replace it?

You can use Jobs Creator [Modules](/jobs-creator/modules) if you want to use your own notifications system


# Replace help notification/TextUI

Used to show the usual `Press E to ...` at the top left of the player's screen

## How to replace it?

You can use Jobs Creator [Modules](/jobs-creator/modules) if you want to use your own TextUI


# Actions


# Using the actions in a radial/external menu

You can use the actions in any external menu, here there are the triggers you can use from external scripts

{% hint style="warning" %}
Make sure that the job has the actions enabled in Jobs Creator settings of that job to avoid issues

So you can enable the actions themselves, but disable "Can open actions menu"
{% endhint %}

### Check identity

```lua
-- Trigger to start check identity action
TriggerEvent("jobs_creator:actions:checkIdentity")
```

## Check vehicle owner

```lua
-- Trigger to start check vehicle owner action
TriggerEvent("jobs_creator:actions:checkVehicleOwner")
```

## Create billing

```lua
-- Trigger to start billing action
TriggerEvent("jobs_creator:actions:createBilling")
```

## Drag player

```lua
-- Trigger to start drag action
TriggerEvent("jobs_creator:actions:drag")
```

## Handcuff player

```lua
-- Trigger to start soft handcuff action
TriggerEvent("jobs_creator:actions:softHandcuff")

-- Trigger to start hard handcuff action
TriggerEvent("jobs_creator:actions:hardHandcuff")
```

## Heal big

```lua
-- Trigger to start heal big action
TriggerEvent("jobs_creator:actions:healBig")
```

## Heal small

```lua
-- Trigger to start heal small action
TriggerEvent("jobs_creator:actions:healSmall")
```

## Impound

```lua
-- Trigger to start impound action
TriggerEvent("jobs_creator:actions:impoundVehicle")
```

## Licenses menu

```lua
-- Trigger to view licenses menu action
TriggerEvent("jobs_creator:actions:checkLicenses")
```

## Lockpick car

```lua
-- Trigger to start lockpick car action
TriggerEvent("jobs_creator:actions:lockpickCar")
```

## Put in car

```lua
-- Trigger to start put in car action
TriggerEvent("jobs_creator:actions:putInCar")
```

## Take from car

```lua
-- Trigger to start take from car action
TriggerEvent("jobs_creator:actions:takeFromCar")
```

## Repair vehicle

```lua
-- Trigger to start repair vehicle action
TriggerEvent("jobs_creator:actions:repairVehicle")
```

## Revive

```lua
-- Trigger to start revive action
TriggerEvent("jobs_creator:actions:revive")
```

## Search

```lua
-- Trigger to start search action
TriggerEvent("jobs_creator:actions:search")
```

## Wash vehicle

```lua
-- Trigger to start wash vehicle action

TriggerEvent("jobs_creator:actions:washVehicle")
```

## Open placeable objects menu

```lua
-- Trigger to open placeable objects menu
TriggerEvent("jobs_creator:actions:placeObject")
```


# Replace default search action

## How to replace it?

You can use Jobs Creator [Modules](/jobs-creator/modules) if you want to use your own stash/safe/armory


# Get player allowed actions

To retrieve allowed actions from player's job

## Export

```lua
exports["jobs_creator"]:getAllowedActions()
```

### Return value

| Name      | Data Type | Description                                                                           |
| --------- | --------- | ------------------------------------------------------------------------------------- |
| `actions` | table     | Key value table where key is the action and value it's boolean if it's allowed or not |

## Example

```lua
local actions = exports["jobs_creator"]:getAllowedActions()

print(ESX.DumpTable(actions))

--[[
    Example output
    
    {
        ["canHeal"] = false,
        ["canCheckDrivingLicense"] = false,
        ["canCheckWeaponLicense"] = false,
        ["canRevive"] = false,
        ["canCheckIdentity"] = false,
        ["canRepairVehicles"] = false,
        ["canHandcuff"] = true,
        ["enableBilling"] = true,
        ["canLockpickCars"] = false,
        ["canCheckVehicleOwner"] = false,
        ["canWashVehicles"] = false,
    }
]]
```


# Open actions menu

Trigger to open the actions menu

## Event

```lua
TriggerEvent("jobs_creator:openActionsMenu")
```


# Integrate external impound script

Triggered when a vehicle is impounded

## Event

```lua
AddEventHandler("jobs_creator:actions:vehicleImpounded", function(vehiclePlate, vehicleModel)

end)
```

### Parameters

| Name           | Data Type | Description       |
| -------------- | --------- | ----------------- |
| `vehiclePlate` | string    | The vehicle plate |
| `vehicleModel` | string    | The vehicle model |

## Example

```lua
RegisterNetEvent("jobs_creator:actions:vehicleImpounded", function(vehiclePlate, vehicleModel)
    -- You can add your impound script exports here
    TriggerServerEvent("impound_script:impoundVehicle", vehiclePlate, vehicleModel)
end)
```


# Vehicle repaired

Triggered after a vehicle is repaired with job actions menu, useful if you want to add an extra repair function to the current ones

## Event

```lua
AddEventHandler("jobs_creator:vehicleRepaired", function(vehicle)
    -- You can add the extra repair functions here
end)
```

### Parameters

| Name      | Data Type      | Description          |
| --------- | -------------- | -------------------- |
| `vehicle` | vehicle handle | The vehicle's handle |


# Get if local player is handcuffed

Returns if the **local** client/player is handcuffed

## Export

```lua
exports["jobs_creator"]:isPlayerHandcuffed()
```

### Return value

| Name           | Data Type | Description                                                                 |
| -------------- | --------- | --------------------------------------------------------------------------- |
| `isHandcuffed` | boolean   | true if the player is handcuffed. false if the player is **not** handcuffed |

## Example

```lua
-- This code will continuously check if the local (self) player is handcuffed
-- If so, specified controls will be disabled
Citizen.CreateThread(function() 
    while true do
        Citizen.Wait(0)
        
        if(exports["jobs_creator"]:isPlayerHandcuffed())then
            DisableControlAction(0, 22, true) -- Disable jump
        end       
    end
end)
```

## Where to insert the code?

You can place the code in any client file of your scripts


# Duty


# Duty status toggled

Triggered after player goes on/off duty client side

## Event

```lua
AddEventHandler("jobs_creator:toggleDuty", function(isOnDuty)

end)
```

### Parameters

| Name       | Data Type | Description            |
| ---------- | --------- | ---------------------- |
| `isOnDuty` | boolean   | Player new duty status |

## Example

```lua
AddEventHandler("jobs_creator:toggleDuty", function(isOnDuty)
    if(isOnDuty) then
        ESX.ShowNotification("You are now on duty")
    else
        ESX.ShowNotification("You are now off duty")
    end
end)
```


# Toggle current duty status

Trigger to toggle the current duty status of the player

## Event

```lua
TriggerEvent("jobs_creator:toggleCurrentDutyStatus")
```

This will toggle the current duty status of the player (if he was off duty he will be on duty and vice versa)

## Event - alternative

```lua
TriggerEvent("jobs_creator:toggleCurrentDutyStatus", newDutyStatus)
```

This will set the duty status of the player to the new status

## Example

```lua
-- Toggles the current duty status
RegisterCommand("duty", function()
    TriggerEvent("jobs_creator:toggleCurrentDutyStatus")
end, false)
```

## Example - alternative

```lua
RegisterCommand("onduty", function()
    TriggerEvent("jobs_creator:toggleCurrentDutyStatus", true)
end, false)

RegisterCommand("offduty", function()
    TriggerEvent("jobs_creator:toggleCurrentDutyStatus", false)
end, false)
```


# Buyable vehicles


# Vehicle spawned

Triggered after the spawn of a bought vehicle from buyable vehicles garage

## Event

```lua
AddEventHandler("jobs_creator:permanent_garage:vehicleSpawned", function(vehicle, vehicleName, vehiclePlate)

end)
```

### Parameters

| Name           | Data Type      | Description          |
| -------------- | -------------- | -------------------- |
| `vehicle`      | vehicle handle | The vehicle's handle |
| `vehicleName`  | string         | The vehicle's name   |
| `vehiclePlate` | string         | Vehicle's plate      |

## Example

```lua
AddEventHandler("jobs_creator:permanent_garage:vehicleSpawned", function(vehicle, vehicleName, vehiclePlate)

    -- Example to give keys to the vehicle (you may have a TriggerEvent to use, that's up to you)
    giveKeysToVehicle(vehicle)

    print(vehicleName) -- Example output 'adder'
end)
```


# Vehicle parked

Triggered after the vehicle from buyable vehicles garage has been parked

## Event

```lua
AddEventHandler("jobs_creator:permanent_garage:vehicleParked", function(vehicleModel, vehiclePlate)

end)
```

### Parameters

| Name           | Data Type | Description                |
| -------------- | --------- | -------------------------- |
| `vehicleModel` | integer   | The vehicle's entity model |
| `vehiclePlate` | string    | Vehicle's plate            |


# Garage owned


# Vehicle spawned

Triggered after the spawn of a vehicle from owned vehicles garage

## Event

```lua
AddEventHandler("jobs_creator:garage_owned:vehicleSpawned", function(vehicle, vehicleName, vehiclePlate)

end)
```

### Parameters

| Name           | Data Type      | Description          |
| -------------- | -------------- | -------------------- |
| `vehicle`      | vehicle handle | The vehicle's handle |
| `vehicleName`  | string         | The vehicle's name   |
| `vehiclePlate` | string         | Vehicle's plate      |

## Example

```lua
AddEventHandler("jobs_creator:garage_owned:vehicleSpawned", function(vehicle, vehicleName, vehiclePlate)

    -- Example to give keys to the vehicle (you may have a TriggerEvent to use, that's up to you)
    giveKeysToVehicle(vehicle)

    print(vehicleName) -- Example output 'adder'
end)
```


# Vehicle parked

Triggered after the vehicle from owned vehicles garage has been parked

## Event

```lua
AddEventHandler("jobs_creator:garage_owned:vehicleParked", function(vehicleModel, vehiclePlate)

end)
```

### Parameters

| Name           | Data Type | Description                |
| -------------- | --------- | -------------------------- |
| `vehicleModel` | integer   | The vehicle's entity model |
| `vehiclePlate` | string    | Vehicle's plate            |


# Temporary garage


# Vehicle spawned

Triggered after the spawn of a temporary vehicle

## Event

```lua
AddEventHandler("jobs_creator:temporary_garage:vehicleSpawned", function(vehicle, vehicleName, vehiclePlate)

end)
```

### Parameters

| Name           | Data Type      | Description          |
| -------------- | -------------- | -------------------- |
| `vehicle`      | vehicle handle | The vehicle's handle |
| `vehicleName`  | string         | The vehicle's name   |
| `vehiclePlate` | string         | Vehicle's plate      |

## Example

```lua
AddEventHandler("jobs_creator:temporary_garage:vehicleSpawned", function(vehicle, vehicleName, vehiclePlate)

    -- Example to give keys to the vehicle (you may have a TriggerEvent to use, that's up to you)
    giveKeysToVehicle(vehicle)

    print(vehicleName) -- Example output 'adder'
end)
```


# Vehicle parked

Triggered after the vehicle from temporary garage has been parked

## Event

```lua
AddEventHandler("jobs_creator:temporary_garage:vehicleParked", function(vehicleModel, vehiclePlate)

end)
```

### Parameters

| Name           | Data Type | Description                |
| -------------- | --------- | -------------------------- |
| `vehicleModel` | integer   | The vehicle's entity model |
| `vehiclePlate` | string    | Vehicle's plate            |


# Replace Stash/Safe/Armory

## How to replace it?

You can use Jobs Creator [Modules](/jobs-creator/modules) if you want to use your own stash/safe/armory


# Replace default billing

Triggered when using billing option in F6 actions menu

## Event

```lua
RegisterNetEvent("jobs_creator:actions:createBilling", function()

end)
```

## Example

```lua
-- To place in jobs_creator/integrations/cl_integrations.lua

RegisterNetEvent("jobs_creator:framework:ready", function() 
    -- Disables the default script billing (otherwise there would be 2 billings)
    exports["jobs_creator"]:disableScriptEvent("jobs_creator:actions:createBilling")
end)

RegisterNetEvent("jobs_creator:actions:createBilling", function()
    -- Uses Billing UI event
    TriggerEvent("billing_ui:activateBillingMode")
end)
```

## Where to insert the code?

You can place it in the file `integrations/cl_integrations.lua` of the script, **at the bottom of the file on new lines**


# Progress bar

## How to replace it?

You can use Jobs Creator [Modules](/jobs-creator/modules) if you want to use your own progress bar

## Use in external scripts

If you like the default progress bar of the script, and you want to use it in external scripts, this is the event

```lua
TriggerEvent("jobs_creator:startProgressBar", timeInMS, text, hexColor)
```

### Parameters

| Name       | Data type | Description                                                                                                     |
| ---------- | --------- | --------------------------------------------------------------------------------------------------------------- |
| `timeInMS` | integer   | Duration of the progress bar in milliseconds                                                                    |
| `text`     | string    | The text that will be shown with the progressbar                                                                |
| `hexColor` | string    | The color of the progressbar in hex code (example `#70f2b4`). Can be `nil` to use the default one of the script |

### Example

```lua
-- This will create a command to show a red progressbar
-- /progressbar 5000 Hello
RegisterCommand("progressbar", function(playerId, args) 
    TriggerEvent("jobs_creator:startProgressBar", tonumber(args[1]), args[2], "#ff0000")
end)
```


# Server


# Armory


# Add weapon to armory

To add a weapon in a marker ID for a specific player

### Export

```lua
exports["jobs_creator"]:addWeaponToArmory(markerId, playerIdentifier, weaponName, weaponAmmo, weaponComponents, weaponTintIndex)
```

#### Parameters

| Name               | Data Type | Description                |
| ------------------ | --------- | -------------------------- |
| `markerId`         | integer   | The marker ID              |
| `playerIdentifier` | string    | Player identifier          |
| `weaponName`       | string    | Weapon name                |
| `weaponAmmo`       | integer   | Ammo count                 |
| `weaponComponents` | table     | Table of weapon components |
| `weaponTintIndex`  | integer   | Weapon tint index          |

#### Return value

| Name           | Data Type | Description                   |
| -------------- | --------- | ----------------------------- |
| `isSuccessful` | boolean   | If the weapon is added or not |

### Example

```lua
local success = exports["jobs_creator"]:addWeaponToArmory(3, "2570e6efd3671584d7ed05a45cbf4156f782wwac", "WEAPON_PISTOL", 5 {}, 1)

print(success)
```


# Remove weapon from armory

To add a weapon in a marker ID for a specific player

### Export

```lua
exports["jobs_creator"]:removeWeaponFromArmory(markerId, weaponId)
```

#### Parameters

| Name       | Data Type | Description                                                                                       |
| ---------- | --------- | ------------------------------------------------------------------------------------------------- |
| `markerId` | integer   | The marker ID                                                                                     |
| `weaponId` | integer   | Weapon ID in the database, can be seen in `exports["jobs_creator"]:getAllArmoryWeapons(markerId)` |

#### Return value

| Name           | Data Type | Description                     |
| -------------- | --------- | ------------------------------- |
| `isSuccessful` | boolean   | If the weapon is removed or not |

### Example

```lua
local markerId = 15
local weaponId = 356

local success = exports["jobs_creator"]:removeWeaponFromArmory(markerId, weaponId)

print(success)
```


# Get player armory weapons

To get a list of weapons of a player stored in a specific armory ID.

### Export

```lua
exports["jobs_creator"]:getPlayerArmoryWeapons(playerId, markerId)
```

#### Parameters

| Name       | Data Type | Description      |
| ---------- | --------- | ---------------- |
| `playerId` | integer   | Player server ID |
| `markerId` | integer   | The marker ID    |

#### Return value

| Name                  | Data Type | Description                                                         |
| --------------------- | --------- | ------------------------------------------------------------------- |
| `playerArmoryWeapons` | table     | List of all weapons contained in the marker deposited by the player |

### Example

```lua
local playerId = 20
local markerId = 52

local playerArmoryWeapons = getPlayerArmoryWeapons(playerId, markerId)

print("Player weapons in that armory")
print(ESX.DumpTable(playerArmoryWeapons))
```


# Get all armory weapons

To get a list of all weapons stored in a specific armory ID.

### Export

```lua
exports["jobs_creator"]:getAllArmoryWeapons(markerId)
```

#### Parameters

| Name       | Data Type | Description   |
| ---------- | --------- | ------------- |
| `markerId` | integer   | The marker ID |

#### Return value

| Name            | Data Type | Description                                 |
| --------------- | --------- | ------------------------------------------- |
| `armoryWeapons` | table     | List of all weapons contained in the marker |

### Example

```lua
local allWeapons = getAllArmoryWeapons(markerId)

print("All players weapons in that armory")
print(ESX.DumpTable(allWeapons))
```


# Boss


# Add society account money

To add money to a society

## Export

```lua
exports["jobs_creator"]:addSocietyMoney(jobName, amount)
```

### Parameters

| Name      | Data Type | Description             |
| --------- | --------- | ----------------------- |
| `jobName` | string    | Job ID (example police) |
| `amount`  | integer   | Amount of money to add  |

### Return value

| Name           | Data Type | Description               |
| -------------- | --------- | ------------------------- |
| `isSuccessful` | boolean   | If money are added or not |

## Example

```lua
local isSuccessful = exports["jobs_creator"]:addSocietyMoney("police", 5000)

print(isSuccessful)
```


# Remove society account money

To remove money from a society

## Export

```lua
exports["jobs_creator"]:removeSocietyMoney(jobName, amount)
```

### Parameters

| Name      | Data Type | Description               |
| --------- | --------- | ------------------------- |
| `jobName` | string    | Job ID (example police)   |
| `amount`  | integer   | Amount of money to remove |

### Return value

| Name           | Data Type | Description                 |
| -------------- | --------- | --------------------------- |
| `isSuccessful` | boolean   | If money are removed or not |

## Example

```lua
local isSuccessful = exports["jobs_creator"]:removeSocietyMoney("police", 5000)

print(isSuccessful)
```


# Get job account money

To get a list of weapons of a player stored in a specific armory ID.

## Export

```lua
exports["jobs_creator"]:getJobAccountMoney(jobName)
```

### Parameters

| Name      | Data Type | Description             |
| --------- | --------- | ----------------------- |
| `jobName` | string    | Job ID (example police) |

### Return value

| Name           | Data Type | Description                     |
| -------------- | --------- | ------------------------------- |
| `accountMoney` | integer   | Money stored in society account |

## Example

```lua
local jobMoney = exports["jobs_creator"]:getJobAccountMoney("gang_job")

print(jobMoney)
```


# On player fired

Triggered when a player has been fired from a job

## Event

```lua
RegisterNetEvent("jobs_creator:boss:employeeFired", function(employeeIdentifier, jobName)

end)
```

### Parameters

| Name                 | Data Type | Description                                     |
| -------------------- | --------- | ----------------------------------------------- |
| `employeeIdentifier` | string    | Player's character identifier                   |
| `jobName`            | string    | The job ID which the player has been fired from |


# On player hired

Triggered when a player has been hired in a job

## Event

```lua
RegisterNetEvent("jobs_creator:boss:playerHired", function(playerId, jobName)

end)
```

### Parameters

| Name      | Data Type | Description                                   |
| --------- | --------- | --------------------------------------------- |
| playerId  | integer   | Player's server ID                            |
| `jobName` | string    | The job ID which the player has been hired in |


# Buyable vehicles


# Get if player is owner of vehicle plate

Returns if a player ID is the owner of a specific plate

## Export

```lua
exports["jobs_creator"]:isPlayerOwnerOfVehiclePlate(playerId, plate)
```

### Parameters

| Name       | Data Type | Description        |
| ---------- | --------- | ------------------ |
| `playerId` | integer   | Player's server ID |
| `plate`    | string    | Vehicle's plate    |

### Return value

| Name      | Data Type | Description                               |
| --------- | --------- | ----------------------------------------- |
| `isOwner` | bool      | If the player is the vehicle owner or not |

## Example

```lua
local playerId = 1
local plate = "40PQB261"
local isTheVehicleOwner = exports["jobs_creator"]:isPlayerOwnerOfVehiclePlate(playerId, plate)

print("Is the player owner of that plate: " .. tostring(isTheVehicleOwner))
```


# Get all vehicles of player

To get all vehicles owned by a player ID in all buyable garages

## Export

```lua
exports["jobs_creator"]:getAllVehiclesOfPlayer(playerId)
```

### Parameters

| Name       | Data Type | Description        |
| ---------- | --------- | ------------------ |
| `playerId` | integer   | Player's server ID |

### Return value

| Name       | Data Type | Description                                                                                                         |
| ---------- | --------- | ------------------------------------------------------------------------------------------------------------------- |
| `vehicles` | table     | Table with all vehicles owned by the player in the buyable garages, key is vehicle ID and value is the vehicle data |

## Example

```lua
local playerId = 4
local vehicles = exports["jobs_creator"]:getAllVehiclesOfPlayer(playerId)

print("Player vehicles:")
print(ESX.DumpTable(vehicles))
```


# On vehicle bought

Triggered when a player buys a vehicle from buyable garage marker

## Event

```lua
RegisterNetEvent("jobs_creator:permanent_garage:vehicleBought", function(playerId, markerId, vehicleName, vehicleId)

end)
```

### Parameters

| Name          | Data Type | Description                |
| ------------- | --------- | -------------------------- |
| `playerId`    | integer   | Player's server ID         |
| `markerId`    | integer   | Marker ID                  |
| `vehicleName` | string    | Vehicle model name         |
| `vehicleId`   | integer   | Vehicle id in the database |

## Example

```lua
RegisterNetEvent("jobs_creator:permanent_garage:vehicleBought", function(playerId, markerId, vehicleName, vehicleId)
    print("Player ID :" .. playerId .. " bought a " .. vehicleName .. " with ID " .. vehicleId .. " from marker " .. markerId)
end)
```


# Get player vehicles in marker ID

To get all vehicles owned by a player ID in a specific buyable garage marker ID

## Export

```lua
exports["jobs_creator"]:getPlayerVehiclesInMarkerId(playerId, markerId)
```

### Parameters

| Name       | Data Type | Description        |
| ---------- | --------- | ------------------ |
| `playerId` | integer   | Player's server ID |
| `markerId` | integer   | Marker ID          |

### Return value

| Name       | Data Type | Description                                                                                                |
| ---------- | --------- | ---------------------------------------------------------------------------------------------------------- |
| `vehicles` | table     | Table with all vehicles owned by the player in the garage, key is vehicle ID and value is the vehicle data |

## Example

```lua
local playerId = 1
local markerId = 252
local playerVehiclesInMarker = exports["jobs_creator"]:getPlayerVehiclesInMarkerId(playerId, markerId)

print(ESX.DumpTable(playerVehiclesInMarker))
```


# Crafting table


# Item crafted

Triggered when a player crafts an item in crafting table marker

### Event

```lua
RegisterNetEvent("jobs_creator:crafting_table:craftedItem", function(playerId, markerId, itemName, itemQuantity)

end)
```

#### Parameters

| Name           | Data Type | Description           |
| -------------- | --------- | --------------------- |
| `playerId`     | integer   | Player's server ID    |
| `markerId`     | integer   | Marker ID             |
| `itemName`     | integer   | Crafted item name     |
| `itemQuantity` | integer   | Crafted item quantity |

### Example

```lua
RegisterNetEvent("jobs_creator:crafting_table:craftedItem", function(playerId, markerId, itemName, itemQuantity)
    TriggerEvent("xp_system:addExperience", playerId, "craft")
end)
```


# Duty


# Duty status changed

Triggered after player goes on/off duty server side

### Event

```lua
RegisterNetEvent("jobs_creator:toggleDuty", function(playerId, jobName, isOnDuty)

end)
```

#### Parameters

| Name       | Data Type | Description             |
| ---------- | --------- | ----------------------- |
| `playerId` | integer   | Target player server ID |
| `jobName`  | string    | Player's job id         |
| `isOnDuty` | boolean   | Player new duty status  |

### Example

```lua
RegisterNetEvent("jobs_creator:toggleDuty", function(playerId, jobName, isOnDuty)
    if(isOnDuty) then
        TriggerEvent("external_scoreboard:increaseOnDutyCount", jobName)
    else
        TriggerEvent("external_scoreboard:decreaseOnDutyCount", jobName)
    end
end)
```


# Get if a player is on duty

Returns if the player is on duty or not.

### Event

```lua
exports["jobs_creator"]:isPlayerOnDuty(playerId)
```

#### Parameters

| Name       | Data Type | Description             |
| ---------- | --------- | ----------------------- |
| `playerId` | integer   | Target player server ID |

#### Return

| Name       | Data Type | Description                                                                                               |
| ---------- | --------- | --------------------------------------------------------------------------------------------------------- |
| `isOnDuty` | boolean   | <p><strong>true</strong> if the player is on-duty<br><strong>false</strong> if the player is off-duty</p> |

### Example

```lua
local playerId = 52

print("Player ID " .. playerId .. " is on duty: " .. tostring( exports["jobs_creator"]:isPlayerOnDuty(playerId) ))
```


# Harvest


# Item harvested

Triggered when a player harvests an item in harvest marker

### Event

```lua
RegisterNetEvent("jobs_creator:harvest:harvestedItem", function(playerId, markerId, itemName, itemType, itemQuantity)

end)
```

#### Parameters

| Name           | Data Type | Description                             |
| -------------- | --------- | --------------------------------------- |
| `playerId`     | integer   | Player's server ID                      |
| `markerId`     | integer   | Marker ID                               |
| `itemName`     | string    | Item name                               |
| `itemType`     | string    | Item type ('item', 'weapon', 'account') |
| `itemQuantity` | integer   | Harvested quantity                      |

### Example

```lua
RegisterNetEvent("jobs_creator:harvest:harvestedItem", function(playerId, markerId, itemName, itemType, itemQuantity)
    print("Player ID :" .. playerId .. " harvested " .. itemQuantity .. " " .. itemName .. " from marker " .. markerId)

    TriggerEvent("xp_system:addExperience", playerId, "harvest")
end)
```


# Market


# Item sold

Triggered when a player buys an item/weapon in shop marker

### Event

```lua
RegisterNetEvent("jobs_creator:market:soldItem", function(playerId, markerId, itemName, itemQuantity, totalPrice)

end)
```

#### Parameters

| Name           | Data Type | Description              |
| -------------- | --------- | ------------------------ |
| `playerId`     | integer   | Player's server ID       |
| `markerId`     | integer   | Marker ID                |
| `itemName`     | string    | Item name or weapon name |
| `itemQuantity` | integer   | Bought quantity          |
| `totalPrice`   | integer   | Total received money     |

### Example

```lua
RegisterNetEvent("jobs_creator:market:soldItem", function(playerId, markerId, itemName, itemQuantity, totalPrice)
    print("Player ID :" .. playerId .. " sold x" .. itemQuantity .. " " .. itemName .. " from shop " .. markerId)
end)
```


# Process


# Item processed

Triggered when a player processes an item in process marker

### Event

```lua
RegisterNetEvent("jobs_creator:process:processedItem", function(playerId, markerId, addedItemName, addedItemQuantity, removedItemName, removedItemQuantity)

end)
```

#### Parameters

| Name                  | Data Type | Description            |
| --------------------- | --------- | ---------------------- |
| `playerId`            | integer   | Player's server ID     |
| `markerId`            | integer   | Marker ID              |
| `addedItemName`       | string    | Received item name     |
| `addedItemQuantity`   | integer   | Received item quantity |
| `removedItemName`     | integer   | Removed item name      |
| `removedItemQuantity` | integer   | Removed item quantity  |

### Example

```lua
RegisterNetEvent("jobs_creator:process:processedItem", function(playerId, markerId, addedItemName, addedItemQuantity, removedItemName, removedItemQuantity)
    TriggerEvent("xp_system:addExperience", playerId, "process")
end)
```


# Shop


# Item bought

Triggered when a player buys an item/weapon in shop marker

### Event

```lua
RegisterNetEvent("jobs_creator:shop:boughtItem", function(playerId, markerId, itemName, itemQuantity, totalPrice)

end)
```

#### Parameters

| Name           | Data Type | Description              |
| -------------- | --------- | ------------------------ |
| `playerId`     | integer   | Player's server ID       |
| `markerId`     | integer   | Marker ID                |
| `itemName`     | string    | Item name or weapon name |
| `itemQuantity` | integer   | Bought quantity          |
| `totalPrice`   | integer   | Total paid price         |

### Example

```lua
RegisterNetEvent("jobs_creator:shop:boughtItem", function(playerId, markerId, itemName, itemQuantity, totalPrice)
    print("Player ID :" .. playerId .. " bought x" .. itemQuantity .. " " .. itemName .. " from shop " .. markerId)
end)
```


# Search/Steal action


# Item stolen

Triggered after a player steals something from the actions menu, only if you use the default player search/rob, it won't work if you replaced it

```lua
RegisterNetEvent("jobs_creator:actions:itemStolen", function(playerId, targetId, itemName, itemQuantity)

end)
```

#### Parameters

| Name           | Data Type | Description                                    |
| -------------- | --------- | ---------------------------------------------- |
| `playerId`     | integer   | The server ID of the player who stole the item |
| `targetId`     | integer   | The server ID of the victim who lost the item  |
| `itemName`     | string    | Item name                                      |
| `itemQuantity` | integer   | Quantity stolen                                |

### Example

<pre class="language-lua"><code class="lang-lua"><strong>-- This example for ESX will "delete" all stolen items
</strong><strong>RegisterNetEvent("jobs_creator:actions:itemStolen", function(playerId, targetId, itemName, itemQuantity)
</strong>    local xPlayer = ESX.GetPlayerFromId(playerId)
    xPlayer.removeInventoryItem(itemName, itemQuantity)
end)
</code></pre>


# Account stolen

Triggered after a player steals something from the actions menu, only if you use the default player search/rob, it won't work if you replaced it

```lua
RegisterNetEvent("jobs_creator:actions:accountStolen", function(playerId, targetId, accountName, amount)

end)
```

#### Parameters

| Name          | Data Type | Description                                     |
| ------------- | --------- | ----------------------------------------------- |
| `playerId`    | integer   | The server ID of the player who stole the money |
| `targetId`    | integer   | The server ID of the victim who lost the money  |
| `accountName` | string    | Account name (example "bank")                   |
| `amount`      | integer   | Amount stolen                                   |

### Example

```lua
RegisterNetEvent("jobs_creator:actions:accountStolen", function(playerId, targetId, accountName, amount)
    print(GetPlayerName(playerId) .. " has stolen " .. amount .. " " .. accountName .. " from " .. GetPlayerName(targetId))
end)
```


# Weapon stolen

Triggered after a player steals something from the actions menu, only if you use the default player search/rob, it won't work if you replaced it

```lua
RegisterNetEvent("jobs_creator:actions:weaponStolen", function(playerId, targetId, weaponName)

end)
```

#### Parameters

| Name         | Data Type | Description                                      |
| ------------ | --------- | ------------------------------------------------ |
| `playerId`   | integer   | The server ID of the player who stole the weapon |
| `targetId`   | integer   | The server ID of the victim who lost the weapon  |
| `weaponName` | string    | Weapon name                                      |

### Example

<pre class="language-lua"><code class="lang-lua"><strong>-- This example for ESX will "delete" the stolen weapons (maybe useful for cops)
</strong>RegisterNetEvent("jobs_creator:actions:weaponStolen", function(playerId, targetId, weaponName)
    local xPlayer = ESX.GetPlayerFromId(playerId)
    xPlayer.removeWeapon(weaponName)
end)
</code></pre>


# Set handcuffs state

To set the handcuffs state of a player, without the animation

## Export

```lua
exports["jobs_creator"]:setHandcuffs(playerId, state)
```

### Parameters

| Name     | Data type | Description                     |
| -------- | --------- | ------------------------------- |
| playerId | integer   | The target player server ID     |
| state    | boolean   | true = handcuffed, false = free |

## Example

```lua
-- This is just an example and won't work, require you to use the export properly
RegisterNetEvent("hospital_script:playerDead", function(playerId)
    -- The script code
    -- The script code
    -- The script code
    
    -- The dead player is not handcuffed anymore
    exports["jobs_creator"]:setHandcuffs(playerId, false)
end)
```


# Home

This is the official Advanced Drugs Creator documentation

* Official [FiveM post](https://forum.cfx.re/t/esx-advanced-drugs-creator-in-game-drug-creation-menu-without-server-restart/1885920)
* Tebex [page](https://jaksam1074-fivem-scripts.tebex.io/)


# Installation

The installation of the script is extremely easy

{% hint style="danger" %}
Do NOT use **FileZilla** to upload the files, otherwise the script will NOT work

Use [WinSCP](https://winscp.net/eng/download.php) instead
{% endhint %}

{% tabs %}
{% tab title="ESX" %}

1. Download the script and extract it in your resources
2. Add the script in your auto start (example: server.cfg)
3. The script will **automatically** setup the database, in case it doesn't, you can manually run the files in `drugs_creator/sql/` folder

### Adding the items - Optional

If you want to use the default items/drugs, follow the steps below

To add the premade items/drugs, you only have to run the file `drugs_creator/sql/items_limit.sql` **or** `drugs_creator/sql/items_weight.sql` depending on your server, if it uses the limit or the weight

{% hint style="info" %}
The latest version of ESX uses **weight**
{% endhint %}

{% hint style="danger" %}
If it doesn't work, be sure to use the latest version of the official ESX with the dependencies
{% endhint %}
{% endtab %}

{% tab title="QBCore" %}

1. Download the script and extract it in your resources
2. Add the script in your auto start (example: server.cfg)
3. The script will **automatically** setup the database, in case it doesn't, you can manually run the files in `drugs_creator/sql/` folder
4. Download and extract the script [menu\_default (clickable link)](https://drive.google.com/file/d/1Ezz-d50NIKQZeZJ-RgyclvNG7qC4Nfu8/view?usp=sharing) in your resources, **without renaming it**, and add it to auto start (example: server.cfg)

### Adding the items - Optional

To add the new items, you have to edit `qb-core/shared/items.lua` file and add at the bottom of the table the following code

```lua
['ammonium_nitrate'] = {['name'] = 'ammonium_nitrate', ['label'] = 'Ammonium nitrate', ['weight'] = 500, ['type'] = 'item', ['image'] = 'ammonium_nitrate.png', ['unique'] = false, ['useable'] = true, ['shouldClose'] = false, ['combinable'] = nil},
['carbon'] = {['name'] = 'carbon', ['label'] = 'Carbon', ['weight'] = 500, ['type'] = 'item', ['image'] = 'carbon.png', ['unique'] = false, ['useable'] = true, ['shouldClose'] = false, ['combinable'] = nil},
['codeine'] = {['name'] = 'codeine', ['label'] = 'Codeine', ['weight'] = 500, ['type'] = 'item', ['image'] = 'codeine.png', ['unique'] = false, ['useable'] = true, ['shouldClose'] = false, ['combinable'] = nil},
['drink_sprite'] = {['name'] = 'drink_sprite', ['label'] = 'Sprite', ['weight'] = 500, ['type'] = 'item', ['image'] = 'drink_sprite.png', ['unique'] = false, ['useable'] = true, ['shouldClose'] = false, ['combinable'] = nil},
['drug_ecstasy'] = {['name'] = 'drug_ecstasy', ['label'] = 'Ecstasy', ['weight'] = 500, ['type'] = 'item', ['image'] = 'drug_ecstasy.png', ['unique'] = false, ['useable'] = true, ['shouldClose'] = false, ['combinable'] = nil},
['drug_lean'] = {['name'] = 'drug_lean', ['label'] = 'Lean', ['weight'] = 500, ['type'] = 'item', ['image'] = 'drug_lean.png', ['unique'] = false, ['useable'] = true, ['shouldClose'] = false, ['combinable'] = nil},
['drug_lsd'] = {['name'] = 'drug_lsd', ['label'] = 'LSD', ['weight'] = 500, ['type'] = 'item', ['image'] = 'drug_lsd.png', ['unique'] = false, ['useable'] = true, ['shouldClose'] = false, ['combinable'] = nil},
['drug_meth'] = {['name'] = 'drug_meth', ['label'] = 'Meth', ['weight'] = 500, ['type'] = 'item', ['image'] = 'drug_meth.png', ['unique'] = false, ['useable'] = true, ['shouldClose'] = false, ['combinable'] = nil},
['hydrogen'] = {['name'] = 'hydrogen', ['label'] = 'Hydrogen', ['weight'] = 500, ['type'] = 'item', ['image'] = 'hydrogen.png', ['unique'] = false, ['useable'] = true, ['shouldClose'] = false, ['combinable'] = nil},
['ice'] = {['name'] = 'ice', ['label'] = 'Ice', ['weight'] = 500, ['type'] = 'item', ['image'] = 'ice.png', ['unique'] = false, ['useable'] = true, ['shouldClose'] = false, ['combinable'] = nil},
['jolly_ranchers'] = {['name'] = 'jolly_ranchers', ['label'] = 'Jolly Ranchers', ['weight'] = 500, ['type'] = 'item', ['image'] = 'jolly_ranchers.png', ['unique'] = false, ['useable'] = true, ['shouldClose'] = false, ['combinable'] = nil},
['liquid_sulfur'] = {['name'] = 'liquid_sulfur', ['label'] = 'Liquid Sulfur', ['weight'] = 500, ['type'] = 'item', ['image'] = 'liquid_sulfur.png', ['unique'] = false, ['useable'] = true, ['shouldClose'] = false, ['combinable'] = nil},
['muriatic_acid'] = {['name'] = 'muriatic_acid', ['label'] = 'Muriatic Acid', ['weight'] = 500, ['type'] = 'item', ['image'] = 'muriatic_acid.png', ['unique'] = false, ['useable'] = true, ['shouldClose'] = false, ['combinable'] = nil},
['nitrogen'] = {['name'] = 'nitrogen', ['label'] = 'Nitrogen', ['weight'] = 500, ['type'] = 'item', ['image'] = 'nitrogen.png', ['unique'] = false, ['useable'] = true, ['shouldClose'] = false, ['combinable'] = nil},
['oxygen'] = {['name'] = 'oxygen', ['label'] = 'Oxygen', ['weight'] = 500, ['type'] = 'item', ['image'] = 'oxygen.png', ['unique'] = false, ['useable'] = true, ['shouldClose'] = false, ['combinable'] = nil},
['pseudoefedrine'] = {['name'] = 'pseudoefedrine', ['label'] = 'Pseudoefedrine', ['weight'] = 500, ['type'] = 'item', ['image'] = 'pseudoefedrine.png', ['unique'] = false, ['useable'] = true, ['shouldClose'] = false, ['combinable'] = nil},
['red_sulfur'] = {['name'] = 'red_sulfur', ['label'] = 'Red Sulfur', ['weight'] = 500, ['type'] = 'item', ['image'] = 'red_sulfur.png', ['unique'] = false, ['useable'] = true, ['shouldClose'] = false, ['combinable'] = nil},
['sodium_hydroxide'] = {['name'] = 'sodium_hydroxide', ['label'] = 'Sodium hydroxide', ['weight'] = 500, ['type'] = 'item', ['image'] = 'sodium_hydroxide.png', ['unique'] = false, ['useable'] = true, ['shouldClose'] = false, ['combinable'] = nil},
['water'] = {['name'] = 'water', ['label'] = 'Water', ['weight'] = 500, ['type'] = 'item', ['image'] = 'water.png', ['unique'] = false, ['useable'] = true, ['shouldClose'] = false, ['combinable'] = nil},
['cannabis'] = {['name'] = 'cannabis', ['label'] = 'Cannabis', ['weight'] = 500, ['type'] = 'item', ['image'] = 'cannabis.png', ['unique'] = false, ['useable'] = true, ['shouldClose'] = false, ['combinable'] = nil},
['green_gelato_cannabis'] = {['name'] = 'green_gelato_cannabis', ['label'] = 'Green Gelato Cannabis', ['weight'] = 500, ['type'] = 'item', ['image'] = 'green_gelato_cannabis.png', ['unique'] = false, ['useable'] = true, ['shouldClose'] = false, ['combinable'] = nil},
['opium'] = {['name'] = 'opium', ['label'] = 'Opium', ['weight'] = 500, ['type'] = 'item', ['image'] = 'opium.png', ['unique'] = false, ['useable'] = true, ['shouldClose'] = false, ['combinable'] = nil},
['cocaine'] = {['name'] = 'cocaine', ['label'] = 'Cocaine', ['weight'] = 500, ['type'] = 'item', ['image'] = 'cocaine.png', ['unique'] = false, ['useable'] = true, ['shouldClose'] = false, ['combinable'] = nil},
['meth_raw'] = {['name'] = 'meth_raw', ['label'] = 'Raw Meth', ['weight'] = 500, ['type'] = 'item', ['image'] = 'meth_raw.png', ['unique'] = false, ['useable'] = true, ['shouldClose'] = false, ['combinable'] = nil},
['meth_processed'] = {['name'] = 'meth_processed', ['label'] = 'Processed Meth', ['weight'] = 500, ['type'] = 'item', ['image'] = 'meth_processed.png', ['unique'] = false, ['useable'] = true, ['shouldClose'] = false, ['combinable'] = nil},
['meth'] = {['name'] = 'meth', ['label'] = 'Meth', ['weight'] = 500, ['type'] = 'item', ['image'] = 'meth.png', ['unique'] = false, ['useable'] = true, ['shouldClose'] = false, ['combinable'] = nil},
['cocaine_raw'] = {['name'] = 'cocaine_raw', ['label'] = 'Raw Cocaine', ['weight'] = 500, ['type'] = 'item', ['image'] = 'cocaine_raw.png', ['unique'] = false, ['useable'] = true, ['shouldClose'] = false, ['combinable'] = nil},
['cocaine_packaged'] = {['name'] = 'cocaine_packaged', ['label'] = 'Packaged Cocaine', ['weight'] = 500, ['type'] = 'item', ['image'] = 'cocaine_packaged.png', ['unique'] = false, ['useable'] = true, ['shouldClose'] = false, ['combinable'] = nil},
['trap_phone'] = {['name'] = 'trap_phone', ['label'] = 'Trap Phone', ['weight'] = 500, ['type'] = 'item', ['image'] = 'trap_phone.png', ['unique'] = true, ['useable'] = true, ['shouldClose'] = true, ['combinable'] = nil},
```

**Screenshot example**

<figure><img src="https://3735039044-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFH9TH8An8XLjMiOMvVGb%2Fuploads%2Fgit-blob-cbab63349a9fe6d9980767b53f1c5bac61091ce4%2Fqb_core_drugs_creator_items.jpg?alt=media" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="OX Inventory" %}
Here's a list for items to use with OX inventory, you can even use it with jaksam's inventory, in 'import from code' setting

```lua
['ammonium_nitrate'] = {
    label = 'Ammonium nitrate',
    weight = 500,
    stack = true,
    close = false,
},

['carbon'] = {
    label = 'Carbon',
    weight = 500,
    stack = true,
    close = false,
},

['codeine'] = {
    label = 'Codeine',
    weight = 500,
    stack = true,
    close = false,
},

['drink_sprite'] = {
    label = 'Sprite',
    weight = 500,
    stack = true,
    close = false,
},

['drug_ecstasy'] = {
    label = 'Ecstasy',
    weight = 500,
    stack = true,
    close = false,
},

['drug_lean'] = {
    label = 'Lean',
    weight = 500,
    stack = true,
    close = false,
},

['drug_lsd'] = {
    label = 'LSD',
    weight = 500,
    stack = true,
    close = false,
},

['drug_meth'] = {
    label = 'Meth',
    weight = 500,
    stack = true,
    close = false,
},

['hydrogen'] = {
    label = 'Hydrogen',
    weight = 500,
    stack = true,
    close = false,
},

['ice'] = {
    label = 'Ice',
    weight = 500,
    stack = true,
    close = false,
},

['jolly_ranchers'] = {
    label = 'Jolly Ranchers',
    weight = 500,
    stack = true,
    close = false,
},

['liquid_sulfur'] = {
    label = 'Liquid Sulfur',
    weight = 500,
    stack = true,
    close = false,
},

['muriatic_acid'] = {
    label = 'Muriatic Acid',
    weight = 500,
    stack = true,
    close = false,
},

['nitrogen'] = {
    label = 'Nitrogen',
    weight = 500,
    stack = true,
    close = false,
},

['oxygen'] = {
    label = 'Oxygen',
    weight = 500,
    stack = true,
    close = false,
},

['pseudoefedrine'] = {
    label = 'Pseudoefedrine',
    weight = 500,
    stack = true,
    close = false,
},

['red_sulfur'] = {
    label = 'Red Sulfur',
    weight = 500,
    stack = true,
    close = false,
},

['sodium_hydroxide'] = {
    label = 'Sodium hydroxide',
    weight = 500,
    stack = true,
    close = false,
},

['water'] = {
    label = 'Water',
    weight = 500,
    stack = true,
    close = false,
},

['cannabis'] = {
    label = 'Cannabis',
    weight = 500,
    stack = true,
    close = false,
},

['green_gelato_cannabis'] = {
    label = 'Green Gelato Cannabis',
    weight = 500,
    stack = true,
    close = false,
},

['opium'] = {
    label = 'Opium',
    weight = 500,
    stack = true,
    close = false,
},

['cocaine'] = {
    label = 'Cocaine',
    weight = 500,
    stack = true,
    close = false,
},

['meth_raw'] = {
    label = 'Raw Meth',
    weight = 500,
    stack = true,
    close = false,
},

['meth_processed'] = {
    label = 'Processed Meth',
    weight = 500,
    stack = true,
    close = false,
},

['meth'] = {
    label = 'Meth',
    weight = 500,
    stack = true,
    close = false,
},

['cocaine_raw'] = {
    label = 'Raw Cocaine',
    weight = 500,
    stack = true,
    close = false,
},

['cocaine_packaged'] = {
    label = 'Packaged Cocaine',
    weight = 500,
    stack = true,
    close = false,
},

['trap_phone'] = {
    label = 'Trap Phone',
    weight = 500,
    stack = false,
    close = true,
},
```

{% endtab %}
{% endtabs %}

You are ready to go! Enjoy the script 😁

## Optional step

After the database is setup correctly, you can delete the files in `drugs_creator/sql/` folder, so the script won't try to setup the database each time you start the script


# FAQ

This page has FAQs related **ONLY to this script**, be sure to also check [Common FAQ](/jaksams-scripts/common-faq) for other issues

<details>

<summary>Drugs effects not working</summary>

If the effects are not working, it means that `ESX.RegisterUsableItem` function of your `es_extended` doesn't work properly

You can still manually register/trigger effects by using the [following event](/drugs-creator/client/manually-start-drugs-effects)

On both **ESX** and **QBCore**, an anticheat may interfere with drugs effects

*Note: this is not something which depends on the script and we can't solve it for you*

</details>

<details>

<summary>Bad performance</summary>

If you are having issues with server side performance with Drugs Creator, most likely is because of NPC selling, which requires to refresh all players inventories to be able to prompt `Press E to sell drugs` dialog

If you want to improve performance, enable the command in the in-game script settings, so it will use the closest NPC or spawn one (depending on your configuration)

</details>


# Modules

Modules are an easy way for Drugs Creator to replace certain default features (progress bar, dispatch, logs)

To choose an existing module, you open /drugscreator menu, go in settings, choose it. As easy as that

### How to create a custom module?

Creating a module is extremely easy:

1. Navigate to `drugs_creator/_modules` folder
2. Choose the module type you want to create (logs, progressbar, dispatch, etc.)
3. Duplicate an existing module and use it as a template


# Guides


# Custom audio and images

> **Want to add your own music or images to drug effects? Just drop files in the right folder**

The script automatically scans the asset folders and shows all valid files in the effect editor dropdown. No code changes needed.

## Adding custom audio files

1. Open your server files and navigate to: `drugs_creator/html/assets/audio/`
2. Place your audio files in this folder
3. Restart the script or the server

That's it! The new audio files will now appear in the **Music** effect dropdown when editing drug effects

### Supported audio formats

`mp3`, `ogg`, `wav`, `flac`, `aac`, `m4a`

## Adding custom images

1. Open your server files and navigate to: `drugs_creator/html/assets/img/`
2. Place your image files in this folder
3. Restart the script or the server

The new images will appear in the **Trip Screen Image** and **3D World Image** effect dropdowns

### Supported image formats

`jpg`, `jpeg`, `png`, `gif`, `webp`

## Important notes

* File names are used directly as labels in the dropdown, so use descriptive names (e.g. `space_trip.jpg` instead of `img1.jpg`)
* If you add files while the server is running, restart the script for changes to appear
* Keep file sizes reasonable: large images or audio files can affect loading times for players


# Client


# Replace default notifications

Triggered after notifying player client side

## Event

```lua
AddEventHandler("drugs_creator:notify", function(message, coloredMessage)

end)
```

### Parameters

| Name             | Data Type | Description                                                     |
| ---------------- | --------- | --------------------------------------------------------------- |
| `message`        | string    | Message of the notification (colorless)                         |
| `coloredMessage` | string    | Message of the notification but with \~r\~, \~g\~\~\~\~\~, etc. |

## Example

```lua
RegisterNetEvent("drugs_creator:framework:ready", function() 
    -- Disables the default script notification (otherwise there would be 2 notifications)
    exports["drugs_creator"]:disableScriptEvent("drugs_creator:notify")
end)

RegisterNetEvent("drugs_creator:notify", function(message, coloredMessage)
    TriggerEvent("external_script:notify", message)
end)
```

## Where to insert the code?

You can place it in the file `integrations/cl_integrations.lua` of the script, **at the bottom of the file on new lines**


# Progress bar

## How to replace it?

You can use Drugs Creator [Modules](/drugs-creator/modules) if you want to use your own progress bar

## Use in external scripts

If you like the default progress bar of the script, and you want to use it in external scripts, this is the event

```lua
TriggerEvent("drugs_creator:startProgressBar", timeInMS, text, hexColor)
```

### Parameters

| Name       | Data type | Description                                                                                                     |
| ---------- | --------- | --------------------------------------------------------------------------------------------------------------- |
| `timeInMS` | integer   | Duration of the progress bar in milliseconds                                                                    |
| `text`     | string    | The text that will be shown with the progressbar                                                                |
| `hexColor` | string    | The color of the progressbar in hex code (example `#70f2b4`). Can be `nil` to use the default one of the script |

### Example

```lua
-- This will create a command to show a red progressbar
-- /progressbar 5000 Hello
RegisterCommand("progressbar", function(playerId, args) 
    TriggerEvent("drugs_creator:startProgressBar", tonumber(args[1]), args[2], "#ff0000")
end)
```


# Replace default mugshot notifications

Notification shown when a ped refuses the drug in NPC selling (notification with ped face)

## Event

```lua
AddEventHandler("drugs_creator:internalMugshotNotify", function(ped, title, message)

end)
```

### Parameters

| Name      | Data Type | Description                 |
| --------- | --------- | --------------------------- |
| `ped`     | int       | Ped entity handle           |
| `title`   | string    | Title of the notification   |
| `message` | string    | Message of the notification |

## Example

```lua
RegisterNetEvent("drugs_creator:framework:ready", function() 
    -- Disables the default script notification (otherwise there would be 2 notifications)
    exports["drugs_creator"]:disableScriptEvent("drugs_creator:internalMugshotNotify")
end)

RegisterNetEvent("drugs_creator:internalMugshotNotify", function(ped, title, message)
    TriggerEvent("external_script:notify", message)
end)
```

## Where to insert the code?

You can place it in the file `integrations/cl_integrations.lua` of the script, **at the bottom of the file on new lines**


# Replace default help notifications

Used to show the usual `Press E to ...` at the top left of the player's screen

## How to replace it?

You can use Drugs Creator [Modules](/drugs-creator/modules) if you want to use your own TextUI


# Replace default police alert

You can use Drugs Creator [Modules](/drugs-creator/modules) if you want to use your dispatch script


# Manually start drugs effects

Trigger to start drug effects (you may prefer to trigger this from server side)

## Event

```lua
TriggerEvent("drugs_creator:drugEffects", takingMethod, effects, effectsDuration, cumulativeEffects)
```

### Parameters

| Name                | Data Type | Description                                                                                            |
| ------------------- | --------- | ------------------------------------------------------------------------------------------------------ |
| `takingMethod`      | string    | How the player will take the drug                                                                      |
| `effects`           | table     | An array of strings containing all effects you want to add                                             |
| `effectsDuration`   | integer   | Seconds the effects will last                                                                          |
| `cumulativeEffects` | table     | OPTIONAL - Array containing the cumulative effects you want to add (check the examples for the format) |

### Taking methods

* `"pill"`
* `"drink"`
* `"smoke"`
* `"needle"`

### Effects

* `"visual_shaking"`
* `"drunk_walk"`
* `"fall"`
* `"pink_visual"`
* `"green_visual"`
* `"confused_visual"`
* `"yellow_visual"`
* `"blurred_visual"`
* `"red_visual"`
* `"foggy_visual"`
* `"blue_visual"`
* `"armor50"`
* `"armor100"`
* `"health50"`
* `"health100"`
* `"sprint_faster"`
* `"swim_faster"`
* `"infinite_stamina"`
* `"remove_old_effects"`
* `"vehicle_stalker"`
* `"ghost"`

### Cumulative effects `actions`

* `increaseArmor`
* `decreaseArmor`
* `increaseHealth`
* `decreaseHealth`
* `increaseHunger`
* `decreaseHunger`
* `increaseThirst`
* `decreaseThirst`
* `increaseStress`
* `decreaseStress`

## Example - Client side

```lua
RegisterCommand("effects", function() 
    local takingMethod = "pill"
    local effects = {
        "drunk_walk",
        "swim_faster",
        "green_visual",
    }

    local cumulativeEffects = {
        {action = "increaseArmor", value = 50},
        {action = "decreaseThirst", value = 15},
    }

    local effectsDuration = 120 -- seconds

    TriggerEvent("drugs_creator:drugEffects", takingMethod, effects, effectsDuration, cumulativeEffects)
end)
```

## Example - Server side

```lua
RegisterCommand("effects", function(playerId) 
    local takingMethod = "pill"
    local effects = {
        "drunk_walk",
        "swim_faster",
        "green_visual",
    }

    local cumulativeEffects = {
        {action = "increaseArmor", value = 50},
        {action = "decreaseThirst", value = 15},
    }

    local effectsDuration = 120 -- seconds

    TriggerClientEvent("drugs_creator:drugEffects", playerId, takingMethod, effects, effectsDuration, cumulativeEffects)
end)
```


# NPC Selling


# Disable default selling method for NPCs

Trigger to disable the prompt above NPCs "Press E to sell drugs"\
\
If you disable the prompt, you have to manually trigger the `drugs_creator:sellToNPC` event to sell to NPCs

## Event

```lua
TriggerEvent("drugs_creator:disableDefaultSellingMethodNPC")
```

## Example

```lua
-- Disables the prompt
RegisterNetEvent("drugs_creator:framework:ready", function() 
    TriggerEvent("drugs_creator:disableDefaultSellingMethodNPC")
end)

-- Manually sell to an NPC (example for targeting scripts)
Citizen.CreateThread(function() 
    local closestPed = ESX.Game.GetClosestPed()

    TriggerEvent("drugs_creator:sellToNPC", closestPed)
end)
```


# Add ped to selling blacklist

To add a ped to NPC selling blacklist, so players won't be able to sell to the ped (example: blackjack dealers, shop keepers, etc.)

If you prefer an easier way, you can blacklist entire ped models in `drugs_creator/integrations/cl_integrations.lua`

## Event

```lua
exports["drugs_creator"]:addPedToNPCSellingBlacklist(ped)
```

### Parameters

| Name  | Data Type     | Description             |
| ----- | ------------- | ----------------------- |
| `ped` | ped (integer) | The target ped's handle |

## Example

```lua
RegisterNetEvent('drugs_creator:framework:ready', function()
    local closestPed = ESX.Game.GetClosestPed()

    exports["drugs_creator"]:addPedToNPCSellingBlacklist(closestPed)
end)
```


# Remove ped from selling blacklist

To remove a ped from NPC selling blacklist, the opposite of the export `addPedToNPCSellingBlacklist`

## Event

```lua
exports["drugs_creator"]:removePedFromNPCSellingBlacklist(ped)
```

### Parameters

| Name  | Data Type     | Description             |
| ----- | ------------- | ----------------------- |
| `ped` | ped (integer) | The target ped's handle |

## Example

```lua
RegisterNetEvent('drugs_creator:framework:ready', function()
    local closestPed = ESX.Game.GetClosestPed()

    exports["drugs_creator"]:removePedFromNPCSellingBlacklist(closestPed)
end)
```




---

[Next Page](/llms-full.txt/1)

