> For the complete documentation index, see [llms.txt](https://docs.ak4y.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ak4y.com/scripts/ak4y-usedcarshop/editable-files/serverconfig.lua.md).

# serverConfig.lua

````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

````


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.ak4y.com/scripts/ak4y-usedcarshop/editable-files/serverconfig.lua.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
