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

Onuse Delay

icekis

Member
Joined
Jan 18, 2018
Messages
91
Reaction score
5
Hi folks

I have this script and i want to add a delay function based on events to prevent miss click

Lua:
function onUse(cid, item, frompos, item2, topos)
    local player = Player(cid)
        
        if player:getStorageValue(Storage.Quest.DjinnDoor) > 1 then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You got the access.')
            return true
        elseif player:getStorageValue(Storage.Quest.DjinnFlowerTimer) > os.time() then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Come back later.')
            return false
        else
            local rareChance = math.random(1, 2)
            if rareChance == 1 then
                    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have found a lamp.')
                    player:addItem(2344, 1)
                    player:setStorageValue(Storage.Quest.DjinnFlower, 1)
                    player:setStorageValue(Storage.Quest.DjinnFlowerTimer, os.time() + 1 * 60)
            else
                player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You could not find the lamp. Come back in a few minutes.')
                player:setStorageValue(Storage.Quest.DjinnFlowerTimer, os.time() + 1 * 60)
                return true
            end
        end

-- end


Could someone help me?
 
Back
Top