• 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 put exhaustion on this item, or time to use again

sallem

Member
Joined
Nov 18, 2024
Messages
20
Reaction score
14
function onUse(cid, item, frompos, item2, topos)
ppos = getPlayerPosition(cid)
temple = getPlayerMasterPos(cid)
if (getCreatureCondition(cid, CONDITION_INFIGHT) == FALSE) then
doTeleportThing(cid, temple, TRUE)
doSendMagicEffect(getCreaturePosition(cid), 10)
else
doPlayerSendCancel(cid,"You can't teleport immediately after fight.")
doSendMagicEffect(ppos,2)
end
return 1
end

teleport scroll - tfs 0.3.6
 
Solution
teleport scroll - tfs 0.3.6
LUA:
function onUse(cid, item, frompos, item2, topos)
    local ppos = getPlayerPosition(cid)
    local temple = getPlayerMasterPos(cid)
    
    -- Define ExhaustTime
    local exhaustTime = 5
    local lastUse = getPlayerStorageValue(cid, 12345) -- Define storage value
    
    if (os.time() - lastUse) < exhaustTime then
        doPlayerSendCancel(cid, "You can't teleport, you are delayed.")
        doSendMagicEffect(ppos, 2)
        return false
    end
    
    if getCreatureCondition(cid, CONDITION_INFIGHT) == FALSE then
        setPlayerStorageValue(cid, 12345, os.time())
        doTeleportThing(cid, temple, TRUE)
        doSendMagicEffect(getCreaturePosition(cid), 10)
    else...
teleport scroll - tfs 0.3.6
LUA:
function onUse(cid, item, frompos, item2, topos)
    local ppos = getPlayerPosition(cid)
    local temple = getPlayerMasterPos(cid)
    
    -- Define ExhaustTime
    local exhaustTime = 5
    local lastUse = getPlayerStorageValue(cid, 12345) -- Define storage value
    
    if (os.time() - lastUse) < exhaustTime then
        doPlayerSendCancel(cid, "You can't teleport, you are delayed.")
        doSendMagicEffect(ppos, 2)
        return false
    end
    
    if getCreatureCondition(cid, CONDITION_INFIGHT) == FALSE then
        setPlayerStorageValue(cid, 12345, os.time())
        doTeleportThing(cid, temple, TRUE)
        doSendMagicEffect(getCreaturePosition(cid), 10)
    else
        doPlayerSendCancel(cid, "You can't teleport during fight.")
        doSendMagicEffect(ppos, 2)
    end

    return true
end
 
Solution
LUA:
function onUse(cid, item, frompos, item2, topos)
    local ppos = getPlayerPosition(cid)
    local temple = getPlayerMasterPos(cid)
   
    -- Define ExhaustTime
    local exhaustTime = 5
    local lastUse = getPlayerStorageValue(cid, 12345) -- Define storage value
   
    if (os.time() - lastUse) < exhaustTime then
        doPlayerSendCancel(cid, "You can't teleport, you are delayed.")
        doSendMagicEffect(ppos, 2)
        return false
    end
   
    if getCreatureCondition(cid, CONDITION_INFIGHT) == FALSE then
        setPlayerStorageValue(cid, 12345, os.time())
        doTeleportThing(cid, temple, TRUE)
        doSendMagicEffect(getCreaturePosition(cid), 10)
    else
        doPlayerSendCancel(cid, "You can't teleport during fight.")
        doSendMagicEffect(ppos, 2)
    end

    return true
end
It worked, thanks !!! +rep
 
Back
Top