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

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

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

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

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

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

» ayuddddaaaaaaaaaaaaaaa
Lun 20 Oct 2014, 17:33 por Jjesus

» uRGENTE SERVER
Lun 06 Oct 2014, 21:42 por kamila2013

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

Mejores posteadores
God Darkaness (11)
 
hoster jhafuer (10)
 
God fusion (4)
 
darks77 (3)
 
God Zeker (2)
 
Astaroth (2)
 
God Leader (2)
 
yeisonruben (2)
 
Give Me (2)
 
lTours (2)
 

Comparte | 
 

 Lottery System

Ver el tema anterior Ver el tema siguiente Ir abajo 
AutorMensaje
hoster jhafuer
Admin
Admin
avatar

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

MensajeTema: Lottery System   Mié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
http://jhafuer-aggresor.forosactivos.net
 
Lottery System
Ver el tema anterior Ver el tema siguiente Volver arriba 
Página 1 de 1.
 Temas similares
-
» [RPG Maker Ace] Bullpup Shooting System
» Tienda New Era: Soldier Dock System
» [VX] Gubid Tactical Battle System (GTBS)
» [VX Ace] Sapphire Action System IV
» [XP] Blizz ABS Battle System + Tutoriales

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