我已经研究了解决此问题的不同方法,但根本不了解。我已经尝试过修复所有可能的代码,但仍然没有成功。
RegisterServerEvent('housing:attemptsale')
AddEventHandler('housing:attemptsale',
function(args,price,hid,model)
local src = source
local user = exports["np-base"]:getModule("Player"):GetUser(src)
local char = user:getCurrentCharacter()
local target = exports["np-base"]:getModule("Player"):GetUser(args)
local targetchar = user:getCurrentCharacter()
if target:getCash() >= price then
target:removeMoney(price)
exports.ghmattimysql:execute("UPDATE houses SET `cid` = @cid, `price` = @price, `model` = @model WHERE `id` = @id", {
['@cid'] = targetchar.id,
['@price'] = price,
['@id'] = hid,
['@model'] = model
})
else
TriggerClientEvent('DoShortHudText', args, 'You dont got money', 2)
end
end)