• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua how add exaust potions in this script 1.2

gubbo123

New Member
Joined
Aug 15, 2017
Messages
151
Solutions
1
Reaction score
3
Hello, how can i add a exaust of 1000 after this code part

Lua:
    if target:isCreature() and target == player then

        if item:getFluidType() == FLUID_NONE then

            player:sendCancelMessage("It is empty.")



Lua:
function onUse(player, item, fromPosition, target, toPosition)
    local targetItemType = ItemType(target:getId())
    if targetItemType and targetItemType:isFluidContainer() then
            if target:getFluidType() == 0 and item:getFluidType() ~= 0 then
            target:transform(target:getId(), item:getFluidType())
            item:transform(item:getId(), 0)
            return true
        elseif item:getFluidType() == 0 and target:getFluidType() ~= 0 then
            return false
        elseif target:getFluidType() ~= 0 and item:getFluidType() == 0 then
            target:transform(target:getId(), 0)
            item:transform(item:getId(), target:getFluidType())
            return true
        end
    end
    
    if target:isCreature() and target == player then
        if item:getFluidType() == FLUID_NONE then
            player:sendCancelMessage("It is empty.")
        else
            local self = target == player
            if self and item:getFluidType() == FLUID_BEER or item:getFluidType() == FLUID_WINE then
                player:addCondition(drunk)
            elseif self and item:getFluidType() == FLUID_SLIME then
                player:addCondition(poison)
            elseif item:getFluidType() == FLUID_MANAFLUID then
                target:addMana(math.random(400, 800))
                target:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
            elseif item:getFluidType() == FLUID_LIFEFLUID then
                target:addHealth(math.random(500, 900))
                target:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
            end
 
try this one i did not test but it should work
Lua:
function onUse(player, item, fromPosition, target, toPosition)
local exhaustTime  = 5 -- time in seconds
local exhuststorage = 200001 -- empty storage
    local targetItemType = ItemType(target:getId())
    if targetItemType and targetItemType:isFluidContainer() then
            if target:getFluidType() == 0 and item:getFluidType() ~= 0 then
            target:transform(target:getId(), item:getFluidType())
            item:transform(item:getId(), 0)
            return true
        elseif item:getFluidType() == 0 and target:getFluidType() ~= 0 then
            return false
        elseif target:getFluidType() ~= 0 and item:getFluidType() == 0 then
            target:transform(target:getId(), 0)
            item:transform(item:getId(), target:getFluidType())
            return true
        end
    end
              

    if target:isCreature() and target == player then
     if (getPlayerStorageValue(player, exhuststorage) < os.time()) then
     setPlayerStorageValue(player, exhaustTime, os.time() + exhaustTime)
        if item:getFluidType() == FLUID_NONE then
            player:sendCancelMessage("It is empty.")
        else
        player:setExhaustion(exhStorage,exhTime)
            local self = target == player
            if self and item:getFluidType() == FLUID_BEER or item:getFluidType() == FLUID_WINE then
                player:addCondition(drunk)
            elseif self and item:getFluidType() == FLUID_SLIME then
                player:addCondition(poison)
            elseif item:getFluidType() == FLUID_MANAFLUID then
                target:addMana(math.random(400, 800))
                target:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
            elseif item:getFluidType() == FLUID_LIFEFLUID then
                target:addHealth(math.random(500, 900))
                target:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
            end
            end
            else
            doPlayerSendCancel(player, "You must wait another " .. getPlayerStorageValue(player, exhuststorage) - os.time() .. ' second' .. ((getPlayerStorageValue(player, exhuststorage) - os.time()) == 1 and "" or "s") .. ".")
            end
            end
 
Back
Top