• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

GlobalEvent Lottery System v2

Help:
2croq38.jpg
 
This work:

PHP:
<?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 3 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>';
}
?>
 
How can i add
create table `lottery` (
`id` int(11) not null auto_increment,
`name` varchar(255) not null,
`item` varchar(255) not null,
`world_id` tinyint(2) unsigned not null default '0',
primary key (`id`)
) engine=myisam default charset=latin1 auto_increment=1 ;

on sqlite studio?
 
Can some show or tell how to get the lottery stats at the top of the news on home page?

Thanks
 
New version: Credits to
Code:
vDk,Masteuszx,klekSu,Cykotitan and Bolero

Mod for TFS 0.3.6pl1 and DEV_ 0.4

Is tested.

Lua:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Lottery" enabled="yes">
	<config name="lottery_config"><![CDATA[
		t = {
			lottery_hour = "45 Min", -- Time to next lottery (you set the real time on interval, it's only for the broadcast message.)
			rewards_id = {2494, 2472, 2514, 2195, 2470, 2656, 7895, 2160}, -- ID's of rewards
			stackable_amount = 20, -- amount, if this it's a stackable item
			website = true -- Do you have `lottery` table in your database?
		}
	]]></config>
	<globalevent name="lottery" interval="2700" event="buffer"><![CDATA[
		domodlib('lottery_config')
		local list = getPlayersOnline()
		if #list > 0 then
			local winner, item = list[math.random(#list)], t.rewards_id[math.random(#t.rewards_id)]
			local stackable = getItemInfo(item).stackable
			doPlayerAddItem(winner, item, stackable and t.stackable_amount or 1)
			doBroadcastMessage('[SISTEMA DE LOTERIA]\nGanador: '.. getCreatureName(winner) ..',\nPremio: '.. (stackable and t.stackable_amount ..' ' or '') .. (stackable and getItemInfo(item).plural or getItemNameById(item)) .. '!\nFelicidades!\n(Siguiente Loteria En '.. t.lottery_hour ..')')
			if t.website then
				db.executeQuery("INSERT INTO `lottery` (`name`, `item`, `world_id`) VALUES ('".. getCreatureName(winner) .."', '".. getItemNameById(item) .."', '".. getConfigValue('worldId') .."');")
			end
		end
		return true
	]]></globalevent>
</mod>
 
can someone make this work for Modern AAC? I cant seem to get it to work with Modern AAC..
 
Everything works 100% correctly, but the Lottery system doesnt show up on the website, i got the tables in my database, the lottery.php and edited index.php
 
Back
Top