Ir para conteúdo
  • Cadastre-se

(Resolvido)Colocar exausted nesse comando


Ir para solução Resolvido por Yan Liima,

Posts Recomendados

Salve a todos, bom.. gostaria de implementar esse script, colocando Exausted nele para usar em x tempo novamente.

 tentei aqui com varios tutoriais mais nao tive exito.

obrigado a todos deste já !

tfs:0.4

 

Script :

Citar

-- Créditos para Yan Liima - Night criador da script.
local time = 4    -- em segundos 1 = 1 segundo 2 = 2 segundos...

    local say_events = {}
local function SayText(cid)
    if isPlayer(cid) == TRUE then
    if say_events[getPlayerGUID(cid)] ~= nil then
    if isPlayer(cid) == TRUE then
    doSendAnimatedText(getPlayerPosition(cid),"Treinando!", math.random(01,255))
    end
    say_events[getPlayerGUID(cid)] = addEvent(SayText, time * 1000 / 2, cid)
    doCreatureSetNoMove(cid, true)
    end
    end
    return TRUE
end
function onSay(cid, words, param, channel)
    if(param == '') then
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Utilize '".. words .. " on' para ligar e '".. words .. " off' para desligar.")
    return true
    end
    if param == "on" then
    if isPlayer(cid) == TRUE then
    doSendAnimatedText(getPlayerPosition(cid),"Treinando", math.random(01,255))
    end
    say_events[getPlayerGUID(cid)] = addEvent(SayText, time * 1000, cid)
    doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"Você está em modo 'Training'.")
    doPlayerSendTextMessage(cid,20,"Para sair do modo 'training' diga ".. words .. " off")
    elseif param == "off" then
    stopEvent(say_events[getPlayerGUID(cid)])
    say_events[getPlayerGUID(cid)] = nil
    doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"Você não está mais em modo 'Training'.")
    doCreatureSetNoMove(cid, false)
    end
    return TRUE
end

 

Link para o post
Compartilhar em outros sites

tente assim, se não funfar manda o erro.

 

se funfar REP+ Obg.

 

 

Spoiler

--[[
    Tag:Desbugar
    -- Kyyah Silva
]]--
local STORAGE_EXAUSTED = 91812
local exausted = 120        --Minutos.
function onSay(cid, words)
local storage = getPlayerStorageValue(cid, STORAGE_EXAUSTED)
    if storage > os.time() then
        return doPlayerSendCancel(cid, string.format("Aguarde %d segundo%s para usar este comando novamente.", storage - os.time(), storage - os.time() > 1 and "s" or ""))
    else
        local time = 4    -- em segundos 1 = 1 segundo 2 = 2 segundos...

    local say_events = {}
local function SayText(cid)
    if isPlayer(cid) == TRUE then
    if say_events[getPlayerGUID(cid)] ~= nil then
    if isPlayer(cid) == TRUE then
    doSendAnimatedText(getPlayerPosition(cid),"Treinando!", math.random(01,255))
    end
    say_events[getPlayerGUID(cid)] = addEvent(SayText, time * 1000 / 2, cid)
    doCreatureSetNoMove(cid, true)
    end
    end
    return TRUE
end
function onSay(cid, words, param, channel)
    if(param == '') then
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Utilize '".. words .. " on' para ligar e '".. words .. " off' para desligar.")
    return true
    end
    if param == "on" then
    if isPlayer(cid) == TRUE then
    doSendAnimatedText(getPlayerPosition(cid),"Treinando", math.random(01,255))
    end
    say_events[getPlayerGUID(cid)] = addEvent(SayText, time * 1000, cid)
    doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"Você está em modo 'Training'.")
    doPlayerSendTextMessage(cid,20,"Para sair do modo 'training' diga ".. words .. " off")
    elseif param == "off" then
    stopEvent(say_events[getPlayerGUID(cid)])
    say_events[getPlayerGUID(cid)] = nil
    doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"Você não está mais em modo 'Training'.")
    doCreatureSetNoMove(cid, false)
    end
    return TRUE
end

Meus Projetos:

Poké Memories- PokeMemories.com

 

 

  1. Dados 2019:
  2. Nome: Gabriel Salles
  3. Idade: 18
  4. Cidade: Guarulhos - SP
  5. Conheci otServer's: 2011
  6. Recomendo: otPokemon.com / otPokemonXY.net / pokemon-miw.com  / Pokememories.com
