Postado Setembro 27, 2014 10 anos function onStatsChange(cid, attacker, type, combat, value) if(isPlayer(cid) and not isPlayer(attacker) and exhaustion.check(cid, 23585) and (type == STATSCHANGE_MANALOSS or type == STATSCHANGE_HEALTHLOSS)) then doCreatureAddHealth(cid, math.abs(value)) doPlayerSendTextMessage(cid, 24,"Você tem mais "..exhaustion.get(cid, 23585).." segundos de proteção!") end end Acho que é minha última tentativa hehe Se não funcionar tenta com outro char, talvez esse aí tenha bugado com o outro script Editado Setembro 27, 2014 10 anos por Danves (veja o histórico de edições)
Postado Setembro 27, 2014 10 anos Autor function onStatsChange(cid, attacker, type, combat, value) if(isPlayer(cid) and not isPlayer(attacker) and exhaustion.check(cid, 23585) and (type == STATSCHANGE_MANALOSS or type == STATSCHANGE_HEALTHLOSS)) then doCreatureAddHealth(cid, math.abs(value)) doPlayerSendTextMessage(cid, 24,"Você tem mais "..exhaustion.get(cid, 23585).." segundos de proteção!") end end Acho que é minha última tentativa hehe Se não funcionar tenta com outro char, talvez esse aí tenha bugado com o outro script é, nada :/ vlw pela boa vontade rep +
Postado Setembro 27, 2014 10 anos Irei editar aqui no meu server até funcionar. Finalmente. function onStatsChange(cid, attacker, type, combat, value) if(isPlayer(cid) and not isPlayer(attacker) and exhaustion.check(cid, 23585) and (type == STATSCHANGE_MANALOSS or type == STATSCHANGE_HEALTHLOSS)) then doPlayerSendTextMessage(cid, 22,"Você tem mais "..exhaustion.get(cid, 23585).." segundos de proteção!") doSendMagicEffect(getThingPos(cid), 2) return false end return true end __________________________________________________ Resumindo o script, basta ter um script com nome "protect.lua" com isso dentro: function onLogin(cid) local tempo = 5 -- tempo de proteção em segundos if isPlayer(cid) then exhaustion.set(cid, 23585, tempo) doPlayerSendTextMessage(cid, 22, "Você está protegido por 5 segundos!") registerCreatureEvent(cid, "Protection") registerCreatureEvent(cid, "Protect") end return true end function onStatsChange(cid, attacker, type, combat, value) if(isPlayer(cid) and not isPlayer(attacker) and exhaustion.check(cid, 23585) and (type == STATSCHANGE_MANALOSS or type == STATSCHANGE_HEALTHLOSS)) then doPlayerSendTextMessage(cid, 22,"Você tem mais "..exhaustion.get(cid, 23585).." segundos de proteção!") doSendMagicEffect(getThingPos(cid), 2) return false end return true end E no creaturescripts.xml ter: <event type="login" name="Protect" event="script" value="protect.lua"/> <event type="statschange" name="Protection" event="script" value="protect.lua"/> Editado Setembro 27, 2014 10 anos por Danves (veja o histórico de edições)
Postado Setembro 27, 2014 10 anos Autor Irei editar aqui no meu server até funcionar. Finalmente. function onStatsChange(cid, attacker, type, combat, value) if(isPlayer(cid) and not isPlayer(attacker) and exhaustion.check(cid, 23585) and (type == STATSCHANGE_MANALOSS or type == STATSCHANGE_HEALTHLOSS)) then doPlayerSendTextMessage(cid, 22,"Você tem mais "..exhaustion.get(cid, 23585).." segundos de proteção!") doSendMagicEffect(getThingPos(cid), 2) return false end return true end __________________________________________________ Resumindo o script, basta ter um script com nome "protect.lua" com isso dentro: function onLogin(cid) local tempo = 5 -- tempo de proteção em segundos if isPlayer(cid) then exhaustion.set(cid, 23585, tempo) doPlayerSendTextMessage(cid, 22, "Você está protegido por 5 segundos!") registerCreatureEvent(cid, "Protection") registerCreatureEvent(cid, "Protect") end return true end function onStatsChange(cid, attacker, type, combat, value) if(isPlayer(cid) and not isPlayer(attacker) and exhaustion.check(cid, 23585) and (type == STATSCHANGE_MANALOSS or type == STATSCHANGE_HEALTHLOSS)) then doPlayerSendTextMessage(cid, 22,"Você tem mais "..exhaustion.get(cid, 23585).." segundos de proteção!") doSendMagicEffect(getThingPos(cid), 2) return false end return true end E no creaturescripts.xml ter: <event type="login" name="Protect" event="script" value="protect.lua"/> <event type="statschange" name="Protection" event="script" value="protect.lua"/> perfeito *-* muito obrigado REP REP REP
Postado Setembro 30, 2014 10 anos Autor está apresentando alguns erros aindas, mais está funcionando normalmente; [1:37:18.017] [Error - CreatureScript Interface] [1:37:18.017] data/creaturescripts/scripts/protect.lua:onStatsChange [1:37:18.017] Description: [1:37:18.017] data/lib/034-exhaustion.lua:4: attempt to compare number with string [1:37:18.017] stack traceback: [1:37:18.017] data/lib/034-exhaustion.lua:4: in function 'check' [1:37:18.017] data/creaturescripts/scripts/protect.lua:14: in function <data/creaturescripts/scripts/protect.lua:13>
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.