Dealers

data/dealers.lua

This file defines all the dealers used by this resource.

Structure

local dealers = {
    dealer_name = {
        label = string,                          -- the label used for UI, etc

        faction = string,                        -- the faction name of this dealer
        required_reputation = number,            -- minimum reputation required to interact

        hostile = boolean,                       -- is this dealer hostile (peds attack if threatened or approached with negative reputation)

        notify_buying = boolean,                 -- notify valid players when buying offers start
        notify_selling = boolean,                -- notify valid players when selling offers start

        restock = boolean,                       -- does this dealer restock automatically?
        restock_time = number,                   -- if this dealer restocks, how many minutes between restock tick?

        open_time = number,                      -- what time does this dealer open? (military hours)
        close_time = number,                     -- what time does this dealer close? (military hours)

        character_restrictions = { character_identifier,    ... },   -- character restrictors
        job_restrictions       = { job_name = min_rank,     ... },   -- job restrictors
        group_restrictions     = { group_name = group_rank, ... },   -- group restrictors

        interactions = {                         -- interaction points for this dealer    
            vector3,                             -- world coordinate
            ...
        },

        peds = {                                     -- peds spawns for this dealer      
            {         
                interactable   = true,               -- can you interact with this ped?
                label          = string,             -- the label used for UI, etc                  
                model          = string OR number    -- model to use at this spawn
                position       = vector3,            -- world coordinate to spawn at
                heading        = number,             -- ped heading
                time_start     = number,             -- dealer will spawn here starting at this hour (military hours)
                time_end       = number,             -- dealer will no longer spawn here after this hour (military hours)
                hostile_weapon = string,             -- weapon name (if hostile)
                hostile_ammo   = number,             -- ammo ammount (if hostile)
            },
            ...
        },

        items = {                                -- items are available any time the dealer is interacted with
            item_name = {
                required_reputation = number,    -- required reputation to purchase this item
                hidden = boolean,                -- should this item be hidden entirely until required reputation received?

                default_stock = number,          -- amount of stock to start (only set on first check, otherwise saved in database)

                buy = boolean,                   -- will purchase this item?
                buy_until = number,              -- maximum stock before refusing purchase
                buy_price_mod = number,          -- multiply item price by this number when purchasing (0.1 - 9.9)

                sell = boolean,                  -- will sell this item?
                sell_price_mod = number,         -- multiply item price by this number when selling (0.1 - 9.9)

                restock = boolean,               -- restock on restock_tick?
                restock_rate = number,           -- restock this amount every restock_time tick
                restock_until = number,          -- maximum stock before on restock

                required_licenses = {            -- required licenses to purchase this item
                    license_name,
                    ...
                },
            },
            ...
        },

        deals = {                                    -- deals are triggered based on chance and timing
            {
                chance = number,                     -- chance of deal offer triggering
                timeout = number,                    -- minimum time between deal offers
                required_reputation = number,        -- required reputation to view this deal
               
                items = {
                    item_name = {
                        required_reputation = number,    -- required reputation to purchase this item
                        hidden = boolean,                -- should this item be hidden entirely until required reputation received?

                        default_stock = number,          -- amount of stock to start (only set on first check, otherwise saved in database)

                        buy = boolean,                   -- will purchase this item?
                        buy_until = number,              -- maximum stock before refusing purchase
                        buy_price_mod = number,          -- multiply item price by this number when purchasing (0.1 - 9.9)

                        sell = boolean,                  -- will sell this item?
                        sell_price_mod = number,         -- multiply item price by this number when selling (0.1 - 9.9)

                        required_licenses = {            -- required licenses to purchase this item
                            license_name,
                            ...
                        },
                    },
                    ...
                }
            },
            ...
        },
    },
    ...
}

Examples