Link para o post
Compartilhar em outros sites
12 minutos atrás, gagfota disse:

tente assim, se não funfar manda o erro.

 

se funfar REP+ Obg.

 

 

  Ocultar conteúdo

--[[
    Tag:Desbugar
    -- Kyyah Silva
]]--
local STORAGE_EXAUSTED = 91812
local exausted = 120        --Minutos.
function onSay(cid, words)
local storage = getPlayerStorageValue(cid, STORAGE_EXAUSTED)
    if storage > os.time() then
        return doPlayerSendCancel(cid, string.format("Aguarde %d segundo%s para usar este comando novamente.", storage - os.time(), storage - os.time() > 1 and "s" or ""))
    else
        local time = 4    -- em segundos 1 = 1 segundo 2 = 2 segundos...

    local say_events = {}
local function SayText(cid)
    if isPlayer(cid) == TRUE then
    if say_events[getPlayerGUID(cid)] ~= nil then
    if isPlayer(cid) == TRUE then
    doSendAnimatedText(getPlayerPosition(cid),"Treinando!", math.random(01,255))
    end
    say_events[getPlayerGUID(cid)] = addEvent(SayText, time * 1000 / 2, cid)
    doCreatureSetNoMove(cid, true)
    end
    end
    return TRUE
end
function onSay(cid, words, param, channel)
    if(param == '') then
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Utilize '".. words .. " on' para ligar e '".. words .. " off' para desligar.")
    return true
    end
    if param == "on" then
    if isPlayer(cid) == TRUE then
    doSendAnimatedText(getPlayerPosition(cid),"Treinando", math.random(01,255))
    end
    say_events[getPlayerGUID(cid)] = addEvent(SayText, time * 1000, cid)
    doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"Você está em modo 'Training'.")
    doPlayerSendTextMessage(cid,20,"Para sair do modo 'training' diga ".. words .. " off")
    elseif param == "off" then
    stopEvent(say_events[getPlayerGUID(cid)])
    say_events[getPlayerGUID(cid)] = nil
    doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"Você não está mais em modo 'Training'.")
    doCreatureSetNoMove(cid, false)
    end
    return TRUE
end

Meus Projetos:

Poké Memories- PokeMemories.com

 

 

  1. Dados 2019:
  2. Nome: Gabriel Salles
  3. Idade: 18
  4. Cidade: Guarulhos - SP
  5. Conheci otServer's: 2011
  6. Recomendo: otPokemon.com / otPokemonXY.net / pokemon-miw.com  / Pokememories.com

 

 

Screenshot_89.png

Link para o post
Compartilhar em outros sites
Spoiler

--[[
    Tag:Desbugar
    -- Kyyah Silva
]]--
local STORAGE_EXAUSTED = 91812
local exausted = 120        --Minutos.
function onSay(cid, words)
local storage = getPlayerStorageValue(cid, STORAGE_EXAUSTED)
        return doPlayerSendCancel(cid, string.format("Aguarde %d segundo%s para usar este comando novamente.", storage - os.time(), storage - os.time() > 1 and "s" or ""))
    else
        local time = 4    -- em segundos 1 = 1 segundo 2 = 2 segundos...

    local say_events = {}
local function SayText(cid)
    if isPlayer(cid) == TRUE then
    if say_events[getPlayerGUID(cid)] ~= nil then
    if isPlayer(cid) == TRUE then
    doSendAnimatedText(getPlayerPosition(cid),"Treinando!", math.random(01,255))
    end
    say_events[getPlayerGUID(cid)] = addEvent(SayText, time * 1000 / 2, cid)
    doCreatureSetNoMove(cid, true)
    end
    end
    return TRUE
end
function onSay(cid, words, param, channel)
    if(param == '') then
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Utilize '".. words .. " on' para ligar e '".. words .. " off' para desligar.")
    return true
    end
    if param == "on" then
    if isPlayer(cid) == TRUE then
    doSendAnimatedText(getPlayerPosition(cid),"Treinando", math.random(01,255))
    end
    say_events[getPlayerGUID(cid)] = addEvent(SayText, time * 1000, cid)
    doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"Você está em modo 'Training'.")
    doPlayerSendTextMessage(cid,20,"Para sair do modo 'training' diga ".. words .. " off")
    elseif param == "off" then
    stopEvent(say_events[getPlayerGUID(cid)])
    say_events[getPlayerGUID(cid)] = nil
    doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"Você não está mais em modo 'Training'.")
    doCreatureSetNoMove(cid, false)
    end
    return true
