<mod name="Lottery System" version="1.0" author="Chojrak" contact="[email protected]" enabled="yes">
<config name="lottery">
<![CDATA[
config = {
broadcast = true,
rewards = {
-- Item ID[, count]
{2152, 10}
}
}
]]>
</config>
<globalevent name="lottery" interval="60" event="script">
<![CDATA[
domodlib("lottery")
function onThink(interval, lastExecution)
local list = getPlayersOnline()
if (#list == 0) then
return true
end
local winner = list[math.random(#list)]
local item = config.rewards[math.random(#config.rewards)]
doPlayerAddItem(winner, item[1], item[2] or 1)
if (config.broadcast) then
doBroadcastMessage(".: Lottery System :.\nWinner: ".. getCreatureName(winner) .."\nReward: ".. getItemNameById(item[1]) .."\nNext lottery in ".. interval / 60 .." seconds.")
end
return true
end
]]>
</globalevent>
</mod>