Link de Concorrente Retirado.
- Fórum
- OTServ
- Recursos
- Scripting
- Globalevents e Spells
- Sistema De Loteria(Exclusivo)!
info
Grupo: Campones
Registrado: 04/12/11
Posts: 67
Reputação: +4

Editado Dezembro 27 por AnyurCT
info
Grupo: Artesão
Registrado: 08/11/11
Posts: 116
Reputação: +29
Gênero: Masculino

o meu ot n tem nenhuma pasta mods -.-
info
Grupo: Campones
Registrado: 01/10/11
Posts: 76
Reputação: +7
Char no Tibia: Dran Quin

post Duplicado!!
info
Grupo: Herói
Registrado: 08/12/11
Posts: 809
Reputação: +253
Gênero: Masculino

muito
bom
estou adicionando no meu ot vamos ver se funciona!! mas oq ele sorteia? kk
info
Grupo: Campones
Registrado: 10/01/11
Posts: 11
Reputação: +3

Muito bom, mas poderia tirar esse erro aqui caso nao tenha player online?
[28/12/2011 10:13:43] [Error - GlobalEvent Interface] [28/12/2011 10:13:43] buffer:onThink [28/12/2011 10:13:43] Description: [28/12/2011 10:13:43] [string "loadBuffer"]:8: bad argument #2 to 'random' (interval is empty) [28/12/2011 10:13:43] stack traceback: [28/12/2011 10:13:43] [C]: in function 'random' [28/12/2011 10:13:43] [string "loadBuffer"]:8: in function <[string "loadBuffer"]:2> [28/12/2011 10:13:43] [Error - GlobalEvents::think] Couldn't execute event: lottery
Obrigado REP+
muito obrigado pela contribuição.
info
Grupo: Campones
Registrado: 28/09/10
Posts: 1
Reputação: 0
Char no Tibia: Luis Matox

Eu acho que foi mau feito pelo fato de ela nao ter explicada para que serveria cada coisa exemplo, ela nao disse o que eu iria querer sortear na loteria e tambem o tempo entre essas loterias, isso pode deixar muitas pessoas com duvidaas pra mim foi mal feito
info
Grupo: Campones
Registrado: 30/08/10
Posts: 74
Reputação: +18
Char no Tibia: Durus Abelarier

Explica melhor..
Aonde Mudo Os Ids dos itens que o Player pode Ganhar? Ele vai ganhar todos os itens que eu colocar?
vai só pra quem ta online?, a cada quanto tempo ocorre o system? e como muda essas coisa
vlws ai
info
Grupo: Campones
Registrado: 07/09/09
Posts: 10
Reputação: +1
Char no Tibia: thiagao kinight

Galera oque eu entendi que pra mudar a HORA que vai ocorrer voces tenque mudar essa tag:
lottery_hour = "3 Hours", -- Time to next lottery (only for broadcast message, real time you can set on globalevents.xml)
E para mudar oque vai sortear e so por o ID do item ae ! ![]()
rewards_id = {2494, 2472, 2514, 2160}, -- Rewards ID
OBS: nao sei si esta correto mais se estiver REP+ ae xD
info
Grupo: Infante
Registrado: 27/07/09
Posts: 1.5k
Reputação: +405
Char no Tibia: Gean Riot

isso qualquer pessoa com uma "mínima" noção de vida saberia neh cara, bastava ler o script.
info
Grupo: Conde
Registrado: 30/10/11
Posts: 625
Reputação: +101
Gênero: Masculino

@subwat
na verdade tem uma parte errada la,alem de isso ser facil ashusauhsahu
Galera oque eu entendi que pra mudar a HORA que vai ocorrer voces tenque mudar essa tag:
lottery_hour = "3 Hours", -- Time to next lottery (only for broadcast message, real time you can set on globalevents.xml)
traduzindo o que esta em vermelho
apenas para a mensagem no broadcast,o tempo real você pode mudar em globalevenst.xml
@CruelShark
o lugar correto para mudar o tempo é na globalevents.xml nessa tag na parte em vermelho( o tempo é em segundos,se n me engano)
<globalevent name="lottery" interval="10800" event="script" value="lottery.lua"/>
Editado Junho 10 por lordbug99
info
Grupo: Conde
Registrado: 18/07/08
Posts: 545
Reputação: +21
Char no Tibia: Nem eu sei

Bom ,uso tfs 0.3.6 e não tenho site para o ot. Entao a unica coisa que eu teria que mudar é isso:
website = "yes" -- Only if you have php scripts and table `lottery` in your database!
Para isso
website = "no" -- Only if you have php scripts and table `lottery` in your database!
Fiz tudo como mostra o script, mas da o seguinte erro:
[Error - GlobalEvent Interface]
buffer:onThink
Description:
[string "loadBuffer"]:8: bad argument #2 to 'random' (interval is empty)
stack traceback:
[C]: in function 'random'
[string "loadBuffer"]:8: in function <[string "loadBuffer"]:2>
[Error - GlobalEvents::think] Couldn't execute event: lottery
Editado Junho 28 por roriscrave
info
Grupo: Herói
Registrado: 20/05/10
Posts: 3.4k
Reputação: +1.5k
Gênero: Masculino

@UP
function onThink(cid, interval, lastExecution)
local config = {
hours = 4,
items = {{2472,1},{2160,10},{2494,1},{2514,1}}
}
local on,list = getPlayersOnline(),{}
if #on > 0 then
for i = 1, #on do
if getPlayerAccess(on[i]) < 3 and getCreatureName(on[i]) ~= "Account Manager" then
table.insert(list, on[i])
end
end
if #list > 0 then
local p,r = list[math.random(#list)],config.items[math.random(#config.items)]
doPlayerAddItem(p, r[1], r[2] or 1)
doBroadcastMessage("[LOTTERY SYSTEM] Winner: " .. getCreatureName(p) .. ", Reward: "..r[2].." "..getItemNameById(r[1]).."! Congratulations! (Next Lottery in "..config.hours.." hours)")
end
end
return true
end
Editado Junho 29 por Vodkart
info
Grupo: Conde
Registrado: 18/07/08
Posts: 545
Reputação: +21
Char no Tibia: Nem eu sei

Vlw vodkart, tu é foda man, rep+
Edit: Só uma dúvida, tem como por pro acc manager nunca ganhar?
Editado Junho 28 por roriscrave





info
Grupo: Artesão
Registrado: 06/01/08
Posts: 137
Reputação: +10
Char no Tibia: LarissaxD
Olá, Vou Ensiar hoje como por Loteria Sytem no seu server
Para TFS 0.3.5 (MOD)
1º:Vai em Mods na Pasta do seu ot e Crie um Aquivo Chamado "lottery.xml" (Sem Aspas)
e Adicone isso dentro dele :
<mod name="Lottery System" version="1.5" author="" contact="" enabled="yes"> <config name="lottery_config"><![CDATA[ config = { lottery_hour = "3 Hours", -- Time to next lottery (only for broadcast message, real time you can set on globalevents.xml) rewards_id = {2494, 2472, 2514, 2160}, -- Rewards ID crystal_counts = 10, -- Used only if on rewards_id is crystal coin (ID: 2160). website = "yes" -- Only if you have php scripts and table `lottery` in your database! } ]]></config> <globalevent name="lottery" interval="10800" event="script"><![CDATA[ domodlib('lottery_config') 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! (Next Lottery in " .. config.lottery_hour .. ")") else doBroadcastMessage("[LOTTERY SYSTEM] Winner: " .. getCreatureName(winner) .. ", Reward: " .. getItemNameById(random_item) .. "! Congratulations! (Next Lottery in " .. 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 ]]></globalevent> </mod>2º: Agora Va em data/globalevents e Adicione "lottery.lua" e dentro dela Adicione :
function onThink(cid, interval, lastExecution) local config = { hours = 4, items = {{2472,1},{2160,10},{2494,1},{2514,1}} } local on,list = getPlayersOnline(),{} if #on > 0 then for i = 1, #on do if getPlayerAccess(on[i]) < 3 and getCreatureName(on[i]) ~= "Account Manager" then table.insert(list, on[i]) end end if #list > 0 then local p,r = list[math.random(#list)],config.items[math.random(#config.items)] doPlayerAddItem(p, r[1], r[2] or 1) doBroadcastMessage("[LOTTERY SYSTEM] Winner: " .. getCreatureName(p) .. ", Reward: "..r[2].." "..getItemNameById(r[1]).."! Congratulations! (Next Lottery in "..config.hours.." hours)") end end return true end3º: Agora Va em data/globalevents/globalevents.xml e Adicione:
Pronto....
Agora se Quer Adicionar o Sistema de Loteria no Site e o Seguinte :
1º:Crie uma Pasta.php e Coloque o Nome de Lottery (Lottery.Php) e adicione isto: :
<?PHP $lottery = $SQL->query('SELECT id, name, item FROM lottery ORDER BY id DESC LIMIT 1;'); foreach($lottery as $result) { $main_content .= '<center><h1>Lottery</h1></center> <center>Every X hours we will choose one player who will win random item!<br/> Last Winner: <a href="?subtopic=characters&name='.urlencode($result['name']).'">'.$result['name'].'</a> Item: <i>'.$result['item'].'</i> Congratulations!</center>'; } ?>2º: Abra o Index.php e Adicione :
case "lottery"; $topic = "Lottery System"; $subtopic = "lottery"; include("lottery.php"); break;3º: DB:
Pronto Sua Loteria ja esta adc no seu Site Bom Proveito
Editado Novembro 26 por gabreilk