• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lottery System time

Keeq

New Member
Joined
Nov 6, 2012
Messages
100
Reaction score
0
Siema mam pewien problem zz ustawieniem czasu w loteri :

<globalevent name="lottery" interval="10800" event="script"><![CDATA[
<-- Tutaj ustawiam czas np xxxx time to loteria jest wczesniej niz ja chce... Wiem ze to trzeba ustawic tylko wiecej ale jak da sie ustawic ze np pisze tyle minuty lub godziny ?
lottery_hour = "3 Hours",
myslalem cos nad tym ale bylo by bez sensu... bo tu wpisze np. xxxx sekund a tu kilka h
PHP:
<mod name="Lottery System" version="1.5" author="vDk" contact="[email protected]" enabled="yes">
	<config name="lottery_config"><![CDATA[
		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!
		}
	]]></config>
	<globalevent name="lottery" interval="10800" event="script"><![CDATA[
		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 
	]]></globalevent>
</mod>
 
Odstęp czasowy ustawiasz tutaj (parametr interval, określany w sekundach).
XML:
<globalevent name="lottery" interval="10800" event="script"><![CDATA[
 
Na 100% w sekundach ? bo ustawialem chyba 1080000 cos takiego i to co 1 h bylo
a 3600 sekund jest to godzina
 
Może być w sekundach, albo milisekundach. Zależy chyba od rev 0.2, albo 0.3/0.4.

@down
Też prawda ;).
 
Last edited:
0.2 nie ma modów, a milisekundy weszły w którejś rewizji 0.3/0.4 bo wcześniej interval był wyrażany w sekundach
 
hm... mam problem znow moze mi ktos powiedziec dlaczego to zawsze losouje tego gracza ktory ostatni sie zalogowal ?
 
Back
Top