Webhooks = {} Webhooks.SelfService = "" Webhooks.Orders = "" Webhooks.TabletTuning = "" Webhooks.Servicing = "" Webhooks.Invoices = "" Webhooks.Mechanic = "" -- mechanic management/employees events Webhooks.Admin = "" function sendWebhook(playerId, webhookUrl, title, type, data) if not webhookUrl then return false end local player = Framework.Server.GetPlayerInfo(playerId) if not player then return false end local color = 0xff6700 if type == "success" then color = 0x2ecc71 end if type == "danger" then color = 0xe74c3c end local fields = { { name = "Player", value = string.format("%s (id: %s)", player.name, tostring(playerId)), inline = false } } for _, row in pairs(data) do fields[#fields + 1] = { name = row.key, value = tostring(row.value), inline = true } end local body = { username = "JG Mechanic Webhook", avatar_url = "https://forum.cfx.re/user_avatar/forum.cfx.re/jgscripts/288/3621910_2.png", content = "", embeds = { { type = "rich", title = title, description = "", color = color, fields = fields } } } PerformHttpRequest( webhookUrl, function(err, text, header) end, "POST", json.encode(body), {["Content-Type"] = "application/json"} ) return true end