您好,一旦触发此事件并检查级别并给我正确的奖励,问题是 xplayer.blablabla 在 1 次单击中多次随机运行,有人知道有什么问题吗?
RegisterServerEvent('battlepass:rewardskteolekaramele')
AddEventHandler('battlepass:rewardskteolekaramele', function()
local _source = source
local xPlayer = ESX.GetPlayerFromId(source)
local identifier = xPlayer.identifier
MySQL.Async.fetchAll("SELECT level FROM levelxp_table WHERE identifier = @identifier", {
["identifier"] = GetPlayerIdentifiers(source)[1]},
function(attributeti)
print(attributeti[1].level)
local resultar = attributeti[1].level
if attributeti[1].level == 1 or resultar == 11 or resultar == 21 or resultar == 31 or resultar == 41 or resultar == 51 or resultar == 61 or resultar == 71 or resultar == 81 or resultar == 91 then
xPlayer.addMoney(50000)
elseif attributeti[1].level == 2 or resultar == 12 or resultar == 22 or resultar == 32 or resultar == 42 or resultar == 52 or resultar == 62 or resultar == 72 or resultar == 82 or resultar == 92 then
xPlayer.addInventoryItem("WEAPON_FENNEC", 1)
elseif attributeti[1].level == 3 or resultar == 13 or resultar == 23 or resultar == 33 or resultar == 43 or resultar == 53 or resultar == 63 or resultar == 73 or resultar == 83 or resultar == 93 then
xPlayer.addAccountMoney('bitcoin_money', 10)
end
end)
end)