• 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!

exhaust for items in actions?

vexler222

Member
Joined
Apr 22, 2012
Messages
509
Solutions
7
Reaction score
15
Hi, how i can add exhaust for this item (Teleport Scroll)? I try but it not work :(

Code:
local exhaust = createConditionObject(CONDITION_EXHAUST)
    setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 10000))
function onUse(cid, item)
    if hasCondition(cid, CONDITION_INFIGHT) == TRUE then
        doPlayerSendCancel(cid, "You may not use this scroll while in-fight!")
        return FALSE
    end
   
    if hasCondition(cid, CONDITION_EXHAUST) == FALSE then
    doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
    doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), FALSE)
    doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
else doPlayerSendCancel(cid, "You can use this scroll one time per 10 second")
end
    return TRUE
end
 
Solution
Lua:
function onUse(cid, item)
    local storage = 30000
    local time = 10
    if exhaustion.check(cid, storage) then
        doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
        return doPlayerSendCancel(cid, "You are exhausted.")
    end   
    if hasCondition(cid, CONDITION_INFIGHT) == TRUE then
        doPlayerSendCancel(cid, "You may not use this scroll while in-fight!")
        return FALSE
    end
    doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
    doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), FALSE)
    doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
    exhaustion.set(cid, storage, time)
end
    return true

M0ustafa

1337
Senator
Joined
Mar 4, 2017
Messages
2,562
Solutions
316
Reaction score
1,135
Location
Egypt
Lua:
function onUse(cid, item)
    local storage = 30000
    local time = 10
    if exhaustion.check(cid, storage) then
        doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
        return doPlayerSendCancel(cid, "You are exhausted.")
    end   
    if hasCondition(cid, CONDITION_INFIGHT) == TRUE then
        doPlayerSendCancel(cid, "You may not use this scroll while in-fight!")
        return FALSE
    end
    doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
    doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), FALSE)
    doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
    exhaustion.set(cid, storage, time)
end
    return true
 
Solution
Top