1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
function newGiveaway()
local randomGiveawayTime = math.random(3000, 3600)
timer(randomGiveawayTime, "doGiveaway")
end
newGiveaway() -- call the function as soon the server starts?
function doGiveaway()
	newGiveaway() -- launch next timer
	
	local playerList = player(0, "table")
	
	if #playerList <= 2 then	-- less than N players/bots online?
		return -- do not raffle
	end
	
	local targetPlayer = playerList[math.random(1, #playerList)]
		
-- give muney here:
msg(os.date("%H:%M:%S") .. " ".. player(targetPlayer, "name") .." (" .. targetPlayer ..") won the lottery!")
end