Postado Fevereiro 21, 2018 7 anos @Micheel15 um dos erros é culpa de um mod seu que está sendo mal executado. Em relação a esse script, não há necessidade dele, a não ser pelo quê vi que é criar um novo monstro e tornar a pessoa que te matou um summon desse monstro, entretanto quando você morre, automaticamente, seus summons somem também, logo isso getCreatureSummons(killer[1]) devido ao fato do addEvent executa após o return true o callback onDeath que por fim finaliza a morte, logo não a tabela que contém a pessoa que matou, não existe mais, não podendo pegar o killer. Os que aparece domodlib, é culpa de algum mod, verifique isso!
Postado Fevereiro 21, 2018 7 anos Autor @KotZletY, então é pq no caso estou fazendo o teste me matando para realmente ver se retornaria algum bug é que não queria remover a Script DeathSystem , gostei dela queria apenas por uma Db.Query nessa script para fazer com que o player fique com Town id 1 quando morrer axo que achei a mod que você citou, é essa abaixo : Spoiler Skullwar.Xml <?xml version="1.0" encoding="ISO-8859-1"?> <mod name="Skull System" version="1.0" author="Skyforever" contact="tibiaking.com" enabled="yes"> <config name="SkullC_func"><![CDATA[ function setSkullColor(cid) local t = { [{50,100}] = 1, [{101,150}] = 2, [{151,250}] = 3, [{251,350}] = 4, [{351,math.huge}] = 5 } for var, ret in pairs(t) do if getPlayerFrags(cid) >= var[1] and getPlayerFrags(cid) <= var[2] then doCreatureSetSkullType(cid, ret) end end end function getPlayerFrags(cid) local time = os.time() local times = {today = (time - 86400), week = (time - (7 * 86400))} local contents, result = {day = {}, week = {}, month = {}}, db.getResult("SELECT `pd`.`date`, `pd`.`level`, `p`.`name` FROM `player_killers` pk LEFT JOIN `killers` k ON `pk`.`kill_id` = `k`.`id` LEFT JOIN `player_deaths` pd ON `k`.`death_id` = `pd`.`id` LEFT JOIN `players` p ON `pd`.`player_id` = `p`.`id` WHERE `pk`.`player_id` = " .. getPlayerGUID(cid) .. " AND `k`.`unjustified` = 1 AND `pd`.`date` >= " .. (time - (30 * 86400)) .. " ORDER BY `pd`.`date` DESC") if(result:getID() ~= -1) then repeat local content = {date = result:getDataInt("date")} if(content.date > times.today) then table.insert(contents.day, content) elseif(content.date > times.week) then table.insert(contents.week, content) else table.insert(contents.month, content) end until not result:next() result:free() end local size = {day = table.maxn(contents.day),week = table.maxn(contents.week),month = table.maxn(contents.month)} return size.day + size.week + size.month end ]]></config> <event type="login" name="SkullLogin" event="script"><![CDATA[ domodlib('SkullC_func') function onLogin(cid) registerCreatureEvent(cid, "ColorKill") setSkullColor(cid) return true end]]></event> <event type="kill" name="ColorKill" event="script"><![CDATA[ domodlib('SkullC_func') function onKill(cid, target) if isPlayer(cid) and isPlayer(target) then doCreatureSetSkullType(target, 0) addEvent(setSkullColor, 100, cid) end return true end]]></event> </mod> oque daria pra fazer, quando caso o player se mata-se não bugar essa mod ? @KotZletY, removi as duas script's tanto a DeathSystem.lua , quanto a MOD Skullwar e mesmo assim quando o character morre acaba Voltando para Town id 0, teria alguma script que fize-se ele ficar com a Town 1 ao morrer ? é um servidor de War, alguem poderia ajudar ?
Postado Fevereiro 21, 2018 7 anos @Micheel15 Spoiler <?xml version="1.0" encoding="ISO-8859-1"?> <mod name="Skull System" version="1.0" author="Skyforever" contact="tibiaking.com" enabled="yes"> <config name="SkullC_func"><![CDATA[ function setSkullColor(cid) local t = { [{50,100}] = 1, [{101,150}] = 2, [{151,250}] = 3, [{251,350}] = 4, [{351,math.huge}] = 5 } local ret_frags = getPlayerFrags(cid) for var, ret in pairs(t) do if isPlayer(cid) then if ret_frags >= var[1] and ret_frags <= var[2] then doCreatureSetSkullType(cid, ret) end end end end function getPlayerFrags(cid) local time = os.time() local times = {today = (time - 86400), week = (time - (7 * 86400))} local contents, result = {day = {}, week = {}, month = {}}, db.getResult("SELECT `pd`.`date`, `pd`.`level`, `p`.`name` FROM `player_killers` pk LEFT JOIN `killers` k ON `pk`.`kill_id` = `k`.`id` LEFT JOIN `player_deaths` pd ON `k`.`death_id` = `pd`.`id` LEFT JOIN `players` p ON `pd`.`player_id` = `p`.`id` WHERE `pk`.`player_id` = " .. getPlayerGUID(cid) .. " AND `k`.`unjustified` = 1 AND `pd`.`date` >= " .. (time - (30 * 86400)) .. " ORDER BY `pd`.`date` DESC") if(result:getID() ~= -1) then repeat local content = {date = result:getDataInt("date")} if(content.date > times.today) then table.insert(contents.day, content) elseif(content.date > times.week) then table.insert(contents.week, content) else table.insert(contents.month, content) end until not result:next() result:free() end local size = {day = table.maxn(contents.day),week = table.maxn(contents.week),month = table.maxn(contents.month)} return size.day + size.week + size.month end ]]></config> <event type="login" name="SkullLogin" event="script"><![CDATA[ domodlib('SkullC_func') function onLogin(cid) registerCreatureEvent(cid, "ColorKill") setSkullColor(cid) return true end]]></event> <event type="kill" name="ColorKill" event="script"><![CDATA[ domodlib('SkullC_func') function onKill(cid, target) if isPlayer(cid) and isPlayer(target) then doCreatureSetSkullType(target, 0) setSkullColor(cid) end return true end]]></event> </mod> Spoiler local monster = 'Morte' function onDeath(cid, corpse, killer) local pos = getCreaturePosition(cid) if isPlayer(cid) and isPlayer(killer[1]) then doConvinceCreature(killer[1], doCreateMonster(monster, pos)) doSendAnimatedText(getThingPos(cid), "OWNED!", TEXTCOLOR_RED) doSendMagicEffect(getThingPos(cid), 6) end return true end
Postado Fevereiro 21, 2018 7 anos Autor @KotZletYvou colocar, essas script's, problema é que eu removi elas para testar, e quando o char morre continua "Zerando" a Town id do char isso acontece tanto quando eu me mato, quanto quando alguem me mata, teria um script que sempre quando o player loga-se ele ganha-se Town id 1 ? o Servidor no caso é de War Editado Fevereiro 21, 2018 7 anos por Micheel15 (veja o histórico de edições)
Postado Fevereiro 22, 2018 7 anos @Micheel15 tem mas não seria legal adiciona-lo, por padrão, a town_id não muda, a menos que você usasse uma função para isso. Quando você morre executa também um onLogout, quando você desloga seu player é salvo, e as informações atuais dele no servidor, como level, nome, posição e etc... incluindo o town id são salvas na database, se seu town_id não está sendo salvo, algo está alterando ele, ou algo não está permitindo que ele salve corretamente. Imagine que futuramente você precise adicionar um sistema de cidades, ou algo que precise alterar o pvp. Então você deve fixar isso!
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.