From the reference libraryRedM

Price Generator

jo_libs/dev_resources/price-generator.md

Price Generator

Use this tool to generate price tables for our scripts.
Copy the generated Lua code and paste it into your config file as the value of the appropriate variable.

<PriceGenerator />

Price syntax reference > Simple price for dollars (number only)

local price = 5

Price syntax reference > Combined price with money and gold

local price = { money = 2.75, gold = 2 }

Price syntax reference > Price with item and money

local price = { { item = "horse_license", keep = true }, money = 10 }

Price syntax reference > Multiple payment options (OR)

The player chooses one of the listed payment options.

-- Example: Player can pay with either (1 apple + $10) OR (152 gold)
local price = {
    operator = "or",
    { { item = "apple", quantity = 1, keep = true }, money = 10 },
    { gold = 152 }
}

Price syntax reference

Each entry is a payment option. Inside one option, all listed costs are paid together.

Price syntax reference > Simple price for dollars

-- Example: Player pays $5
local price = 5

Price syntax reference > Money and gold together

-- Example: Player pays $2.75 and 2 gold
local price = {
    { money = 2.75, gold = 2 }
}

Price syntax reference > Rol

-- Example: Player pays 3 rol
local price = { rol = 3 }

Price syntax reference > Item only

-- Example: Player pays with 1 water
local price = { item = "water" }

Price syntax reference > Item with quantity

-- Example: Player pays with 3 apples
local price = { item = "apple", quantity = 3 }

Price syntax reference > Item kept after payment

-- Example: Player needs a permit and keeps it after payment
local price = { item = "permit", keep = true }

Price syntax reference > Item and money together

-- Example: Player pays $10 and 1 water
local price = {
    { item = "water", money = 10 }
}

Price syntax reference > Item with quantity and money

-- Example: Player pays $10 and 2 apples
local price = {
    { { item = "apple", quantity = 2 }, money = 10 }
}

Price syntax reference > Multiple items in one option

-- Example: Player pays 2 apples and 1 water
local price = {
    {
        { item = "apple", quantity = 2 },
        { item = "water" }
    }
}

Price syntax reference > Multiple payment options

The player chooses one option.

-- Example: Player can pay with either ($10 + 1 water) OR 152 gold
local price = {
    { item = "water", money = 10 },
    { gold = 152 }
}
-- Example: Player can pay with either ($10 + 2 apples) OR 152 gold
local price = {
    { { item = "apple", quantity = 2 }, money = 10 },
    { gold = 152 }
}
Back to documentation