local dealers = {
    ["example_empty_shop"] = {
        label = "Empty Shop",

        faction = nil,
        required_reputation = nil,

        hostile = false,

        notify_buying = false,
        notify_selling = false,
        
        restock = false,
        restock_time = nil,

        open_time = nil,
        close_time = nil,

        character_restrictions = nil,
        job_restrictions = nil,
        group_restrictions = nil,

        interactions = nil,
        peds = nil,
        items = nil,
        deals = nil,
    },

    ["example_populated_shop"] = {
        label = "Pawn Stars",

        faction = "ballas",
        required_reputation = false,

        hostile = true,

        notify_buying = true,
        notify_selling = true,
        
        restock = true,
        restock_time = 30,

        open_time = nil,
        close_time = nil,

        character_restrictions = nil,
        job_restrictions = nil,
        group_restrictions = nil,

        interactions = {
            vector3(258.94, -638.26, 40.55),
        },

        blip = {                    
            label = "Pawn Stars",
            position = vector3(258.94, -638.26, 40.55),
            sprite = 52,
            color = 35,
            alpha = 255,
            scale = 0.7,
            display = 2,
            highDetail = true,
            shortRange = true
        },
   
        peds = {                       
            {
                label          = "Dealer",
                model          = "player_zero",
                position       = vector3(260.06, -638.74, 40.55),
                heading        = 67.12,
                time_start     = 0000,
                time_end       = 2300,
            },            
            {
                label          = "Guard 1",
                model          = "player_one",
                position       = vector3(259.18, -640.76, 40.37),
                heading        = 67.12,
                time_start     = 0000,
                time_end       = 2300,
                hostile_weapon = "WEAPON_PISTOL",
                hostile_ammo   = 100,
            },            
            {
                label          = "Guard 2",
                model          = "player_two",
                position       = vector3(260.94, -636.53, 40.74),
                heading        = 67.12,
                time_start     = 0000,
                time_end       = 2300,
                hostile_weapon = "WEAPON_PISTOL50",
                hostile_ammo   = 100,
            },
        },

        items = {
            ["weapon_knife"] = {
                default_stock = 1,

                buy = true,
                buy_until = 5,
                buy_price_mod = 0.8,

                sell = true,
                sell_price_mod = 1.2,

                restock_rate = 1,
                restock_until = 1,

                required_licenses = {"knife_license"},

                valid_accounts = {'cash','bank'}
            },

            ["weapon_pistol"] = {
                default_stock = 10,

                buy = false,
                buy_until = nil,
                buy_price_mod = nil,

                sell = true,
                sell_price_mod = 1.2,

                restock_rate = 1,
                restock_until = 10,

                required_licenses = {"firearm_license"},

                valid_accounts = {'cash','bank'}
            },
        },

        deals = {
            {
                chance = 50,
                timeout = 30,
                required_reputation = 60,

                items = {
                    ["weapon_smg"] = {
                        required_reputation = 70,

                        default_stock = 2,
        
                        buy = false,
                        buy_until = nil,
                        buy_price_mod = nil,
        
                        sell = true,
                        sell_price_mod = 1.2,
        
                        required_licenses = {"firearm_license","auto_firearm_license"},

                        valid_accounts = {'cash','bank'}
                    } 
                }
            }
        },
    },

    ["example_character"] = {
        label = "Pawnie the Dealer",

        faction = "grove",
        required_reputation = 0,

        hostile = true,

        notify_buying = true,
        notify_selling = true,

        restock = false,
        restock_time = nil,

        open_time = nil,
        close_time = nil,

        character_restrictions = {
            '1:ABC123',
        },

        job_restrictions = {
            ["police"] = 2
        },

        group_restrictions = {
            ["ballas"] = 3
        },

        interactions = nil,
   
        peds = {                       
            {
                interactable   = true,
                label          = "Pawnie the Dealer",
                model          = "player_zero",
                position       = vector3(217.66,-645.02,39.05),
                heading        = 252.63,
                time_start     = 0000,
                time_end       = 0600,
                hostile_weapon = "WEAPON_SMG",
                hostile_ammo   = 1000,
            },            
            {
                interactable   = true,
                label          = "Pawnie the Dealer",
                model          = "player_zero",
                position       = vector3(213.48,-655.46,38.29),
                heading        = 249.72,
                time_start     = 0600,
                time_end       = 1400,
                hostile_weapon = "WEAPON_PISTOL50",
                hostile_ammo   = 1000,

                blip = {                    
                    label = "Pawnie the Dealer",
                    position = vector3(213.48, -655.46, 38.29),
                    sprite = 52,
                    color = 35,
                    alpha = 255,
                    scale = 0.7,
                    display = 2,
                    highDetail = true,
                    shortRange = true
                },
            },            
            {
                interactable   = true,
                label          = "Pawnie the Dealer",
                model          = "player_zero",
                position       = vector3(211.97,-661.88,37.86),
                heading        = 249.10,
                time_start     = 1400,
                time_end       = 2300,
                hostile_weapon = "WEAPON_ASSAULTRIFLE",
                hostile_ammo   = 1000,
            },
        },

        items = {
            ["lockpick"] = {
                default_stock = 10,

                buy = true,
                buy_until = 50,
                buy_price_mod = 0.9,

                sell = true,
                sell_price_mod = 1.1,

                restock_rate = nil,
                restock_until = nil,

                required_licenses = nil,

                valid_accounts = {'cash','bank'}
            },
        },

        deals = nil,
    },
}

Last updated