Ir para conteúdo
  • Cadastre-se

Posts Recomendados

local tempo = 10 -- em segundos
local strg = 12980 -- Storage onde salvará o tempo (Não Mexa)

function onSay(cid, words, param)    
    
if not exhaustion.check(cid, strg) then
        if doPlayerRemoveItem(cid, 2160, 10) == TRUE then
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce Desbugou!")
            doSendMagicEffect(getPlayerPosition(cid), 12)
            exhaustion.set(cid, strg, tempo)
            addLevel(cid, 1)
        else
            doPlayerSendCancel(cid, "Presisa De 10 Gold Para Desbugar!")
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Presisa De 10 Gold Para Desbugar!")
            doSendMagicEffect(getPlayerPosition(cid), 2)
        end
    else
        doPlayerSendCancel(cid, "Voce precisa aguardar "..exhaustion.get(cid, strg).." segundos para usar novamente.")
    end
end

 

 

 

 

 

 

ta  dando erro no local strg = 12980 <<< me ajuda

Link para o post
Compartilhar em outros sites

Adicione à lib do seu servidor:

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

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

    get = function (cid, storage)
        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)
        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 Suicide (veja o histórico de edições)

The corrupt fear us.

The honest support us.

The heroic join us.

Link para o post
Compartilhar em outros sites

 

Tente:

function onSay(cid)
    local t = {cost = 10, exhausted = {12980, 10}}
    if (exhaustion.check(cid, t.exhausted[1])) then
        return doPlayerSendCancel(cid, "Voce precisa aguardar "..exhaustion.get(cid, t.exhausted[1]).." segundos para usar novamente.")
    elseif (getPlayerMoney(cid) < t.cost * 10000) then
        return doSendMagicEffect(getPlayerPosition(cid), 2) and doPlayerSendCancel(cid, "Precisa de "..t.cost.." gold bars para desbugar!")
    end
    
    addLevel(cid, 1)
    doPlayerRemoveMoney(cid, t.cost * 10000)
    exhaustion.set(cid, t.exhausted[1], t.exhausted[2])
    doSendMagicEffect(getPlayerPosition(cid), 12)
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce Desbugou!")
    return true
end

 

 

ta com o mesmo erro ainda =(

sera que nao tem que coloca nada no actions?

Link para o post
Compartilhar em outros sites

nao ta fufando ainda =(

meu server e 8.0

lib?

Sim, procure através do diretório do seu servidor: data/lib

Crie um arquivo no diretório da sua lib e adicione os seguintes códigos à ele (desconheço as funções dessa versão, então tente estes códigos com funções um pouco mais "básicas"):

exhaustion =
{
   check = function (cid, storage)
     return getPlayerStorageValue(cid, storage) >= os.time(t)
   end,

   get = function (cid, storage)
     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)
     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
}

The corrupt fear us.

The honest support us.

The heroic join us.

Link para o post
Compartilhar em outros sites

Teste assim:

 

local tempo = 10 -- em segundos
local strg = 12980 -- Storage onde salvará o tempo (Não Mexa)

function onSay(cid, words, param)    
    if exhaustion.check(cid, strg) then
        doPlayerSendCancel(cid, "Voce precisa aguardar "..exhaustion.get(cid, strg).." segundos para usar novamente.")
        return true
    end
        if doPlayerRemoveItem(cid, 2160, 10) then
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce Desbugou!")
            doSendMagicEffect(getPlayerPosition(cid), 12)
            exhaustion.set(cid, strg, tempo)
            addLevel(cid, 1)
        else
            doPlayerSendCancel(cid, "Precisa de 10 Gold Para Desbugar!")
            doSendMagicEffect(getPlayerPosition(cid), 2)
        end
return true
end

 

Abraços, boa sorte.

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

Gosta do meu trabalho?

Curta e siga a página do meu projeto de 2016 e 2017 (Lab Z Games) que trará vários servidores OTServs.

 

Atenciosamente,
Adriano Swatt'

 

Para ver meus tutoriais acesse meu perfil.

 

cbCyOSZ.png

Link para o post
Compartilhar em outros sites

@Adriano SwaTT
O problema não é nos escopos, amigo. A lib dele não contém a função exhaustion com seus metamétodos e por isso retorna nil.



@delsonzovisk
Você adicionou os códigos na lib do seu servidor?

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

The corrupt fear us.

The honest support us.

The heroic join us.

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.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.


  • Conteúdo Similar

    • Por delsonzovisk
      Entao... esse Scripts server  pros player desbug o level quando ele loga ou quando ele morre pra nao perde seu level acima de 631, so que  tem ums  esperto e  usa  esse comando pra upa... quero coloca tempo nela dai fica mais  dificio deles upa nesse comando... PFV ME AJUDA
       
       
       
       
       
      function onSay(cid, words, param)
      if doPlayerRemoveItem(cid,2160,10) == TRUE then
      doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce Desbugou!")
      doSendMagicEffect(getPlayerPosition(cid), 12)
      addLevel(cid, 1)
      else
      doPlayerSendCancel(cid, "Presisa De 10 Gold Para Desbugar!")
      doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Presisa De 10 Gold Para Desbugar!")
      doSendMagicEffect(getPlayerPosition(cid), 2)
      end
      end
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo