Hello i use this script and dont work;/ This script give points to Sms Shop for advance for level, error in consol. I add this to function :
and this to login.lua
and this events.lua in creaturescripts
Code:
function doAddPoints(cid, points)
db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points` + " .. points .. " WHERE `id` = " .. getPlayerAccountId(cid) .. ";")
end
and this to login.lua
Code:
registerCreatureEvent(cid, "Events")
and this events.lua in creaturescripts
Code:
local skills =
{
[1] = {points = 10, storage = 30701, value = 2, text = "level", level = 50},
[2] = {points = 10, storage = 30702, value = 2, text = "level", level = 80},
[3] = {points = 10, storage = 30703, value = 2, text = "level", level = 110},
[4] = {points = 10, storage = 30704, value = 2, text = "level", level = 135},
[5] = {points = 10, storage = 30705, value = 2, text = "level", level = 150},
[6] = {points = 20, storage = 30707, value = 2, text = "level", level = 180},
[7] = {points = 20, storage = 30708, value = 2, text = "level", level = 200},
[8] = {points = 20, storage = 30709, value = 2, text = "level", level = 250}
}
function onAdvance(cid, skill, oldLevel, newLevel)
local x = skills[skill]
if getGlobalStorageValue(x.storage) < x.value and getPlayerStorageValue(cid, x.storage) ~= x.value and getPlayerSkillLevel(cid, skill) >= x.level and skills[skill] then
doAddPoints(cid, x.points)
setGlobalStorageValue(x.storage, x.value)
setPlayerStorageValue(cid, x.storage, x.value)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You are first player with ".. x.level .." ".. x.text .." and you have gained ".. x.points .." Premium Points!")
end
return true
end
Code:
[10:25:37.612] [Error - CreatureScript Interface]
[10:25:37.612] data/creaturescripts/scripts/events.lua:onAdvance
[10:25:37.612] Description:
[10:25:37.612] data/creaturescripts/scripts/events.lua:15: attempt to compare number with boolean
[10:25:37.612] stack traceback:
[10:25:37.612] data/creaturescripts/scripts/events.lua:15: in function