Postado Fevereiro 20, 2015 10 anos Boa noite, Tenho um global 10.53, que compilei faz algumas semanas, aparentemente está sem erros e os que tinham eu arrumei, porém tem um erro que persiste e incomoda. Toda vez que um player morre, aparece um erro no distro referente a quest elemental spheres, como mostra a imagem abaixo: ...\data\creaturescripts\scripts\elemental spheres quest.lua local boss = { ["fire overlord"] = {g_storage = 40064, p_storage = 60027}, ["energy overlord"] = {g_storage = 40065, p_storage = 60028}, ["ice overlord"] = {g_storage = 40066, p_storage = 60029}, ["earth overlord"] = {g_storage = 40067, p_storage = 60030}, } function onDeath(cid, corpse, lasthitkiller, mostdamagekiller, lasthitunjustified, mostdamageunjustified) local pid = Player(mostdamagekiller) local t = boss[Creature(cid):getName():lower()] pid:setStorageValue(t.p_storage, 1) setGlobalStorageValue(t.g_storage, -1) return true end function onKill(cid, target) if Creature(target):getName():lower() == "lord of the elements" then Player(cid):setStorageValue(60031, 1) end return true end function onLogin(cid) Player(cid):registerEvent("ElementalSpheresKill") return true end Lembrando que o erro só aparece quando algum player morre, alguém sabe o que possa ser?
Postado Junho 5, 2015 9 anos debaixo de local t = boss[Creature(cid):getName():lower()] addiciona if not t then return true end
Postado Junho 5, 2015 9 anos Na linha onde tem: pid:setStorageValue(t.p_storage, 1) Substitua por: if pid ~= nil then pid:setStorageValue(t.p_storage, 1) end Explicação: Ele tenta identificar o PID (ID da Creature/Player) só que não encontra, ou seja, é considerado nulo/inexistente. Para evitar tal erro, fiz a verificação pra se caso o PID seja existente e/ou diferente de nulo.
Postado Junho 5, 2015 9 anos function onDeath(cid, corpse, lasthitkiller, mostdamagekiller, lasthitunjustified, mostdamageunjustified) local pid = Player(mostdamagekiller) local t = boss[Creature(cid):getName():lower()] pid:setStorageValue(t.p_storage, 1) setGlobalStorageValue(t.g_storage, -1) return true end por esta: function onDeath(cid, corpse, lasthitkiller, mostdamagekiller, lasthitunjustified, mostdamageunjustified) local pid = Player(mostdamagekiller) if pid then local t = boss[Creature(cid):getName():lower()] if t then pid:setStorageValue(t.p_storage, 1) setGlobalStorageValue(t.g_storage, -1) 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.