Locksmith Example

We'll use the pre-configured locksmith job as a template and explain what each property does. V

You can find everything in [rcore_doorlock]/rcore_doorlock/config.business.lua.

Name and framework job

For a business to works properly, the configuration needs to be correct. The category name needs to match the name entry, as you can see below. It does not have to be the job name. To link the business to a job from your framework (ESX/QBCore/...), specify the correct job name in job.

locksmith = { --            ⬇️ Needs to match 
    name = 'locksmith',  -- ⬆️Needs to match 
    label = 'Locksmith', 
    job = 'locksmith', 

    ...

Crafting

Let's take a look at the crafting board setup. Everything is located in money section. We can set up key or card crafting. Let's demonstrate this on the key crafting.

The item property is passed from the main config, we don't need to touch it.Next we see the key label in the crafting menu. This is displayed when we select what we want to craft. The enabled property tells us if we want to let players in this business craft key.

💼 This gives us the ability to have multiple businesses, where one will handle the key door and the other the card reader door and card item production.

Another important thing is the price. The price is quoted per item crafted for door. However, if we want to produce a key/card for a whole group of doors, we can use a price modifier (multiplier).

We can decide if the price for crafting will come out of the player's pocket, or out of the framework job society's money. If we set enabled to false, the money will be taken from the player's account defined in playerAccount. For ESX, this can be money for cash, or bank for a bank account, for example.

money = {
    key = { 
        item = Config.DoorSystem.Items.Key.Item, -- Item for key
        label = 'Key',
        enabled = true,                          -- Enable or disable crafting key
        price = 100,                             -- Price for crafting key
        groupModifier = 1.5,                     -- Increase price by x1.5 for group keys for all doors
        society = {
            enabled = true,                      -- Enable or disable society, if false, money will be taken from player account
            name = 'society_locksmith',
        },
        playerAccount = 'money' -- If society is disabled, money will be taken from this account
    },

    ...

Locations

We must also set locations where the crafting table and NPC with boss actions will be placed.

We don't have to touch the type of location. This is in case we want to have several locations. In addition to the coordinates, we can also set a blip that will be displayed to players in the business on the map.

locations = {                                                   -- Locations for business
    {
        type = Business.Locations.CRAFTING_TABLE,               -- Location type [CRAFTING_TABLE, BOSS_ACTIONS]
        coords = vector4(162.2114, -1810.1307, 28.7273, 230.0), -- Location coords
        blip = {                                                -- Blip settings
            label = 'Locksmith Crafting Table',
            sprite = 763,
            color = 5,
            scale = 1.0,
            isShortRange = true,
            display = 2,
        },
    },

    ...

Grades

Another important configuration are business grades. We need to set grades to match exactly the job one from your framework. It is important to set the grade and name correctly, which for each grad must match the one in the framework job. If everything matches the framework job, we can move on.

The boss grade must be marked with the boss = true property so that the business can know who has access to the boss actions.

Each grade has configurable permissions of what they can do. If we want rookie grade to only be able to craft keys/cards, we set permission to craft. If we want experienced grade to be able to create door locks, we set the appropriate permission for it as well.

grades = {                -- Grades for business (need to be same as in your framework jobs)
    {
        grade = 0,        -- Grade number
        name = 'rookie',  -- Grade name
        label = 'Rookie', -- Grade label
        permissions = {   -- Permissions for grade
            [Business.Permissions.CRAFT_ITEM] = true,
            --[Business.Permissions.CREATE_DOOR] = true,
            },
    },

    ...

    {
        grade = 3,
        boss = true, -- Is boss grade
        name = 'boss',
        label = 'Owner',
        permissions = {
            [Business.Permissions.CREATE_DOOR] = true,
            [Business.Permissions.CRAFT_ITEM] = true,
            [Business.Permissions.EDIT_DOOR] = true,
            [Business.Permissions.DELETE_DOOR] = true,
            [Business.Permissions.CHANGE_LOCKS] = true,
        },
    }

Last updated