i've got this error..
when trying to execute this script
this code is in login.lua
the full login.lua is
any ideas how can i make the top level effect works?....thx in advance
when trying to execute this script
Code:
query = db.storeQuery("SELECT `name` FROM `players` ORDER BY `level` DESC, `experience` DESC LIMIT 1")
if (query:getID() ~= -1) then
name = query:getDataString("name")
if player:getName(player) == name then
TopEffect(player)
end
end
this code is in login.lua
the full login.lua is
Code:
-- ordered as in creaturescripts.xml
local events = {
........
}
local function onMovementRemoveProtection(cid, oldPosition, time)
local player = Player(cid)
if not player then
return true
end
local playerPosition = player:getPosition()
if (playerPosition.x ~= oldPosition.x or playerPosition.y ~= oldPosition.y or playerPosition.z ~= oldPosition.z) or player:getTarget() then
player:setStorageValue(Storage.combatProtectionStorage, 0)
return true
end
addEvent(onMovementRemoveProtection, 1000, cid, oldPosition, time - 1)
end
function TopEffect(player)
if isPlayer(player) then
player:getPosition():sendMagicEffect(CONST_ME_FIREWORK_RED)
addEvent(TopEffect, 10*1000, player)
end
return true
end
function onLogin(player)
player:getPosition():sendMagicEffect(CONST_ME_HOLYDAMAGE)
local loginStr = 'Welcome to ' .. configManager.getString(configKeys.SERVER_NAME) .. '!'
if player:getLastLoginSaved() <= 0 then
loginStr = loginStr .. ' Please choose your outfit.'
player:sendTutorial(1)
else
if loginStr ~= '' then
player:sendTextMessage(MESSAGE_STATUS_DEFAULT, loginStr)
end
loginStr = string.format('Your last visit was on %s.', os.date('%a %b %d %X %Y', player:getLastLoginSaved()))
end
player:sendTextMessage(MESSAGE_STATUS_DEFAULT, loginStr)
local playerId = player.uid
-- Stamina
Game.getStorageValue("stamina")[playerId] = 0
-- Promotion
local vocation = player:getVocation()
local promoted = player:isPromoted()
if player:isPremium() then
local value = player:getStorageValue(Storage.Promotion)
if promoted and value ~= 1 then
player:setStorageValue(Storage.Promotion, 1)
elseif not promoted and value == 1 then
player:setVocation(vocation:getPromotion())
end
elseif promoted then
player:setVocation(vocation:getDemotion())
end
-- Events
for i = 1, #events do
player:registerEvent(events[i])
end
if player:getStorageValue(Storage.combatProtectionStorage) <= os.time() then
player:setStorageValue(Storage.combatProtectionStorage, os.time() + 10)
onMovementRemoveProtection(playerId, player:getPosition(), 10)
end
if player:getLevel() <= 120 then
for i = 1, 5 do
player:addBlessing(i)
end
player:getPosition():sendMagicEffect(CONST_ME_HOLYDAMAGE)
player:say('BLESSED!', TALKTYPE_MONSTER_SAY)
end
query = db.storeQuery("SELECT `name` FROM `players` ORDER BY `level` DESC, `experience` DESC LIMIT 1")
if (query:getID() ~= -1) then
name = query:getDataString("name")
if player:getName(player) == name then
TopEffect(player)
end
end
return true
end
any ideas how can i make the top level effect works?....thx in advance