Ir para conteúdo

Featured Replies

Postado

Olá pessoal!

O script a seguir é do redbull de meu server, ao consumir o player aumenta 150 de comida e tem 5 segundos de exaustion pra usar outro novamente..

local limite = 2500 -- limite não passar de 1000
local food = {[2672] = {150, "Glup Glup"}}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    
    if exhaustion.check(cid, 23007) == false then
    exhaustion.set(cid, 23007, 5)
    else
    doPlayerSendCancel(cid, "Tempo de espera:  " ..exhaustion.get(cid, 23007).."")
    return false
    end
    
    
    if(food[item.itemid] ~= nil) then
  if(getPlayerFood(cid) + food[item.itemid][1]) >= limite then
   doPlayerSendCancel(cid, "You are full.")
  else
    doPlayerFeed(cid, food)
    doSendAnimatedText(getCreaturePosition(cid), food[item.itemid][2], TEXTCOLOR_WHITE)
    doSendMagicEffect(getCreaturePosition(cid), 25)
    doRemoveItem(item.uid, 1)
    doSendAnimatedText(getCreaturePosition(cid), "REDBUUUUL", TEXTCOLOR_BLUE)
  end
  return true
    end

        
        
return true
    end
    

    
   

 

 

gostaria que acrescentassem ao script que ao usar, a velocidade do player aumentaria para 2500 por 3 segundos

 

grato desde já!

Resolvido por Wakon

Ir para solução
  • Respostas 10
  • Visualizações 388
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Opa foi mal eu troquei o item, tente agora: local limite = 2500 -- limite não passar de 1000 --{nova velocidade, tempo que durará em segundos} local speedCfg = {2500, 3} local food = {[2672] = {150,

Postado
local limite = 2500 -- limite não passar de 1000
               --{nova velocidade, tempo que durará em segundos}
local speedCfg = {2500, 3}
local food = {[2672] = {150, "Glup Glup"}}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    
    if exhaustion.check(cid, 23007) == false then
        exhaustion.set(cid, 23007, 5)
    else
        return doPlayerSendCancel(cid, "Tempo de espera:  " ..exhaustion.get(cid, 23007).."")
    end
    
    
    if food[item.itemid] ~= nil then
        if (getPlayerFood(cid) + food[item.itemid][1]) >= limite then
            doPlayerSendCancel(cid, "You are full.")
        else
            doPlayerFeed(cid, food)
            local speed = getCreatureSpeed(cid)
            doChangeSpeed(cid, -speed)
            doChangeSpeed(cid, speedCfg[1])
            addEvent(function() if isCreature(cid) doChangeSpeed(cid, speed) end end, speedCfg[2]*1000)
            doSendAnimatedText(getCreaturePosition(cid), food[item.itemid][2], TEXTCOLOR_WHITE)
            doSendMagicEffect(getCreaturePosition(cid), 25)
            doRemoveItem(item.uid, 1)
            doSendAnimatedText(getCreaturePosition(cid), "REDBUUUULL", TEXTCOLOR_BLUE)
        end
        return true
    end

        
        
    return true
end
                              _
                          .-'` `}
                  _./)   /       }
                .'o   \ |       }
                '.___.'`.\    {`
                /`\_/  , `.    }                                      ME DA UMA NOZ!
                \=' .-'   _`\  {
                 `'`;/      `,  }
                    _\   @   ;  }
                   /__`;-...'--'

Cluck!

Postado
  • Autor

[29/05/2015 22:12:42] [Error - LuaScriptInterface::loadFile] data/actions/scripts/redbull.lua:23: 'then' expected near 'doChangeSpeed'
[29/05/2015 22:12:42] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/redbull.lua)
[29/05/2015 22:12:42] data/actions/scripts/redbull.lua:23: 'then' expected near 'doChangeSpeed'
[29/05/2015 22:12:42] Reloaded actions.
Postado

[29/05/2015 22:12:42] [Error - LuaScriptInterface::loadFile] data/actions/scripts/redbull.lua:23: 'then' expected near 'doChangeSpeed'

Substitua o conteúdo da linha 23 por:
addEvent(function() if isCreature(cid) then doChangeSpeed(cid, speed) end end, speedCfg[2]*1000)

The corrupt fear us.

The honest support us.

The heroic join us.

Postado

Substitua o conteúdo da linha 23 por:

addEvent(function() if isCreature(cid) then doChangeSpeed(cid, speed) end end, speedCfg[2]*1000)

Obrigado kk', não tinha percebido:

 

local limite = 2500 -- limite não passar de 1000
               --{nova velocidade, tempo que durará em segundos}
local speedCfg = {2500, 3}
local food = {[2672] = {150, "Glup Glup"}}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    
    if exhaustion.check(cid, 23007) == false then
        exhaustion.set(cid, 23007, 5)
    else
        return doPlayerSendCancel(cid, "Tempo de espera:  " ..exhaustion.get(cid, 23007).."")
    end
    
    
    if food[item.itemid] ~= nil then
        if (getPlayerFood(cid) + food[item.itemid][1]) >= limite then
            doPlayerSendCancel(cid, "You are full.")
        else
            doPlayerFeed(cid, food)
            local speed = getCreatureSpeed(cid)
            doChangeSpeed(cid, -speed)
            doChangeSpeed(cid, speedCfg[1])
            addEvent(function() if isCreature(cid) then doChangeSpeed(cid, speed) end end, speedCfg[2]*1000)
            doSendAnimatedText(getCreaturePosition(cid), food[item.itemid][2], TEXTCOLOR_WHITE)
            doSendMagicEffect(getCreaturePosition(cid), 25)
            doRemoveItem(item.uid, 1)
            doSendAnimatedText(getCreaturePosition(cid), "REDBUUUULL", TEXTCOLOR_BLUE)
        end
        return true
    end

        
        
    return true
end
                              _
                          .-'` `}
                  _./)   /       }
                .'o   \ |       }
                '.___.'`.\    {`
                /`\_/  , `.    }                                      ME DA UMA NOZ!
                \=' .-'   _`\  {
                 `'`;/      `,  }
                    _\   @   ;  }
                   /__`;-...'--'

Cluck!

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

Informação Importante

Confirmação de Termo