Mechanic
Events
Client and server events you can use to integrate JG Mechanic with other resources
Client
Open tuning menu
Opens the tuning menu at a specific location.
-- mechanicId: string (The mechanic id from the config)
-- mechanicLabel: string (The label which will show in the menu)
TriggerEvent("jg-mechanic:client:open-customisation-menu", mechanicId, mechanicLabel)Example Usage
ReigsterCommand('openmechmenu', function() -- This creates a command called openmechmenu (maybe for admins?)
TriggerEvent("jg-mechanic:client:open-customisation-menu", 'bennys', 'bennys') -- Trigger Actual event
end, true) -- Is it locked? (https://natives.avarian.dev/?native=0x5FA79B0F&game=gta5)Open tablet
Opens the tablet.
TriggerEvent("jg-mechanic:client:use-tablet")Example usage
exports.ox_target:addBoxZone({
coords = vector3(0.0, 0.0, 0.0), -- Vector of where you wanted the box zone
size = vec3(1.0, 1.0, 2.0),
rotation = 0,
debug = false,
options = {
{
label = "Use Tablet",
icon = "fa-solid fa-tablet-screen-button",
onSelect = function()
TriggerEvent("jg-mechanic:client:use-tablet")
end,
}
}
})Open admin menu
Opens the admin menu.
TriggerEvent("jg-mechanic:client:open-admin")Example Usage
exports.ox_target:addBoxZone({
coords = vector3(0.0, 0.0, 0.0), -- Vector of where you wanted the box zone
size = vec3(1.0, 1.0, 2.0),
rotation = 0,
debug = false,
options = {
{
label = "Open Admin",
icon = "fa-solid fa-tablet-screen-button",
onSelect = function()
TriggerEvent("jg-mechanic:client:open-admin")
end,
}
}
})Listeners
Listen to toggling of tablet being hidden
AddEventHandler("jg-mechanic:client:tablet-hidden-for-interaction", function()
end)Example usage
AddEventHandler("jg-mechanic:client:tablet-hidden-for-interaction", function()
-- Example: Print something random when tablet is hidden
print('Scorpion is the best support member')
end)Listen to toggling of tablet being shown
AddEventHandler("jg-mechanic:client:tablet-shown-after-interaction", function()
end)AddEventHandler("jg-mechanic:client:tablet-shown-after-interaction", function()
print('James is cool')
end)Server
Add local hook code to config/config.hooks.lua. You can also listen from another server resource with AddEventHandler.
Before invoice paid
Runs after the invoice and payment method pass validation, immediately before the player is charged. This event can't cancel the payment.
-- server only
AddEventHandler("jg-mechanic:server:before-invoice-paid", function(context)
if (tonumber(source) or 0) > 0 then return end
--[[
context = {
invoice = {}, -- The database invoice record
payer = {
source = 1,
identifier = "ABC123",
name = "John Smith"
},
mechanic = {
id = "bennys",
job = "mechanic",
label = "Benny's",
type = "owned"
},
amount = 2500,
paymentMethod = "bank", -- "bank" or "cash"
senderPlayerId = 2 -- The mechanic who sent the invoice, when available
}
]]
print(("Invoice %s is about to be paid"):format(context.invoice.id))
end)After invoice paid
Runs after the player is charged, commission is paid, the society receives its contribution and the invoice is marked as paid. It doesn't run when payment fails or is cancelled.
-- server only
AddEventHandler("jg-mechanic:server:after-invoice-paid", function(context)
if (tonumber(source) or 0) > 0 then return end
-- context contains the same invoice, payer, mechanic, amount and payment fields
-- context.result.success: boolean
-- context.result.commissionAmount: number
-- context.result.societyContribution: number
print(("Invoice %s paid %s"):format(context.invoice.id, context.result.societyContribution))
end)Last updated 29 July 2026