Yo i was searching for a Lottery System couldn't find one for TFS 0.4 Once again haha..
Soooo heree it is DNO WHO CREDITS GO TO? Chojrak?
Lottery System. MODS/Lottery System.xml
Add this to your PHPMYADMIN/MYSQL File
Soooo heree it is DNO WHO CREDITS GO TO? Chojrak?
Lottery System. MODS/Lottery System.xml
PHP:
<mod name="Lottery System" version="1.0" author="Chojrak" contact="[email protected]" enabled="yes">
<config name="lottery">
<![CDATA[
config = {
broadcast = true,
rewards = {
-- Item ID[, count]
{ITEM ID, AMMOUT},
{ITEM ID, AMMOUT},
{ITEM ID, AMMOUT},
{ITEM ID, AMMOUT},
{ITEM ID, AMMOUT},
{ITEM ID, AMMOUT},
}
}
]]>
</config>
<globalevent name="lottery" interval="10000000" event="script">
<![CDATA[
domodlib("lottery")
local dbHandle = db.query and db.query or db.executeQuery;
function onThink(interval, lastExecution)
local list = getPlayersOnline()
if (#list == 0) then
return true
end
local winner = list[math.random(#list)]
local item = config.rewards[math.random(#config.rewards)]
doPlayerAddItem(winner, item[1], item[2] or 1)
if (config.broadcast) then
doBroadcastMessage(".: Lottery System :.\nWinner is: ".. getCreatureName(winner) .."\nReward: ".. getItemNameById(item[1]) .."\nNext lottery in ".. interval / 60000 .." minutes.")
end
dbHandle("INSERT INTO `lottery_system`(`player_id`, `date`, `item_id`, `item_name`) VALUES ( ".. getPlayerGUID(winner) ..", ".. os.time() ..", ".. item[1] ..", '".. getItemNameById(item[1]) .."');");
return true
end
]]>
</globalevent>
</mod>
Add this to your PHPMYADMIN/MYSQL File
PHP:
-- Table structure for table `lottery_system`
--
CREATE TABLE IF NOT EXISTS `lottery_system` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`player_id` int(11) NOT NULL DEFAULT '0',
`date` int(10) unsigned NOT NULL DEFAULT '0',
`item_id` int(11) NOT NULL DEFAULT '0',
`item_name` varchar(50) NOT NULL DEFAULT '',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ;
--
-- Dumping data for table `lottery_system`
--
INSERT INTO `lottery_system` (`id`, `player_id`, `date`, `item_id`, `item_name`) VALUES
(3, 205, 1327460833, ITEM ID, 'NAME'),
(4, 217, 1327486033, ITEM ID, 'NAME'),
(5, 266, 1327511233, ITEM ID, 'NAME'),
(6, 236, 1327571565, ITEM ID, 'NAME'),
(7, 180, 1327596765, ITEM ID, 'NAME'),
(8, 403, 1327681153, ITEM ID, 'NAME');
-- --------------------------------------------------------
Last edited: