Ir para conteúdo

Featured Replies

  • Respostas 43
  • Visualizações 3.6k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Galera, comentar "UP" nos tópicos é proibido, leiam as regras: 2.7 - Dar "UP" para subir tópicos: É totalmente proibido comentar "UP" para subir tópicos, caso você tenha a intenção você pode ut

Posted Images

Postado
  • Autor

cara as buffs estão funcionando perfeitamente ja fiz o teste com as vocações, o evento ta perfeito só acontece esse erro ao acabar quando os players são teleportados pro templo, 

pode perceber que na imagem tem 6 erros na distro, é pq tinha 6 player dentro do evento, 3 em cada time !!!

@x1zy , ele remove sim todos os player do evento, mais mesmo assim dá esse erro, eu não faço ideia o porque.

pois o evento ocorre tudo certo, mais não queria deixar esse erro na distro ao acabar o evento !!!

Postado

pode postar o seu codigo como ele esta agora, e TODOS os erros que da no console assim que o evento acaba?
visto que ainda assim remove os players, o que falta é alguns checks, para n chamar x função caso o player não seja encontrado.

Postado
  • Autor
Spoiler

function onLogin(cid)
    registerCreatureEvent(cid, "dttDeath")
    registerCreatureEvent(cid, "dttPrepare")
    registerCreatureEvent(cid, "dttStats")
    registerCreatureEvent(cid, "dttOutfit")
    registerCreatureEvent(cid, "dttKill") 
    registerCreatureEvent(cid, "dttCombat")
    if (getPlayerStorageValue(cid, dtt.storage.team_blue) == 1) or (getPlayerStorageValue(cid, dtt.storage.team_red) == 1) then
        dtt.cleanPlayer(cid)
    end
    if (dtt.getBonusExp(cid)) then
        doPlayerSendTextMessage(cid,25, "[DEFEND THE TOWER] Voce esta com "..dtt.bonus_rate.."x de bonus experiencia.")
    end
    return true
end

--Preparar jogadores pra morte
function onPrepareDeath(cid, deathList)
    if not isPlayer(cid) then
        return true
    end

    if (getPlayerStorageValue(cid, dtt.storage.team_blue) == 1) or (getPlayerStorageValue(cid, dtt.storage.team_red) == 1) then
        local strings = {""}
        local j, position, corpse = 1, 1, 0
        --Dropar corpo ficticio
        for _, pid in ipairs(deathList) do
            if isCreature(pid) == true then
                strings[position] = j == 1 and "" or strings[position] .. ", "
                strings[position] = strings[position] .. getCreatureName(pid) .. ""
                j = j + 1
            else
                strings[position] = j == 1 and "" or strings[position] .. ", "
                strings[position] = strings[position] .."a field item"
                j = j + 1
            end
        end
        for i, str in ipairs(strings) do
            if(str:sub(str:len()) ~= ",") then
                str = str .. "."
            end
            desc = "You recognize "
            desc = desc .. "" .. getCreatureName(cid) .. ". He was killed by " .. str
        end
        if(getPlayerSex(cid) == 1) then
            corpse = doCreateItem(3058, getCreaturePosition(cid))
        else
            corpse = doCreateItem(3065, getCreaturePosition(cid))
        end
        doItemSetAttribute(corpse, "description", desc)
        dtt.setDelay(cid)
        dtt.getDelay(cid)
    end

    --Adicionando contagem de frags
    if (getPlayerStorageValue(cid, dtt.storage.team_blue) == 1) then
        setGlobalStorageValue(dtt.storage.kill_blue, (getGlobalStorageValue(dtt.storage.kill_blue)+1))
        doPlayerSetTown(cid, dtt.townid.blue)
    end
    if (getPlayerStorageValue(cid, dtt.storage.team_red) == 1) then
        setGlobalStorageValue(dtt.storage.kill_red, (getGlobalStorageValue(dtt.storage.kill_red)+1))
        doPlayerSetTown(cid, dtt.townid.red)
    end
    return true
end

--Atacar jogadores do mesmo time
function onCombat(cid, target)
    --Membros do mesmo time se atacando
    if isPlayer(cid) and isPlayer(target) then
        if (getPlayerStorageValue(cid, dtt.storage.team_blue) == 1) and (getPlayerStorageValue(target, dtt.storage.team_blue) == 1) then
          doPlayerSendCancel(cid, "[DEFEND THE TOWER] Nao se pode atacar um membro do mesmo time.") 
          return false
       end
       if (getPlayerStorageValue(cid, dtt.storage.team_red) == 1) and (getPlayerStorageValue(target, dtt.storage.team_red) == 1) then
          doPlayerSendCancel(cid, "[DEFEND THE TOWER] Nao se pode atacar um membro do mesmo time.") 
          return false
       end
    end

    --Membro time azul atacando propria torre
    if getPlayerStorageValue(cid, dtt.storage.team_blue) == 1 and isMonster(target) then
        if (getCreatureName(target) == dtt.monster.name.a1) then
            return false
        end
        if (getCreatureName(target) == dtt.monster.name.a2) then
            return false
        end
        if (getCreatureName(target) == dtt.monster.name.a3) then
            return false
        end
        if (getCreatureName(target) == dtt.monster.name.a4) then
            return false
        end
    end

    --Membro time vermelho atacando propria torre
    if getPlayerStorageValue(cid, dtt.storage.team_red) == 1 and isMonster(target) then
        if (getCreatureName(target) == dtt.monster.name.b1) then
            return false
        end
        if (getCreatureName(target) == dtt.monster.name.b2) then
            return false
        end
        if (getCreatureName(target) == dtt.monster.name.b3) then
            return false
        end
        if (getCreatureName(target) == dtt.monster.name.b4) then
            return false
        end
    end

    --Impedir que ataquem torres secundarias
    if (getCreatureName(target) == dtt.monster.name.a1) and isMonster(target) then
        if(isCreature(getThingFromPos(dtt.monster.pos.a2).uid) or isCreature(getThingFromPos(dtt.monster.pos.a3).uid) or isCreature(getThingFromPos(dtt.monster.pos.a4).uid)) then  -- SE ALGUM VALOR DER TRUE NÃO VAI PODER ATACAR 
            return false
        end
    end

    if (getCreatureName(target) == dtt.monster.name.b1) and isMonster(target) then
        if(isCreature(getThingFromPos(dtt.monster.pos.b2).uid) or isCreature(getThingFromPos(dtt.monster.pos.b3).uid) or isCreature(getThingFromPos(dtt.monster.pos.b4).uid)) then  -- SE ALGUM VALOR DER TRUE NÃO VAI PODER ATACAR 
            return false
        end
    end

    return true
end

--Bonus exp
function onKill(cid, target)
    if (dtt.getBonusExp(cid)) and isMonster(target) then     
        doPlayerAddExp(cid, getMonsterInfo(getCreatureName(target)).experience * dtt.bonus_rate)
    end
    return true
end

--Aviso de attack sobre as torres
function onStatsChange(cid, attacker, type, combat, value)
    if not isPlayer(attacker) then
        return true
    end

    -- Avisar que as torres estão sendo atacadas | a2 =  top, a3 = middle, a4 = bottom.
    if (type == STATSCHANGE_HEALTHLOSS) and (getCreatureName(cid) == dtt.monster.name.a2) then
        dtt.warningAttack(cid, "azul do topo", dtt.storage.team_blue) 
    end
    if (type == STATSCHANGE_HEALTHLOSS) and (getCreatureName(cid) == dtt.monster.name.a3) then
        dtt.warningAttack(cid, "azul do meio", dtt.storage.team_blue) 
    end
    if (type == STATSCHANGE_HEALTHLOSS) and (getCreatureName(cid) == dtt.monster.name.a4) then
        dtt.warningAttack(cid, "azul de baixo", dtt.storage.team_blue)   
    end
    if (type == STATSCHANGE_HEALTHLOSS) and (getCreatureName(cid) == dtt.monster.name.b2) then
        dtt.warningAttack(cid, "vermelha do topo", dtt.storage.team_red) 
    end
    if (type == STATSCHANGE_HEALTHLOSS) and (getCreatureName(cid) == dtt.monster.name.b3) then
        dtt.warningAttack(cid, "vermelha do meio", dtt.storage.team_red) 
    end
    if (type == STATSCHANGE_HEALTHLOSS) and (getCreatureName(cid) == dtt.monster.name.b4) then
        dtt.warningAttack(cid, "vermelha de baixo", dtt.storage.team_red) 
    end

    return true
end 

--Impedindo troca de outfit durante o evento
function onOutfit(cid, old, current)
    if getPlayerStorageValue(cid, dtt.storage.team_blue) == 1 or getPlayerStorageValue(cid, dtt.storage.team_red) == 1  then
        doPlayerSendCancel(cid, dtt.msg.outfit)
        return false
    end
    return true
