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

TFS 1.X+ Premium poins scroll problem

janes123

New Member
Joined
Jun 21, 2012
Messages
100
Reaction score
4
Hello i use this script:
Code:
local points = 30 -- amount of premium points
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if isPlayer(cid) == TRUE  then
local Sql = "UPDATE `accounts` SET `premium_points` = `premium_points` + "..points.." where id="..getPlayerAccountId(cid)
                 db.executeQuery(Sql)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"You Have Received 30 Premium Point")
    doRemoveItem(item.uid)
    end
        return true
end
Error:
Code:
Lua Script Error: [Action Interface]
data/actions/scripts/premiumscroll.lua:onUse
data/actions/scripts/premiumscroll.lua:3: attempt to call global 'getPlayerAccountId' (a nil value)
stack traceback:
        [C]: in function 'getPlayerAccountId'
        data/actions/scripts/premiumscroll.lua:3: in function <data/actions/scripts/premiumscroll.lua:1>
 
Your line(look at the end):
Lua:
local Sql = "UPDATE `accounts` SET `premium_points` = `premium_points` + "..points.." where id="..getPlayerAccountId(cid)

How it should be:
Lua:
local Sql = "UPDATE `accounts` SET `premium_points` = `premium_points` + "..points.." WHERE `id`= "..getPlayerAccountId(cid)..";"
 
Lua:
local points = 30 -- amount of premium points

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    db.query("UPDATE `accounts` SET `premium_points` = `premium_points` + ".. points .." where id=".. player:getAccountId()
    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE,"You Have Received ".. points .." Premium Point".. (points > 1 and "s" or ""))
    item:remove(1)
    return true
end
 
You might be using an old/deprecated function. What TFS version are you rocking?
1.3
Your line(look at the end):
Lua:
local Sql = "UPDATE `accounts` SET `premium_points` = `premium_points` + "..points.." where id="..getPlayerAccountId(cid)

How it should be:
Lua:
local Sql = "UPDATE `accounts` SET `premium_points` = `premium_points` + "..points.." WHERE `id`= "..getPlayerAccountId(cid)..";"
Code:
Lua Script Error: [Action Interface]
data/actions/scripts/premiumscroll.lua:onUse
data/actions/scripts/premiumscroll.lua:3: attempt to call global 'getPlayerAccountId' (a nil value)
stack traceback:
        [C]: in function 'getPlayerAccountId'
        data/actions/scripts/premiumscroll.lua:3: in function <data/actions/scripts/premiumscroll.lua:1>
Lua:
local points = 30 -- amount of premium points

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    db.query("UPDATE `accounts` SET `premium_points` = `premium_points` + ".. points .." where id=".. player:getAccountId()
    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE,"You Have Received ".. points .." Premium Point".. (points > 1 and "s" or ""))
    item:remove(1)
    return true
end
Same error
 
Static's post missed a ) at the end of line 4, try adding it.
works but
Code:
[C]: in function 'getPlayerAccountId'
        data/actions/scripts/premiumscroll.lua:3: in function <data/actions/scripts/premiumscroll.lua:1>
[Error - mysql_real_query] Query: UPDATE `accounts` SET `premium_points` = `premium_points` + 30 where id=2
Message: Unknown column 'premium_points' in 'field list'
 
Can't be possible, there's no "getPlayerAccountId" in his code.
Sorry
Code:
[Error - mysql_real_query] Query: UPDATE `accounts` SET `premium_points` = `premium_points` + 30 where id=2
Message: Unknown column 'premium_points' in 'field list'
 
Sorry
Code:
[Error - mysql_real_query] Query: UPDATE `accounts` SET `premium_points` = `premium_points` + 30 where id=2
Message: Unknown column 'premium_points' in 'field list'
Look into your accounts table, "premium_points" column (does not exist) is not where you store the premium points if you even store any there.
 
Back
Top