chojrak
Banned User
- Joined
- Oct 25, 2008
- Messages
- 5,832
- Solutions
- 2
- Reaction score
- 160
Code:
<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]
{2160, 1},
{2148}, -- Count = 1
{2152, 100}
}
}
]]>
</config>
<globalevent name="lottery" interval="10800" 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 .." minutes.")
end
return true
end
]]>
</globalevent>
</mod>
0.3.5+ eace:
Last edited: