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.
login.lua
And creaturescript.xml
I get a error in the console when i reach the level.
"attempt to compare table with numbers"
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: