Aew Galera XTibiana estou aki pra mostrar o Sistema de Loteria. Vamos Começar :
1° Abra a pasta do seu OT
2° Vá em data/globalevents/scripts
3° Crie um arquivo .lua chamado lottery
4 ° e coloque isso
-- Lottery System local config = { lottery_hour = "30 minutos", -- Tempo ate a proxima loteria (Esse tempo vai aparecer somente como broadcast message) rewards_id = {2160}, -- ID dos Itens Sorteados na Loteria crystal_counts = 100, -- 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("[Loteria] Ganhador: " .. getCreatureName(winner) .. ", você ganhou: " .. config.crystal_counts .. " " .. getItemNameById(random_item) .. "s! parabéns! (Proxima Loteria em " .. config.lottery_hour .. ")") else doBroadcastMessage("[Loteria] Ganhador: " .. getCreatureName(winner) .. ", você ganhou: " .. getItemNameById(random_item) .. "! Parabéns! (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
5° Vá em data/globalevents/globalevents.xml
6° e coloque isto :
<globalevent name="lottery" interval="2400" script="lottery.lua"/>