Page cover

exports / triggers

Client Exports

Export
Result

exports.brutal_keys:addKey(keyID, label)

Give key to the player. Create a key for anything. The label can be anything. (Won't work with vehicles)

exports.brutal_keys:removeKey(keyID, deleteAll)

Remove key from the player. deleteAll: true/false - if true then it will delete all the keys with this keyID from the player

exports.brutal_keys:removeKey(plate, deleteAll)

Remove vehicle key from the player. deleteAll: true/false - if true then it will delete all the keys with this keyID from the player

exports.brutal_keys:addVehicleKey(plate, label)

Give vehicle key to the player. The label can be anything.

exports.brutal_keys:addVehicleTemporaryKey(seconds, plate, label)

Give a temporary key to the plaer to the vehicle. After the given seconds it will be removed. The label can be anything.

exports.brutal_keys:getPlayerKey(keyID)

Return two values

hasKey: true/false - Wether the player has the key or not. quantity: number - if has the key then the quantity.

Server Triggers

Export
Result

TriggerEvent('brutal_keys:server:addKey', PlayerID, keyID, label)

Give key to the player. Create a key for anything. (Won't work with vehicles)

TriggerEvent('brutal_keys:server:removeKey', PlayerID, keyID, deleteAll)

Remove key from the player. deleteAll: true/false - if true then it will felete all the keys with this keyID from the player

TriggerEvent('brutal_keys:server:addVehicleKey', PlayerID, plate, label)

Give vehicle key to the player

TriggerEvent('brutal_keys:server:addVehicleTemporaryKey', PlayerID, seconds, plate, label)

Give a temporary key to the player to the vehicle. After the given seconds it will be removed.

Vehicle Shop Integrate

You have to add this trigger on server side when the player gets a new vehicle: TriggerEvent('brutal_keys:server:addVehicleKey', source, plate, plate)

ESX - esx_vehicleshop/main.lua

We already integrated the needed triggers to this file. But you can add by yourself too.

QBCORE - qb-vehicleshop/server.lua

We already integrated the needed triggers to this file. But you can add by yourself too.

QBOX- qbx_vehicleshop/config/server.lua

Change the export to this event and it will support the brutal_keys after you integrated it!

giveKeys = function(src, plate, vehicle)
        --exports.qbx_vehiclekeys:GiveKeys(src, vehicle)
        
    end,

How to use custom keys

Here is an exmple how to create a custom key for a stash for example.

  • How to give a key to a player to anything

local StashName = "stash_1"
exports.brutal_keys:addKey(StashName.."_key", "Chest Key")
  • How to get if the player have a key for the stash or not

local keyID = "stash_1_key"
local hasKey,quantity = exports.brutal_keys:getPlayerKey(keyID)

if hasKey then 
    exports.ox_inventory:openInventory('stash', { id = "stash_1"})
else
    -- Dont have key for the stash
end

Last updated

Was this helpful?