Ir para conteúdo
  • 0

erro no comando =X


rohfagundes

Pergunta

eu peguei um sistema de pontos

q funciona assim

quando vc passa um level vc ganha tantos pontos

com aqueles pontos vc pode trocar por hp , magiclvl e skills

o problema é q tem um comando q n funciona

o magic level

 

o script era assim(desse jeito vc usa o comando perde os pontos mas n ganha o magic level)

 

-- #######################################

-- ####### Developed by MaXwEllDeN #######

-- ####### Level Points System #######

-- ####### Version: 1.0 #######

-- #######################################

 

function onSay(cid, words, param)

if not (L_LvlPoints.vocPoints[getPlayerVocation(cid)]) then

return false

end

 

local param = param:lower()

local p2 = string.explode(param, ",")

 

if (getPlayerStorageValue(cid, 14574) < 0) then

setPlayerStorageValue(cid, 14574, 0)

end

 

local skillids = {

["fist"] = SKILL_FIST,

["club"] = SKILL_CLUB,

["sword"] = SKILL_SWORD,

["axe"] = SKILL_AXE,

["distance"] = SKILL_DISTANCE,

["shielding"] = SKILL_SHIELD

}

 

if (param == "check") then

doPlayerPopupFYI(cid, "~*~*~ Level Points System by MaXwEllDeN ~*~*~\n\nPontos disponíveis: ".. getPlayerStorageValue(cid, 14574) .."\nPontos por level: ".. L_LvlPoints.vocPoints[getPlayerVocation(cid)])

elseif (p2[1] and p2[1] == "add") and (L_LvlPoints.attributes[p2[2]]) and (tonumber(p2[3])) then

if (getPlayerStorageValue(cid, 14574) < tonumber(p2[3]) * L_LvlPoints.attributes[p2[2]].np) then

doPlayerSendCancel(cid, "Você não tem pontos suficientes para distribuir!")

return doSendMagicEffect(getThingPos(cid), 2)

end

 

if (p2[2] == "vitalidade") then

setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + L_LvlPoints.attributes[p2[2]].vl * tonumber(p2[3]))

doCreatureAddHealth(cid, L_LvlPoints.attributes[p2[2]].vl * tonumber(p2[3]))

elseif(skillids[p2[2]]) then

for a = 1, tonumber(p2[3]) do

doPlayerAddSkillTry(cid, skillids[p2[2]], getPlayerRequiredSkillTries(cid, skillids[p2[2]], getPlayerSkillLevel(cid, skillids[p2[2]]) + 1) - getPlayerSkillTries(cid, skillids[p2[2]]), false)

end

end

 

 

doSendMagicEffect(getThingPos(cid), 29)

doSendMagicEffect(getThingPos(cid), 30)

doSendAnimatedText(getThingPos(cid), "-" .. tonumber(p2[3]) * L_LvlPoints.attributes[p2[2]].np, 180)

setPlayerStorageValue(cid, 14574, getPlayerStorageValue(cid, 14574) - tonumber(p2[3]) * L_LvlPoints.attributes[p2[2]].np)

else

local msgx = ""

for i, v in pairs(L_LvlPoints.attributes) do

local add = (v.np > 1) and "s" or ""

