Hi all right with you?
Guys, so I'm trying to make this automatic event, it is usually only has one detail:
I would like:
When missing 5 minutes it had to happen the event, send one msg:
The event will start in 4 minutes, stay tuned!
The event will start in 3 minutes, stay tuned!
The event will start at 2minutes stay tuned!
Missing one minute:
The event will begin at 1 minute, stay tuned!
After 1 minute, it will make the check:
if #players <2 Then
broadcastMessage return ("The Event may not start. They missed players.")
end
and the amount of players is greater than 2, it starts normally.
Guys, so I'm trying to make this automatic event, it is usually only has one detail:
I would like:
When missing 5 minutes it had to happen the event, send one msg:
The event will start in 4 minutes, stay tuned!
The event will start in 3 minutes, stay tuned!
The event will start at 2minutes stay tuned!
Missing one minute:
The event will begin at 1 minute, stay tuned!
After 1 minute, it will make the check:
if #players <2 Then
broadcastMessage return ("The Event may not start. They missed players.")
end
and the amount of players is greater than 2, it starts normally.
Code:
function onThink(interval)
if days[os.date("%A")] then
hours = tostring(os.date("%X")):sub(1, 5)
tb = days[os.date("%A")][hours]
if tb then
local players = {}
for i = 1, #t do
local v = getTopCreature(t[i]).uid
players[i] = isPlayer(v) and v or nil
end
if #players < 2 then
return broadcastMessage("The Event may not start. They missed players.")
end
local first = players[1] and 1 or players[2] and 2 or players[3] and 3 or players[4] and 4
for i = 1, 4 do
if players[i] then
setPlayerStorageValue(players[i], storage.placed, 0)
setPlayerStorageValue(players[i], storage.max, 1)
setPlayerStorageValue(players[i], storage.radius, 1)
doSendMagicEffect(t[i], CONST_ME_TELEPORT)
doTeleportThing(players[i], n[i])
doChangeSpeed(cid, 350)
doSendMagicEffect(n[i], CONST_ME_TELEPORT)
end
end
broadcastMessage("The event has started.")
end
end
return true
end