• 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 Need Script x item 8981 acess area 30 minutes with contdown movemente I already did it

samuel157

/root
Joined
Mar 19, 2010
Messages
447
Solutions
3
Reaction score
49
Location
São Paulo, Brazil
GitHub
Samuel10M
Need Script x item 8981 acess area 30 minutes with contdown movemente I already did it even logging out in the middle of time, go to the temple

Lua:
local storageValue = 13741
local itemID = 8981
local teleportPosition = {x = 150, y = 50, z = 7}
local timeInterval = 30 * 60

function onUse(cid, item, frompos, item2, topos)
    if getPlayerStorageValue(cid, storageValue) ~= -1 then
        doPlayerSendCancel(cid, "Voce ja tem acesso a essa funcionalidade.")
        return true
    end

    if not doPlayerRemoveItem(cid, itemID, 1) then
        doPlayerSendCancel(cid, "Voce precisa ter o item no set ou na bp para usar essa funcionalidade e de (use).")
        return true
    end

    local currentTime = os.time()
    local accessTime = 72 * 60 * 60
    local expirationTime = currentTime + accessTime

    setPlayerStorageValue(cid, storageValue, expirationTime)
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce Ganhou Acesso a Cave Exclusiva Por 72 Horas Bom [LEVEL-UP].")

    return true
end

function onLogin(cid)
    local currentTime = os.time()
    local expirationTime = getPlayerStorageValue(cid, storageValue)

    if expirationTime ~= -1 and currentTime >= expirationTime then
        doTeleportThing(cid, teleportPosition, false)
        setPlayerStorageValue(cid, storageValue, -1)
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Seu acesso expirou. Você foi teleportado para a posição 154, 51, 7.")
    end

    local timeDifference = currentTime - getPlayerStorageValue(cid, "lastTimeCheck")

    if timeDifference >= timeInterval then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "O tempo atual é: " .. os.date("%H:%M:%S"))
        setPlayerStorageValue(cid, "lastTimeCheck", currentTime)
    end

    return true
end
 
Lua:
local storageValue = 13741
local itemID = 8981
local teleportPosition = {x = 150, y = 50, z = 7}
local timeInterval = 30 * 60

function onUse(cid, item, frompos, item2, topos)
    if getPlayerStorageValue(cid, storageValue) ~= -1 then
        doPlayerSendCancel(cid, "Você já tem acesso a essa funcionalidade.")
        return true
    end

    if not doPlayerRemoveItem(cid, itemID, 1) then
        doPlayerSendCancel(cid, "Você precisa ter o item no set ou na bp para usar essa funcionalidade e de (use).")
        return true
    end

    local currentTime = os.time()
    local expirationTime = currentTime + timeInterval

    setPlayerStorageValue(cid, storageValue, expirationTime)
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você ganhou acesso à área por 30 minutos.")

    return true
end

function onLogin(cid)
    local currentTime = os.time()
    local expirationTime = getPlayerStorageValue(cid, storageValue)

    if expirationTime ~= -1 and currentTime >= expirationTime then
        doTeleportThing(cid, teleportPosition, false)
        setPlayerStorageValue(cid, storageValue, -1)
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Seu acesso expirou. Você foi teleportado para o templo.")
    end

    local timeDifference = currentTime - getPlayerStorageValue(cid, "lastTimeCheck")

    if timeDifference >= timeInterval then
        local remainingTime = math.floor((expirationTime - currentTime) / 60)
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Tempo restante: " .. remainingTime .. " minutos.")
        setPlayerStorageValue(cid, "lastTimeCheck", currentTime)
    end

    return true
end
 
I need that when using item 8981 it disappears and has access to the exclusive donation area for a determined time 30 minutes with contdown it stays in that area after 30 minutes it is kicked to the temple even if it has logged out before 1 minute it is kicked to the temple pos temple 154 51 7

1 minute if he logs off thinking he will have access if he thinks there is a bug but it doesn't

xp.thumb.gif.131eae7c6daac03477fa82ecc472bc2c.gif

like this, only instead of xp, it shows the access time I have in the donation area
 
Last edited:
Lua:
local storageValue = 13741
local itemID = 8981
local teleportPosition = {x = 154, y = 51, z = 7}
local timeInterval = 30 * 60

function onUse(cid, item, frompos, item2, topos)
    if getPlayerStorageValue(cid, storageValue) ~= -1 then
        doPlayerSendCancel(cid, "Você já tem acesso a essa funcionalidade.")
        return true
    end

    if not doPlayerRemoveItem(cid, itemID, 1) then
        doPlayerSendCancel(cid, "Você precisa ter o item no set ou na bp para usar essa funcionalidade e de (use).")
        return true
    end

    local currentTime = os.time()
    local expirationTime = currentTime + timeInterval

    setPlayerStorageValue(cid, storageValue, expirationTime)
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você ganhou acesso à área por 30 minutos.")

    doPlayerAddItem(cid, itemID, 1, false)  -- Adiciona o item novamente (opcional)
    doSetItemActionId(item.uid, 0)  -- Remove a action id do item (opcional)

    return true
end

function onLogin(cid)
    local currentTime = os.time()
    local expirationTime = getPlayerStorageValue(cid, storageValue)

    if expirationTime ~= -1 and currentTime >= expirationTime then
        doTeleportThing(cid, teleportPosition, false)
        setPlayerStorageValue(cid, storageValue, -1)
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Seu acesso expirou. Você foi teleportado para o templo.")
    end

    local timeDifference = currentTime - getPlayerStorageValue(cid, "lastTimeCheck")

    if timeDifference >= timeInterval then
        local remainingTime = math.floor((expirationTime - currentTime) / 60)
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Tempo restante: " .. remainingTime .. " minutos.")
        setPlayerStorageValue(cid, "lastTimeCheck", currentTime)
    end

    return true
end
 
no show time on display do client tibia MY 8.60 TFS 0.4 countdown no have type 30 29 28 27 more... Need the script with function. LIKE THAT
HELP HELP ON SCRIPT REV

Lua:
local storageValue = 13741
local itemID = 8981
local teleportPosition = {x = 154, y = 51, z = 7}
local timeInterval = 30 * 60
local config = {
    time = 12,       
    storage = 13741,
    cdstorage = 123457
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getStorageValue(config.cdstorage) >= os.time() then
        player:sendTextMessage(MESSAGE_INFO_DESCR, remainTime(player:getStorageValue(config.cdstorage) - os.time()))
        return true
    end
   
    if player:getStorageValue(config.storage) >= os.time() then
        player:sendTextMessage(MESSAGE_INFO_DESCR, "You still have extra experience time left.")
        return true
    end
   
    player:setStorageValue(config.cdstorage, os.time() + config.cd * 3600)
    player:setStorageValue(config.storage, os.time() + config.time * 3600)
    player:sendTextMessage(MESSAGE_INFO_DESCR, string.format("You have activated %d hour%s of 10x experience.", config.time, config.time ~= 1 and "s" or ""))
    item:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
    item:remove(1)
    return true
end

function remainTime(seconds)
    hrs = math.floor(seconds / 3600)
    mins = math.floor((seconds - (hrs * 3600)) / 60)
    secs = math.floor(seconds - (hrs * 3600) - mins * 60)
    return string.format("Sorry, you can only use this item again in %d hour(s), %d minute(s) and %d second(s).", hrs, mins, secs)
end
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getStorageValue(config.cdstorage) >= os.time() then
        player:sendTextMessage(MESSAGE_INFO_DESCR, remainTime(player:getStorageValue(config.cdstorage) - os.time()))
        return true
    end

function onUse(cid, item, frompos, item2, topos)
    if getPlayerStorageValue(cid, storageValue) ~= -1 then
        doPlayerSendCancel(cid, "Você já tem acesso a essa funcionalidade.")
        return true
    end

    if not doPlayerRemoveItem(cid, itemID, 1) then
        doPlayerSendCancel(cid, "Você precisa ter o item no set ou na bp para usar essa funcionalidade e de (use).")
        return true
    end

    local currentTime = os.time()
    local expirationTime = currentTime + timeInterval

    setPlayerStorageValue(cid, storageValue, expirationTime)
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você ganhou acesso à área por 30 minutos.")

    doPlayerRemoveItem(cid, itemID, 1)  -- Adiciona o item novamente (opcional)
    doSetItemActionId(item.uid, 0)  -- Remove a action id do item (opcional)
    doPlayerRemoveItem(cid, itemID, 1)

    return true
end

function onLogin(cid)
    local currentTime = os.time()
    local expirationTime = getPlayerStorageValue(cid, storageValue)

    if expirationTime ~= -1 and currentTime >= expirationTime then
        doTeleportThing(cid, teleportPosition, false)
        setPlayerStorageValue(cid, storageValue, -1)
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Seu acesso expirou. Você foi teleportado para o templo.")
    end

function remainTime(seconds)
    hrs = math.floor(seconds / 3600)
    mins = math.floor((seconds - (hrs * 3600)) / 60)
    secs = math.floor(seconds - (hrs * 3600) - mins * 60)
    return string.format("Sorry, you can only use this item again in %d hour(s), %d minute(s) and %d second(s).", hrs, mins, secs)
end

    local timeDifference = currentTime - getPlayerStorageValue(cid, "lastTimeCheck")

    if timeDifference >= timeInterval then
        local remainingTime = math.floor((expirationTime - currentTime) / 60)
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Tempo restante: " .. remainingTime .. " minutos.")
        setPlayerStorageValue(cid, "lastTimeCheck", currentTime)
    end

    return true
end
 
Last edited:
Back
Top