Ir para conteúdo

[Encerrado] Dungeon Finder


subyth

Posts Recomendados

TFS 0.3.6

Base: OTX 2

 

 

Estou com um problema no Dungeon Finder. Para ver todo o script: 

 

Digito /queue join nos 5 personagens mas após isso, nada acontece (não da erro nenhum no distro).
Quando digito /queue join ele adiciona na DB e aparece a mensagem que estou na QUEUE, até ai tudo certo. O problema acho que está no globalevents, como ele não estivesse dando partida ao ter 5 personagens na queue :/

local DUNGEONS = {
[1] = {NAME = "Serpent Dungeon", LEVEL = 30, POS = {x = 30317, y = 32307, z = 10}},
}

local condition = createConditionObject(CONDITION_INFIGHT)
setConditionParam(condition, CONDITION_PARAM_TICKS, 15000)


function onThink(cid, interval)

	DUNGEON = DUNGEONS[math.random(1, table.maxn(DUNGEONS))]
	players = {}
	for i = 1, 1000 do
		if(table.maxn(players) == 5) then
			break
		end
		
	query = db.getResult("SELECT * FROM `dungeon_finder` WHERE `id` = " .. i .. ";")
		
		if(query:getID() > -1) then
			pid = getPlayerByName(getPlayerNameByGUID(query:getDataInt("player_id")))
			if(getPlayerStorageValue(pid, CONFIG.DUNGEON_STORAGE) > 1) then
				return true
			end

			if(getPlayerLevel(pid) > DUNGEON.LEVEL and getPlayerLevel(pid) < DUNGEON.LEVEL + 50) then
				table.insert(players, getPlayerGUID(pid))
			end
			
			query:free()
		end
	end

	if(table.maxn(players) == 5) then
		for i = 1, 5 do
			pid = getPlayerByName(getPlayerNameByGUID(players[i]))
			if(i == 1) then
				doPlayerSendTextMessage(pid, MESSAGE_STATUS_CONSOLE_BLUE, "You were chosen to be a dungeon guide.")
				addEvent(doCreatureSay, 15200, pid, "You and your team were teleported to the " .. DUNGEON.NAME .. ".", TALKTYPE_ORANGE_1)
				for j = 2, 5 do
					lid = getPlayerByName(getPlayerNameByGUID(players[j]))
					doPlayerInviteToParty(pid, lid)
				end
			else
				doPlayerJoinParty(pid, getPlayerByName(getPlayerNameByGUID(players[1])))
			end
			
			delay = 0
			for i = 1, 15 do
				addEvent(doPlayerSendTextMessage, delay + 1000, pid, MESSAGE_STATUS_CONSOLE_BLUE, "A dungeon group for you has been found. You'll be teleported to the dungeon in " .. 15 - i .. " seconds.")
				delay = delay + 1000
			end

			doAddCondition(pid, condition)
			addEvent(doTeleportThing, 15000, pid, DUNGEON.POS)
			addEvent(doSendMagicEffect, 15000, DUNGEON.POS, CONST_ME_TELEPORT)
			db.executeQuery("DELETE FROM `dungeon_finder` WHERE `player_id` = " .. players[i] .. ";")

			if(CONFIG.QUIT_POS) then
				setPlayerStorageValue(pid, 42250, getPlayerPosition(pid).x)
				setPlayerStorageValue(pid, 42251, getPlayerPosition(pid).y)
				setPlayerStorageValue(pid, 42252, getPlayerPosition(pid).z)
			end
			
			setPlayerStorageValue(pid, CONFIG.DUNGEON_STORAGE, 1)
		end
	end
	return true
end
<globalevent name="dungeon" interval="1000" event="script" value="dungeon.lua"/>

 

Link para o comentário
Compartilhar em outros sites

  • 2 months later...
Visitante
Este tópico está impedido de receber novos posts.
  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...