Ir para conteúdo
  • Cadastre-se

(Resolvido)data/lib/034-exhaustion.lua:39


Ir para solução Resolvido por Vodkart,

Posts Recomendados

Bom dia galera, estou tentando usar uma magia do itachi, que ele teleporta ele e o player pra outra dimensão e depois de um tempo volta pra onde os dois estavam, ta funcionando normal "mas aparece um errinho na distro", eles tão indo pra esse local, e depois voltam normal, o problema é quando o player morre la, aparece um erre na distro, porque não tem como achar um player que nem on esta "MORREU", o outro problema é quando 

 

Erro que aparece sempre, morrendo na outra dimensão ou não morrendo.

[8:33:16.145] [Error - Spell Interface]
[8:33:16.148] data/spells/scripts/teste.lua:onCastSpell
[8:33:16.150] Description:
[8:33:16.153] data/lib/034-exhaustion.lua:39: attempt to perform arithmetic on local 'time' (a nil value)
[8:33:16.155] stack traceback:
[8:33:16.159]   data/lib/034-exhaustion.lua:39: in function 'set'
[8:33:16.161]   data/spells/scripts/teste.lua:58: in function <data/spells/scripts/teste.lua:13>

 

 

Quando o player morre na outra dimensão

[8:29:41.055] [Error - Spell Interface]
[8:29:41.058] In a timer event called from:
[8:29:41.059] data/spells/scripts/teste.lua:onCastSpell
[8:29:41.063] Description:
[8:29:41.065] (luaDoCreatureSetNoMove) Creature not found

[8:29:41.069] [Error - Spell Interface]
[8:29:41.074] In a timer event called from:
[8:29:41.077] data/spells/scripts/teste.lua:onCastSpell
[8:29:41.083] Description:
[8:29:41.084] (luaDoTeleportThing) Thing not found

 

 

Script da magia

Spoiler

local exausted = 0.3 -- em minutos
local time = 5 -- tempo em segundos para voltar
local points = 20 -- o tanto de skills ele ficara mais forte
local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_TICKS, time*1000)
setConditionParam(condition, CONDITION_PARAM_STAT_MAGICLEVEL, points)
setConditionParam(condition, CONDITION_PARAM_SKILL_FIST, points)
setConditionParam(condition, CONDITION_PARAM_SKILL_SWORD, points)
setConditionParam(condition, CONDITION_PARAM_SKILL_AXE, points)
setConditionParam(condition, CONDITION_PARAM_SKILL_CLUB, points)
setConditionParam(condition, CONDITION_PARAM_SKILL_DISTANCE, points)
setConditionParam(condition, CONDITION_PARAM_SKILL_SHIELD, points)
function onCastSpell(cid, var)
    if isPlayer(cid) and getPlayerAccess(cid) < 3 and getPlayerStorageValue(cid, 998879)-os.time() > 1 then
local seetime = getPlayerStorageValue(cid, 998879)-os.time()
local minutes, seconds = math.floor(seetime/60), math.floor(seetime%60)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Aguarde "..minutes.." minuto(s) e "..seconds.." segundo(s) para usar novamente!")
return false
end
setPlayerStorageValue(cid, 998879, exausted*60+os.time())
    local tar = getCreatureTarget(cid)
    if hasCondition(tar, CONDITION_MUTED) == true then
        return false
end
local pos = getCreaturePosition(cid)
local target = getCreatureTarget(cid)
local targetpos = getCreaturePosition(target)
local Tile1 = {x=1083, y=473, z=8} -- position onde o player sera teleportado
local Tile2 = {x=1083, y=471, z=8} -- position onde o target sera teleportado
local from,to = {x=154, y=57, z=7},{x=158, y=62, z=7} -- ponto 1 ao ponto 2 da area em que ele sera teleportado
local from,to1 = {x=159, y=49, z=7},{x=165, y=56, z=7} -- ponto 1 ao ponto 2 da area em que ele sera teleportado
local from,to2 = {x=159, y=49, z=7},{x=165, y=57, z=7} -- ponto 1 ao ponto 2 da area em que ele sera teleportado
local from,to3 = {x=159, y=49, z=7},{x=165, y=58, z=7} -- ponto 1 ao ponto 2 da area em que ele sera teleportado
local from,to4 = {x=159, y=49, z=7},{x=165, y=59, z=7} -- ponto 1 ao ponto 2 da area em que ele sera teleportado

if isInRange(pos, from, to) and isInRange(pos, from1, to1) and isInRange(pos, from2, to2) and isInRange(pos, from3, to3) and isInRange(pos, from4, to4) then
doPlayerSendCancel(cid, "Você nao pode usar o Tsukuyomi World aqui!")
return FALSE
end
if not isPlayer(target) then
doPlayerSendCancel(cid, "Você so pode usar essa magia em players!")
return FALSE
end
local function Teleport_Player(cid)
doTeleportThing(cid,pos)
end
local function Teleport_Target(target)
doCreatureSetNoMove(target, 0)
doTeleportThing(target,targetpos)
end
doAddCondition(cid, condition)
doCreatureSetNoMove(target, 1)
doTeleportThing(cid,Tile1)
doTeleportThing(target,Tile2)
doSendMagicEffect(targetpos, 252)
addEvent(Teleport_Player, time*1000, cid)
addEvent(Teleport_Target, time*1000, target)
exhaustion.set(cid, storage, waittime)
return TRUE
end

 

 

 

lib que aparece o erro

Spoiler

exhaustion =
{
 check = function (cid, storage)
  if(isMonster(cid)) then
    return false
  end

  if(getPlayerFlagValue(cid, PLAYERFLAG_HASNOEXHAUSTION)) then
   return false
  end

  return getPlayerStorageValue(cid, storage) >= os.time(t)
 end,

 get = function (cid, storage)
  if(isMonster(cid)) then
    return false
  end
  
  if(getPlayerFlagValue(cid, PLAYERFLAG_HASNOEXHAUSTION)) then
   return false
  end

  local exhaust = getPlayerStorageValue(cid, storage)
  if(exhaust > 0) then
   local left = exhaust - os.time(t)
   if(left >= 0) then
    return left
   end
  end

  return false
 end,

 set = function (cid, storage, time)
   if(isMonster(cid)) then
    return false
  end
  setPlayerStorageValue(cid, storage, os.time(t) + time)
 end,

 make = function (cid, storage, time)
  local exhaust = exhaustion.get(cid, storage)
  if(not exhaust) then
   exhaustion.set(cid, storage, time)
   return true
  end

  return false
 end
}

 

 

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

       112674.gif

 

 

 

Link para o post
Compartilhar em outros sites
  • Solução
local exausted = 0.3 -- em minutos
local time = 5 -- tempo em segundos para voltar
local points = 20 -- o tanto de skills ele ficara mais forte
local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_TICKS, time*1000)
setConditionParam(condition, CONDITION_PARAM_STAT_MAGICLEVEL, points)
setConditionParam(condition, CONDITION_PARAM_SKILL_FIST, points)
setConditionParam(condition, CONDITION_PARAM_SKILL_SWORD, points)
setConditionParam(condition, CONDITION_PARAM_SKILL_AXE, points)
setConditionParam(condition, CONDITION_PARAM_SKILL_CLUB, points)
setConditionParam(condition, CONDITION_PARAM_SKILL_DISTANCE, points)
setConditionParam(condition, CONDITION_PARAM_SKILL_SHIELD, points)
function onCastSpell(cid, var)
    if isPlayer(cid) and getPlayerAccess(cid) < 3 and getPlayerStorageValue(cid, 998879)-os.time() > 1 then
        local seetime = getPlayerStorageValue(cid, 998879)-os.time()
        local minutes, seconds = math.floor(seetime/60), math.floor(seetime%60)
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Aguarde "..minutes.." minuto(s) e "..seconds.." segundo(s) para usar novamente!")
        return false
    end
    setPlayerStorageValue(cid, 998879, exausted*60+os.time())
    local tar = getCreatureTarget(cid)
    if hasCondition(tar, CONDITION_MUTED) == true then
        return false
    end
    local pos = getCreaturePosition(cid)
    local target = getCreatureTarget(cid)
    local targetpos = getCreaturePosition(target)
    local Tile1 = {x=1083, y=473, z=8} -- position onde o player sera teleportado
    local Tile2 = {x=1083, y=471, z=8} -- position onde o target sera teleportado
    local from,to = {x=154, y=57, z=7},{x=158, y=62, z=7} -- ponto 1 ao ponto 2 da area em que ele sera teleportado
    local from,to1 = {x=159, y=49, z=7},{x=165, y=56, z=7} -- ponto 1 ao ponto 2 da area em que ele sera teleportado
    local from,to2 = {x=159, y=49, z=7},{x=165, y=57, z=7} -- ponto 1 ao ponto 2 da area em que ele sera teleportado
    local from,to3 = {x=159, y=49, z=7},{x=165, y=58, z=7} -- ponto 1 ao ponto 2 da area em que ele sera teleportado
    local from,to4 = {x=159, y=49, z=7},{x=165, y=59, z=7} -- ponto 1 ao ponto 2 da area em que ele sera teleportado

    if isInRange(pos, from, to) and isInRange(pos, from1, to1) and isInRange(pos, from2, to2) and isInRange(pos, from3, to3) and isInRange(pos, from4, to4) then
        doPlayerSendCancel(cid, "Você nao pode usar o Tsukuyomi World aqui!")
        return FALSE
    end
    if not isPlayer(target) then
        doPlayerSendCancel(cid, "Você so pode usar essa magia em players!")
        return FALSE
    end
    local function Teleport_Player(cid)
        if not isCreature(cid) then return LUA_ERROR end
        doTeleportThing(cid,pos)
    end
    local function Teleport_Target(target)
        if not isCreature(target) then return LUA_ERROR end
        doCreatureSetNoMove(target, 0)
        doTeleportThing(target,targetpos)
    end
    doAddCondition(cid, condition)
    doCreatureSetNoMove(target, 1)
    doTeleportThing(cid,Tile1)
    doTeleportThing(target,Tile2)
    doSendMagicEffect(targetpos, 252)
    addEvent(Teleport_Player, time*1000, cid)
    addEvent(Teleport_Target, time*1000, target)
    exhaustion.set(cid, storage, waittime)
    return TRUE
end 

 

vodkart_logo.png

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

 

DISCORDvodkart#6090

 

Link para o post
Compartilhar em outros sites
4 minutos atrás, Vodkart disse:

local exausted = 0.3 -- em minutos
local time = 5 -- tempo em segundos para voltar
local points = 20 -- o tanto de skills ele ficara mais forte
local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_TICKS, time*1000)
setConditionParam(condition, CONDITION_PARAM_STAT_MAGICLEVEL, points)
setConditionParam(condition, CONDITION_PARAM_SKILL_FIST, points)
setConditionParam(condition, CONDITION_PARAM_SKILL_SWORD, points)
setConditionParam(condition, CONDITION_PARAM_SKILL_AXE, points)
setConditionParam(condition, CONDITION_PARAM_SKILL_CLUB, points)
setConditionParam(condition, CONDITION_PARAM_SKILL_DISTANCE, points)
setConditionParam(condition, CONDITION_PARAM_SKILL_SHIELD, points)
function onCastSpell(cid, var)
    if isPlayer(cid) and getPlayerAccess(cid) < 3 and getPlayerStorageValue(cid, 998879)-os.time() > 1 then
        local seetime = getPlayerStorageValue(cid, 998879)-os.time()
        local minutes, seconds = math.floor(seetime/60), math.floor(seetime%60)
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Aguarde "..minutes.." minuto(s) e "..seconds.." segundo(s) para usar novamente!")
        return false
    end
    setPlayerStorageValue(cid, 998879, exausted*60+os.time())
    local tar = getCreatureTarget(cid)
    if hasCondition(tar, CONDITION_MUTED) == true then
        return false
    end
    local pos = getCreaturePosition(cid)
    local target = getCreatureTarget(cid)
    local targetpos = getCreaturePosition(target)
    local Tile1 = {x=1083, y=473, z=8} -- position onde o player sera teleportado
    local Tile2 = {x=1083, y=471, z=8} -- position onde o target sera teleportado
    local from,to = {x=154, y=57, z=7},{x=158, y=62, z=7} -- ponto 1 ao ponto 2 da area em que ele sera teleportado
    local from,to1 = {x=159, y=49, z=7},{x=165, y=56, z=7} -- ponto 1 ao ponto 2 da area em que ele sera teleportado
    local from,to2 = {x=159, y=49, z=7},{x=165, y=57, z=7} -- ponto 1 ao ponto 2 da area em que ele sera teleportado
    local from,to3 = {x=159, y=49, z=7},{x=165, y=58, z=7} -- ponto 1 ao ponto 2 da area em que ele sera teleportado
    local from,to4 = {x=159, y=49, z=7},{x=165, y=59, z=7} -- ponto 1 ao ponto 2 da area em que ele sera teleportado

    if isInRange(pos, from, to) and isInRange(pos, from1, to1) and isInRange(pos, from2, to2) and isInRange(pos, from3, to3) and isInRange(pos, from4, to4) then
        doPlayerSendCancel(cid, "Você nao pode usar o Tsukuyomi World aqui!")
        return FALSE
    end
    if not isPlayer(target) then
        doPlayerSendCancel(cid, "Você so pode usar essa magia em players!")
        return FALSE
    end
    local function Teleport_Player(cid)
        if not isCreature(cid) then return LUA_ERROR end
        doTeleportThing(cid,pos)
    end
    local function Teleport_Target(target)
        if not isCreature(target) then return LUA_ERROR end
        doCreatureSetNoMove(target, 0)
        doTeleportThing(target,targetpos)
    end
    doAddCondition(cid, condition)
    doCreatureSetNoMove(target, 1)
    doTeleportThing(cid,Tile1)
    doTeleportThing(target,Tile2)
    doSendMagicEffect(targetpos, 252)
    addEvent(Teleport_Player, time*1000, cid)
    addEvent(Teleport_Target, time*1000, target)
    exhaustion.set(cid, storage, waittime)
    return TRUE
