Ir para conteúdo

Featured Replies

Postado

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: 

ZjIOwlo.png

 

Eu uso um servidor versão 7.92, me ajudaria bastante se alguem souber como resolver isso :x

Editado por yolocaust (veja o histórico de edições)

  • Respostas 11
  • Visualizações 510
  • Created
  • Última resposta

Top Posters In This Topic

Postado
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: 

ZjIOwlo.png

 

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

 

20230912_034613.png.cf49b650c34dd7d7b1f79bd49c70f53c.png

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
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 por Alexy Brocanello (veja o histórico de edições)

 

20230912_034613.png.cf49b650c34dd7d7b1f79bd49c70f53c.png

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
  • 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.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.8k

Informação Importante

Confirmação de Termo