end

 

Link para o post
Compartilhar em outros sites
7 horas atrás, gagfota disse:
  Mostrar conteúdo oculto

--[[
    Tag:Desbugar
    -- Kyyah Silva
]]--
local STORAGE_EXAUSTED = 91812
local exausted = 120        --Minutos.
function onSay(cid, words)
local storage = getPlayerStorageValue(cid, STORAGE_EXAUSTED)
        return doPlayerSendCancel(cid, string.format("Aguarde %d segundo%s para usar este comando novamente.", storage - os.time(), storage - os.time() > 1 and "s" or ""))
    else
        local time = 4    -- em segundos 1 = 1 segundo 2 = 2 segundos...

    local say_events = {}
local function SayText(cid)
    if isPlayer(cid) == TRUE then
    if say_events[getPlayerGUID(cid)] ~= nil then
    if isPlayer(cid) == TRUE then
    doSendAnimatedText(getPlayerPosition(cid),"Treinando!", math.random(01,255))
    end
    say_events[getPlayerGUID(cid)] = addEvent(SayText, time * 1000 / 2, cid)
    doCreatureSetNoMove(cid, true)
    end
    end
    return TRUE
end
function onSay(cid, words, param, channel)
    if(param == '') then
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Utilize '".. words .. " on' para ligar e '".. words .. " off' para desligar.")
    return true
    end
    if param == "on" then
    if isPlayer(cid) == TRUE then
    doSendAnimatedText(getPlayerPosition(cid),"Treinando", math.random(01,255))
    end
    say_events[getPlayerGUID(cid)] = addEvent(SayText, time * 1000, cid)
    doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"Você está em modo 'Training'.")
    doPlayerSendTextMessage(cid,20,"Para sair do modo 'training' diga ".. words .. " off")
    elseif param == "off" then
    stopEvent(say_events[getPlayerGUID(cid)])
    say_events[getPlayerGUID(cid)] = nil
    doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"Você não está mais em modo 'Training'.")
    doCreatureSetNoMove(cid, false)
    end
    return true
end

 

 

 

Screenshot_91.png

Link para o post
Compartilhar em outros sites

Dei uma organizada no código,veja se ainda apresenta erro:

 

--[[
Tag:Desbugar
-- Kyyah Silva
]]--
local STORAGE_EXAUSTED = 91812
local exausted = 120        --Minutos.

function onSay(cid, words)
    local storage = getPlayerStorageValue(cid, STORAGE_EXAUSTED)
    local retorno = doPlayerSendCancel(cid, string.format("Aguarde %d segundo%s para usar este comando novamente.", storage - os.time(), storage - os.time() > 1 and "s" or ""))
    
    if (!retorno) then
        local time = 4    -- em segundos 1 = 1 segundo 2 = 2 segundos...

        local say_events = {}
    
        function SayText(cid)
            if isPlayer(cid) then
                if say_events[getPlayerGUID(cid)] ~= nil then
                    if isPlayer(cid) == TRUE then
                        doSendAnimatedText(getPlayerPosition(cid),"Treinando!", math.random(01,255))
                    end
                say_events[getPlayerGUID(cid)] = addEvent(SayText, time * 1000 / 2, cid)
                doCreatureSetNoMove(cid, true)
                end
            end
            return true
        end
    
        function onSay(cid, words, param, channel)
            if(param == '') then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Utilize '".. words .. " on' para ligar e '".. words .. " off' para desligar.")
                return true
            end
    
            if param == "on" then
                if isPlayer(cid) then
                    doSendAnimatedText(getPlayerPosition(cid),"Treinando", math.random(01,255))
                end
                say_events[getPlayerGUID(cid)] = addEvent(SayText, time * 1000, cid)
                doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"Você está em modo 'Training'.")
                doPlayerSendTextMessage(cid,20,"Para sair do modo 'training' diga ".. words .. " off")

            else
                stopEvent(say_events[getPlayerGUID(cid)])
                say_events[getPlayerGUID(cid)] = nil
                doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"Você não está mais em modo 'Training'.")
                doCreatureSetNoMove(cid, false)
            end

            return true 
        end 

    else
        return true
    end
    
 return true
