Hello, I'm trying to add a setPlayerStorageValue with os.time () when using the lever, I've tried several forms and I could not, can anyone help me?
Lua:
local function removeBosst(fromArea1, fromArea2, bossName)
for x = fromArea1.x, fromArea2.x do
for y = fromArea1.y, fromArea2.y do
for z = fromArea1.z, fromArea2.z do
if(getTopCreature({x = x, y = y, z = z, stackpos = 255}).uid > 0) then
if(isMonster(getTopCreature({x = x, y = y, z = z, stackpos = 255}).uid)) then
if(string.lower(getCreatureName(getTopCreature({x = x, y = y, z = z, stackpos = 255}).uid)) == bossName) then
doRemoveCreature(getTopCreature({x = x, y = y, z = z, stackpos = 255}).uid)
end
end
end
end
end
end
return true
end
local function teleportAllPlayersFromAreat(fromArea1, fromArea2, toPos)
for x = fromArea1.x, fromArea2.x do
for y = fromArea1.y, fromArea2.y do
for z = fromArea1.z, fromArea2.z do
if(getTopCreature({x = x, y = y, z = z, stackpos = 255}).uid > 0) then
if(isPlayer(getTopCreature({x = x, y = y, z = z, stackpos = 255}).uid)) then
doTeleportThing(getTopCreature({x = x, y = y, z = z, stackpos = 255}).uid, toPos)
end
end
end
end
end
return true
end
local function PrepareEnter()
teleportAllPlayersFromAreat({x=32291,y=32225,z=7},{x=32291,y=32229,z=7},{x=32272,y=32211,z=7})
removeBosst({x=32268,y=32205,z=7}, {x=32276,y=32213,z=7}, "Rat") --
Game.createMonster("Rat", {x=32272,y=32209,z=7})
end
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if item.itemid == 9825 or 9826 then
if getGlobalStorageValue(28082) >= os.time() then
doPlayerSendTextMessage(player, 19, "You need to wait 5 minutes to use again.")
return true
end
local specs, spec = Game.getSpectators({x=32273,y=32209,z=7}, false, false, 13, 13, 13, 13)
for i = 1, #specs do
spec = specs[i]
if spec:isPlayer() then
player:sendTextMessage(MESSAGE_STATUS_SMALL, "A team is already inside the quest room.")
return true
end
spec:remove()
end
setGlobalStorageValue(28082, os.time()+5*60)
addEvent(PrepareEnter, 1)
end
item:transform(item.itemid == 9825 and 9826 or 9825)
return true
end