Tenta Assim :
Abra o "globalevents" é cole essa tag:
<globalevent name="lottery" interval="2400" script="lottery.lua"/>
é substitua seu lotery por este :
-- Lottery System
local config = {
lottery_hour = "40 minutos", -- Tempo ate a proxima loteria (Esse tempo vai aparecer somente como broadcast message)
rewards_id = {9693, 2503, 7424, 2160, 7417, 2538, 2494, 2173}, -- ID dos Itens Sorteados na Loteria
crystal_counts = 300, -- Usado somente se a rewards_id for crystal coin (ID: 2160).
website = "no" -- Only if you have php scripts and table `lottery` in your database!
}
function onThink(interval, lastExecution)
if(getWorldCreatures(0) == 0)then
return true
end
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 == 2160) then
doPlayerAddItem(winner, random_item, config.crystal_counts)
doBroadcastMessage("[LOTTERY SYSTEM] Winner: " .. getCreatureName(winner) .. ", Reward: " .. config.crystal_counts .. " " .. getItemNameById(random_item) .. "s! Congratulations! (Proxima Loteria em " .. config.lottery_hour .. ")")
else
doBroadcastMessage("[LOTTERY SYSTEM] Winner: " .. getCreatureName(winner) .. ", Reward: " .. getItemNameById(random_item) .. "! Congratulations! (Proxima Loteria 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
Ajudei?Rep+






info
Grupo: Campones
Registrado: 24/03/13
Posts: 8
Reputação: 0
Char no Tibia: Japinha Knight
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 \/
<globalevent name="lotery" time="20:00" event="script" value="loterry.lua"/>