• 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 HELP with this script os.date

  • Thread starter Thread starter Deleted member 141899
  • Start date Start date
D

Deleted member 141899

Guest
Hello, can someone help me to put os.date on this script?

I wanted to put every weekday open a tp with a different coordinate, to vary the maps of zombies, it is possible?

GlobalEvents:
Code:
dofile('data/lib/ZE_config.lua')

local function ZE_Verifica()
local tile = Tile(ZE.tpOpen)
if tile then
local item = tile:getItemById(1387)
if item then
item:remove()
broadcastMessage("O Evento Zombie começará agora!", MESSAGE_STATUS_WARNING)
doSummonCreature("Zumbi", ZE.posEnterEvent)
else
broadcastMessage("O Evento Zombie foi aberto e será fechado em ".. ZE.tpTimeOpen .." minutos.", MESSAGE_STATUS_WARNING)
setGlobalStorageValue(ZE.storage, 0)

local teleport = Game.createItem(1387, 1, ZE.tpOpen)
if teleport then
teleport:setActionId(45000)
end
end
end
end

function onTime(interval)

ZE_Verifica()
addEvent(ZE_Verifica, ZE.tpTimeOpen * 60 * 1000)

return true
end

ZE_config (lib):
Code:
ZE = -- Zumbi Event
{
tpOpen = {x=32373, y=32236, z=7}, -- posição de onde abrirá o teleport para entrar no evento.
tpTimeOpen = 1, -- tempo que o tp ficará aberto (em minutes).
posEnterEvent = {x=31889, y=32342, z=7}, -- posição de onde os players irão para dentro do evento.
reward = {24137, 1, "You won 1 event coin."}, -- recompensa: "itemid, quantidade, msg"
storage = 88888,
}


I have a ready example of what I really want to implement the above script, but already tried several times and I am not able, if someone can help me I would be very grateful!

Code:
local config = {
    teleportId = 1387,
    days = {
        ["Monday"] = { {x = 33649, y = 31261, z = 11}, {x = 33641, y = 31233, z = 11}, "tanjis", {x=33647, y=31242, z=11} },
        ["Tuesday"] = { {x = 33649, y = 31261, z = 11}, {x = 33641, y = 31233, z = 11}, "tanjis", {x=33647, y=31242, z=11} },
        ["Wednesday"] = { {x = 33649, y = 31261, z = 11}, {x = 33641, y = 31233, z = 11}, "tanjis", {x=33647, y=31242, z=11} },
        ["Thursday"] = { {x = 33558, y = 31282, z = 11},{x = 33545, y = 31263, z = 11}, "jaul", {x=33541, y=31266, z=11} },
        ["Friday"] = { {x = 33558, y = 31282, z = 11}, {x = 33545, y = 31263, z = 11}, "jaul", {x=33541, y=31266, z=11} },
        ["Saturday"] = { {x=33438, y=31248, z=11}, {x=33419, y=31255, z=11}, "obujos", {x=33434, y=31262, z=11} },
        ["Sunday"] = { {x=33438, y=31248, z=11}, {x=33419, y=31255, z=11} , "obujos", {x=33434, y=31262, z=11} }
    }
}

function onStartup(interval)
    local i = config.days[os.date("%A")]
    doCreateTeleport(config.teleportId, i[2], i[1])   
end
 
Last edited by a moderator:
I'm ashamed to admit how long it took me to realize the error.
Code:
function onStartup()
   local config = {
     teleportId = 1387,
     days = {
       ["Monday"]    = {
         {x = 1394, y = 1425, z = 7}, -- Where the teleport will spawn.
         {x = 1396, y = 1423, z = 7}  -- Where the teleport will send you.
         },
       ["Tuesday"] = {
         {x = 1394, y = 1425, z = 7},
         {x = 1396, y = 1423, z = 7}
       },
       ["Wednesday"] = {
         {x = 1394, y = 1425, z = 7},
         {x = 1396, y = 1423, z = 7}
       },
       ["Thursday"] = {
         {x = 1394, y = 1425, z = 7},
         {x = 1396, y = 1423, z = 7}
       },
       ["Friday"]    = {
         {x = 1394, y = 1425, z = 7},
         {x = 1396, y = 1423, z = 7}
       },
       ["Saturday"] = {
         {x = 1394, y = 1425, z = 7},
         {x = 1396, y = 1423, z = 7}
       },
       ["Sunday"]    = {
         {x = 1394, y = 1425, z = 7},
         {x = 1396, y = 1423, z = 7}
       }
     }
   }
   local x = config.days[os.date("%A")]
   doCreateTeleport(config.teleportId, x[2], x[1]) 
   return true
end
 
Last edited by a moderator:
Back
Top