示例#1
0
bool Entity::IsActiveWeaponPistol()
{
	int WeaponId = LocalEntity.GetActiveWeapon();

	return( WeaponId == WEAPON_DEAGLE || WeaponId == WEAPON_ELITE || WeaponId == WEAPON_FIVESEVEN || WeaponId == WEAPON_GLOCK
			|| WeaponId == WEAPON_P228 || WeaponId == WEAPON_USP || WeaponId == WEAPON_TEC9 || WeaponId == WEAPON_TASER || WeaponId == WEAPON_HKP2000 );
}
示例#2
0
bool Entity::IsActiveWeaponNotVaild()
{
	int WeaponId = LocalEntity.GetActiveWeapon();

	return( WeaponId == WEAPON_KNIFEGG || WeaponId == WEAPON_KNIFE || WeaponId == WEAPON_FLASHBANG || WeaponId == WEAPON_HEGRENADE || WeaponId == WEAPON_SMOKEGRENADE
			|| WeaponId == WEAPON_MOLOTOV || WeaponId == WEAPON_DECOY || WeaponId == WEAPON_INCGRENADE || WeaponId == WEAPON_C4 );
}
示例#3
0
文件: hud.cpp 项目: TSM-Dev/nh30
void hud::DrawESP()
{
	surface->SetFont(ui::font_hud);
	surface->SetTextColor(0xff, 0xff, 0xff, 0xff);

	Entity *lp  = LocalPlayer();
	int  maxent = globals->maxclients();

	for (int i = 1; i <= ents->GetMaxEntities(); ++i)
	{
		Entity *ent = ents->GetEntity(i);

		if (ent == nullptr || ent == lp)
			continue;

		if (ent->IsDormant())
			continue;

		if (1 && i <= maxent)
		{
			if (!ent->IsAlive())
				continue;

			int x0, y0, x1, y1;

			if (!MakeBox(ent, x0, y0, x1, y1))
			 	continue;

			surface->SetColor(0x00, 0x00, 0x00, 0x7f);
			surface->DrawOutlinedRect(x0 - 1, y0 - 1, x1 + 1, y1 + 1);
			surface->DrawOutlinedRect(x0 + 1, y0 + 1, x1 - 1, y1 - 1);

			if (1) // menu.ESP.health
			 	surface->DrawFilledRect(x0 - 4, y0 - 1, x0 - 1, y1 + 1);

#if defined(L4D) || defined(L4D2)
			switch (ent->GetTeam())
			{
				case 2:
				case 4:
					surface->SetColor(0x46, 0x78, 0xff, 0xff);
				break;

				case 3:
					surface->SetColor(0x96, 0x00, 0xe1, 0xff);
				break;
			}
#else
			switch (ent->GetTeam())
			{
				case TEAM_RED:
					surface->SetColor(0xff, 0x64, 0x64, 0xff);
				break;

				case TEAM_BLU:
					surface->SetColor(0x46, 0x78, 0xff, 0xff);
				break;
			}
#endif

			surface->DrawOutlinedRect(x0, y0, x1, y1);

			if (1) // menu.ESP.health
			{
				if (ent->GetHealth() <= ent->GetMaxHealth())
				{
					if (ent->GetHealth() <= (ent->GetMaxHealth() / 4))
						surface->SetColor(0xff, 0x00, 0x00, 0xff);
					else
						surface->SetColor(0x00, 0xff, 0x00, 0xff);
				}

				surface->DrawFilledRect(x0 - 3, y1 - Min<int>(y1 - y0, (float)(y1 - y0) * ((float)ent->GetHealth() / (float)ent->GetMaxHealth()) + 0.5f), x0 - 1, y1);
			}

			if (1) // menu.ESP.name
			{
				player_info info;
				engine->GetPlayerInfo(i, info);

				int length = 0;
				const wchar_t *text = tounicode(info.name, length);

				int tw, th;
				surface->GetTextSize(ui::font_hud, text, tw, th);

				surface->SetTextPos((x0 + x1 - tw) / 2, y0 - th);
				surface->DrawText(text, length, 0);
			}

			if (1) // menu.ESP.weapon
			{
				Entity *weapon = ent->GetActiveWeapon();

				if (weapon)
				{
					const char *classname = weapon->GetClass();
#ifndef GMOD
					if (qstrlen(classname) > 6)
					{
						classname += 6;
					}
#endif

					int length = 0;
					const wchar_t *text = util::MakeReadable(classname, length);

					int tw, th;
					surface->GetTextSize(ui::font_hud, text, tw, th);

					surface->SetTextPos((x0 + x1 - tw) / 2, y1 + 1);
					surface->DrawText(text, length, 0);
				}
			}

			continue;
		}

		if (1)
		{
#if defined(L4D) || defined(L4D2)
			if (streq(ent->GetNetworkClass()->name, "Infected"))
			{
				if (!ent->NPC_IsAlive())
					continue;

				int x0, y0, x1, y1;

				if (!MakeBox(ent, x0, y0, x1, y1))
					continue;

				surface->SetColor(0x00, 0x00, 0x00, 0x7f);
				surface->DrawOutlinedRect(x0 - 1, y0 - 1, x1 + 1, y1 + 1);
				surface->DrawOutlinedRect(x0 + 1, y0 + 1, x1 - 1, y1 - 1);

				surface->SetColor(0xc8, 0xff, 0x00, 0xff);
				surface->DrawOutlinedRect(x0, y0, x1, y1);


				int tw, th;

				if (ReadPtr<bool>(ent, m_mobRush))
				{
					surface->GetTextSize(ui::font_hud, L"Mob rush", tw, th);

					surface->SetTextPos((x0 + x1 - tw) / 2, y1 + 1);
					surface->DrawText(L"Mob rush", 8, 0);
				}
				else
				{
					surface->GetTextSize(ui::font_hud, L"Common", tw, th);

					surface->SetTextPos((x0 + x1 - tw) / 2, y1 + 1);
					surface->DrawText(L"Common", 6, 0);
				}

				continue;
			}

			if (streq(ent->GetNetworkClass()->name, "Witch"))
			{
				if (!ent->NPC_IsAlive())
					continue;

				int x0, y0, x1, y1;

				if (!MakeBox(ent, x0, y0, x1, y1))
					continue;

				surface->SetColor(0x00, 0x00, 0x00, 0x7f);
				surface->DrawOutlinedRect(x0 - 1, y0 - 1, x1 + 1, y1 + 1);
				surface->DrawOutlinedRect(x0 + 1, y0 + 1, x1 - 1, y1 - 1);

				surface->SetColor(0x96, 0x00, 0xe1, 0xff);
				surface->DrawOutlinedRect(x0, y0, x1, y1);

				int tw, th;

				surface->GetTextSize(ui::font_hud, L"Witch", tw, th);

				surface->SetTextPos((x0 + x1 - tw) / 2, y1 + 1);
				surface->DrawText(L"Witch", 5, 0);

				continue;
			}
#endif
		}
	}
}
示例#4
0
文件: main.cpp 项目: TSM-Dev/nh30
void __thiscall hooked_SetViewAngles(void *t, Angle &angles)
{
	bpaware();

	register UserCmd *ucmd asm("esi");

#ifdef GMOD
	if (ucmd && ucmd->tick_count == 0 && ucmd->predicted)
		return;
#endif

	org_SetViewAngles(t, angles);


	if (ucmd && ucmd->command_number == bp->next->arg<int>(1))
	{
		Entity *lp = LocalPlayer();
		Entity *weapon = lp->GetActiveWeapon();

		float curtime = (float)lp->GetTickCount() * globals->interval();

		if (!lp->IsAlive())
			return;


		// static int speedcmd = 0;

		// if (speedfix[(ucmd->command_number+1) % sizeof(speedfix)] = (GetAsyncKeyState(VK_LSHIFT) && --speedcmd > 0))
		// {
		// 	bp->next->next->next->next->ret -= 5;
		// }
		// else
		// {
		// 	speedcmd = 5;
		// }


		aimbot::RunCommand(ucmd);

		Angle viewang = ucmd->viewangles;
		bool canshoot = weapon && weapon->Clip1() > 0;

#ifdef VORANGEBOX
		bool &sendpacket = *((bool *)bp->next->next->next - 1);
#endif
#ifdef VL4D
		bool &sendpacket = *((bool *)bp->next->next->next - 0x21);
#endif

#ifdef CSGO
		bool &sendpacket = *((bool *)bp->next - 0x1c);
#endif

		if (1 && !lp->HasFlag(FL_ONGROUND)) // menu/bhop
			ucmd->buttons.del(IN_JUMP);

		if (1 && canshoot) // menu.aimbot
		{
			if (aimbot::Think(ucmd) && 0)
			{
			//	org_SetViewAngles(t, ucmd->viewangles);
			}
		}

		if (1) // menu.norecoil
		{
			nospread::ApplyRecoil(lp, ucmd->viewangles, -1.0f);
		}

		if (canshoot && ucmd->buttons.test(IN_ATTACK))
		{
			//if (1) // menu/nospread
			//	nospread::ApplySpread(ucmd->command_number, lp, ucmd->viewangles, -1.0f);

			if (1 && weapon->GetNextPrimaryFire() > curtime) // menu/autopistol
				ucmd->buttons.del(IN_ATTACK);

			if (1)
			{
				if (weapon->GetNextPrimaryFire() > curtime)
				{
					ucmd->viewangles = viewang;
				}
				else
				{
					sendpacket = false;
				}
			}

			if (weapon->GetNextPrimaryFire() <= curtime)
				aimbot::Next();
		}


		Angle move;
		VectorAngles(ucmd->move, move);

		float velocity = ucmd->move.Length2D();
		float sin, cos;
		SinCos(Deg2Rad(ucmd->viewangles.y - viewang.y + move.y), sin, cos);

		if (ucmd->viewangles.x < -90.0f || ucmd->viewangles.x > 90.0f)
		{
			ucmd->move.x = sin * velocity;
			ucmd->move.y = cos * velocity;
		}
		else
		{
			ucmd->move.x = cos * velocity;
			ucmd->move.y = sin * velocity;
		}

		// ucmd->move.RotateInPlace();
	}
}
示例#5
0
文件: aimbot.cpp 项目: TSM-Dev/nh30
bool aimbot::Think(UserCmd *ucmd)
{
	Entity *lp = LocalPlayer();
	Entity *t  = nullptr;

	float best = 3.40282347e+38f;

	weaponinfo = lp->GetActiveWeapon()->GetWeaponInfo();


	Vector aim, tp, sp = lp->GetShootPos();
	AngleVectors(ucmd->viewangles, aim);

	BulletFilter bf(lp);

	for (int i = 1, ignore = engine->GetLocalPlayer(), players = globals->maxclients();
#ifdef NPCS
		i <= ents->GetMaxEntities();
#else
		i <= globals->maxclients();
#endif
		i++)
	{
		if (i == ignore)
			continue;

		if (Entity *pl = ents->GetEntity(i))
		{
			if (pl->IsDormant())
				continue;

			if (i > players)
				continue;

			if (!CheckTarget(lp, pl))
				continue;

			if (!pl->GetModel())
				continue;

			if (!pl->SetupBones())
				continue;

			float rate = RateOf(ucmd, lp, pl, i);
			if (rate >= best)
				continue;

			bf.against(pl);

			bool next = false;
			int index = 0;

			for (int j = pl->Hitboxes() - 1; j >= 0; j--)
			{
				hitbox *box = pl->GetHitbox(j);

				if (box->group == HITGROUP_HEAD)
				{
					Vector pos = pl->GetBoxPos(box);

					if (BulletTrace(sp, pos, &bf))
					{
						t  = pl;
						tp = pos;

						best = rate;
						shot = i;

						next = true;
					}

					index = j;
					break;
				}
			}

			if (!next && 1) // menu.aimbot.hitscan
			{
				for (int j = 0; j < pl->Hitboxes(); j++)
				{
					if (j == index)
						continue;

					hitbox *box = pl->GetHitbox(j);

					if (box->group && box->group != HITGROUP_HEAD)
					{
						Vector pos = pl->GetBoxPos(box);

						if (BulletTrace(sp, pos, &bf))
						{
							t  = pl;
							tp = pos;

							best = rate;
							shot = i;

							break;
						}
					}
				}
			}
		}
	}

	if (t != nullptr)
	{
		VectorAngles(tp - sp, ucmd->viewangles);

		//if (1) // menu.aimbot.autoshot
		//	ucmd->buttons.add(IN_ATTACK);

		return true;
	}

	return false;
}