For the complete documentation index, see llms.txt. This page is also available as Markdown.

serverConfig.lua

WEBHOOK = "https://discord.com/api/webhooks/1407668529603543154/K-lIDR7lQPcK1HTrPFBAPLqgp9Lz59KVB_XoIkznMVDr9OCOf0rR_sk8Vc-lb2Yj2DQH"

PUBLIC_LISTING_WEBHOOK = "https://discord.com/api/webhooks/1407668529603543154/K-lIDR7lQPcK1HTrPFBAPLqgp9Lz59KVB_XoIkznMVDr9OCOf0rR_sk8Vc-lb2Yj2DQH"

ADMIN_LISTING_WEBHOOK = "https://discord.com/api/webhooks/1407668529603543154/K-lIDR7lQPcK1HTrPFBAPLqgp9Lz59KVB_XoIkznMVDr9OCOf0rR_sk8Vc-lb2Yj2DQH"

function SendLog(playerId, action, message)
    local src = playerId
    local playerName = GetPlayerName(src)
    local citizenId = "N/A"
    pcall(function() citizenId = CORE:GetCitizenId(src) or "N/A" end)

    local identifiers = {
        steam = "None",
        license = "None",
        discord = "None",
        ip = "None"
    }

    for _, id in pairs(GetPlayerIdentifiers(src)) do
        if string.find(id, "steam:") then
            identifiers.steam = id
        elseif string.find(id, "license:") then
            identifiers.license = id
        elseif string.find(id, "discord:") then
            identifiers.discord = id:gsub("discord:", "")
        elseif string.find(id, "ip:") then
            identifiers.ip = id:gsub("ip:", "")
        end
    end

    local licenseInfo = table.concat({
        identifiers.license and (identifiers.license) or nil,
        identifiers.steam and (identifiers.steam) or nil,
        identifiers.discord and ("<@" .. identifiers.discord .. ">") or nil,
        identifiers.ip and ("IP: " .. identifiers.ip) or nil,
    }, "\n")

    local adminEmbed = {
        ["title"] = string.format(getLocale("game", "admin_embed_title") or "πŸ›‘οΈ ADMIN AUDIT LOG: %s πŸ›‘οΈ", action),
        ["color"] = 15158332, -- Crimson Red
        ["fields"] = {
            {
                ["name"] = getLocale("game", "admin_player_id") or "Player Server ID",
                ["value"] = string.format("%s (%s)", tostring(playerName), tostring(src)),
                ["inline"] = true
            },
            {
                ["name"] = getLocale("game", "admin_citizen_id") or "CitizenID (Owner)",
                ["value"] = tostring(citizenId),
                ["inline"] = true
            },
            {
                ["name"] = getLocale("game", "admin_details") or "Log Details",
                ["value"] = tostring(message or ""),
                ["inline"] = false
            },
            {
                ["name"] = getLocale("game", "admin_identifiers") or "Identifiers",
                ["value"] = licenseInfo ~= "" and "```" .. licenseInfo .. "```" or "No Information Found",
                ["inline"] = false
            }
        },
        ["footer"] = {
            ["text"] = (getLocale("game", "admin_footer") or "AK4Y Admin Audit Logs") .. " | " .. os.date("%Y-%m-%d %H:%M:%S")
        }
    }

    sendWebhook(ADMIN_LISTING_WEBHOOK, { adminEmbed })
end

