搜索
开启左侧

翻译成简体中文

[复制链接]
FIVEM 0.0 发表于 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[plate] 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[plate] = 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
回复

使用道具 举报

文明发言,和谐互动
文明发言,和谐互动
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|首页 ( 冀ICP备2021005225号-1 ) |网站地图

GMT+8, 2025-2-9 05:29 , Processed in 0.067232 second(s), 11 queries , Gzip On, Redis On.

Powered by Discuz! X3.4

© 2001-2013 ELITE论坛【技术无价-分享快乐】

快速回复 返回顶部 返回列表