Postado Dezembro 5, 2015 9 anos Boa tarde, eu não sei se estou na área correta para postar isso mas eu gostaria de pedir ajuda com um script que estou tentando usar no meu servidor. Ele é um spellbook, eu uso esse: function onUse(cid, item, frompos, item2, topos) local count = getPlayerInstantSpellCount(cid) local text = "" local t = {} for i=0, count-1 do local spell = getPlayerInstantSpellInfo(cid, i) if spell.mlevel <= 0 or spell.mlevel >= 0 then if spell.manapercent > 0 then spell.mana = spell.manapercent .. "%" end table.insert(t, spell) end end table.sort(t, function(a, b) return a.mlevel < b.mlevel end) local prevLevel = -1 for i,spell in ipairs(t) do local line = "" if prevLevel ~= spell.mlevel then if i ~= 1 then line = "\n" end line = line .. "Spells for magic level " .. spell.mlevel .. "\n" prevLevel = spell.mlevel end text = text .. line .. " " .. spell.words .. " - " .. spell.name .. " : " .. spell.mana .. "\n" end doShowTextDialog(cid, item.itemid, text) return 1 end Quando eu do use nele da esse erro no distro: Eu uso um servidor versão 7.92, me ajudaria bastante se alguem souber como resolver isso :x Editado Dezembro 5, 2015 9 anos por yolocaust (veja o histórico de edições)
Postado Dezembro 5, 2015 9 anos 1 hora atrás, yolocaust disse: Boa tarde, eu não sei se estou na área correta para postar isso mas eu gostaria de pedir ajuda com um script que estou tentando usar no meu servidor. Ele é um spellbook, eu uso esse: function onUse(cid, item, frompos, item2, topos) local count = getPlayerInstantSpellCount(cid) local text = "" local t = {} for i=0, count-1 do local spell = getPlayerInstantSpellInfo(cid, i) if spell.mlevel <= 0 or spell.mlevel >= 0 then if spell.manapercent > 0 then spell.mana = spell.manapercent .. "%" end table.insert(t, spell) end end table.sort(t, function(a, b) return a.mlevel < b.mlevel end) local prevLevel = -1 for i,spell in ipairs(t) do local line = "" if prevLevel ~= spell.mlevel then if i ~= 1 then line = "\n" end line = line .. "Spells for magic level " .. spell.mlevel .. "\n" prevLevel = spell.mlevel end text = text .. line .. " " .. spell.words .. " - " .. spell.name .. " : " .. spell.mana .. "\n" end doShowTextDialog(cid, item.itemid, text) return 1 end Quando eu do use nele da esse erro no distro: Eu uso um servidor versão 7.92, me ajudaria bastante se alguem souber como resolver isso :x function onUse(cid, item, fromPosition, itemEx, toPosition) local t = {} for i = 0, getPlayerInstantSpellCount(cid) - 1 do local spell = getPlayerInstantSpellInfo(cid, i) if(spell.level ~= 0) then if(spell.manapercent > 0) then spell.mana = spell.manapercent .. "%" end table.insert(t, spell) end end table.sort(t, function(a, b) return a.level < b.level end) local text, prevLevel = "", -1 for i, spell in ipairs(t) do local line = "" if(prevLevel ~= spell.level) then if(i ~= 1) then line = "\n" end line = line .. "Spells for Level " .. spell.level .. "\n" prevLevel = spell.level end text = text .. line .. " " .. spell.words .. " - " .. spell.name .. " : " .. spell.mana .. "\n" end doShowTextDialog(cid, item.itemid, text) return true end Eu sou um entusiasta da programação apaixonado por ajudar a comunidade open source a crescer. Sempre em busca de novos desafios e oportunidades para contribuir com meu código. #OpenSource #Programação #Contribuição
Postado Dezembro 5, 2015 9 anos Autor Continua o mesmo erro que eu citei no post quando eu clico no spellbook :x
Postado Dezembro 5, 2015 9 anos 18 minutos atrás, yolocaust disse: Continua o mesmo erro que eu citei no post quando eu clico no spellbook :x os outros spells book pega ? vc configurou ele certinho no item.xml copia um spellbook e refaça com calma... pq não está achando getPlayerInstantSpellInfo tenta era pra pegar getPlayerInstantSpellCount(cid) - Verifica quantas spells o player sabe. e aonde CID é representado como player function onUse(cid, item, fromPosition, itemEx, toPosition) local count = getPlayerInstantSpellCount(cid) local text = "" local t = {} for i = 0, count - 1 do local spell = getPlayerInstantSpellInfo(cid, i) if spell.level ~= 0 then if spell.manapercent > 0 then spell.mana = spell.manapercent .. "%" end table.insert(t, spell) end end table.sort(t, function(a, b) return a.level < b.level end) local prevLevel = -1 for i, spell in ipairs(t) do local line = "" if prevLevel ~= spell.level then if i ~= 1 then line = "\n" end line = line .. "Spells for Level " .. spell.level .. "\n" prevLevel = spell.level end text = text .. line .. " " .. spell.words .. " - " .. spell.name .. " : " .. spell.mana .. "\n" end doShowTextDialog(cid,6120,text) return TRUE end Editado Dezembro 5, 2015 9 anos por Alexy Brocanello (veja o histórico de edições) Eu sou um entusiasta da programação apaixonado por ajudar a comunidade open source a crescer. Sempre em busca de novos desafios e oportunidades para contribuir com meu código. #OpenSource #Programação #Contribuição
Postado Dezembro 5, 2015 9 anos Autor 7 minutos atrás, Alexy Brocanello disse: os outros spells book pega ? vc configurou ele certinho no item.xml copia um spellbook e refaça com calma... pq não está achando getPlayerInstantSpellInfo Sim ta tudo certinho, refiz ele aqui tudo denovo só pra confirmar isso e continua dando o mesmo erro, no caso nao é no getPlayerInstantSpellInfo e sim no getPlayerInstantSpellCount
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.