Integrations

We provide various open source functions into our Advanced Chop Shop resource that enables you to add further customization and/or add third-party resource integrations such as XP systems.

Client

The functions below can be found in lation_chopshop/client/functions.lua

StartChopping() - Empty function that's triggered when player has started chopping process

-- Empty function that's triggered when player has started chopping process
-- Can be used for things like disabling inventory, etc
StartChopping = function()
    -- Below are some examples:
    -- qs-inventory: exports['qs-inventory']:setInventoryDisabled(true)
    -- ox_inventory: LocalPlayer.state.invBusy = true
    -- qb-inventory: LocalPlayer.state.inv_busy = true
end

FinishChopping() - Empty function that's triggered when player has finished chopping process

-- Empty function that's triggered when player has finished chopping process
-- Can be used for things like disabling inventory, etc
FinishChopping = function()
    -- Below are some examples:
    -- qs-inventory: exports['qs-inventory']:setInventoryDisabled(false)
    -- ox_inventory: LocalPlayer.state.invBusy = false
    -- qb-inventory: LocalPlayer.state.inv_busy = false
end

ContractStarted() - Empty function that's triggered when a contract has started

-- Empty function that's triggered when a contract has started
--- @param coords vector4 Position at which the vehicle is spawned
--- @param driver number The driver's entity ID
--- @param vehicle number The vehicle's entity ID
--- @param model string The vehicle spawn name, data can be accessed via Config.Vehicles[model]
--- @param isSale boolean True if it's a selling contract, false if chopping
ContractStarted = function(coords, driver, vehicle, model, isSale)

end

VehicleHijacked() - Empty function that's triggered when a player obtained contract vehicle

-- Empty function that's triggered when a player succesfully obtained contract vehicle
--- @param vehicle number Entity ID
--- @param model string Vehicle spawn name, data can be accessed via Config.Vehicles[model]
--- @param isSale boolean True if it's a selling contract, false if chopping
VehicleHijacked = function(vehicle, model, isSale)

end

Server

The functions below can be found in lation_chopshop/server/functions.lua

ChoppedPart() - Empty function that's triggered when done chopping a part

-- Empty function that's triggered when done chopping a part
-- Useful for various reasons such as XP systems, rewarding items, etc
--- @param source number Player ID
--- @param model string Vehicle model: panto
--- @param type string Part type: wheels, doors or frame
ChoppedPart = function(source, model, type)
    -- Can be used for any purpose, such as rewarding a specific item for a specific model
    -- When chopping a specific part, or any sort of other similar variation(s).
    -- Below is a simplified example:
    if model == 'baller3' then
        if type == 'frame' then
            local chance = math.random(100)
            if chance < 15 then
                -- AddItem(source, 'specialItem', 1)
            end
        end
    end
    -- The simplified example above rewards a "specialItem" with a 15% chance
    -- When a baller3 frame is chopped by a player

    -- This can be expanded on by the use of exports as well. For example, checking
    -- If the player has a certain amount of reputation first. Like so:
    if exports.lation_chopshop:GetData(source, 'reputation') >= 10000 then
        if model == 'baller3' then
            if type == 'frame' then
                local chance = math.random(100)
                if chance < 15 then
                    -- AddItem(source, 'specialItem', 1)
                end
            end
        end
    end
    -- The above example will now only consider a player for this "specialItem" if
    -- They have 10,000 or more reputation. 
end

ToolPurchased() - Empty function that's triggered when a player purchased from the tool shop

-- Empty function that's triggered when a player purchases from the tool shop
--- @param source number Player ID
--- @param data table item, label, price, min, max
--- @param quantity number Quantity of item purchased
ToolPurchased = function(source, data, quantity)

end

PartsSwapped - Empty function that's triggered when a player swaps auto parts for an item

-- Empty function that's triggered when a player swaps auto parts for an item
--- @param source number Player ID
--- @param data table item, label, price, min, max of item swapped for
--- @param quantity number Quantity of item swapped for
PartsSwapped = function(source, data, quantity)

end

Last updated