end 

 

 

 

 

O unico erro que continuou é o da lib
 

Spoiler

[9:24:50.649] [Error - Spell Interface]
[9:24:50.649] data/spells/scripts/teste.lua:onCastSpell
[9:24:50.665] Description:
[9:24:50.665] data/lib/034-exhaustion.lua:39: attempt to perform arithmetic on local 'time' (a nil value)
[9:24:50.665] stack traceback:
[9:24:50.665]   data/lib/034-exhaustion.lua:39: in function 'set'
[9:24:50.665]   data/spells/scripts/teste.lua:60: in function <data/spells/scripts/teste.lua:13>

 

 

       112674.gif

 

 

 

Link para o post
Compartilhar em outros sites

a variável "waittime" não está declarada

 

remova esta linha:

 

exhaustion.set(cid, storage, waittime)

 

vodkart_logo.png

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

 

DISCORDvodkart#6090

 

Link para o post
Compartilhar em outros sites

 

36 minutos atrás, Vodkart disse:

a variável "waittime" não está declarada

 

remova esta linha:

 


exhaustion.set(cid, storage, waittime)

 

 

Perfeito, funcionou 100% sera que teria como me tirar outra duvida? o tile que o target é teleportado ele remove 20% da vida do player se ele morre la, aparece esse erro aqui no death channel.

 

[9:51:29.506] [Error - CreatureScript Interface]
[9:51:29.508] data/creaturescripts/scripts/deathchannel.lua:onDeath
[9:51:29.526] Description:
[9:51:29.527] (luaGetCreatureStorage) Creature not found

[9:51:29.537] [Error - CreatureScript Interface]
[9:51:29.538] data/creaturescripts/scripts/deathchannel.lua:onDeath
[9:51:29.544] Description:
[9:51:29.547] (luaGetCreatureStorage) Creature not found

[9:51:29.557] [Error - CreatureScript Interface]
[9:51:29.558] data/creaturescripts/scripts/deathchannel.lua:onDeath
[9:51:29.563] Description:
[9:51:29.565] data/creaturescripts/scripts/deathchannel.lua:11: attempt to perform arithmetic on a boolean value
[9:51:29.575] stack traceback:
[9:51:29.576]   data/creaturescripts/scripts/deathchannel.lua:11: in function <data/creaturescripts/scripts/deathchannel.lua:5>

Script.
 

Spoiler

-- Coded by Zoom..
local info, win, lose = "%s [Level: %s] foi mort%s pelo %s %s%s", "%s obteve %s frags seguidos após derrotar %s.", "%s acabou de impedir que %s fizesse uma sequência de %s frags seguidos."
local frags, storage = {10, 15, 20, 25, 30, 35, 40, 45, 50}, 30045

function onDeath(cid, corpse, deathList)
    if(not isPlayer(cid)) then
        return true
    end
    
    local target = deathList[1]
    doCreatureSetStorage(target, storage, getCreatureStorage(target, storage) + (getCreatureStorage(target, storage) == -1 and 2 or 1))
    
    for _, pid in ipairs(getPlayersOnline()) do
        doPlayerSendChannelMessage(pid, '', info:format(getCreatureName(cid), getPlayerLevel(cid), getPlayerSex(cid) == 1 and "o" or "a", isPlayer(target) and "player" or "monstro", getCreatureName(target), isPlayer(target) and " [Level: "..getPlayerLevel(target).."]." or "."), TALKTYPE_CHANNEL_O, 0xF)
        for _, frag in ipairs(frags) do
            if(getCreatureStorage(target, storage) == frag) then
                doPlayerSendChannelMessage(pid, '', win:format(getCreatureName(target), frag, getCreatureName(cid)), TALKTYPE_CHANNEL_W, 0xF)
            end
            
            if(getCreatureStorage(cid, storage) >= frag) then
                doPlayerSendChannelMessage(pid, '', lose:format(getCreatureName(target), getCreatureName(cid), getCreatureStorage(cid, storage)+1), TALKTYPE_CHANNEL_RN, 0xF)
            end
        end
    end
    
    doCreatureSetStorage(cid, storage, 0)
    return true
end

 

 

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

       112674.gif

 

 

 

Link para o post
Compartilhar em outros sites
-- Coded by Zoom..
local info, win, lose = "%s [Level: %s] foi mort%s pelo %s %s%s", "%s obteve %s frags seguidos após derrotar %s.", "%s acabou de impedir que %s fizesse uma sequência de %s frags seguidos."
local frags, storage = {10, 15, 20, 25, 30, 35, 40, 45, 50}, 30045
function onDeath(cid, corpse, deathList)
    if(not isPlayer(cid)) then
        return true
    end    
    local target = deathList[1]
	if not isCreature(target) or not isPlayer(target) then
		return true
	end
    doCreatureSetStorage(target, storage, getCreatureStorage(target, storage) + (getCreatureStorage(target, storage) == -1 and 2 or 1))
    for _, pid in ipairs(getPlayersOnline()) do
        doPlayerSendChannelMessage(pid, '', info:format(getCreatureName(cid), getPlayerLevel(cid), getPlayerSex(cid) == 1 and "o" or "a", isPlayer(target) and "player" or "monstro", getCreatureName(target), isPlayer(target) and " [Level: "..getPlayerLevel(target).."]." or "."), TALKTYPE_CHANNEL_O, 0xF)
        for _, frag in ipairs(frags) do
            if(getCreatureStorage(target, storage) == frag) then
                doPlayerSendChannelMessage(pid, '', win:format(getCreatureName(target), frag, getCreatureName(cid)), TALKTYPE_CHANNEL_W, 0xF)
            end
            if(getCreatureStorage(cid, storage) >= frag) then
                doPlayerSendChannelMessage(pid, '', lose:format(getCreatureName(target), getCreatureName(cid), getCreatureStorage(cid, storage)+1), TALKTYPE_CHANNEL_RN, 0xF)
            end
        end
    end
    doCreatureSetStorage(cid, storage, 0)
    return true
end

 

vodkart_logo.png

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

 

DISCORDvodkart#6090

 

Link para o post
Compartilhar em outros sites
5 horas atrás, Vodkart disse:

-- Coded by Zoom..
local info, win, lose = "%s [Level: %s] foi mort%s pelo %s %s%s", "%s obteve %s frags seguidos após derrotar %s.", "%s acabou de impedir que %s fizesse uma sequência de %s frags seguidos."
local frags, storage = {10, 15, 20, 25, 30, 35, 40, 45, 50}, 30045
function onDeath(cid, corpse, deathList)
    if(not isPlayer(cid)) then
        return true
    end    
    local target = deathList[1]
	if not isCreature(target) or not isPlayer(target) then
		return true
	end
    doCreatureSetStorage(target, storage, getCreatureStorage(target, storage) + (getCreatureStorage(target, storage) == -1 and 2 or 1))
    for _, pid in ipairs(getPlayersOnline()) do
        doPlayerSendChannelMessage(pid, '', info:format(getCreatureName(cid), getPlayerLevel(cid), getPlayerSex(cid) == 1 and "o" or "a", isPlayer(target) and "player" or "monstro", getCreatureName(target), isPlayer(target) and " [Level: "..getPlayerLevel(target).."]." or "."), TALKTYPE_CHANNEL_O, 0xF)
        for _, frag in ipairs(frags) do
            if(getCreatureStorage(target, storage) == frag) then
                doPlayerSendChannelMessage(pid, '', win:format(getCreatureName(target), frag, getCreatureName(cid)), TALKTYPE_CHANNEL_W, 0xF)
            end
            if(getCreatureStorage(cid, storage) >= frag) then
                doPlayerSendChannelMessage(pid, '', lose:format(getCreatureName(target), getCreatureName(cid), getCreatureStorage(cid, storage)+1), TALKTYPE_CHANNEL_RN, 0xF)
            end
        end
    end
    doCreatureSetStorage(cid, storage, 0)
    return true
end

 

 

Como sempre, perfect!

       112674.gif

 

 

 

Link para o post
Compartilhar em outros sites

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

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo