function onThink()
function getRealTime()
local hours = tonumber(os.date("%H", os.time()))
local minutes = tonumber(os.date("%M", os.time()))
local seconds = tonumber(os.date("%S", os.time()))
if hours < 10 then
hours = '0' .. hours
end
if minutes < 10 then
minutes = '0' .. minutes
end
if seconds < 10 then
seconds = '0' .. seconds
end
return hours .. ':' .. minutes .. ':' .. seconds
end
local cnfPlayTime = { --List of times when roulette should be played.
{"00:00"},
{"00:30"},
{"02:00"},
{"03:40"},
{"05:10"},
{"09:00"},
{"10:20"},
{"12:00"},
{"15:40"},
{"17:30"},
{"19:00"},
{"21:20"},
{"22:00"},
}
function addReward()
local players = Game.getPlayers()
for _, player in pairs(players) do
local winningNumber = math.random(0,35)
if player:getStorageValue(72450) == 1 then
for u = 0,11 do
local stor = u*10000
if player:getStorageValue(7245 + stor) >= 0 then
if player:getStorageValue(7245 + stor) == winningNumber then
end
end
end
end
end
end
function outMessage(showClock)
local showSplit = showClock:splitTrimmed(":")
local test = os.time{year = os.date("%Y"), month = os.date("%m"), day = os.date("%d"), hour = showSplit[1], min = showSplit[2], sec = 0}
local spectators = Game.getSpectators({x = 1086, y = 1228, z = 7}, false, true, 10, 10, 10, 10) -- Send message of time left until next round of roulette.
if #spectators > 0 then
for i = 1, #spectators do
spectators[i]:say("Next run in: \n[" .. os.date("%X", test - os.time()) .. "]", TALKTYPE_MONSTER_SAY, false, spectators[i], {x = 1086, y = 1228, z = 7})
end
end
end
for i = 1, #cnfPlayTime do
if getRealTime() >= cnfPlayTime[i][1] then -- checks if time in list selected has passed.
else
outMessage(cnfPlayTime[i][1])
return true
end
end
return true
end