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

Shop Points at a Certain level doesn't work

Tyson12302

New Member
Joined
Aug 6, 2014
Messages
264
Reaction score
4
I searched a couple scripts where you get Shop points at a certain level here is the script that i have in my creaturescripts/scripts/points.lua.
Code:
local t, storage = {
{30, 30},
{190, 30},
{220, 30},
{250, 30},
{280, 30},
{300, 30},
{315, 30},
{330, 30}
}, 256

function onAdvance(cid, skill, oldLevel, newLevel)
if skill ~= SKILL__LEVEL then
return true
end
for i = 1, #t do
local v = t
if newLevel >= v[1] and getStorage(storage) < i then
db.executeQuery('UPDATE accounts SET premium_points=premium_points+'.. v[2] ..' WHERE id=' .. getPlayerAccountId(cid))
doSetStorage(storage, i)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Congratulations! You have advanced to level ' .. v[1] .. ' and you have earned '.. v[2] ..' Premium Points!')
doBroadcastMessage('Congratulations! ' .. getCreatureName(cid) .. ' advenced to ' .. v[1] .. 'lvl and got ' .. v[2] .. ' ptz to sms shop.')
break
end
end
return true
end

login.lua
Code:
registerCreatureEvent(cid, "ReportBug")
    registerCreatureEvent(cid, "AdvanceSave")
    registerCreatureEvent(cid, "PlayerAdvance")
    registerCreatureEvent(cid, "Inq")
    registerCreatureEvent(cid, "death")
    return true
end

And creaturescript.xml
Code:
<event type="advance" name="pointsforlvl" event="script" value="points.lua"/>

I get a error in the console when i reach the level.
"attempt to compare table with numbers"
 
Last edited by a moderator:
I just noticed something strange with my Znote_accounts table. It is empty. It only has the account on there that i just created. How can i put all the accounts that have already been created on that list.
 
Back
Top