• 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

I want to make the lottery only for players wich are not training at notlogout sqm.

How to do?

It isnt too hard :D
 
This system includes the ids of all players?
Or just players who have paid?
 
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>

Gona test it
 
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"><=!=[=C=D=A=T=A=[
		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"><=!=[=C=D=A=T=A=[
		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>

you sure it work in 0.4 rev3884?
for me it give the reward every 2-3 seconds
btw, i didnt modify that mod..
 
TFS works in 0.2.10?

I have the folder functions, where do I put the script?
 
Back
Top