msgx = msgx .. string.upper(i:sub(1,1)) .. i:sub(2, #i) .. " - ".. v.np .. " ponto".. add .. " ~ " .. v.vl .. " ".. v.nm .. "\n"

end

 

doPlayerPopupFYI(cid, "~*~*~ Level Points System by MaXwEllDeN ~*~*~\n\nPontos necessários para aumentar os stats:\n\n".. msgx .. "\nExemplo de uso: ".. words .." add, vitalidade, 5\n\nPontos disponíveis: ".. getPlayerStorageValue(cid, 14574))

end

 

return true

end

 

 

 

 

ja desse outro jeito(o comando n funciona e da erro no console)

 

 

[28/02/2013 17:57:40] [Error - TalkAction Interface]

[28/02/2013 17:57:40] data/talkactions/scripts/PointsSystem.lua:onSay

[28/02/2013 17:57:40] Description:

[28/02/2013 17:57:40] data/talkactions/scripts/PointsSystem.lua:42: attempt to perform arithmetic on a boolean value

[28/02/2013 17:57:40] stack traceback:

[28/02/2013 17:57:40] data/talkactions/scripts/PointsSystem.lua:42: in function <data/talkactions/scripts/PointsSystem.lua:7>

 

 

 

-- #######################################

-- ####### Developed by MaXwEllDeN #######

-- ####### Level Points System #######

-- ####### Version: 1.0 #######

-- #######################################

 

function onSay(cid, words, param)

if not (L_LvlPoints.vocPoints[getPlayerVocation(cid)]) then

return false

end

 

local param = param:lower()

local p2 = string.explode(param, ",")

 

if (getPlayerStorageValue(cid, 14574) < 0) then

setPlayerStorageValue(cid, 14574, 0)

end

 

local skillids = {

["fist"] = SKILL_FIST,

["club"] = SKILL_CLUB,

["sword"] = SKILL_SWORD,

["axe"] = SKILL_AXE,

["distance"] = SKILL_DISTANCE,

["shielding"] = SKILL_SHIELD,

["magic"] = SKILL__MAGLEVEL

}

 

if (param == "check") then

doPlayerPopupFYI(cid, "~*~*~ Level Points System by MaXwEllDeN ~*~*~\n\nPontos disponíveis: ".. getPlayerStorageValue(cid, 14574) .."\nPontos por level: ".. L_LvlPoints.vocPoints[getPlayerVocation(cid)])

elseif (p2[1] and p2[1] == "add") and (L_LvlPoints.attributes[p2[2]]) and (tonumber(p2[3])) then

if (getPlayerStorageValue(cid, 14574) < tonumber(p2[3]) * L_LvlPoints.attributes[p2[2]].np) then

doPlayerSendCancel(cid, "Você não tem pontos suficientes para distribuir!")

return doSendMagicEffect(getThingPos(cid), 2)

end

 

if (p2[2] == "vitalidade") then

setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + L_LvlPoints.attributes[p2[2]].vl * tonumber(p2[3]))

doCreatureAddHealth(cid, L_LvlPoints.attributes[p2[2]].vl * tonumber(p2[3]))

elseif(skillids[p2[2]]) then

for a = 1, tonumber(p2[3]) do

doPlayerAddSkillTry(cid, skillids[p2[2]], getPlayerRequiredSkillTries(cid, skillids[p2[2]], getPlayerSkillLevel(cid, skillids[p2[2]]) + 1) - getPlayerSkillTries(cid, skillids[p2[2]]), false)

end

end

 

 

doSendMagicEffect(getThingPos(cid), 29)

doSendMagicEffect(getThingPos(cid), 30)

doSendAnimatedText(getThingPos(cid), "-" .. tonumber(p2[3]) * L_LvlPoints.attributes[p2[2]].np, 180)

setPlayerStorageValue(cid, 14574, getPlayerStorageValue(cid, 14574) - tonumber(p2[3]) * L_LvlPoints.attributes[p2[2]].np)

else

local msgx = ""

for i, v in pairs(L_LvlPoints.attributes) do

local add = (v.np > 1) and "s" or ""

msgx = msgx .. string.upper(i:sub(1,1)) .. i:sub(2, #i) .. " - ".. v.np .. " ponto".. add .. " ~ " .. v.vl .. " ".. v.nm .. "\n"

end

 

doPlayerPopupFYI(cid, "~*~*~ Level Points System by MaXwEllDeN ~*~*~\n\nPontos necessários para aumentar os stats:\n\n".. msgx .. "\nExemplo de uso: ".. words .." add, vitalidade, 5\n\nPontos disponíveis: ".. getPlayerStorageValue(cid, 14574))

end

 

return true

end

 

 

 

 

 

alguem ai sabe o q esta errado?

Link para o comentário
Compartilhar em outros sites

3 respostass a esta questão

Posts Recomendados

  • 0

http://www.xtibia.co...2-level-points/

 

Esse? O autor atualizou e disse que corrigiu o erro do magic level.

 

sim ele disse porem n esta funcionando '-'

 

edit: eu achei la no otland um cara q conseguiu arrumar isso

pelo menos no meu caso ta funcionando agora

 

entao podem mover

qualquer coisa fala q eu posto aqui =)

Editado por rohfagundes
Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...