> For the complete documentation index, see [llms.txt](https://titans-productions.gitbook.io/documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://titans-productions.gitbook.io/documentation/redm/scripts/clans/blackmarket.md).

# Blackmarket

### Basic Information

The blackmarket feature system is an extra addon system that allows you to create a scheduled blackmarket merchant to be spawned on a specified spot at specified time. This system uses **TP Stores** by default as an example of how to open a Blackmarket store.

To add your own export or event, open `client/escrow_ignore.lua` file and search for **OpenBlackMarket()** function which is the function that is executed when pressing the blackmarket action prompt.

> The input time, must be the exact spawn time which means, if your input is 22:45, the merchant will spawn the exact time - don't expect the merchant to spawn at 22:46 if you are restarting the server or the script, it will skip it because the time has passed.

### Configuration Explanation

1. The first is for adding an input time, a valid real-time to spawn the merchant. When time is from xx:00 - xx:09 (minutes not hours), the input must be xx:0 - xx:9 (the system skips the 01,02,09 seconds and displays them without the 0).\
   \
   So if you want to spawn a merchant at 15:05, your input must be `15:5`.<br>
2. Requires a prompt name to be displayed when player is near the merchant.
3. Requires a valid model name - you can find any models in many websites related to RedM.
4. The `RandomCoords` section requires a table form which is for having multiple elements for selecting randomly and spawning a merchant. You can add as many locations you want for a merchant to spawn. The coords must be also in a table form and not a vector3 or vector4\
   \
   The `StoreName` is an extra addon which is used on `escrow_ignore.lua` file in case you want to open different blackmarket stores.
5. The `ActionDistance` is the distance between you and the NPC for displaying the action prompt and opening the blackmarket.

```lua
[""] = { -- #1

    PromptName = '', -- #2

    Model = "", -- #3

    RandomCoords = {-- #4
        { Coords = { x = 0.0, y = 0.0, z = 0.0, h = 0.0 }, StoreName = 'BLACKMARKET'},
    },
    
    ActionDistance = 1.8, -- #5

    Attachment = { -- Set to true if you want to add a backpack attached to the npc.
        Enabled = true,
        
        Model     = 'p_ambpack01x', 
        BoneIndex = 'SCALE_Spine5', 
        xpos      = -0.50, 
        ypos      = -0.10, 
        zpos      = -0.01, 
        xrot      = 10.0, 
        yrot      = 90.0, 
        zrot      = 0.0 
    },

    WeaponAttachment = { Enabled = true, WeaponHash = 0x6DFA071B },

    BlipData = {
        Enabled = true,

        Coords = {x = -3955.85, y = -2133.93, z = -3.578, h = 97.171997},

        -- @param BlipData.Type : 'EVERYWHERE', 'NEARBY' are the available types.
        -- "EVERYWHERE"         : To display the blip in the world map.
        -- "NEARBY"             : To display the blip only when being nearby to the merchant.
        Type = 'EVERYWHERE',

        -- "NEARBY" ONLY: To display the blip only when being nearby to the merchant. 
        NearbyBlipRenderDistance = 60.0,

        CircleRadius = 100.0,

        Title = 'Black Market',
        Color = 0x3F90ADF0,
    },

    -- (!) Set @Objects to Object = {} if you don't want any.
    Objects = {

        --[[{ -- THIS IS AN EXAMPLE.
            Model = 'xxxxxxxx',
    
            Coords = { 
                x = 0.0, y = 0.0, z = 0.0, 
                pitch = 0.0, roll = 0.0, yaw = 0.0
            },
    
            PlaceObjectOnGroundProperly = false,
        },]]--

    },

    -- (!) Checkout server/escrow_ignore.lua file to modify the announce trigger event - export.
    NotifyTitle = "Black Market",
    NotifyDescription = "The black market merchant has been revealed, you have (1) hour before the merchant leaves.",
    NotifyDisplayDuration = 30, -- time in seconds
},
```
