local config = {
lottery_hora = "60 Minutos",
reward_count = 1,
website = 0
}
function onThink(interval, lastExecution)
local players = getPlayersOnline()
local winner = players[math.random(#players)]
if config.website == 1 then
db.executeQuery("INSERT INTO `lottery` (`name`) VALUES ('".. getCreatureName(winner) .."');")
end
doBroadcastMessage('[Loteria Venetta] Ganhador: '.. getCreatureName(winner) ..', Recompensa: '.. config.reward_count ..'Boost Stone - Parabens ! (Proxima em: '.. config.lottery_hora ..')')
doPlayerAddItem(winner, 12618, config.reward_count)
return true
end






info
Grupo: Infante
Registrado: 27/08/11
Posts: 1.9k
Reputação: +85
Gênero: Masculino
Char no Tibia: Bruno Maciel
Estou com um bug no meu systema de loteria =/
BUG
[05/02/2016 22:09:38] [Error - GlobalEvent Interface]
[05/02/2016 22:09:38] data/globalevents/scripts/lottery.lua:onThink
[05/02/2016 22:09:38] Description:
[05/02/2016 22:09:38] data/globalevents/scripts/lottery.lua:12: bad argument #2 to 'random' (interval is empty)
[05/02/2016 22:09:38] stack traceback:
[05/02/2016 22:09:38] [C]: in function 'random'
[05/02/2016 22:09:38] data/globalevents/scripts/lottery.lua:12: in function
[05/02/2016 22:09:38] [Error - GlobalEvents::think] Couldn't execute event: lottery
SYSTEMA
local config = {
lottery_hora = "60 Minutos",
reward_count = 1,
website = 0
}
function onThink(interval, lastExecution)
local players = getPlayersOnline()
local list = {}
for i, tid in ipairs(players) do
list = 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 Venetta] Ganhador: '.. getCreatureName(winner) ..', Recompensa: '.. config.reward_count ..'Boost Stone - Parabens ! (Proxima em: '.. config.lottery_hora ..')')
doPlayerAddItem(winner, 12618,config.reward_count)
return TRUE
end
Quem puder me ajuda ^^