¿Quieres reaccionar a este mensaje? Regístrate en el foro con unos pocos clics o inicia sesión para continuar.


Foro tibia, donde podran descargar y subir server tibia
 
PortalÍndiceÚltimas imágenesRegistrarseConectarse
Conectarse
Nombre de Usuario:
Contraseña:
Entrar automáticamente en cada visita: 
:: Recuperar mi contraseña
Últimos temas
» Alissow ot sin bugs 8.60
Lottery System I_icon_minitimeSáb 26 Nov 2016, 19:32 por oquendo10

» xf amigos pasenme un link de un mapa kalima urgenten xf
Lottery System I_icon_minitimeMiér 08 Abr 2015, 01:05 por yeisonruben

» Tiko Ot Editado By: God Necro
Lottery System I_icon_minitimeMar 07 Abr 2015, 23:54 por yeisonruben

» nuestro server tibia 8.6
Lottery System I_icon_minitimeMar 17 Mar 2015, 15:48 por Juanmoreno315

» KIEN ME PASA UN OT 8.60 MAPA RL CON ITEMS VIP EDITED?
Lottery System I_icon_minitimeSáb 14 Mar 2015, 16:36 por Lolaso123

» Ayuda un bug en mi mapa
Lottery System I_icon_minitimeMar 18 Nov 2014, 08:47 por bobon55

» ayuddddaaaaaaaaaaaaaaa
Lottery System I_icon_minitimeLun 20 Oct 2014, 17:33 por Jjesus

» uRGENTE SERVER
Lottery System I_icon_minitimeLun 06 Oct 2014, 21:42 por kamila2013

» nesecito un ot 9.8 mapa rl
Lottery System I_icon_minitimeDom 14 Sep 2014, 20:05 por darks77

Mejores posteadores
God Darkaness (11)
Lottery System Vote_lcapLottery System Voting_barLottery System Vote_rcap 
hoster jhafuer (10)
Lottery System Vote_lcapLottery System Voting_barLottery System Vote_rcap 
God fusion (4)
Lottery System Vote_lcapLottery System Voting_barLottery System Vote_rcap 
darks77 (3)
Lottery System Vote_lcapLottery System Voting_barLottery System Vote_rcap 
God Zeker (2)
Lottery System Vote_lcapLottery System Voting_barLottery System Vote_rcap 
Astaroth (2)
Lottery System Vote_lcapLottery System Voting_barLottery System Vote_rcap 
God Leader (2)
Lottery System Vote_lcapLottery System Voting_barLottery System Vote_rcap 
jose (2)
Lottery System Vote_lcapLottery System Voting_barLottery System Vote_rcap 
Give Me (2)
Lottery System Vote_lcapLottery System Voting_barLottery System Vote_rcap 
yeisonruben (2)
Lottery System Vote_lcapLottery System Voting_barLottery System Vote_rcap 

 

 Lottery System

Ir abajo 
AutorMensaje
hoster jhafuer
Admin
Admin
hoster jhafuer


Druid
Mensajes : 10
Reputación : 1
Fecha de inscripción : 22/10/2010
Edad : 28

Lottery System Empty
MensajeTema: Lottery System   Lottery System I_icon_minitimeMiér 27 Oct 2010, 20:16

Lottery System!
Hello,

For TFS 0.3.5 (MOD)
mods/lottery.xml
Code:

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!
}
]]>
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
]]>

For TFS 0.3.4pl2:
data/globalevents/lottery.lua

Lua Code:
-- by vDk
local 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!
}
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
data/globalevents/globalevents.xml:

Code:

If you want lottery system on your acc maker:

lottery.php

PHP Code:
$lottery = $SQL->query('SELECT id, name, item FROM lottery ORDER BY id DESC LIMIT 1;');
foreach($lottery as $result) {
$main_content .= '
Lottery


Every X hours we will choose one player who will win random item!

Last Winner: '.$result['name'].' Item: '.$result['item'].' Congratulations!
';
}
?>
Open index.php and add:

PHP Code:
case "lottery";
$topic = "Lottery System";
$subtopic = "lottery";
include("lottery.php");
break;
DB:

Code:
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;
Code:
INSERT INTO `lottery`(`id`, `name`, `item`) VALUES (NULL , 'Nobody', 'nothing');
Volver arriba Ir abajo
https://jhafuer-aggresor.forosactivos.net
 
Lottery System
Volver arriba 
Página 1 de 1.

Permisos de este foro:No puedes responder a temas en este foro.
 :: Descarga :: Versiones de Ot Server Tibia-
Cambiar a: