• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Delay time help!

eardrums

Member
Joined
May 27, 2010
Messages
101
Solutions
1
Reaction score
11
Hi guys! So I made this script..

Code:
function onStepIn(cid, item, pos)
if getPlayerStorageValue(cid, 34544) == -1 then
setPlayerStorageValue(cid, 34544, 1)
doSummonCreature("Magnificent Chicken", {x= 562, y= 861, z= 7})

elseif getPlayerStorageValue(cid, 34544) == 1 then
    doSummonCreature("Magnificent Chicken 2", {x= 562, y= 861, z= 7})
    setPlayerStorageValue(cid, 34544, 2)
   
    elseif getPlayerStorageValue(cid, 34544) == 2 then
    setPlayerStorageValue(cid, 34544, -1)
   
      
end
return true
end

What it basically does is summon a monster when you step on a certain sqm.. the next time you step on the sqm it summons another type of monster.. the third time you step on the sqm it does nothing but reset ur storage value so u can do it again. What i need help in is that i want between the first step on sqm and the second one to be a 10 second delay before i can summon the second one.. and a message that says you must w8 10 seconds before you summon again... thanks :D
 
Code:
function onStepIn(cid, item, pos)
    if getPlayerStorageValue(cid, 34544) == -1 then
        setPlayerStorageValue(cid, 34544, 1)
        setPlayerStorageValue(cid, 12342, os.time() + 10)
        doSummonCreature("Magnificent Chicken", {x= 562, y= 861, z= 7})
    elseif getPlayerStorageValue(cid, 34544) == 1 then
        if getCreatureStorage(cid, 12342) < os.time() then
            doSummonCreature("Magnificent Chicken 2", {x= 562, y= 861, z= 7})
            setPlayerStorageValue(cid, 34544, 2)
        else
            doPlayerSendCancel(cid, "You must wait 10 seconds to use this again.")
            doSendMagicEffect(getCreaturePosition(cid), 2)
            return false
        end
    elseif getPlayerStorageValue(cid, 34544) == 2 then
        setPlayerStorageValue(cid, 34544, -1)   
    end
return true
end
 
Back
Top