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
|