Sistema de Loteria Para OT's

Vá em Data/GlobalEvents/scripts e crie um arquivo chamado lottery.lua

E Adicione isso :
Código:
local config = {
    lottery_hora = "60 Minutos",
    reward_count = 20,
    website = 0
    }
function onThink(interval, lastExecution)
    local players = getPlayersOnline()
    local list = {}
    for i, tid in ipairs(players) do
    list[i] = tid
end
    local winner = list[math.random(1, #list)]
    if(config.website == 1) then
        db.executeQuery("INSERT INTO `lottery` (`name`) VALUES ('".. getCreatureName(winner) .."');")
    end
    doBroadcastMessage('[Loteria Mineira] Ganhador: '..  getCreatureName(winner) ..', Recompensa: '.. config.reward_count  ..'moedas! - Parabens ! (Proxima em: '.. config.lottery_hora ..')')
    doPlayerAddItem(winner, 2160,config.reward_count)
    return TRUE
end
Agora vá em Data/GlobalEvents/globalevents.xml e add a Tag:
Código:
<globalevent name="lottery" interval="7200" event="script" value="lottery.lua"/>
Obs: O "interval" são os segundos, nesse caso correspondem a 60 min.

Creditos:
Walef - Script