local QBCore = exports["qb-core"]:GetCoreObject() RegisterNetEvent('alizadev-emlak:server:karapara', function(amount, rate, key) local Player = QBCore.Functions.GetPlayer(source) if Player ~= nil then local markedBills = Player.Functions.GetItemByName('karapara') if markedBills and markedBills.amount >= amount then local cleanAmount = math.floor(amount * (rate / 100)) local jobDepotAmount = amount - cleanAmount -- Give clean money to the player Player.Functions.AddMoney('cash', cleanAmount) -- Remove the marked bills from the player Player.Functions.RemoveItem('karapara', amount) -- Add the jobDepotAmount to the job's management funds exports['qb-management']:AddMoney(Player.PlayerData.job.name, jobDepotAmount) -- Notify the player TriggerClientEvent("QBCore:Notify", source, string.format(Config.Locales['success_launder'], cleanAmount, jobDepotAmount)) -- Prepare webhook message local webhookUrl = Config.WebHookURL local playerName = Player.PlayerData.name local playerId = Player.PlayerData.source local citizenId = Player.PlayerData.citizenid local jobLabel = Player.PlayerData.job.label local descriptionMessage = string.format( Config.Locales['webhook_description'], playerName, playerName, playerId, citizenId, jobLabel, cleanAmount, jobDepotAmount, rate, os.date("%Y-%m-%d %H:%M:%S")) local logData = { content = "", username = "kashi - Emlak Log", embeds = {{ title = Config.Locales['webhook_title'], description = descriptionMessage, color = 3447003, image = { url = Config.ImageURL }, footer = { text = "kashi - Emlak log", icon_url = 'https://cdn.discordapp.com/attachments/1437937532301217812/1438637800978124964/Cooz-PngLogoT_oyun.png?' }, timestamp = os.date("!%Y-%m-%dT%H:%M:%SZ") }} } if cleanAmount > Config.webhookAlertLimit then logData.content = "@everyone" end PerformHttpRequest(webhookUrl, function(statusCode, response, headers) print("Webhook status: " .. statusCode) end, 'POST', json.encode(logData), { ['Content-Type'] = 'application/json' }) else TriggerClientEvent("QBCore:Notify", source, Config.Locales['insufficient_marked_bills'], "error") end end end)