赴爱 发表于 2025-4-1 16:05:06

汉化


function BuyTattoo(collection, name, label, price)
    local paymentType
    print(string.sub(label, 1, 4))
    if string.sub(label, 1, 4) == "VIP_" then
      paymentType = "VIP"
    elseif string.sub(label, 1, 4) == "TAT_" then
      paymentType = "Regular"
    else
      paymentType = "Default"
    end
    if paymentType == "VIP" then
      ESX.TriggerServerCallback('SmallTattoos:PurchaseTattoovip', function(success)
            if success then
                table.insert(currentTattoos, {collection = collection, nameHash = name, Count = opacity})
            end
      end, currentTattoos, price, {collection = collection, nameHash = name, Count = opacity}, GetLabelText(label), paymentType)
    else
      ESX.TriggerServerCallback('SmallTattoos:PurchaseTattoo', function(success)
            if success then
                table.insert(currentTattoos, {collection = collection, nameHash = name, Count = opacity})
            end
      end, currentTattoos, price, {collection = collection, nameHash = name, Count = opacity}, GetLabelText(label), paymentType)
    end
end


ChatGPT 发表于 2025-4-1 16:05:30

以下是您提供的代码的汉化版本:


function 购买纹身(集合, 名称, 标签, 价格)
    local 支付类型
    print(string.sub(标签, 1, 4))
    if string.sub(标签, 1, 4) == "VIP_" then
      支付类型 = "VIP"
    elseif string.sub(标签, 1, 4) == "TAT_" then
      支付类型 = "常规"
    else
      支付类型 = "默认"
    end

    if 支付类型 == "VIP" then
      ESX.TriggerServerCallback('SmallTattoos:PurchaseTattoovip', function(成功)
            if 成功 then
                table.insert(currentTattoos, {集合 = 集合, 名称哈希 = 名称, 数量 = 不透明度})
            end
      end, currentTattoos, 价格, {集合 = 集合, 名称哈希 = 名称, 数量 = 不透明度}, GetLabelText(标签), 支付类型)
    else
      ESX.TriggerServerCallback('SmallTattoos:PurchaseTattoo', function(成功)
            if 成功 then
                table.insert(currentTattoos, {集合 = 集合, 名称哈希 = 名称, 数量 = 不透明度})
            end
      end, currentTattoos, 价格, {集合 = 集合, 名称哈希 = 名称, 数量 = 不透明度}, GetLabelText(标签), 支付类型)
    end
end


请注意:
- 变量名和函数名翻译成中文是为了更容易理解,但在实际编程中,最好保持英文以确保代码的可读性和一致性。
- 代码中的`不透明度`与上下文不太清楚,请根据实际含义进行修改,如果有其他变量定义可以提供,方便进一步完善。

这段代码应该放在`client.lua`中,因为它涉及到客户端的纹身购买逻辑。
页: [1]
查看完整版本: 汉化