Ir para conteúdo
Banner com Efeitos

Featured Replies

Postado

Seu sistema de cast é diferente, nesse caso tenta:

Spoiler

local function getCastsOnline()
	local ret, result = {}, db.getResult("SELECT `id` FROM `players` WHERE `broadcasting` >= 1")
	if(result:getID() ~= -1) then
		while(result:next()) do
			local player = getPlayerByGUID(tonumber(result:getDataInt("id")))
			if(player) then
				table.insert(ret, player)
			end
		end
		result:free()
	end
	return ret
end

-- Lottery System By Jeff

local config = {
	lottery_hour = "1 Hours", -- Tempo ate a proxima loteria (Esse tempo vai aparecer somente como broadcast message)
	rewards_id = {2160, 9810, 9822, 9819, 2173, 9693}, -- ID dos Itens Sorteados na Loteria
	crystal_counts = 100, -- Usado somente se a rewards_id for crystal coin (ID: 2160).
	website = "no" -- 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(getCastsOnline()) 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! (Proxima Loteria em " .. config.lottery_hour .. ")")
	else
		doBroadcastMessage("[LOTTERY SYSTEM] Ganhador: " .. getCreatureName(winner) .. ", Item: " .. getItemNameById(random_item) .. "! Parabens! (Proxima Loteria em " .. config.lottery_hour .. ") Premios que podem cair: 1kk, Rusty Armor, Rusty Helmet, Rusty Boots ou Addon Doll. Fique online! Quem sabe vc pode ser o proximo ganhador?")
		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

 

 

Editado por MaTTch (veja o histórico de edições)

  • Respostas 23
  • Visualizações 785
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Bodak Reborn
    Bodak Reborn

    =)

  • Bodak Reborn
    Bodak Reborn

    Cast aberto seria com a tv ligada para outras pessoas assistirem?

  • Bodak Reborn
    Bodak Reborn

    -- Lottery System By Jeff local config = { lottery_hour = "1 Hours", -- Tempo ate a proxima loteria (Esse tempo vai aparecer somente como broadcast message) rewards_id = {2160, 9810, 9822, 9819, 2173

Postado
  • Autor
39 minutos atrás, MaTTch disse:

Seu sistema de cast é diferente, nesse caso tenta:

  Ocultar conteúdo


local function getCastsOnline()
	local ret, result = {}, db.getResult("SELECT `id` FROM `players` WHERE `broadcasting` >= 1")
	if(result:getID() ~= -1) then
		while(result:next()) do
			local player = getPlayerByGUID(tonumber(result:getDataInt("id")))
			if(player) then
				table.insert(ret, player)
			end
		end
		result:free()
	end
	return ret
end

-- Lottery System By Jeff

local config = {
	lottery_hour = "1 Hours", -- Tempo ate a proxima loteria (Esse tempo vai aparecer somente como broadcast message)
	rewards_id = {2160, 9810, 9822, 9819, 2173, 9693}, -- ID dos Itens Sorteados na Loteria
	crystal_counts = 100, -- Usado somente se a rewards_id for crystal coin (ID: 2160).
	website = "no" -- 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(getCastsOnline()) 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! (Proxima Loteria em " .. config.lottery_hour .. ")")
	else
		doBroadcastMessage("[LOTTERY SYSTEM] Ganhador: " .. getCreatureName(winner) .. ", Item: " .. getItemNameById(random_item) .. "! Parabens! (Proxima Loteria em " .. config.lottery_hour .. ") Premios que podem cair: 1kk, Rusty Armor, Rusty Helmet, Rusty Boots ou Addon Doll. Fique online! Quem sabe vc pode ser o proximo ganhador?")
		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

 

 

Funcionou certinho!! VLW MAN!

@

MaTTch

@

Talesigorvr

Acabaram meus reps, mas vou colocar amanha! Dia 15! VLW!!!

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo