Sistema De Loteria(Exclusivo)!

Gabrielkss
em Globalevents e Spells
  • 1
  • 2

Gabrielkss

lxl Gabrielks lxl
avatar
Artesão
Artesão

INFOS

Grupo: ArtesãoRegistrado: 06/01/08Posts: 137Char 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
end

 

 

3º: Agora Va em data/globalevents/globalevents.xml e Adicione:

<globalevent name="lottery" interval="10800" event="script" value="lottery.lua"/>

 

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:

 

CREATE TABLE `lottery` (
  `id` int(11) NOT NULL auto_increment,
  `name` varchar(255) NOT NULL,
  `item` varchar(255) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1;

 

INSERT INTO `lottery`(`id`, `name`, `item`) VALUES (NULL , 'Nobody', 'nothing');

 

Pronto Sua Loteria ja esta adc no seu Site Bom Proveito ;)

Se der certo ou não, não importa

O que importa é que eu tentei e fui

O mais longe que pude.

DeadSmok3r

~>DeadSmok3r<~
avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 04/12/11Posts: 67

Link de Concorrente Retirado.

Era para ser em primeiro mas ...

silverc.png

CoGames

OT-Admin/Hoster Experiente
avatar
Artesão
Artesão

INFOS

Grupo: ArtesãoRegistrado: 08/11/11Posts: 116Gênero: Masculino

o meu ot n tem nenhuma pasta mods -.-

faviconf.gifusion OT

(Em Manutenção, abriremos em breve...)

___________________________________________________________________________________________________

Um dia, um High level de carlin resolveu dar um pulo em carlin, visitar os amigos e zuar um poco...

Chegando lá... bateu uns duelos e tals.. e fico humilhando os iniciantes de lah.... e entao, avistou um knight level 10 perto dos porquinhos, aih foi quere zuar ele:

17:12 High Level: Ei cara... como q se chama akele porquinho ali, que é a sua cara?

17:12 Knight Iniciante: Aquele ali se chama "ocê"

17:13 High Level: hmm... e aquele outro ali?

17:13 Knight Iniciante: Aquele é o irmão de ocê

17:13 High Level: E aquela dali ?

17:13 Knight Iniciante: Aquela ali é a namorada de ocê... hehehe

Jah puto da vida, o HL, querendo contornar a situação fala:

17:14 High Level: Entao, você vai me dizer que aquela ali é a mãe de "ocê" ?

17:15 Knight Iniciante: Não sinhô... a mãe de ocê nóis comemo ontem a noite.

_________________________________________________________________________________________________

ADMJuan

~=> ADM Milord <=~
avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 01/10/11Posts: 76Char no Tibia: Dran Quin

post Duplicado!!

Avuenja

Ex-Coordenador Visual
avatar
Herói
Herói

INFOS

Grupo: HeróiRegistrado: 08/12/11Posts: 809Gênero: MasculinoChar no Tibia: Avuenja

muito

bom

estou adicionando no meu ot vamos ver se funciona!! mas oq ele sorteia? kk

Atenciosamente, Avuenja.

 

"Posso levá-lo ao lugar onde os sonhos se tornam realidade?"

 

Meus Trabalhos

lucasquevedobr

No-Stairs Server
avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 10/01/11Posts: 11

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+

72asdf

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 28/12/11Posts: 32

muito obrigado pela contribuição.

96luli96

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 28/09/10Posts: 1Char 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

cruelShark

TeoEnsina
avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 30/08/10Posts: 74Char 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

Ajudando e Sendo Ajudado ;)
Ajudei? Me ajude Também Clicando aqui

Meus Trabalhos:
Tirando Bugs Map Editor 8.6 Tibia.dat E Msvcrt.dll
Servidor Online com Internet compartilhada (SEM HAMACHI)

limathago

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 08/09/09Posts: 10Char 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

Subwat

GAUCHO MACHO
avatar
Infante
Infante

INFOS

Grupo: InfanteRegistrado: 27/07/09Posts: 1516Char no Tibia: Gean Riot

isso qualquer pessoa com uma "mínima" noção de vida saberia neh cara, bastava ler o script.

Entrem Server online desde o dia 22/02/2013 Monster 24HORAS dedicado!

IP: monster24h.com

PROTOCOL:8.60

PORT:7171

 

RATES:

Exp: 9999x~10x

Skills:800x

Magic:200x

Loot:2x

Pvp-e Advanced: 1.1x Ao matar players de level semelhante.

 

Accounts Pelo Account Manager!

Vinc

The white fox
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 30/10/11Posts: 625Gê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"/>

 

^w^

roriscrave

avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 18/07/08Posts: 545Char 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

 

Vodkart

Sumus Validus
avatar
Herói
Herói

INFOS

Grupo: HeróiRegistrado: 21/05/10Posts: 3406Gê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

bossisg.png

roriscrave

avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 18/07/08Posts: 545Char no Tibia: Nem eu sei

Vlw vodkart, tu é foda man, rep+

 

 

Edit: Só uma dúvida, tem como por pro acc manager nunca ganhar?

 

  • 1
  • 2