Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local config = {
- rewards = {[2195] = 1, [2472] = 1, [2493] = 1}
- }
- function onTime(interval)
- if Game.getPlayerCount() == 0 then
- return true
- end
- local players = Game.getPlayers()
- local winner = players[math.random(1, #players)]
- local items = {}
- for itemid, count in pairs(config.rewards) do
- items[#items + 1] = itemid
- end
- local itemid = items[math.random(1, #items)]
- local amount = config.rewards[itemid]
- winner:addItem(itemid, amount)
- local it = ItemType(itemid)
- local name = ""
- if amount == 1 then
- name = it:getArticle() .. " " .. it:getName()
- else
- name = amount .. " " .. it:getPluralName()
- end
- Game.broadcastMessage("" .. winner:getName() .. " won " .. name .. "! Congratulations.", MESSAGE_STATUS_WARNING)
- return true
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement