antiblock
Cyphriun
  • Chatbox

    You don't have permission to chat.
    Load More
Owsap

[C++] Comando de GM (/kill_all)

1 post in this topic

Comando de GM para derrotar todos os jogadores à sua volta.

zYm3YlG.gif

game/src/cmd.cpp

Spoiler

Procura:


ACMD(do_clear_affect);

Adiciona abaixo:


ACMD(do_kill_all);

Procura:


	{ "do_clear_affect", do_clear_affect, 	0, POS_DEAD,		GM_LOW_WIZARD},

Adiciona abaixo:


	{ "kill_all", do_kill_all, 0, POS_DEAD, GM_HIGH_WIZARD },

 

 

game/src/cmd_gm.cpp

Spoiler

Procura:


ACMD (do_clear_affect)
{
	ch->ClearAffect(true);
}

Adiciona abaixo:


struct FuncKillAll
{
	LPCHARACTER m_ch;

	FuncKillAll(LPCHARACTER ch):
		m_ch(ch)
	{}

	void operator()(LPENTITY ent)
	{
		if (ent->IsType(ENTITY_CHARACTER))
		{
			LPCHARACTER ch = (LPCHARACTER) ent;

			if (!test_server)
			{
				if (!ch->IsPC() || m_ch == ch || ch->IsGM() || ch->IsDead() || ch->GetHP() <= 0)
					return;
			}
			else
			{
				if (!ch->IsPC() || m_ch == ch || ch->IsDead() || ch->GetHP() <= 0)
					return;
			}

			float fDist = DISTANCE_APPROX(m_ch->GetX() - ch->GetX(), m_ch->GetY() - ch->GetY());
			if (fDist > 7000.f)
				return;

			int damage = ch->GetHP()+number(1, 4250);
			ch->EffectPacket(SE_CRITICAL);
			ch->PointChange(POINT_HP, -damage, false);
			ch->Dead();
		}
	}
};

ACMD(do_kill_all)
{
	LPSECTREE pSec = ch->GetSectree();
	if (pSec)
	{
		FuncKillAll f(ch);
		pSec->ForEachAround(f);
	}
}

 

Share this post


Link to post
Share on other sites
antiblock
Elveron

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now