Jump to content
  • 0

Como executar um Globalevent apenas no Domingo?


P0ker

Question

Gostaria que esse script fosse executado apenas no Domingo, como faço isso? (TFS 0.3.7)

 

globalevents.xml

<globalevent name="castleopen" time="20:05" event="script" value="castleopen.lua"/>

castleopen.lua

function onTime(cid, item, fromPosition, itemEx, toPosition)
local item = getTileItemById({x=32311, y=32214, z=6, stackpos=1}, 4907)
local item2 = getTileItemById({x=32310, y=32214, z=6, stackpos=1}, 4907)
local item3 = getTileItemById({x=32312, y=32214, z=6, stackpos=1}, 4907)
local item4 = getTileItemById({x=1000, y=1002, z=4, stackpos=1}, 1051)


doRemoveItem(item.uid, 1)
doRemoveItem(item2.uid, 1)
doRemoveItem(item3.uid, 1)
doRemoveItem(item4.uid, 1)
doBroadcastMessage("[EVENTO] Castle Opened")


   return 
end
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0


local day = "Sunday" --Dia que o script será executado.

 

function onTime(cid, item, fromPosition, itemEx, toPosition)

if os.date("%A") ~= day then return true end

 

local item = getTileItemById({x=32311, y=32214, z=6, stackpos=1}, 4907)

local item2 = getTileItemById({x=32310, y=32214, z=6, stackpos=1}, 4907)

local item3 = getTileItemById({x=32312, y=32214, z=6, stackpos=1}, 4907)

local item4 = getTileItemById({x=1000, y=1002, z=4, stackpos=1}, 1051)

 

doRemoveItem(item.uid, 1)

doRemoveItem(item2.uid, 1)

doRemoveItem(item3.uid, 1)

doRemoveItem(item4.uid, 1)

doBroadcastMessage("[EVENTO] Castle Opened")

return true

end

 

Link to comment
Share on other sites

×
×
  • Create New...