• 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 Exhaustion music items?

chupaescadatri

Banned User
Joined
Jul 5, 2014
Messages
338
Reaction score
49
Code:
local HORN = 2079
local BIRD_CAGE = 2095
local WOODEN_WHISTLE = 5786
local DIDGERIDOO = 3952
local CORNUCOPIA = 2369
local PARTY_TRUMPET = 6572
local USED_PARTY_TRUMPET = 6573

local GREEN_NOTES = {2070, 2071, 2073, 2075, 2076, 2078, 2367, 2374}
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local random = math.random(1, 5)
    if(item.itemid == BIRD_CAGE) then
        doSendMagicEffect(fromPosition, CONST_ME_SOUND_YELLOW)
    elseif(item.itemid == DIDGERIDOO) then
        if(random == 1) then
            doSendMagicEffect(fromPosition, CONST_ME_SOUND_BLUE)
            return true
        end
    elseif(item.itemid == PARTY_TRUMPET) then
        doTransformItem(item.uid, USED_PARTY_TRUMPET)
        doCreatureSay(cid, "TOOOOOOT!", TALKTYPE_ORANGE_1)

        doSendMagicEffect(fromPosition, CONST_ME_SOUND_BLUE)
        doDecayItem(item.uid)
    elseif(item.itemid == CORNUCOPIA) then
        for i = 1, 11 do
            doPlayerAddItem(cid, 2681)
        end

        doRemoveItem(item.uid, 1)
        doSendMagicEffect(fromPosition, CONST_ME_SOUND_YELLOW)
    elseif(item.itemid == WOODEN_WHISTLE) then
        if(random == 2) then
            doSendMagicEffect(fromPosition, CONST_ME_SOUND_RED)
            doRemoveItem(item.uid, 1)
            return true
        end

        local position = getPlayerPosition(cid)
        position.x = position.x + 1

        doSendMagicEffect(fromPosition, CONST_ME_SOUND_PURPLE)
        doSummonCreature("Wolf", pos)
    else
        local effect = CONST_ME_SOUND_BLUE
        if(item.itemid == HORN) then
            effect = CONST_ME_SOUND_PURPLE
        elseif(isInArray(GREEN_NOTES, item.itemid)) then
            effect = CONST_ME_SOUND_GREEN
        end

        doSendMagicEffect(fromPosition, effect)
    end

    return true
end
I'm very noob, how do I put an exausted on this lua?
this lua belongs to all the musical instruments
 
Solution
Lua:
local storage = 9988
local time_delay = 5 --- amount of time in seconds


local HORN = 2079
local BIRD_CAGE = 2095
local WOODEN_WHISTLE = 5786
local DIDGERIDOO = 3952
local CORNUCOPIA = 2369
local PARTY_TRUMPET = 6572
local USED_PARTY_TRUMPET = 6573

local GREEN_NOTES = {2070, 2071, 2073, 2075, 2076, 2078, 2367, 2374}
function onUse(cid, item, fromPosition, itemEx, toPosition)

    if(exhaustion.check(cid, storage) == true) then
        doPlayerSendCancel(cid, 'You are exhausted.')
        return false
    end
   
    exhaustion.set(cid, storage, time_delay)
   
    local random = math.random(1, 5)
    if(item.itemid == BIRD_CAGE) then
        doSendMagicEffect(fromPosition, CONST_ME_SOUND_YELLOW)
    elseif(item.itemid ==...
Lua:
local HORN = 2079
local BIRD_CAGE = 2095
local WOODEN_WHISTLE = 5786
local DIDGERIDOO = 3952
local CORNUCOPIA = 2369
local PARTY_TRUMPET = 6572
local USED_PARTY_TRUMPET = 6573

local GREEN_NOTES = {2070, 2071, 2073, 2075, 2076, 2078, 2367, 2374}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local storage = 1000
local time = 1000 --- amount of time
if(exhaustion.check(cid, storage) == false) then

local random = math.random(1, 5)
    if(item.itemid == BIRD_CAGE) then
        doSendMagicEffect(fromPosition, CONST_ME_SOUND_YELLOW)
    elseif(item.itemid == DIDGERIDOO) then
        if(random == 1) then
            doSendMagicEffect(fromPosition, CONST_ME_SOUND_BLUE)
            return true
        end
    elseif(item.itemid == PARTY_TRUMPET) then
        doTransformItem(item.uid, USED_PARTY_TRUMPET)
        doCreatureSay(cid, "TOOOOOOT!", TALKTYPE_ORANGE_1)

        doSendMagicEffect(fromPosition, CONST_ME_SOUND_BLUE)
        doDecayItem(item.uid)
    elseif(item.itemid == CORNUCOPIA) then
        for i = 1, 11 do
            doPlayerAddItem(cid, 2681)
        end

        doRemoveItem(item.uid, 1)
        doSendMagicEffect(fromPosition, CONST_ME_SOUND_YELLOW)
    elseif(item.itemid == WOODEN_WHISTLE) then
        if(random == 2) then
            doSendMagicEffect(fromPosition, CONST_ME_SOUND_RED)
            doRemoveItem(item.uid, 1)
            return true
        end

        local position = getPlayerPosition(cid)
        position.x = position.x + 1

        doSendMagicEffect(fromPosition, CONST_ME_SOUND_PURPLE)
        doSummonCreature("Wolf", pos)
    else
        local effect = CONST_ME_SOUND_BLUE
        if(item.itemid == HORN) then
            effect = CONST_ME_SOUND_PURPLE
        elseif(isInArray(GREEN_NOTES, item.itemid)) then
            effect = CONST_ME_SOUND_GREEN
        end

        doSendMagicEffect(fromPosition, effect)
    end

    return true
end
       
exhaustion.set(cid, storage, time)
else
    doPlayerSendCancel(cid, 'You are exhausted.')
end
return TRUE
end
 
Lua:
local HORN = 2079
local BIRD_CAGE = 2095
local WOODEN_WHISTLE = 5786
local DIDGERIDOO = 3952
local CORNUCOPIA = 2369
local PARTY_TRUMPET = 6572
local USED_PARTY_TRUMPET = 6573

local GREEN_NOTES = {2070, 2071, 2073, 2075, 2076, 2078, 2367, 2374}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local storage = 1000
local time = 1000 --- amount of time
if(exhaustion.check(cid, storage) == false) then

local random = math.random(1, 5)
    if(item.itemid == BIRD_CAGE) then
        doSendMagicEffect(fromPosition, CONST_ME_SOUND_YELLOW)
    elseif(item.itemid == DIDGERIDOO) then
        if(random == 1) then
            doSendMagicEffect(fromPosition, CONST_ME_SOUND_BLUE)
            return true
        end
    elseif(item.itemid == PARTY_TRUMPET) then
        doTransformItem(item.uid, USED_PARTY_TRUMPET)
        doCreatureSay(cid, "TOOOOOOT!", TALKTYPE_ORANGE_1)

        doSendMagicEffect(fromPosition, CONST_ME_SOUND_BLUE)
        doDecayItem(item.uid)
    elseif(item.itemid == CORNUCOPIA) then
        for i = 1, 11 do
            doPlayerAddItem(cid, 2681)
        end

        doRemoveItem(item.uid, 1)
        doSendMagicEffect(fromPosition, CONST_ME_SOUND_YELLOW)
    elseif(item.itemid == WOODEN_WHISTLE) then
        if(random == 2) then
            doSendMagicEffect(fromPosition, CONST_ME_SOUND_RED)
            doRemoveItem(item.uid, 1)
            return true
        end

        local position = getPlayerPosition(cid)
        position.x = position.x + 1

        doSendMagicEffect(fromPosition, CONST_ME_SOUND_PURPLE)
        doSummonCreature("Wolf", pos)
    else
        local effect = CONST_ME_SOUND_BLUE
        if(item.itemid == HORN) then
            effect = CONST_ME_SOUND_PURPLE
        elseif(isInArray(GREEN_NOTES, item.itemid)) then
            effect = CONST_ME_SOUND_GREEN
        end

        doSendMagicEffect(fromPosition, effect)
    end

    return true
end
      
exhaustion.set(cid, storage, time)
else
    doPlayerSendCancel(cid, 'You are exhausted.')
end
return TRUE
end
You cannot use this object :(
 
Lua:
local storage = 9988
local time_delay = 5 --- amount of time in seconds


local HORN = 2079
local BIRD_CAGE = 2095
local WOODEN_WHISTLE = 5786
local DIDGERIDOO = 3952
local CORNUCOPIA = 2369
local PARTY_TRUMPET = 6572
local USED_PARTY_TRUMPET = 6573

local GREEN_NOTES = {2070, 2071, 2073, 2075, 2076, 2078, 2367, 2374}
function onUse(cid, item, fromPosition, itemEx, toPosition)

    if(exhaustion.check(cid, storage) == true) then
        doPlayerSendCancel(cid, 'You are exhausted.')
        return false
    end
   
    exhaustion.set(cid, storage, time_delay)
   
    local random = math.random(1, 5)
    if(item.itemid == BIRD_CAGE) then
        doSendMagicEffect(fromPosition, CONST_ME_SOUND_YELLOW)
    elseif(item.itemid == DIDGERIDOO) then
        if(random == 1) then
            doSendMagicEffect(fromPosition, CONST_ME_SOUND_BLUE)
            return true
        end
    elseif(item.itemid == PARTY_TRUMPET) then
        doTransformItem(item.uid, USED_PARTY_TRUMPET)
        doCreatureSay(cid, "TOOOOOOT!", TALKTYPE_ORANGE_1)

        doSendMagicEffect(fromPosition, CONST_ME_SOUND_BLUE)
        doDecayItem(item.uid)
    elseif(item.itemid == CORNUCOPIA) then
        for i = 1, 11 do
            doPlayerAddItem(cid, 2681)
        end

        doRemoveItem(item.uid, 1)
        doSendMagicEffect(fromPosition, CONST_ME_SOUND_YELLOW)
    elseif(item.itemid == WOODEN_WHISTLE) then
        if(random == 2) then
            doSendMagicEffect(fromPosition, CONST_ME_SOUND_RED)
            doRemoveItem(item.uid, 1)
            return true
        end

        local position = getPlayerPosition(cid)
        position.x = position.x + 1

        doSendMagicEffect(fromPosition, CONST_ME_SOUND_PURPLE)
        doSummonCreature("Wolf", pos)
    else
        local effect = CONST_ME_SOUND_BLUE
        if(item.itemid == HORN) then
            effect = CONST_ME_SOUND_PURPLE
        elseif(isInArray(GREEN_NOTES, item.itemid)) then
            effect = CONST_ME_SOUND_GREEN
        end

        doSendMagicEffect(fromPosition, effect)
    end

    return true
end
 
Last edited:
Solution
Lua:
local storage = 9988
local time_delay = 5 --- amount of time in seconds


local HORN = 2079
local BIRD_CAGE = 2095
local WOODEN_WHISTLE = 5786
local DIDGERIDOO = 3952
local CORNUCOPIA = 2369
local PARTY_TRUMPET = 6572
local USED_PARTY_TRUMPET = 6573

local GREEN_NOTES = {2070, 2071, 2073, 2075, 2076, 2078, 2367, 2374}
function onUse(cid, item, fromPosition, itemEx, toPosition)

    if(exhaustion.check(cid, storage) == true) then
        doPlayerSendCancel(cid, 'You are exhausted.')
        return false
    end
  
    exhaustion.set(cid, storage, time_delay)
  
    local random = math.random(1, 5)
    if(item.itemid == BIRD_CAGE) then
        doSendMagicEffect(fromPosition, CONST_ME_SOUND_YELLOW)
    elseif(item.itemid == DIDGERIDOO) then
        if(random == 1) then
            doSendMagicEffect(fromPosition, CONST_ME_SOUND_BLUE)
            return true
        end
    elseif(item.itemid == PARTY_TRUMPET) then
        doTransformItem(item.uid, USED_PARTY_TRUMPET)
        doCreatureSay(cid, "TOOOOOOT!", TALKTYPE_ORANGE_1)

        doSendMagicEffect(fromPosition, CONST_ME_SOUND_BLUE)
        doDecayItem(item.uid)
    elseif(item.itemid == CORNUCOPIA) then
        for i = 1, 11 do
            doPlayerAddItem(cid, 2681)
        end

        doRemoveItem(item.uid, 1)
        doSendMagicEffect(fromPosition, CONST_ME_SOUND_YELLOW)
    elseif(item.itemid == WOODEN_WHISTLE) then
        if(random == 2) then
            doSendMagicEffect(fromPosition, CONST_ME_SOUND_RED)
            doRemoveItem(item.uid, 1)
            return true
        end

        local position = getPlayerPosition(cid)
        position.x = position.x + 1

        doSendMagicEffect(fromPosition, CONST_ME_SOUND_PURPLE)
        doSummonCreature("Wolf", pos)
    else
        local effect = CONST_ME_SOUND_BLUE
        if(item.itemid == HORN) then
            effect = CONST_ME_SOUND_PURPLE
        elseif(isInArray(GREEN_NOTES, item.itemid)) then
            effect = CONST_ME_SOUND_GREEN
        end

        doSendMagicEffect(fromPosition, effect)
    end

    return true
end
thanks
 
Back
Top