end

 

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

Contribuições:
 

=> Distribuições/Servidores

  1. [8.60] The Forgotten Server 1.3 (COMPILADO WIN x64)

 

=> Scripts/Códigos/Tutoriais

  1. Pokemon pescado aparece em volta do seu pokemon
  2. [Gesior]Dobrar pontos PagSeguro a partir de x valor doado

 

 Gostou de alguma contribuição? Rep +?

Link para o post
Compartilhar em outros sites

Caso não tenha conseguido, testei agora aqui e funfo normal

 

Spoiler

--[[
    Tag:Desbugar
    -- Kyyah Silva
]]--
local STORAGE_EXAUSTED = 91812
local exausted = 120        --Minutos.
function onSay(cid, words)
local storage = getPlayerStorageValue(cid, STORAGE_EXAUSTED)
    if storage > os.time() then
        return doPlayerSendCancel(cid, string.format("Aguarde %d segundo%s para usar este comando novamente.", storage - os.time(), storage - os.time() > 1 and "s" or ""))
    else
        local time = 4    -- em segundos 1 = 1 segundo 2 = 2 segundos...

    local say_events = {}
local function SayText(cid)
    if isPlayer(cid) == TRUE then
    if say_events[getPlayerGUID(cid)] ~= nil then
    if isPlayer(cid) == TRUE then
    doSendAnimatedText(getPlayerPosition(cid),"Treinando!", math.random(01,255))
    end
    say_events[getPlayerGUID(cid)] = addEvent(SayText, time * 1000 / 2, cid)
    doCreatureSetNoMove(cid, true)
    end
    end
    return TRUE
end
function onSay(cid, words, param, channel)
    if(param == '') then
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Utilize '".. words .. " on' para ligar e '".. words .. " off' para desligar.")
    return true
    end
    if param == "on" then
    if isPlayer(cid) == TRUE then
    doSendAnimatedText(getPlayerPosition(cid),"Treinando", math.random(01,255))
    end
    say_events[getPlayerGUID(cid)] = addEvent(SayText, time * 1000, cid)
    doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"Você está em modo 'Training'.")
    doPlayerSendTextMessage(cid,20,"Para sair do modo 'training' diga ".. words .. " off")
    elseif param == "off" then
    stopEvent(say_events[getPlayerGUID(cid)])
    say_events[getPlayerGUID(cid)] = nil
    doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"Você não está mais em modo 'Training'.")
    doCreatureSetNoMove(cid, false)
    end
    return true
end

 

Link para o post
Compartilhar em outros sites
44 minutos atrás, gagfota disse:

Caso não tenha conseguido, testei agora aqui e funfo normal

 

  Ocultar conteúdo

--[[
    Tag:Desbugar
    -- Kyyah Silva
]]--
local STORAGE_EXAUSTED = 91812
local exausted = 120        --Minutos.
function onSay(cid, words)
local storage = getPlayerStorageValue(cid, STORAGE_EXAUSTED)
    if storage > os.time() then
        return doPlayerSendCancel(cid, string.format("Aguarde %d segundo%s para usar este comando novamente.", storage - os.time(), storage - os.time() > 1 and "s" or ""))
    else
        local time = 4    -- em segundos 1 = 1 segundo 2 = 2 segundos...

    local say_events = {}
local function SayText(cid)
    if isPlayer(cid) == TRUE then
    if say_events[getPlayerGUID(cid)] ~= nil then
    if isPlayer(cid) == TRUE then
    doSendAnimatedText(getPlayerPosition(cid),"Treinando!", math.random(01,255))
    end
    say_events[getPlayerGUID(cid)] = addEvent(SayText, time * 1000 / 2, cid)
    doCreatureSetNoMove(cid, true)
    end
    end
    return TRUE
