Fazer scripts sem testar, tem dessas coisas kkkkk. São erros mto toscos
local configs = {
hours = 2, -- quantas em quantas horas, vai acontecer.
winners = 1, -- qntos players podem ganhar.
premio = {
[1] = {item = 2160, count = 10},
}
}
function onThink(interval, lastExecution)
if #getPlayersOnline() >= configs.winners then
local str = "Lottery:"
for i = 1, configs.winners do
local lucky_player = getPlayersOnline()[math.random(#getPlayersOnline())]
if getPlayerAccess(lucky_player) <= 1 then
local random_reward = configs.premio[math.random(#configs.premio)]
doPlayerAddItem(lucky_player, random_reward.item, random_reward.count)
str = str .. "\n" .. getCreatureName(lucky_player) .. " - " .. random_reward.count .. "x " .. getItemNameById(random_reward.item)
end
end
doBroadcastMessage(str .. "\n (Next in " .. configs.hours .. " hours.)")
end
return true
end