Ir para conteúdo

Featured Replies

Postado

Movements script:

 

Spoiler


local table = {
itemNeed = 2205, -- Mesmo id do itemid que você colocou na tag xml.
delay = 1000 -- Tempo que vai ficar saindo
}

function doPlayerLoopEff(cid)
local sto = getPlayerStorageValue(cid, 2399) - os.time()
local x = sto > 0 and 2 or 1
local mpAdd = math.random(500, 500)*x

 if isPlayer(cid) and getPlayerSlotItem(cid, CONST_SLOT_RING).itemid == table.itemNeed then
  doSendAnimatedText(getThingPos(cid), "+" .. mpAdd .. "MP", TEXTCOLOR_LIGHTGREEN)
  doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
  doCreatureAddMana(cid, mpAdd)
  addEvent(function() doPlayerLoopEff(cid) end, table.delay)
end
return true 
 end

function onEquip(cid, item, slot)
 doPlayerLoopEff(cid)
 return true
end
 

 

 

Erro acontece na hora que o player desloga:

 

Spoiler

Tester Pro has logged out.

[Error - MoveEvents Interface]
In a timer event called from:
data/movements/scripts/ring.lua:onEquip
Description:
(LuaInterface::luaGetCreatureStorage) Creature not found

[Error - MoveEvents Interface]
In a timer event called from:
data/movements/scripts/ring.lua:onEquip
Description:
data/movements/scripts/ring.lua:8: attempt to perform arithmetic on a boolean value
stack traceback:
        data/movements/scripts/ring.lua:8: in function 'doPlayerLoopEff'
        data/movements/scripts/ring.lua:21: in function <data/movements/scripts/ring.lua:21>

 

Resolvido por Vodkart

Ir para solução
Postado
  • Solução
local table = {
itemNeed = 2205, -- Mesmo id do itemid que você colocou na tag xml.
delay = 1000 -- Tempo que vai ficar saindo
}

function doPlayerLoopEff(cid)
if not isCreature(cid) then return LUA_ERROR end
local sto = getPlayerStorageValue(cid, 2399) - os.time()
local x = sto > 0 and 2 or 1
local mpAdd = math.random(500, 500)*x
 if isPlayer(cid) and getPlayerSlotItem(cid, CONST_SLOT_RING).itemid == table.itemNeed then
  doSendAnimatedText(getThingPos(cid), "+" .. mpAdd .. "MP", TEXTCOLOR_LIGHTGREEN)
  doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
  doCreatureAddMana(cid, mpAdd)
  addEvent(function() doPlayerLoopEff(cid) end, table.delay)
end
return true 
 end

function onEquip(cid, item, slot)
 doPlayerLoopEff(cid)
 return true
end

 

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

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

Informação Importante

Confirmação de Termo