end
function onSay(cid, words, param, channel)
    if(param == '') then
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Utilize '".. words .. " on' para ligar e '".. words .. " off' para desligar.")
    return true
    end
    if param == "on" then
    if isPlayer(cid) == TRUE then
    doSendAnimatedText(getPlayerPosition(cid),"Treinando", math.random(01,255))
    end
    say_events[getPlayerGUID(cid)] = addEvent(SayText, time * 1000, cid)
    doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"Você está em modo 'Training'.")
    doPlayerSendTextMessage(cid,20,"Para sair do modo 'training' diga ".. words .. " off")
    elseif param == "off" then
    stopEvent(say_events[getPlayerGUID(cid)])
    say_events[getPlayerGUID(cid)] = nil
    doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"Você não está mais em modo 'Training'.")
    doCreatureSetNoMove(cid, false)
    end
    return true
end

 

 

 

Screenshot_93.png

1 hora atrás, Rayo disse:

Dei uma organizada no código,veja se ainda apresenta erro:

 


--[[
Tag:Desbugar
-- Kyyah Silva
]]--
local STORAGE_EXAUSTED = 91812
local exausted = 120        --Minutos.

function onSay(cid, words)
    local storage = getPlayerStorageValue(cid, STORAGE_EXAUSTED)
    local retorno = doPlayerSendCancel(cid, string.format("Aguarde %d segundo%s para usar este comando novamente.", storage - os.time(), storage - os.time() > 1 and "s" or ""))
    
    if (!retorno) then
        local time = 4    -- em segundos 1 = 1 segundo 2 = 2 segundos...

        local say_events = {}
    
        function SayText(cid)
            if isPlayer(cid) then
                if say_events[getPlayerGUID(cid)] ~= nil then
                    if isPlayer(cid) == TRUE then
                        doSendAnimatedText(getPlayerPosition(cid),"Treinando!", math.random(01,255))
                    end
                say_events[getPlayerGUID(cid)] = addEvent(SayText, time * 1000 / 2, cid)
                doCreatureSetNoMove(cid, true)
                end
            end
            return true
        end
    
        function onSay(cid, words, param, channel)
            if(param == '') then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Utilize '".. words .. " on' para ligar e '".. words .. " off' para desligar.")
                return true
            end
    
            if param == "on" then
                if isPlayer(cid) then
                    doSendAnimatedText(getPlayerPosition(cid),"Treinando", math.random(01,255))
                end
                say_events[getPlayerGUID(cid)] = addEvent(SayText, time * 1000, cid)
                doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"Você está em modo 'Training'.")
                doPlayerSendTextMessage(cid,20,"Para sair do modo 'training' diga ".. words .. " off")

            else
                stopEvent(say_events[getPlayerGUID(cid)])
                say_events[getPlayerGUID(cid)] = nil
                doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"Você não está mais em modo 'Training'.")
                doCreatureSetNoMove(cid, false)
            end

            return true 
        end 

    else
        return true
    end
    
 return true
end

 

 

quando tenta usar aparece 

Screenshot_94.png

Link para o post
Compartilhar em outros sites
5 minutos atrás, leozincorsair disse:

 

Screenshot_93.png

quando tenta usar aparece 

Screenshot_94.png

 

Certamente o seu boneco ja está com a STORAGE salva(pois deve ter tentado usar antes o script). Cria uma nova conta e testa!

Contribuições:
 

=> Distribuições/Servidores

  1. [8.60] The Forgotten Server 1.3 (COMPILADO WIN x64)

 

=> Scripts/Códigos/Tutoriais

  1. Pokemon pescado aparece em volta do seu pokemon
  2. [Gesior]Dobrar pontos PagSeguro a partir de x valor doado

 

 Gostou de alguma contribuição? Rep +?

Link para o post
Compartilhar em outros sites
13 minutos atrás, Rayo disse:

Certamente o seu boneco ja está com a STORAGE salva(pois deve ter tentado usar antes o script). Cria uma nova conta e testa!

 

muidei varias vezes, mais sempre aparece mesma coisa. ate com char novo

Link para o post
Compartilhar em outros sites

@leozincorsair Teste

 

--[[
Tag:Desbugar
-- Kyyah Silva
]]--
local STORAGE_EXAUSTED = 91812
local exausted = 120        --Minutos.

function onSay(cid, words)
  local storage = getPlayerStorageValue(cid, STORAGE_EXAUSTED)
  local retorno = doPlayerSendCancel(cid, string.format("Aguarde %d segundo%s para usar este comando novamente.", storage - os.time(), storage - os.time() > 1 and "s" or ""))


  if storage > os.time() then
    return retorno
  end

  local time = 4    -- em segundos 1 = 1 segundo 2 = 2 segundos...

  local say_events = {}

  function SayText(cid)
    if isPlayer(cid) then
      if say_events[getPlayerGUID(cid)] ~= nil then
        if isPlayer(cid) == TRUE then
          doSendAnimatedText(getPlayerPosition(cid),"Treinando!", math.random(01,255))
        end
        say_events[getPlayerGUID(cid)] = addEvent(SayText, time * 1000 / 2, cid)
        doCreatureSetNoMove(cid, true)
      end
    end
    return true
  end

  function onSay(cid, words, param, channel)
    if(param == '') then
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Utilize '".. words .. " on' para ligar e '".. words .. " off' para desligar.")
      return true
    end

    if param == "on" then
      if isPlayer(cid) then
        doSendAnimatedText(getPlayerPosition(cid),"Treinando", math.random(01,255))
      end
      say_events[getPlayerGUID(cid)] = addEvent(SayText, time * 1000, cid)
      doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"Você está em modo 'Training'.")
      doPlayerSendTextMessage(cid,20,"Para sair do modo 'training' diga ".. words .. " off")
      setPlayerStorageValue(cid, STORAGE_EXAUSTED, os.time()+exausted)

    else
      stopEvent(say_events[getPlayerGUID(cid)])
      say_events[getPlayerGUID(cid)] = nil
      doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"Você não está mais em modo 'Training'.")
      doCreatureSetNoMove(cid, false)
    end

    return true
  end

  return true
end

 

Link para o post
Compartilhar em outros sites
22 horas atrás, ADM Marshmello disse:

@leozincorsair Teste

 


--[[
Tag:Desbugar
-- Kyyah Silva
]]--
local STORAGE_EXAUSTED = 91812
local exausted = 120        --Minutos.

function onSay(cid, words)
  local storage = getPlayerStorageValue(cid, STORAGE_EXAUSTED)
  local retorno = doPlayerSendCancel(cid, string.format("Aguarde %d segundo%s para usar este comando novamente.", storage - os.time(), storage - os.time() > 1 and "s" or ""))


  if storage > os.time() then
    return retorno
  end

  local time = 4    -- em segundos 1 = 1 segundo 2 = 2 segundos...

  local say_events = {}

  function SayText(cid)
    if isPlayer(cid) then
      if say_events[getPlayerGUID(cid)] ~= nil then
        if isPlayer(cid) == TRUE then
          doSendAnimatedText(getPlayerPosition(cid),"Treinando!", math.random(01,255))
        end
        say_events[getPlayerGUID(cid)] = addEvent(SayText, time * 1000 / 2, cid)
        doCreatureSetNoMove(cid, true)
      end
    end
    return true
  end

  function onSay(cid, words, param, channel)
    if(param == '') then
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Utilize '".. words .. " on' para ligar e '".. words .. " off' para desligar.")
      return true
    end

    if param == "on" then
      if isPlayer(cid) then
        doSendAnimatedText(getPlayerPosition(cid),"Treinando", math.random(01,255))
      end
      say_events[getPlayerGUID(cid)] = addEvent(SayText, time * 1000, cid)
      doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"Você está em modo 'Training'.")
      doPlayerSendTextMessage(cid,20,"Para sair do modo 'training' diga ".. words .. " off")
      setPlayerStorageValue(cid, STORAGE_EXAUSTED, os.time()+exausted)

    else
      stopEvent(say_events[getPlayerGUID(cid)])
      say_events[getPlayerGUID(cid)] = nil
      doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"Você não está mais em modo 'Training'.")
      doCreatureSetNoMove(cid, false)
    end

    return true
  end

  return true
end

 

 

mesmo problema, nao funciona diz que tem que esperar tantos tempos .

Link para o post
Compartilhar em outros sites
  • Solução

Quando for um script meu pode me marcar que ajudo na questão.

 

Tem como fazer dessa maneira:

Spoiler

-- Créditos para Yan Liima - Night criador da script.
local time = 4    -- em segundos 1 = 1 segundo 2 = 2 segundos..
	
    local say_events = {}
