if globalexhaustion.check(storage) then
doTeleportThing(cid, fromPosition)
end
-- to set storage
globalexhaustion.set(storage, time)
globalexhaustion =
{
check = function (storage)
return getGlobalStorageValue(storage) >= os.time(t)
end,
get = function (storage)
local exhaust = getGlobalStorageValue(storage)
if(exhaust > 0) then
local left = exhaust - os.time(t)
if(left >= 0) then
return left
end
end
return false
end,
set = function (storage, time)
setGlobalStorageValue(storage, os.time(t) + time)
end,
make = function (storage, time)
local exhaust = globalexhaustion.get(storage)
if(not exhaust) then
globalexhaustion.set(storage, time)
return true
end
return false
end
}
local storage = 9853
local time = 10 -- time in seconds
function onStepIn(cid, item, position, fromPosition)
-- this part will check if the time isn't over yet, then it will teleport/push the player back
if globalexhaustion.check(storage) then
return doTeleportThing(cid, fromPosition)
end
-- what your script does here
-- to set storage
globalexhaustion.set(storage, time)
return true
end
local storage = 9853
local time = 10 -- time in seconds
function onStepIn(cid, item, position, fromPosition)
if globalexhaustion.check(storage) then
doTeleportThing(cid, fromPosition)
doPlayerSendCancel(cid, "You need to wait "..globalexhaustion.get(storage).." seconds before you can enter here again.")
return true
end
doTeleportThing(cid, {x = 95, y = 120, z = 7})
globalexhaustion.set(storage, time)
return true
end
local storage = 9853
local time = 10 -- time in seconds
function onStepIn(cid, item, position, fromPosition)
if globalexhaustion.check(storage) then
addEvent(doTeleportThing, 100, cid, fromPosition)
doPlayerSendCancel(cid, "You need to wait "..globalexhaustion.get(storage).." seconds before you can enter here again.")
return true
end
globalexhaustion.set(storage, time)
return true
end
globalexhaustion.check(storage + item.actionid)
globalexhaustion.get(storage + item.actionid)
globalexhaustion.set(storage + item.actionid, time)
if item.actionid == 0 then
return true
end
local storage = 9854
local time = 300 --time in seconds
function onStepIn(cid, item, position, fromPosition)
if item.actionid == 9853 then
if globalexhaustion.check(storage + item.actionid) then
doTeleportThing(cid, fromPosition)
doPlayerSendCancel(cid, "You need to wait "..globalexhaustion.get(storage + item.actionid).." seconds before entering this instance")
return true
end
end
doTeleportThing(cid, {x = 2079, y = 1992, x = 11})
globalexhaustion.set(storage + item.actionid, time)
return true
end
local storage = 9853
local time = 300 -- time in seconds
function onStepIn(cid, item, position, fromPosition)
if item.actionid == 0 then
return true
end
if globalexhaustion.check(storage + item.actionid) then
addEvent(doTeleportThing, 100, cid, fromPosition)
doPlayerSendCancel(cid, "You need to wait "..globalexhaustion.get(storage + item.actionid).." seconds before entering this instance.")
return true
end
globalexhaustion.set(storage + item.actionid, time)
return true
end