Eai, tudo bem?
Fiz umas modificações no script:
local premio = {
[1] = {item = 2493, count = 1}
}
local configs = {
hours = 3, -- quantas em quantas horas, vai acontecer.
winners = 1 -- qntos players podem ganhar.
}
function onThink(interval, lastExecution)
local online = {}
for _, pid in ipairs(getPlayersOnline()) do
if getPlayerAccess(pid) == 0 then
table.insert(online,pid)
end
end
local winners = configs.winners
if #online < winners then
winners = #online
end
for i = 1, winners do
local p = online
local c, w = #p, #premio
local d, e = math.random(c), math.random(w)
local playerwin = p[d]
doPlayerAddItem(playerwin, premio[e].item, premio[e].count)
doBroadcastMessage("[" .. i .. "ST PLACE] Winner: " .. getCreatureName(playerwin) .. ", Reward: " .. premio[e].count
.. " " .. getItemNameById(premio[e].item) .. ", Congratulations!", MESSAGE_STATUS_CONSOLE_RED)
table.remove(online,d)
if i == winners then
doBroadcastMessage("(Next Lottery in " .. configs.hours .. " hours.)", MESSAGE_STATUS_CONSOLE_RED)
end
doSendMagicEffect(getThingPos(playerwin), 12)
end
return true
end
Se não funcionar avise ![]()
![]()





info
Grupo: Campones
Registrado: 22/07/08
Posts: 56
Reputação: +5
RESOLVIDO
Editado Setembro 29 por gahgah