Postado Abril 3, 2014 11 anos Olá a todos, tenho uma rune no meu server que está funcionando 100%, mas gostaria quando for usada, mostrar a xp subindo no char... Citar local exp = 500000 -- Quanto de experience o player irá ganhar local exhaust = 3600 -- Tempo para o player poder usar o item novamente! (tempo em segundos) local text = "Congratulations, you gained "..exp.." points of experience." local storage = 9811 -- Não mexa aqui. function onUse(cid, item, fromPosition, itemEx, toPosition) if (getPlayerStorageValue(cid, storage) <= os.time()) then doPlayerAddExp(cid, exp) doCreatureSay(cid, text, 14) doSendMagicEffect(getCreaturePosition(cid), 5) doRemoveItem(cid, item.uid, 1) setPlayerStorageValue(cid, storage, os.time()+exhaust) else doPlayerSendCancel(cid, "Sorry, you only can again use this item after "..exhaust.." seconds.") end return TRUE end Obrigado =)
Postado Abril 3, 2014 11 anos adiciona isso embaixo de doPlayerAddExp(cid,exp) doSendAnimatedText(pos, "+"..exp , TEXTCOLOR_GREEN)
Postado Abril 3, 2014 11 anos Autor Apareceu o seguinte erro: Citar Lua Script error: [action interface] data/actions/scripts/exprune.lua:onUse attempt to index a nil vaule stack traceback: [C]: in function 'doSendAnimatedText' data/actions/scripts/exprune.lua:9: in function <data/actions/scripts/exprune.lua:6> Action ficou assim: Citar local exp = 500000 -- Quanto de experience o player irá ganhar?! local exhaust = 1 -- Tempo para o player poder usar o item novamente! (tempo em segundos) local text = "Congratulations, you gained "..exp.." points of experience." local storage = 9811 -- Não mexa aqui. function onUse(cid, item, fromPosition, itemEx, toPosition) if (getPlayerStorageValue(cid, storage) <= os.time()) then doPlayerAddExp(cid, exp) doSendAnimatedText(pos, "+"..exp , TEXTCOLOR_GREEN) doCreatureSay(cid, text, 14) doSendMagicEffect(getCreaturePosition(cid), 5) doRemoveItem(cid, item.uid, 1) setPlayerStorageValue(cid, storage, os.time()+exhaust) else doPlayerSendCancel(cid, "Sorry, you only can again use this item after "..exhaust.." seconds.") end return TRUE end Editado Abril 3, 2014 11 anos por zuckah (veja o histórico de edições)
Postado Abril 4, 2014 11 anos esqueci de declarar oque era o "pos" local pos = getPlayerPosition(cid) ficando assim: local exp = 500000 -- Quanto de experience o player irá ganhar?!local exhaust = 1 -- Tempo para o player poder usar o item novamente! (tempo em segundos) local text = "Congratulations, you gained "..exp.." points of experience." local storage = 9811 -- Não mexa aqui. function onUse(cid, item, fromPosition, itemEx, toPosition) if (getPlayerStorageValue(cid, storage) <= os.time()) then doPlayerAddExp(cid, exp) local pos = getPlayerPosition(cid) doSendAnimatedText(pos, "+"..exp , TEXTCOLOR_GREEN) doCreatureSay(cid, text, 14) doSendMagicEffect(getCreaturePosition(cid), 5) doRemoveItem(cid, item.uid, 1) setPlayerStorageValue(cid, storage, os.time()+exhaust) else doPlayerSendCancel(cid, "Sorry, you only can again use this item after "..exhaust.." seconds.") end return TRUE end Editado Abril 4, 2014 11 anos por xWhiteWolf (veja o histórico de edições)
Postado Abril 4, 2014 11 anos Autor Tem algumas falhas agora... Agora mostra a xp subindo no char, mas n funfa com a cor verde e nem a branca que eu queria, quando eu coloco essas cores a xp sai preta. Tambem a msg "Congratulations you gained "..exp.." points of experience." não aparece mais.
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.