• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Item give premium points

danigym

New Member
Joined
Feb 5, 2019
Messages
2
Reaction score
0
I need an item to use it to give premium points. I have this code but I get an error.

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
 
Solution
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local addpoints = 10 -- amount of points to add
    doPlayerAddPremiumDays(cid, addpoints)
    doRemoveItem(item.uid,1)
return true
end
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local addpoints = 10 -- amount of points to add
    doPlayerAddPremiumDays(cid, addpoints)
    doRemoveItem(item.uid,1)
return true
end
 
Solution
hey @danigym, remember that you need to give us a few more information in order to help you quickly
Some of the most important things are missing. If you are going to create another request/support thread I beg you to give us the information we need.
I'm going to link you the rules:

Anyways the most important information is
  • A good thread name
  • Distro name
  • Description of the script
    • What it should do
    • Errors (in console)
And remember that we can "delete the threads if it doesn't contain the correct information to help"
Thanks in advance.
 
Back
Top