Ir para conteúdo

Featured Replies

Postado
  • Autor
Em 21/06/2020 em 19:09, luanluciano93 disse:

A função getTourneyLevel esta retornando nula.

 

Tenta: 


domodlib('TourneyPVP_func')
function onKill(cid, target, damage, flags)
    if not isPlayer(target) or not isPlayer(cid) then return true end
    addEvent(doCleanArena, 100)
    local shield = getCreaturePartyShield(cid)
    local players = getPlayersInArea(TOURNEY_CONFIG.ARENA.AREA[1], TOURNEY_CONFIG.ARENA.AREA[2])
    local t = getTourneyLevel()

    if isInArray(players, target) then
        for _, dead in pairs(players) do
            if dead == target then
                table.remove(players, _)
                doRemovePlayerTourney(target)
            end
        end
    end

    local check = true
    local check_again = false

    for i = 1, #players do
        if getCreaturePartyShield(players) ~= shield then
            check = false
            break
        end
    end
    
	if t then
		local tourney_players = getPlayersTourneyByLevel(t.level)

		if check == true then
			local r = t.round_rewards
			for i = 1, #players do
				for k = 1, #r do
					if not isItemStackable(r[k][1]) then
						for j = 1, r[k][2] do
							doPlayerAddItem(players, r[k][1], 1)
						end
					else
						doPlayerAddItem(players, r[k][1], r[k][2])
					end
				end
				doSendAnimatedText(getPlayerPosition(players), "WINNER!", COLOR_ORANGE)
			end
			if #tourney_players < TOURNEY_CONFIG.GROUP and #tourney_players > 0 then
				for i = 1, #tourney_players do
					local tid = tourney_players
					if isPlayer(tid) then
						if (not isInArray(TOURNEY_CONFIG.NOT_ALLOWED, getCreatureSkullType(tid))) then
							doCreatureSetPartyShield(tid, (shield == SHIELD_YELLOW and SHIELD_BLUE or SHIELD_YELLOW))
							doTeleportThing(tid, TOURNEY_CONFIG.ARENA.FIGHT[1])
							doPlayerSendTextMessage(tid, MESSAGE_INFO_DESCR, "IT'S TIME!")
							doRemovePlayerTourney(tid)
						else
							doRemovePlayerTourney(tid)
							if #getPlayersTourneyByLevel(t.level) == 0 then
								check_again = true
								break
							end
						end
					end
				end
			elseif #tourney_players >= TOURNEY_CONFIG.GROUP then
				g = doPlayersGroups(tourney_players, TOURNEY_CONFIG.GROUP)[1]
				for i = 1, TOURNEY_CONFIG.GROUP do
					if isPlayer(g) then
						if (not isInArray(TOURNEY_CONFIG.NOT_ALLOWED, getCreatureSkullType(g))) then
							doCreatureSetPartyShield(g, (shield == SHIELD_YELLOW and SHIELD_BLUE or SHIELD_YELLOW))
							doTeleportThing(g, TOURNEY_CONFIG.ARENA.FIGHT[1])
							doPlayerSendTextMessage(g, MESSAGE_INFO_DESCR, "IT'S TIME!")
							doRemovePlayerTourney(g)
						else
							doRemovePlayerTourney(g)
							if #getPlayersTourneyByLevel(t.level) == 0 then
								check_again = true
								break
							end
						end
					end
				end
				doSendMagicEffect(TOURNEY_CONFIG.ARENA.FIGHT[1], CONST_ME_TELEPORT)
			else
				for i = 1, #players do
					doTeleportThing(players, TOURNEY_CONFIG.ARENA.EXIT)
					doPlayerSendTextMessage(players, MESSAGE_STATUS_CONSOLE_ORANGE, "Voc▒ n▒o tem mais oponentes para lutar.")
					doCreatureSetPartyShield(players, SHIELD_NONE)
				end
				doSendMagicEffect(TOURNEY_CONFIG.ARENA.EXIT, CONST_ME_TELEPORT)
			end
		end
		if check_again == true then
			local new_players = getPlayersInArea(TOURNEY_CONFIG.ARENA.AREA[1], TOURNEY_CONFIG.ARENA.AREA[2])
			for i = 1, #new_players do
				doTeleportThing(new_players, TOURNEY_CONFIG.ARENA.EXIT)
				doPlayerSendTextMessage(new_players, MESSAGE_STATUS_CONSOLE_ORANGE, "Voc▒ n▒o tem mais oponentes para lutar.")
				doCreatureSetPartyShield(new_players, SHIELD_NONE)
			end
			doSendMagicEffect(TOURNEY_CONFIG.ARENA.EXIT, CONST_ME_TELEPORT)
		end
	end
return true
end:onKill

 

tentei aqui so q deu erro. se possivel me manda o arquivo ja modificado para mim testa agradeço de coração se pdoer fazer isso.

  • Respostas 5
  • Visualizações 558
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Olá @Guilherme HP cole o código completo que está dando erro e me informe a versão da TFS por gentileza.

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.

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo