Group Limited

Details

You can make shop available only to certain groups. This can be useful for creating job-specific shops, or shops that are only available to certain players.

Example configuration file for single group

config/shops.lua
return {
    -- ...
    BuySellShop = {
        label = 'Shop',
        description = 'A small convenience store that is open 24/7.',
        paymentMethods = {
            buy = { 'cash', 'bank' },
            sell = { 'cash' }
        },
        group = 'police', -- Only players with 'police' group can access this shop
        settings = {
            useStock = false,
            useCategories = false,
            fluctuatePrices = true
        },
        blip = {
            sprite = 59, color = 69, scale = 0.8
        },
        items = {
            buy = {
                { name = 'burger', price = 10 },
                { name = 'water',  price = 10 },
                { name = 'cola',   price = 10 },
            },
            sell = {
                { name = 'burger', price = 10 },
            }
        },
        locations = {
            { coords = vec3(25.06, -1347.32, 29.7),   size = vector3(0.7, 0.5, 0.4), rotation = 0.0,   distance = 1.5 },
            { coords = vec3(-3039.18, 585.13, 8.11),  size = vector3(0.6, 0.5, 0.4), rotation = 15.0,  distance = 1.5 },
            { coords = vec3(-3242.2, 1000.58, 13.03), size = vector3(0.6, 0.6, 0.4), rotation = 175.0, distance = 1.5 },
            { coords = vec3(1728.39, 6414.95, 35.24), size = vector3(0.6, 0.6, 0.4), rotation = 65.0,  distance = 1.5 },
            { coords = vec3(1698.37, 4923.43, 42.26), size = vector3(0.5, 0.5, 0.4), rotation = 235.0, distance = 1.5 },
            { coords = vec3(1960.54, 3740.28, 32.54), size = vector3(0.6, 0.5, 0.4), rotation = 120.0, distance = 1.5 },
            { coords = vec3(548.5, 2671.25, 42.36),   size = vector3(0.6, 0.5, 0.4), rotation = 10.0,  distance = 1.5 },
            { coords = vec3(2678.29, 3279.94, 55.44), size = vector3(0.6, 0.5, 0.4), rotation = 330.0, distance = 1.5 },
            { coords = vec3(2557.19, 381.4, 108.82),  size = vector3(0.6, 0.5, 0.4), rotation = 0.0,   distance = 1.5 },
            { coords = vec3(373.13, 326.29, 103.77),  size = vector3(0.6, 0.5, 0.4), rotation = 345.0, distance = 1.5 },
        }
    },
}

Example configuration file for multiple groups

config/shops.lua
return {
    -- ...
    BuySellShop = {
        label = 'Shop',
        description = 'A small convenience store that is open 24/7.',
        paymentMethods = {
            buy = { 'cash', 'bank' },
            sell = { 'cash' }
        },
        group = {'police', 'ambulance'}, -- Only players with 'police' or 'ambulance' group can access this shop
        settings = {
            useStock = false,
            useCategories = false,
            fluctuatePrices = true
        },
        blip = {
            sprite = 59, color = 69, scale = 0.8
        },
        items = {
            buy = {
                { name = 'burger', price = 10 },
                { name = 'water',  price = 10 },
                { name = 'cola',   price = 10 },
            },
            sell = {
                { name = 'burger', price = 10 },
            }
        },
        locations = {
            { coords = vec3(25.06, -1347.32, 29.7),   size = vector3(0.7, 0.5, 0.4), rotation = 0.0,   distance = 1.5 },
            { coords = vec3(-3039.18, 585.13, 8.11),  size = vector3(0.6, 0.5, 0.4), rotation = 15.0,  distance = 1.5 },
            { coords = vec3(-3242.2, 1000.58, 13.03), size = vector3(0.6, 0.6, 0.4), rotation = 175.0, distance = 1.5 },
            { coords = vec3(1728.39, 6414.95, 35.24), size = vector3(0.6, 0.6, 0.4), rotation = 65.0,  distance = 1.5 },
            { coords = vec3(1698.37, 4923.43, 42.26), size = vector3(0.5, 0.5, 0.4), rotation = 235.0, distance = 1.5 },
            { coords = vec3(1960.54, 3740.28, 32.54), size = vector3(0.6, 0.5, 0.4), rotation = 120.0, distance = 1.5 },
            { coords = vec3(548.5, 2671.25, 42.36),   size = vector3(0.6, 0.5, 0.4), rotation = 10.0,  distance = 1.5 },
            { coords = vec3(2678.29, 3279.94, 55.44), size = vector3(0.6, 0.5, 0.4), rotation = 330.0, distance = 1.5 },
            { coords = vec3(2557.19, 381.4, 108.82),  size = vector3(0.6, 0.5, 0.4), rotation = 0.0,   distance = 1.5 },
            { coords = vec3(373.13, 326.29, 103.77),  size = vector3(0.6, 0.5, 0.4), rotation = 345.0, distance = 1.5 },
        }
    },
}

Example configuration file for multiple groups with grades

config/shops.lua
return {
    -- ...
    BuySellShop = {
        label = 'Shop',
        description = 'A small convenience store that is open 24/7.',
        paymentMethods = {
            buy = { 'cash', 'bank' },
            sell = { 'cash' }
        },
        group = {
            ['police'] = 1, -- Only players with 'police' group and grade 1 or higher can access this shop
            ['ambulance'] = 2 -- Only players with 'ambulance' group and grade 2 or higher can access this shop
        },
        settings = {
            useStock = false,
            useCategories = false,
            fluctuatePrices = true
        },
        blip = {
            sprite = 59, color = 69, scale = 0.8
        },
        items = {
            buy = {
                { name = 'burger', price = 10 },
                { name = 'water',  price = 10 },
                { name = 'cola',   price = 10 },
            },
            sell = {
                { name = 'burger', price = 10 },
            }
        },
        locations = {
            { coords = vec3(25.06, -1347.32, 29.7),   size = vector3(0.7, 0.5, 0.4), rotation = 0.0,   distance = 1.5 },
            { coords = vec3(-3039.18, 585.13, 8.11),  size = vector3(0.6, 0.5, 0.4), rotation = 15.0,  distance = 1.5 },
            { coords = vec3(-3242.2, 1000.58, 13.03), size = vector3(0.6, 0.6, 0.4), rotation = 175.0, distance = 1.5 },
            { coords = vec3(1728.39, 6414.95, 35.24), size = vector3(0.6, 0.6, 0.4), rotation = 65.0,  distance = 1.5 },
            { coords = vec3(1698.37, 4923.43, 42.26), size = vector3(0.5, 0.5, 0.4), rotation = 235.0, distance = 1.5 },
            { coords = vec3(1960.54, 3740.28, 32.54), size = vector3(0.6, 0.5, 0.4), rotation = 120.0, distance = 1.5 },
            { coords = vec3(548.5, 2671.25, 42.36),   size = vector3(0.6, 0.5, 0.4), rotation = 10.0,  distance = 1.5 },
            { coords = vec3(2678.29, 3279.94, 55.44), size = vector3(0.6, 0.5, 0.4), rotation = 330.0, distance = 1.5 },
            { coords = vec3(2557.19, 381.4, 108.82),  size = vector3(0.6, 0.5, 0.4), rotation = 0.0,   distance = 1.5 },
            { coords = vec3(373.13, 326.29, 103.77),  size = vector3(0.6, 0.5, 0.4), rotation = 345.0, distance = 1.5 },
        }
    },
}

Example configuration file for items limiting

If you don't want to limit whole shop to certain groups, you can limit specific items to certain groups.

config/shops.lua
return {
    -- ...
    BuySellShop = {
        label = 'Shop',
        description = 'A small convenience store that is open 24/7.',
        paymentMethods = {
            buy = { 'cash', 'bank' },
            sell = { 'cash' }
        },
        settings = {
            useStock = false,
            useCategories = false,
            fluctuatePrices = true
        },
        blip = {
            sprite = 59, color = 69, scale = 0.8
        },
        items = {
            buy = {
                {
                    name = 'burger',
                    price = 10,
                    group = {
                        ['police'] = 1, -- Only players with 'police' group and grade 1 or higher can access this shop
                        ['ambulance'] = 2 -- Only players with 'ambulance' group and grade 2 or higher can access this shop
                    },
                },
                { name = 'water',  price = 10 },
                { name = 'cola',   price = 10 },
            },
            sell = {
                { name = 'burger', price = 10 },
            }
        },
        locations = {
            { coords = vec3(25.06, -1347.32, 29.7),   size = vector3(0.7, 0.5, 0.4), rotation = 0.0,   distance = 1.5 },
            { coords = vec3(-3039.18, 585.13, 8.11),  size = vector3(0.6, 0.5, 0.4), rotation = 15.0,  distance = 1.5 },
            { coords = vec3(-3242.2, 1000.58, 13.03), size = vector3(0.6, 0.6, 0.4), rotation = 175.0, distance = 1.5 },
            { coords = vec3(1728.39, 6414.95, 35.24), size = vector3(0.6, 0.6, 0.4), rotation = 65.0,  distance = 1.5 },
            { coords = vec3(1698.37, 4923.43, 42.26), size = vector3(0.5, 0.5, 0.4), rotation = 235.0, distance = 1.5 },
            { coords = vec3(1960.54, 3740.28, 32.54), size = vector3(0.6, 0.5, 0.4), rotation = 120.0, distance = 1.5 },
            { coords = vec3(548.5, 2671.25, 42.36),   size = vector3(0.6, 0.5, 0.4), rotation = 10.0,  distance = 1.5 },
            { coords = vec3(2678.29, 3279.94, 55.44), size = vector3(0.6, 0.5, 0.4), rotation = 330.0, distance = 1.5 },
            { coords = vec3(2557.19, 381.4, 108.82),  size = vector3(0.6, 0.5, 0.4), rotation = 0.0,   distance = 1.5 },
            { coords = vec3(373.13, 326.29, 103.77),  size = vector3(0.6, 0.5, 0.4), rotation = 345.0, distance = 1.5 },
        }
    },
}