• 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!

Error when i use an item

Tyson12302

New Member
Joined
Aug 6, 2014
Messages
264
Reaction score
4
I've made a Shop tokens which will give me Shop points and i click on it. But whenever i click on it i get an error on the console.
Code:
[10/06/2015 16:48:15] [Error - Action Interface]
[10/06/2015 16:48:15] data/actions/scripts/points.lua:onUse
[10/06/2015 16:48:15] Description:
[10/06/2015 16:48:15] data/lib/048-ppoints.lua:16: attempt to perform arithmetic on a boolean value
[10/06/2015 16:48:15] stack traceback:
[10/06/2015 16:48:15]     data/lib/048-ppoints.lua:16: in function 'doAccountAddPoints'
[10/06/2015 16:48:15]     data/actions/scripts/points.lua:10: in function <data/actions/scripts/points.lua:7>

Here is my 048-ppoints.lua script
Code:
-- Sirion_Mido Says: Credites to: LucasFerraz
-- Sirion_Mido Says: Credites to: LucasFerraz
-- Sirion_Mido Says: Credites to: LucasFerraz

function getAccountPoints(cid)
local res = db.getResult('select `points` from znote_accounts where account_id = \''..getPlayerAccount(cid)..'\'')
if(res:getID() == -1) then
return false
end
local ret = res:getDataInt("points")
res:free()
return tonumber(ret)
end

function doAccountAddPoints(cid, count)
return db.executeQuery("UPDATE `znote_accounts` SET `points` = '".. getAccountPoints(cid) + count .."' WHERE `account_id` ='"..getPlayerAccount(cid).."'")
end


-- Sirion_Mido Says: Credites to: LucasFerraz
-- Sirion_Mido Says: Credites to: LucasFerraz
-- Sirion_Mido Says: Credites to: LucasFerraz

points.lua
Code:
local cfg = {
amount = 1 -- here how many points you want
}



function onUse(cid, item, fromPosition, itemEx, toPosition) 

if getPlayerLevel(cid) > 8 then
doAccountAddPoints(cid, cfg.amount)
doCreatureSay(cid, "CONGRATULATIONS! You have recived 1 premium points!. ", TALKTYPE_ORANGE_1)
doSendMagicEffect(getCreaturePosition(cid), 28)
doRemoveItem(item.uid,1)
else
doPlayerSendCancel(cid,"You need level 8 or higher to use this item.")
end
return TRUE
end
 
Last edited:
Hard to say, you could try to debug-print some interesting variables. Try writing out `print(ret)` right before line 16, where the error occurs.

Ignazio
 
Back
Top