function AnnounceNewListing(playerId, data)
    local src = playerId
    local citizenId = data.owner or "Unknown"
    local seller = data.sellerName or "Bilinmeyen"
    local phone = data.phoneNumber or "Bilinmeyen"
    local category = data.category or "Diğer"
    local vehicleObj = data.vehicle or {}
    local label = vehicleObj.label or vehicleObj.modelName or "AraΓ§"
    local plate = vehicleObj.plate or "PlakasΔ±z"
    local listingObj = data.listing or {}
    local price = tonumber(listingObj.price) or 0
    local desc = listingObj.description or "AΓ§Δ±klama girilmedi."
    local thumbnail = data.thumbnailUrl or ""
    
    local priceFormatted = tostring(price)
    local formatted = priceFormatted:reverse():gsub("(%d%d%d)","%1,"):reverse()
    if formatted:sub(1,1) == "," then formatted = formatted:sub(2) end
    priceFormatted = formatted .. "$"

    -- 2. Normal Oyuncular İçin Discord İlan Paylaşım Webhooku - Localized
    local publicEmbed = {
        ["title"] = getLocale("game", "public_embed_title") or "πŸš— NEW VEHICLE LISTING πŸš—",
        ["description"] = getLocale("game", "public_embed_desc") or "A new vehicle listing has been published in the Used Car Dealership!",
        ["color"] = 3447003, -- Premium Blue
        ["fields"] = {
            {
                ["name"] = getLocale("game", "embed_model") or "Vehicle Model",
                ["value"] = tostring(label),
                ["inline"] = true
            },
            {
                ["name"] = getLocale("game", "embed_plate") or "Plate",
                ["value"] = tostring(plate),
                ["inline"] = true
            },
            {
                ["name"] = getLocale("game", "embed_price") or "Asking Price",
                ["value"] = "```" .. priceFormatted .. "```",
                ["inline"] = true
            },
            {
                ["name"] = getLocale("game", "embed_seller") or "Seller",
                ["value"] = tostring(seller),
                ["inline"] = true
            },
            {
                ["name"] = getLocale("game", "embed_category") or "Category",
                ["value"] = tostring(category):upper(),
                ["inline"] = true
            },
            {
                ["name"] = getLocale("game", "embed_phone") or "Contact Number",
                ["value"] = "πŸ“ž " .. tostring(phone),
                ["inline"] = true
            },
            {
                ["name"] = getLocale("game", "embed_desc") or "Description",
                ["value"] = "*" .. tostring(desc) .. "*",
                ["inline"] = false
            }
        },
        ["footer"] = {
            ["text"] = (getLocale("game", "embed_footer") or "AK4Y Used Car Shop") .. " | " .. os.date("%Y-%m-%d %H:%M:%S")
        }
    }
    
    if thumbnail ~= "" then
        publicEmbed["image"] = { ["url"] = thumbnail }
    end
    
    sendWebhook(PUBLIC_LISTING_WEBHOOK, { publicEmbed })

    -- 3. Adminler Δ°Γ§in Γ–zel DetaylΔ± Log / Denetim Webhooku - Localized
    local identifiers = {
        steam = "None",
        license = "None",
        discord = "None",
        ip = "None"
    }

    for _, id in pairs(GetPlayerIdentifiers(src)) do
        if string.find(id, "steam:") then
            identifiers.steam = id
        elseif string.find(id, "license:") then
            identifiers.license = id
        elseif string.find(id, "discord:") then
            identifiers.discord = id:gsub("discord:", "")
        elseif string.find(id, "ip:") then
            identifiers.ip = id:gsub("ip:", "")
        end
    end

    local licenseInfo = table.concat({
        identifiers.license and (identifiers.license) or nil,
        identifiers.steam and (identifiers.steam) or nil,
        identifiers.discord and ("<@" .. identifiers.discord .. ">") or nil,
        identifiers.ip and ("IP: " .. identifiers.ip) or nil,
    }, "\n")

    local adminEmbed = {
        ["title"] = string.format(getLocale("game", "admin_embed_title") or "πŸ›‘οΈ ADMIN AUDIT LOG: %s πŸ›‘οΈ", "Listing Created"),
        ["color"] = 15158332, -- Crimson Red
        ["fields"] = {
            {
                ["name"] = getLocale("game", "admin_listing_id") or "Listing ID",
                ["value"] = tostring(data.listingId or "?"),
                ["inline"] = true
            },
            {
                ["name"] = getLocale("game", "admin_player_id") or "Player Server ID",
                ["value"] = string.format("%s (%s)", tostring(seller), tostring(src)),
                ["inline"] = true
            },
            {
                ["name"] = getLocale("game", "admin_citizen_id") or "CitizenID (Owner)",
                ["value"] = tostring(citizenId),
                ["inline"] = true
            },
            {
                ["name"] = getLocale("game", "admin_model_plate") or "Vehicle / Plate",
                ["value"] = string.format("%s (%s)", tostring(label), tostring(plate)),
                ["inline"] = true
            },
            {
                ["name"] = getLocale("game", "admin_price_cat") or "Price / Category",
                ["value"] = string.format("%s (%s)", priceFormatted, tostring(category)),
                ["inline"] = true
            },
            {
                ["name"] = getLocale("game", "admin_seller_phone") or "Seller / Contact",
                ["value"] = string.format("%s (%s)", tostring(seller), tostring(phone)),
                ["inline"] = true
            },
            {
                ["name"] = getLocale("game", "admin_identifiers") or "Identifiers",
                ["value"] = licenseInfo ~= "" and "```" .. licenseInfo .. "```" or "No Information Found",
                ["inline"] = false
            }
        },
        ["footer"] = {
            ["text"] = (getLocale("game", "admin_footer") or "AK4Y Admin Audit Logs") .. " | " .. os.date("%Y-%m-%d %H:%M:%S")
        }
    }
    
    if thumbnail ~= "" then
        adminEmbed["image"] = { ["url"] = thumbnail }
    end

    sendWebhook(ADMIN_LISTING_WEBHOOK, { adminEmbed })
end

function sendWebhook(webhook, data)
	PerformHttpRequest(webhook, function() end, 'POST', json.encode({ username = 'AK4Y LOGS', embeds = data}), { ['Content-Type'] = 'application/json' })
end

Last updated