Tenho um script de loterry so que queria que ele desse o item de 24 em 24h tenho um script aqui mais ele não funfa alguem pode me ajudar
script não funfa \/
´local premio = {
[1] = {item = 10503, count = 1}
}
local configs = {
hours = 24, -- 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©, 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
<globalevent name="lotery" time="20:00" event="script" value="loterry.lua"/>