Postado Maio 15, 2017 8 anos Olá boa noite, desculpa o incomodo mais gostaria de uma ajuda estou tentando implementar esse script no meu servidor que é do malucoo baixei sábado. Mas o mesmo clica com o moonlight crystal, no helmet gera erro na linha 18 e 19 do codigo. Abaixo o codigo.. local moonlightcrystals = 24739 local items = { -- 1 and 2 is mage, 3 is paladin, 4 is knight, change if wrong [1] = { [24716] = 24717, [24718] = 24784 }, [3] = { [24716] = 24717, [24718] = 24772 }, [4] = { [24716] = 24717, [24718] = 24783 } } items[2] = items[1] function onUse(player, item, fromPosition, target, toPosition, isHotkey) local voc = player:getVocation()%4 voc = (voc > 0 and voc) or 4 if isInArray(moonlightcrystals, item:getId()) then local toId = items[voc][item.itemid] if toId then target:transform(toId) item:remove(1) target:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED) else fromPosition:sendMagicEffect(CONST_ME_POFF) return true end end end O erro gerado é : Lua Script Error: [Action Interface] data/actions/scripts/other/moonlightcrystals.lua:onUse data/actions/scripts/other/moonlightcrystals.lua:19: attempt to perform arithmetic on a userdata value stack traceback: [C]: in function '__mod' data/actions/scripts/other/moonlightcrystals.lua:19: in function <data/actions/scripts/other/moonlightcrystals.lua:18> Linha 18 e 19 do erro: function onUse(player, item, fromPosition, target, toPosition, isHotkey) local voc = player:getVocation()%4 Solução do problema. local moonlightcrystals = {24739} local items = { -- 1 and 2 is mage, 3 is paladin, 4 is knight, change if wrong [1] = { [24716] = 24717, [24718] = 24784 }, [3] = { [24716] = 24717, [24718] = 24772 }, [4] = { [24716] = 24717, [24718] = 24783 } } items[2] = items[1] function onUse(player, item, fromPosition, target, toPosition, isHotkey) local voc = player:getVocation():getId()%4 voc = (voc > 0 and voc) or 4 if isInArray(moonlightcrystals, item:getId()) then local toId = items[voc][target.itemid] if toId then target:transform(toId) item:remove(1) target:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED) else fromPosition:sendMagicEffect(CONST_ME_POFF) return true end end end Editado Maio 15, 2017 8 anos por neykos (veja o histórico de edições)
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.