end

--Tratando morte dos montros buff e torres
function onDeath(cid, corpse, mostDamageKiller) 
--Avisos de morte torres time azul
if getCreatureName(cid) == dtt.monster.name.a2 then
    doBroadcastMessage("[DEFEND THE TOWER] A torre azul do topo foi destruida.", MESSAGE_EVENT_ADVANCE)
    doCreateItem(9596, dtt.monster.pos.a2)
    setGlobalStorageValue(dtt.storage.tower_red, (getGlobalStorageValue(dtt.storage.tower_red)+1))
end 

if getCreatureName(cid) == dtt.monster.name.a3 then
    broadcastMessage("[DEFEND THE TOWER] A torre azul do meio foi destruida.", MESSAGE_EVENT_ADVANCE)
    doCreateItem(9596, dtt.monster.pos.a3)
    setGlobalStorageValue(dtt.storage.tower_red, (getGlobalStorageValue(dtt.storage.tower_red)+1))
end

if getCreatureName(cid) == dtt.monster.name.a4 then
    broadcastMessage("[DEFEND THE TOWER] A torre azul de baixo foi destruida.", MESSAGE_EVENT_ADVANCE)
    doCreateItem(9596, dtt.monster.pos.a4)
    setGlobalStorageValue(dtt.storage.tower_red, (getGlobalStorageValue(dtt.storage.tower_red)+1))
end

--Avisos de morte torres time vermelho
if getCreatureName(cid) == dtt.monster.name.b2 then
    broadcastMessage("[DEFEND THE TOWER] A torre vermelha do topo foi destruida.", MESSAGE_EVENT_ADVANCE)
    doCreateItem(9596, dtt.monster.pos.b2)
    setGlobalStorageValue(dtt.storage.tower_blue, (getGlobalStorageValue(dtt.storage.tower_blue)+1))
end 

if getCreatureName(cid) == dtt.monster.name.b3 then
    broadcastMessage("[DEFEND THE TOWER] A torre vermelha do meio foi destruida.", MESSAGE_EVENT_ADVANCE)
    doCreateItem(9596, dtt.monster.pos.b3)
    setGlobalStorageValue(dtt.storage.tower_blue, (getGlobalStorageValue(dtt.storage.tower_blue)+1))
end

if getCreatureName(cid) == dtt.monster.name.b4 then
    broadcastMessage("[DEFEND THE TOWER] A torre vermelha de baixo foi destruida.", MESSAGE_EVENT_ADVANCE)
    doCreateItem(9596, dtt.monster.pos.b4)
    setGlobalStorageValue(dtt.storage.tower_blue, (getGlobalStorageValue(dtt.storage.tower_blue)+1))
end


--Aviso ultimas torres e abertura do teleporte
if getCreatureName(cid) == dtt.monster.name.a1 then
    dtt.removeMonsters()
    setGlobalStorageValue(dtt.storage.win, "red")
    setGlobalStorageValue(dtt.storage.tower_red, (getGlobalStorageValue(dtt.storage.tower_red)+1))
    dtt.close()
    broadcastMessage(dtt.msg.win_team_red, MESSAGE_EVENT_ADVANCE)
    dtt.resultBattle()
end 

--Aviso ultimas torres e abertura do teleporte
if getCreatureName(cid) == dtt.monster.name.b1 then
    dtt.removeMonsters()
    setGlobalStorageValue(dtt.storage.win, "blue")
    setGlobalStorageValue(dtt.storage.tower_blue, (getGlobalStorageValue(dtt.storage.tower_blue)+1))
    dtt.close()
    broadcastMessage(dtt.msg.win_team_blue, MESSAGE_EVENT_ADVANCE)
    dtt.resultBattle()
end 

--Verificando buff sorcerer and paladin
if getCreatureName(cid) == dtt.monster.name.buff1 then
    if (getPlayerStorageValue(mostDamageKiller[1], dtt.storage.team_blue) == 1) then
        dtt.setBuff(dtt.storage.team_blue, 1, 3)
        for _, index in ipairs(dtt.getPlayersInEvent()) do
            if getPlayerStorageValue(index.pid, dtt.storage.team_blue) == 1 then
                doPlayerSendTextMessage(index.pid, 25, "[DEFEND THE TOWER] Os sorcerers e paladinos do seu time receberao buff, utilize as magias wizard buff ou archer buff.")  
            end
        end
    else
        dtt.setBuff(dtt.storage.team_red, 1, 3)
        for _, index in ipairs(dtt.getPlayersInEvent()) do
            if getPlayerStorageValue(index.pid, dtt.storage.team_red) == 1 then
                doPlayerSendTextMessage(index.pid, 25, "[DEFEND THE TOWER] Os sorcerers e paladinos do seu time receberao buff, utilize as magias wizard buff ou archer buff.")  
            end
        end
    end