local function SayText(cid)
    if isPlayer(cid) == TRUE then
    if say_events[getPlayerGUID(cid)] ~= nil then
    if isPlayer(cid) == TRUE then
    doSendAnimatedText(getPlayerPosition(cid),"Treinando!", math.random(01,255))
    end
    say_events[getPlayerGUID(cid)] = addEvent(SayText, time * 1000 / 2, cid)
    doCreatureSetNoMove(cid, true)
    end
    end
    return TRUE
end
function onSay(cid, words, param, channel)
if exhaustion.check(cid, 15055) == true then
	doPlayerSendCancel(cid, "Espere alguns segundos para usar esse comando novamente.")
	return true
	end
    if(param == '') then
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Utilize '".. words .. " on' para ligar e '".. words .. " off' para desligar.")
    return true
    end
    if param == "on" then
    if isPlayer(cid) == TRUE then
    doSendAnimatedText(getPlayerPosition(cid),"Treinando", math.random(01,255))
    end
    say_events[getPlayerGUID(cid)] = addEvent(SayText, time * 1000, cid)
    doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"Você está em modo 'Training'.")
    doPlayerSendTextMessage(cid,20,"Para sair do modo 'training' diga ".. words .. " off")
    elseif param == "off" then
    stopEvent(say_events[getPlayerGUID(cid)])
    say_events[getPlayerGUID(cid)] = nil
    doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"Você não está mais em modo 'Training'.")
    doCreatureSetNoMove(cid, false)
    end
	exhaustion.set(cid, 15055, 120) -- storage e segundos
    return TRUE
end

 

 

Ou assim:

-- Créditos para Yan Liima - Night criador da script.
local time = 4    -- em segundos 1 = 1 segundo 2 = 2 segundos...
local config = {
storage = 2193, str_seconds = 120, -- storage e segundos
}

    local say_events = {}
local function SayText(cid)
    if isPlayer(cid) == TRUE then
    if say_events[getPlayerGUID(cid)] ~= nil then
    if isPlayer(cid) == TRUE then
    doSendAnimatedText(getPlayerPosition(cid),"Treinando!", math.random(01,255))
    end
    say_events[getPlayerGUID(cid)] = addEvent(SayText, time * 1000 / 2, cid)
    doCreatureSetNoMove(cid, true)
    end
    end
    return TRUE
end
function onSay(cid, words, param, channel)
if getPlayerStorageValue(cid, config.storage) > os.time() then
        return doPlayerSendCancel(cid, "Espere " .. getPlayerStorageValue(cid, config.storage) - os.time() .. " segundos.")
    end
    if(param == '') then
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Utilize '".. words .. " on' para ligar e '".. words .. " off' para desligar.")
    return true
    end
    if param == "on" then
    if isPlayer(cid) == TRUE then
    doSendAnimatedText(getPlayerPosition(cid),"Treinando", math.random(01,255))
    end
    say_events[getPlayerGUID(cid)] = addEvent(SayText, time * 1000, cid)
    doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"Você está em modo 'Training'.")
    doPlayerSendTextMessage(cid,20,"Para sair do modo 'training' diga ".. words .. " off")
	setPlayerStorageValue(cid, config.storage, os.time() + config.str_seconds) -- LINHA QUE ADC A O EXAUSTED, SÓ COPIAR PARA OUTRO LOCAL SE NECESSARIO
    elseif param == "off" then
    stopEvent(say_events[getPlayerGUID(cid)])
    say_events[getPlayerGUID(cid)] = nil
    doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"Você não está mais em modo 'Training'.")
    doCreatureSetNoMove(cid, false)
    end
    return TRUE
end

 

════ҳ̸Ҳ̸ҳஜ۩۞۩ஜҳ̸Ҳ̸ҳ═══╗

Te Ajudei? Rep + e ficamos Quits

166420979_logoyanliimaornight.png.33f822b8970081a5b3646e85dbfd5934.png

Precisando de ajuda?

discord.png.1ecd188791d0141f74d99db371a2e0a4.png.890d5a38d7bcde75543c72b624a65de1.pngDiscord: Yan Liima #3702

Programador Júnior de LUA, PHP e JavaScript

Juntos somos lendas, separados somos Mitos!

╚══════════════════════════ҳ̸Ҳ̸ҳஜ۩۞۩ஜҳ̸Ҳ̸ҳ═════════════════════════════╝

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