hi, need some help here cuz i'm too amateur in scripting.....im trying to convert to tfs 1.x the top level effect posted here:
http://www.tibiaking.com/forum/topic/49367-toplevel-effect/
and this is what i have so far..
and as you can imagine i doesnt work.....can you help me??
also i know in tfs 1.x there is no function --doSendAnimatedText but any idea how to make it work? and any chance to change the name of the top level to [TOP]xxxxx???
http://www.tibiaking.com/forum/topic/49367-toplevel-effect/
and this is what i have so far..
Code:
local config = {
tempo = 5, --time in secs
mensagem = {
texto = "[TOP]",
efeito = TEXTCOLOR_LIGHTBLUE --efect doSendAnimatedText
},
efeito = 30, --efect doSendMagicEffect
globalstr = 150202 -- global storage
}
function TopEffect(player)
local var = tostring(Game.getStorageValue(config.globalstr)):gsub(':', ''):explode(',')
if not isCreature(player) or player:getName() ~= var[1] then return LUA_ERROR end
--doSendAnimatedText(getCreaturePosition(cid), config.mensagem.texto, config.mensagem.efeito)
player:getPosition():sendMagicEffect(CONST_ME_FIREWORK_RED)
addEvent(TopEffect, config.tempo*1000, player)
end
function onLogin(player)
if tonumber(Game.getStorageValue(config.globalstr)) then -- virgin
local query = db.storeQuery("SELECT `name`, `level` FROM `players` WHERE `group_id` < 2 ORDER BY `level` DESC LIMIT 1")
if (query:getID() ~= -1) then
Game.setStorageValue(config.globalstr, ":"..query:getDataString("name")..",:"..query:getDataInt("level"))
TopEffect(player)
end
else
TopEffect(player)
end
registerCreatureEvent(player, "CheckTop")
return true
end
function onAdvance(player, skill, oldLevel, newLevel)
if skill ~= SKILL__LEVEL then return true end
local var = tostring(Game.getStorageValue(config.globalstr)):gsub(':', ''):explode(',')
if newLevel > tonumber(var[2]) then
Game.broadcastMessage("The Player " .. player:getName() .. " its the new Top Level. Grats!", 22)
Game.setStorageValue(config.globalstr, ":"..player:getName()..",:"..newLevel)
TopEffect(player)
end
return true
end
and as you can imagine i doesnt work.....can you help me??
also i know in tfs 1.x there is no function --doSendAnimatedText but any idea how to make it work? and any chance to change the name of the top level to [TOP]xxxxx???