What's new

Problem z Lottery System

Status
Not open for further replies.

GoD Kula

User
Joined
Jul 22, 2009
Messages
16
Reaction score
1
Age
30
a Wiec tak mam Silnik TFS 0.3.6 i czytalem poradnik jak zrobic Lottery System i zrobilem tak ze dodalem ten Lottery do Mods i zadne blendy mi nie wyskakuja ale ustawilem na 1 Godz. i nikt nie dostal Loterji potem zrobilem w data/globalevents/scripts lottery czekalem 1 godz. i tez nic nie wiem o co hodzi prosze o pomoc dam rep a globalevents.xml dodaje linijke <globalevent name="lottery" interval="3600" event="script" value="lottery.lua"/> ale w Silniku tez zadnych blendow nie ma nic nie wyskakuje prosze o szybka odp.
 
Joined
Jan 6, 2011
Messages
552
Reaction score
65
Odp: Problem z Lottery System

Poka? skrypt (lub podaj link do tematu, w kt?rym si? znajduj?).
 

GoD Kula

User
Joined
Jul 22, 2009
Messages
16
Reaction score
1
Age
30
local config = {
lottery_hour = "1 Hour", -- Time to next lottery (only for broadcast message, real time you can set on globalevents.xml)
rewards_id = {2494, 2472, 2514, 2160, 2495, 6132, 2493, 8266, 8905}, -- Rewards ID
crystal_counts = 50, -- 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 = 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
to jest to co mam
Prosze o szybka odp. o 15:00 moj serwer startuje daje odrazu rep
Notka moderatorska:
??cze
 
Last edited by a moderator:
Joined
Jan 6, 2011
Messages
552
Reaction score
65
Odp: Problem z Lottery System

Doda?e? tabelk? 'rewards' do bazy?

Wys?a?em skrypt koledze i twierdzi, ?e dzia?a na TFS 0.3.6pl1.

Zmniejsz interval, wklej ten skrypt:
PHP:
local config = {
	lottery_hour = "1 Hour", -- Time to next lottery (only for broadcast message, real time you can set on globalevents.xml)
	rewards_id = {2494, 2472, 2514, 2160, 2495, 6132, 2493, 8266, 8905}, -- Rewards ID
	crystal_counts = 50, -- 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)
	print ('a')
	if(getWorldCreatures(0) == 0)then
	print ('b')
		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
		print ('c')
		db.executeQuery("INSERT INTO `lottery` (`name`, `item`) VALUES ('".. getCreatureName(winner) .."', '".. getItemNameById(random_item) .."');")
	end
	print ('d')
	return true
end
i powiedz jakie s? komunikaty...
 

GoD Kula

User
Joined
Jul 22, 2009
Messages
16
Reaction score
1
Age
30
Odp: Problem z Lottery System

juz mi dziala nie wiem zrobilem cos tam i nagle dzialal juz ale thx
 
Status
Not open for further replies.
Top