end

--Verificando buff druid and knight
if getCreatureName(cid) == dtt.monster.name.buff2 then
    if (getPlayerStorageValue(mostDamageKiller[1], dtt.storage.team_blue) == 1) then
        dtt.setBuff(dtt.storage.team_blue, 2, 4)
        for _, index in ipairs(dtt.getPlayersInEvent()) do
            if getPlayerStorageValue(index.pid, dtt.storage.team_blue) == 1 then
                doPlayerSendTextMessage(index.pid, 25, "[DEFEND THE TOWER] Os druids e knights do seu time receberao buff, utilize as magias magician buff ou warrior buff.")  
            end
        end
    else
        dtt.setBuff(dtt.storage.team_red, 2, 4)
        for _, index in ipairs(dtt.getPlayersInEvent()) do
            if getPlayerStorageValue(index.pid, dtt.storage.team_red) == 1 then
                doPlayerSendTextMessage(index.pid, 25, "[DEFEND THE TOWER] Os druids e knights do seu time receberao buff, utilize as magias magician buff ou warrior buff.")  
            end
        end
    end
end
return true
end

 

SAIDA EVENTO DTT.jpg

 

estou usando esse ai, e o erro que acontece é esse dai, antes dava um erro na entrada dos player no evento.

mais o @Vodkart , me mandou um script lib  e sumiu o erro da distro de entrada dos player

na minha visão (quase certeza) pelo numero de players que eu levo no evento

sempre levo 6 player 3 de cada time, e acaba dando esse erro na saida pode fazer a contagem que é apenas 6 erros que aparecem

agora eu to tendo apenas esse erro na saida, que esta acusando em creaturescripts

obrigado deis de já !!!

 

ah lembrando que esse script se localiza em :

 

data\creaturescripts\scripts\events

 

@x1zy

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

Postado

experimente mudar 2 coisas,

function dtt.removeMonsters() :

function dtt.removeMonsters()
	for i = 1, 4 do 
		local a = getThingfromPos(dtt.monster.pos.a .. i)
		local b = getThingfromPos(dtt.monster.pos.b .. i)
		if isMonster(a.uid) then
			doRemoveCreature(a.uid)
		end
		if isMonster(b.uid) then
			doRemoveCreature(b.uid)
		end		
	end
    return true
end

 

function onDeath(cid, corpse, mostDamageKiller) :
 

function onDeath(cid, corpse, mostDamageKiller) 
	--Avisos de morte torres time azul
	if getCreatureName(cid) == dtt.monster.name.a2 then
		doBroadcastMessage("[DEFEND THE TOWER] A torre azul do topo foi destruida.", MESSAGE_EVENT_ADVANCE)
		doCreateItem(9596, dtt.monster.pos.a2)
		setGlobalStorageValue(dtt.storage.tower_red, (getGlobalStorageValue(dtt.storage.tower_red)+1))
		return true
	end 
	if getCreatureName(cid) == dtt.monster.name.a3 then
		broadcastMessage("[DEFEND THE TOWER] A torre azul do meio foi destruida.", MESSAGE_EVENT_ADVANCE)
		doCreateItem(9596, dtt.monster.pos.a3)
		setGlobalStorageValue(dtt.storage.tower_red, (getGlobalStorageValue(dtt.storage.tower_red)+1))
		return true
	end
	if getCreatureName(cid) == dtt.monster.name.a4 then
		broadcastMessage("[DEFEND THE TOWER] A torre azul de baixo foi destruida.", MESSAGE_EVENT_ADVANCE)
		doCreateItem(9596, dtt.monster.pos.a4)
		setGlobalStorageValue(dtt.storage.tower_red, (getGlobalStorageValue(dtt.storage.tower_red)+1))
		return true
	end
	--Avisos de morte torres time vermelho
	if getCreatureName(cid) == dtt.monster.name.b2 then
		broadcastMessage("[DEFEND THE TOWER] A torre vermelha do topo foi destruida.", MESSAGE_EVENT_ADVANCE)
		doCreateItem(9596, dtt.monster.pos.b2)
		setGlobalStorageValue(dtt.storage.tower_blue, (getGlobalStorageValue(dtt.storage.tower_blue)+1))
		return true
	end 
	if getCreatureName(cid) == dtt.monster.name.b3 then
		broadcastMessage("[DEFEND THE TOWER] A torre vermelha do meio foi destruida.", MESSAGE_EVENT_ADVANCE)
		doCreateItem(9596, dtt.monster.pos.b3)
		setGlobalStorageValue(dtt.storage.tower_blue, (getGlobalStorageValue(dtt.storage.tower_blue)+1))
		return true
	end
	if getCreatureName(cid) == dtt.monster.name.b4 then
		broadcastMessage("[DEFEND THE TOWER] A torre vermelha de baixo foi destruida.", MESSAGE_EVENT_ADVANCE)
		doCreateItem(9596, dtt.monster.pos.b4)
		setGlobalStorageValue(dtt.storage.tower_blue, (getGlobalStorageValue(dtt.storage.tower_blue)+1))
		return true
	end

	--Aviso ultimas torres e abertura do teleporte
	if getCreatureName(cid) == dtt.monster.name.a1 then
		dtt.removeMonsters()
		setGlobalStorageValue(dtt.storage.win, "red")
		setGlobalStorageValue(dtt.storage.tower_red, (getGlobalStorageValue(dtt.storage.tower_red)+1))
		dtt.close()
		broadcastMessage(dtt.msg.win_team_red, MESSAGE_EVENT_ADVANCE)
		dtt.resultBattle()
		return true
	end 
	--Aviso ultimas torres e abertura do teleporte
	if getCreatureName(cid) == dtt.monster.name.b1 then
		dtt.removeMonsters()
		setGlobalStorageValue(dtt.storage.win, "blue")
		setGlobalStorageValue(dtt.storage.tower_blue, (getGlobalStorageValue(dtt.storage.tower_blue)+1))
		dtt.close()
		broadcastMessage(dtt.msg.win_team_blue, MESSAGE_EVENT_ADVANCE)
		dtt.resultBattle()
		return true
	end 
	--Verificando buff sorcerer and paladin
	if getCreatureName(cid) == dtt.monster.name.buff1 then
		if (getPlayerStorageValue(mostDamageKiller[1], dtt.storage.team_blue) == 1) then
			dtt.setBuff(dtt.storage.team_blue, 1, 3)
			for _, index in ipairs(dtt.getPlayersInEvent()) do
				if getPlayerStorageValue(index.pid, dtt.storage.team_blue) == 1 then
					doPlayerSendTextMessage(index.pid, 25, "[DEFEND THE TOWER] Os sorcerers e paladinos do seu time receberao buff, utilize as magias wizard buff ou archer buff.")  
				end
			end
		else
			dtt.setBuff(dtt.storage.team_red, 1, 3)
			for _, index in ipairs(dtt.getPlayersInEvent()) do
				if getPlayerStorageValue(index.pid, dtt.storage.team_red) == 1 then
					doPlayerSendTextMessage(index.pid, 25, "[DEFEND THE TOWER] Os sorcerers e paladinos do seu time receberao buff, utilize as magias wizard buff ou archer buff.")  
				end
			end
		end
		return true
	end
	--Verificando buff druid and knight
	if getCreatureName(cid) == dtt.monster.name.buff2 then
		if (getPlayerStorageValue(mostDamageKiller[1], dtt.storage.team_blue) == 1) then
			dtt.setBuff(dtt.storage.team_blue, 2, 4)
			for _, index in ipairs(dtt.getPlayersInEvent()) do
				if getPlayerStorageValue(index.pid, dtt.storage.team_blue) == 1 then
					doPlayerSendTextMessage(index.pid, 25, "[DEFEND THE TOWER] Os druids e knights do seu time receberao buff, utilize as magias magician buff ou warrior buff.")  
				end
			end
		else
			dtt.setBuff(dtt.storage.team_red, 2, 4)
			for _, index in ipairs(dtt.getPlayersInEvent()) do
				if getPlayerStorageValue(index.pid, dtt.storage.team_red) == 1 then
					doPlayerSendTextMessage(index.pid, 25, "[DEFEND THE TOWER] Os druids e knights do seu time receberao buff, utilize as magias magician buff ou warrior buff.")  
				end
			end
		end
		return true
	end
	return true
end

 

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.7k

Informação Importante

Confirmação de Termo