Eai bro, eu fiz aqui mas não testei. Vê aí
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 getPlayerAcess(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






info
Grupo: Campones
Registrado: 15/01/17
Posts: 12
Reputação: 0
Fala galera, to tendo uns probleminhas aqui, como o título do tópico diz, preciso de uma adequação no script. Segue o script abaixo, meu servidor é o Styller 8.60. Qualquer informação que for necessária que eu não tenha mencionado, comentem que eu edito o pedido. Agradeço desde já pela atenção e pelo tempo dedicado. Valeu!
local premio = { [1] = {item = 2160, count = 10}, } local configs = { hours = 2, -- quantas em quantas horas, vai acontecer. winners = 1 -- qntos players podem ganhar. } function onThink(interval, lastExecution) local p = getPlayersOnline() local winners = configs.winners if #p < winners then winners = #p end for i = 1, winners do local p = getPlayersOnline() 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("") if i == winners then doBroadcastMessage("[" .. i .. "ST PLACE] Winner: " .. getCreatureName(playerwin) .. ", Reward: " .. premio[e].count .. " " .. getItemNameById(premio[e].item) .. ", Congratulations! (Next Lottery in " .. configs.hours .. " hours.)") end doSendMagicEffect(getThingPos(playerwin), 12) end return true end