Esse local é para scripts já prontas, tenha mais atenção.
Movido!
Esse local é para scripts já prontas, tenha mais atenção.
Movido!
info
Grupo: Herói
Registrado: 20/05/10
Posts: 3.4k
Reputação: +1.5k
Gênero: Masculino

-- By Allebr
local config = {
lottery_hour = "20 Minutos", -- Time to next lottery (only for broadcast message, real time you can set on globalevents.xml)
rewards_id = {9693}, -- Rewards ID
crystal_counts = 50, -- Used only if on rewards_id is crystal coin (ID: 2160).
website = "no" -- Only if you have php scripts and table `lottery` in your database!
}
function onThink(interval, lastExecution)
local list = {}
for i, tid in ipairs(getPlayersOnline()) do
list[i] = tid
end
local winner = list[math.random(1, #list)]
local random_item = config.rewards_id[math.random(1, #config.rewards_id)]
if(random_item == 9693) then
doPlayerAddItem(winner, random_item, config.crystal_counts)
doBroadcastMessage("[Lottery System] Vencedor: " .. getCreatureName(winner) .. ", Ganhou: " .. config.crystal_counts .. " " .. getItemNameById(random_item) .. "s! Congratulations! (Proxima Loterry em: " .. config.lottery_hour .. "")
else
doBroadcastMessage("[Lottery System] Vencedor: " .. getCreatureName(winner) .. ", Ganhou: " .. getItemNameById(random_item) .. "! Congratulations! (Proxima Loterry em: " .. config.lottery_hour .. ".")
doPlayerAddItem(winner, random_item, 1)
end
if(config.website == "yes") then
db.executeQuery("INSERT INTO `lottery` (`name`, `item`) VALUES ('".. getCreatureName(winner) .."', '".. getItemNameById(random_item) .."');")
end
return true
end
info
Grupo: Barão
Registrado: 24/01/11
Posts: 245
Reputação: +10

testando...
!edit perfeito vlw mano amanhã passo pra dar o +REP pq hoje esgotou :S
info
Grupo: Herói
Registrado: 20/05/10
Posts: 3.4k
Reputação: +1.5k
Gênero: Masculino

vlw
obrigado
reportado para moverem
info
Grupo: Barão
Registrado: 24/01/11
Posts: 245
Reputação: +10
ta dando esse erro quando rodo meu ot ai a loterry num pega :S alguem sabe o que é?
[Error - LuaScriptInterface::loadFile] data/globalevents/scripts/lottery.lua:21: unfinished string near '")'
[Warning - Event::loadScript] Cannot load script (data/globalevents/scripts/lottery.lua)
data/globalevents/scripts/lottery.lua:21: unfinished string near '")'
eu uso esse system:
-- By Allebr local config = { lottery_hour = "20 Minutos", -- Time to next lottery (only for broadcast message, real time you can set on globalevents.xml) rewards_id = {9693}, -- Rewards ID crystal_counts = 50, -- Used only if on rewards_id is crystal coin (ID: 2160). website = "no" -- Only if you have php scripts and table `lottery` in your database! } function onThink(interval, lastExecution) local list = {} for i, tid in ipairs(getPlayersOnline()) do list[i] = tid end local winner = list[math.random(1, #list)] local random_item = config.rewards_id[math.random(1, #config.rewards_id)] if(random_item == 9693) then doPlayerAddItem(winner, random_item, config.crystal_counts) doBroadcastMessage("[Lottery System] Vencedor: " .. getCreatureName(winner) .. ", Ganhou: " .. config.crystal_counts .. " " .. getItemNameById(random_item) .. "s! Congratulations! (Proxima Loterry em: " .. config.lottery_hour .. "") else doBroadcastMessage("[Lottery System] Vencedor: " .. getCreatureName(winner) .. ", Ganhou: " .. getItemNameById(random_item) .. "! Congratulations! (Proxima Loterry em: " .. config.lottery_hour .. ") doPlayerAddItem(winner, random_item, 1) end if(config.website == "yes") then db.executeQuery("INSERT INTO `lottery` (`name`, `item`) VALUES ('".. getCreatureName(winner) .."', '".. getItemNameById(random_item) .."');") end return true end