I need an item to use it to give premium points. I have this code but I get an error.
My script is this:
I use Global Tibia Face server v24
Code:
Lua Script Error: [Action Interface]
data/actions/scripts/points.lua:onUse
data/actions/scripts/points.lua:3: attempt to call global 'getPlayerAccountId' (a nil value)
stack traceback:
[C]: in function 'getPlayerAccountId'
data/actions/scripts/points.lua:3: in function <data/actions/scripts/points.lua:1>
My script is this:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local addpoints = 10 -- amount of points to add
db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points` + "..addpoints.." WHERE `id` = '" ..getPlayerAccountId(cid).. "';")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, ""..addpoints.." premium points have been added to your account.")
doRemoveItem(item.uid, 1)
return true
end
I use Global Tibia Face server v24