local QBCore = exports['qb-core']:GetCoreObject() RegisterServerEvent('alizadev-vehiclesales:server:LogTransfer') AddEventHandler('alizadev-vehiclesales:server:LogTransfer', function(plate, seller, buyer, price, model) if not Config.WebHookURL then return end -- Get buyer information local buyerName = Lang:t("webhook.unkown") local buyerCitizenId = Lang:t("webhook.unkown") local buyerJobLabel = Lang:t("webhook.unkown") local buyerSource = 0 if buyer and buyer.PlayerData then if buyer.PlayerData.charinfo then buyerName = buyer.PlayerData.charinfo.firstname .. " " .. buyer.PlayerData.charinfo.lastname end buyerCitizenId = buyer.PlayerData.citizenid buyerJobLabel = buyer.PlayerData.job and buyer.PlayerData.job.label or Lang:t("webhook.unkown") buyerSource = buyer.PlayerData.source end -- Get seller information local sellerData = QBCore.Functions.GetPlayerByCitizenId(seller) local sellerName = Lang:t("webhook.unkown") local sellerJobLabel = Lang:t("webhook.unkown") local sellerSource = 0 -- Content oluşturma local content = "" if price >= Config.webhookAlertLimit then content = "@everyone" end if sellerData and sellerData.PlayerData then if sellerData.PlayerData.charinfo then sellerName = sellerData.PlayerData.charinfo.firstname .. " " .. sellerData.PlayerData.charinfo.lastname end sellerJobLabel = sellerData.PlayerData.job and sellerData.PlayerData.job.label or Lang:t("webhook.unkown") sellerSource = sellerData.PlayerData.source end local description = string.format(Lang:t("webhook.description"), GetPlayerName(buyer.PlayerData.source), sellerName, seller, sellerSource, sellerJobLabel, buyerName, buyerCitizenId, buyerSource, buyerJobLabel, model, plate, price ) local payload = { username = Lang:t("webhook.botname"), -- Bot ismi buradan değiştirilir avatar_url = "https://cdn.discordapp.com/attachments/1437937532301217812/1438637800978124964/Cooz-PngLogoT_oyun.png?", -- İsterseniz botun avatarını da değiştirebilirsiniz content = content, embeds = { { title = Lang:t("webhook.title"), description = description, color = 3447003, image = { url = Config.ImageURL }, footer = { text = "kashi - Car Sell Log", icon_url = 'https://cdn.discordapp.com/attachments/1437937532301217812/1438637800978124964/Cooz-PngLogoT_oyun.png?' }, timestamp = os.date("!%Y-%m-%dT%H:%M:%SZ") } } } PerformHttpRequest(Config.WebHookURL, function(err, text, headers) if err ~= 204 and err ~= 200 then -- print('^1[Webhook Error]^7: Araç satış logu gönderilemedi!') end end, 'POST', json.encode(payload), { ['Content-Type'] = 'application/json' }) end)