---
description: How to add a contract into the gang app ?
---

# Contracts

You can add any heist resource to the gang app contracts.&#x20;

* If the heist script is <mark style="color:green;">open source</mark> then you can start it with the gang group.
* If the heist script is <mark style="color:orange;">not open source</mark> then you need to start it solo from the gang app.
* All zat heists works with the gang app.

<figure><img src="https://2134242036-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9QbcpHOPz9QGhghryntp%2Fuploads%2FUXBFEoBpH1jMAtdLSHLt%2Fimage.png?alt=media&#x26;token=0041cae5-ad32-4a0a-a880-ffdd4abaaadd" alt=""><figcaption></figcaption></figure>

<details>

<summary>How To add a contract in the gang script ?</summary>

* 1 - Under config.lua you will find the Config.Contracts, example :

```

{
        id = 1, -- must be a unique id for the contract
        label = 'Roof Running', -- label that will show in the ui gang app
        requirements = {    -- the required items to start the contract (just to display them)
            'Green Laptop',
            'RFID Cloner',
            'Drill',
            'Helmet'
        },
        price = 15, -- price to start the contract
        available = true, -- in case you want to disable it (as admin)
        image = 'https://www.awheatingandcooling.com/blog/wp-content/uploads/2020/07/Are-Rooftop-AC-Units-Right-for-Your-Business.jpg',
        resource = 'zat-roofrunning', -- the resource of the heist or contract 
        text = 'Roof Running mission started, head over to the location and contact the responsable...', -- notification that the player will get on contract start
        coords = vector3(574.08, 133.01, 98.47) -- npc location
    },
```

*   2 - Once the player buys the contract, then he must head to the npc to start the contract from, here are the exports you can use on the heist / contract script : \
    client exports : \


    ```lua
    exports('AmIMemberOfThisContractById', AmIMemberOfThisContractById)
    exports('GetMyContractIdByResource', GetMyContractIdByResource)
    exports('GetContractMembersById', GetContractMembersById)
    exports('GetContractResourceById', GetContractResourceById)
    exports('DisableContractById', DisableContractById)
    ```

    \
    server exports : \


    ```lua
    exports('GetMyContractIdByResource', GetMyContractIdByResource)
    exports('GetContractMembersById', GetContractMembersById)
    exports('GetContractResourceById', GetContractResourceById)
    exports('DisableContractById', DisableContractById)
    ```

-   3 - All you have to do is to add a condition to start the mission. example :&#x20;

    <pre class="language-lua"><code class="lang-lua">contractId = exports['zat-gangs']:GetMyContractIdByResource(GetCurrentResourceName())
    if contractId == nil then
         -- No contracts available
    else
    <strong>     exports['zat-gangs']:DisableContractById(contractId) -- disable the contract so it could not be started again
    </strong>     -- start the contract
         if exports['zat-gangs']:AmIMemberOfThisContractById(contractId) then
              StartMission()
         end
    end
    </code></pre>

&#x20;        Check if there is a contract bought of roofrunning or not, then check if the client is member or not of the contract then start it.



</details>

