Postado Junho 11, 2014 10 anos Boa tarde Pessoal estou com um probleminha num script. O script faz no checagem do Top level do servidor e envia mensagem para todo servidor avisando que tal jogador virou top level,porem testei e no meu servidor 8.60 tfs 0.4.0 SNV e não obtive sucesso alguém pode informar o que tem de errado no script? Segue abaixo. function getTop() -- função by vodkart local query = db.getResult("SELECT `name`, `level` FROM `players` WHERE `id` > 6 AND `group_id` < 2 ORDER BY `level` DESC, `name` ASC;") if (query:getID() ~= -1) then return {query:getDataString("name"),query:getDataInt("level")} end return false end function onAdvance(cid, oldLevel, newLevel) if skill == 8 then local top = getTop() if newLevel > top[2] and getCreatureName(cid) ~= top[1] then broadcastMessage(getCreatureName(cid).." é o novo TOP do servidor ele está no level [" .. newLevel .. " ] .", 25) end end return true end registerCreatureEvent(cid, "checkNewTop") <event type="advance" name="checkNewTop" script="newtop.lua"/>
Postado Junho 13, 2014 10 anos Tenta assim amigo .. local function getTop() -- função by vodkart local query = db.getResult("SELECT `name`, `level` FROM `players` WHERE `id` > 6 AND `group_id` < 2 ORDER BY `level` DESC, `name` ASC;") if (query:getID() ~= -1) then return {query:getDataString("name"),query:getDataInt("level")} end return false end function onAdvance(cid, oldLevel, newLevel) local top = getTop() if skill == 8 then if newLevel > top[2] and getCreatureName(cid) ~= top[1] then doBroadcastMessage(getCreatureName(cid).." é o novo TOP do servidor, ele está no level " .. newLevel .. ".", 22) end end return true end
Postado Junho 14, 2014 10 anos Autor também não funcionou luanluciano93 o extranho é que nao da nenhum erro no console.
Postado Junho 14, 2014 10 anos Solução Não estava funcionando porque skill possuía um valor nulo, já que não foi declarado. Tenta assim: local function getTop() -- função by vodkart local query = db.getResult("SELECT `name`, `level` FROM `players` WHERE `id` > 6 AND `group_id` < 2 ORDER BY `level` DESC, `name` ASC;") if (query:getID() ~= -1) then return {query:getDataString("name"),query:getDataInt("level")} end return false end function onAdvance(cid, skill, oldLevel, newLevel) local top = getTop() if skill == 8 then if newLevel > top[2] and getCreatureName(cid) ~= top[1] then doBroadcastMessage(getCreatureName(cid).." é o novo TOP do servidor, ele está no level " .. newLevel .. ".", 22) end end return true end
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.