201442085 发表于 2024-3-28 12:51:54

翻译成简体中文

Config = {}

Config.OldESX = false -- 老版本是TriggerEvent 新版本是exports['es_extended']:getSharedObject()

ESX = nil

if Config.OldESX then
    Citizen.CreateThread(function()
      while ESX == nil do
            TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
            Citizen.Wait(0)
      end
    end)
else
    ESX = exports['es_extended']:getSharedObject()
end

Config.Coords = vec3(161.19, -3038.69, 5.04)
Config.OpenText = "请按 ~INPUT_PICKUP~ 进行车牌选号"
Config.OpenKey = 38

Config.MaxNum = 30

Config.ItemName = "money"
Config.ItemPrice = 1

inventory = nil
if IsDuplicityVersion() then
    inventory = exports.ox_inventory
    function NextPlate(source, plate)
      if PlatePool then
            local xPlayer = ESX.GetPlayerFromId(source)
            local item = xPlayer.getInventoryItem(Config.ItemName)

            if item.count >= Config.ItemPrice then
                xPlayer.removeInventoryItem(Config.ItemName, Config.ItemPrice)

                inventory:AddItem(source, "realplate", 1, {
                  plate = plate,
                  description = plate
                })
                PlatePool = false
            else
                TriggerClientEvent("esx:showNotification", source, "~o~物品不足")
            end
      end
    end

    function GetSelectNum(source)
      local xPlayer = ESX.GetPlayerFromId(source)
      local item = xPlayer.getInventoryItem(Config.ItemName)
      return item and item.count or 0
    end

    RegisterCommand('replate', function()
      RefreshPlate()
    end)

    Citizen.CreateThread(function()
      while true do
            RefreshPlate()
            Citizen.Wait(1000 * 60 *60 * 24)-- 每隔24小时刷新一次车牌
      end
    end)
end

ChatGPT 发表于 2024-3-28 12:52:05

Config = {}

Config.OldESX = false -- 旧版本使用TriggerEvent,新版本使用exports:getSharedObject()

ESX = nil

if Config.OldESX then
    Citizen.CreateThread(function()
      while ESX == nil do
            TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
            Citizen.Wait(0)
      end
    end)
else
    ESX = exports:getSharedObject()
end

Config.Coords = vec3(161.19, -3038.69, 5.04)
Config.OpenText = "请按 ~INPUT_PICKUP~ 进行车牌选号"
Config.OpenKey = 38

Config.MaxNum = 30

Config.ItemName = "money" -- 物品名称
Config.ItemPrice = 1 -- 物品价格

inventory = nil
if IsDuplicityVersion() then
    inventory = exports.ox_inventory
    function NextPlate(source, plate)
      if PlatePool then
            local xPlayer = ESX.GetPlayerFromId(source)
            local item = xPlayer.getInventoryItem(Config.ItemName)

            if item.count >= Config.ItemPrice then
                xPlayer.removeInventoryItem(Config.ItemName, Config.ItemPrice)

                inventory:AddItem(source, "realplate", 1, {
                  plate = plate,
                  description = plate
                })
                PlatePool = false
            else
                TriggerClientEvent("esx:showNotification", source, "~o~物品不足")
            end
      end
    end

    function GetSelectNum(source)
      local xPlayer = ESX.GetPlayerFromId(source)
      local item = xPlayer.getInventoryItem(Config.ItemName)
      return item and item.count or 0
    end

    RegisterCommand('replate', function()
      RefreshPlate()
    end)

    Citizen.CreateThread(function()
      while true do
            RefreshPlate()
            Citizen.Wait(1000 * 60 *60 * 24) -- 每隔24小时刷新一次车牌
      end
    end)
end
页: [1]
查看完整版本: 翻译成简体中文