Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[suggestion] add auto strafe and seperate banable features with a new menu button #270

Open
psxjtwr01 opened this issue Apr 23, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@psxjtwr01
Copy link

I made this because the bhop is kinda trash without auto strafe and i havent found any decent working bhops besides this one. I have a strafe

void F::MISC::MOVEMENT::AutoStrafe(CUserCmd* pCmd, CBaseUserCmdPB* pUserCmd, C_CSPlayerPawn* pLocalPawn, int type)
{
	static uint64_t last_pressed = 0;
	static uint64_t last_buttons = 0;

	if (!C_GET(bool, Vars.bAutostrafe))
		return;

	auto& cmd = I::Input->arrCommands[I::Input->nSequenceNumber % 150];
	bool strafe_assist = C_GET(bool, Vars.bAutostrafeAssistance);
	const auto current_buttons = cmd.m_nButtons.m_nValue;
	auto yaw = MATH::normalize_yaw(pUserCmd->m_pViewangles->m_angValue.y);

	const auto check_button = [&](const uint64_t button)
	{
		if (current_buttons & button && (!(last_buttons & button) || button & IN_MOVELEFT && !(last_pressed & IN_MOVERIGHT) || button &
			IN_MOVERIGHT && !(last_pressed & IN_MOVELEFT) || button & IN_FORWARD && !(last_pressed & IN_BACK) ||
			button & IN_BACK && !(last_pressed & IN_FORWARD)))
		{
			if (strafe_assist)
			{
				if (button & IN_MOVELEFT)
					last_pressed &= ~IN_MOVERIGHT;
				else if (button & IN_MOVERIGHT)
					last_pressed &= ~IN_MOVELEFT;
				else if (button & IN_FORWARD)
					last_pressed &= ~IN_BACK;
				else if (button & IN_BACK)
					last_pressed &= ~IN_FORWARD;
			}

			last_pressed |= button;
		}
		else if (!(current_buttons & button))
			last_pressed &= ~button;
	};

	check_button(IN_MOVELEFT);
	check_button(IN_MOVERIGHT);
	check_button(IN_FORWARD);
	check_button(IN_BACK);

	last_buttons = current_buttons;

	const auto velocity = pLocalPawn->GetAbsVelocity();
	bool wasdstrafe = C_GET(unsigned int, Vars.bAutostrafeMode) == 0;
	bool viewanglestrafe = C_GET(unsigned int, Vars.bAutostrafeMode) == 1;
	float smoothing = C_GET(float, Vars.autostrafe_smooth);

	/*const auto weapon = pLocalPawn->get_weapon_services_ptr()->get_h_active_weapon().get();
	const auto js = weapon && (cfg.weapon_config.is_scout && cfg.weapon_config.cur.scout_jumpshot && pLocalPawn->get_vec_abs_velocity().length_2d() < 50.f);
	const auto throwing_nade = weapon && weapon->is_grenade() && ticks_to_time(local_player->get_tickbase()) >= weapon->get_throw_time() && weapon->get_throw_time() != 0.f;

	if (js)
		return;*/

	if (pLocalPawn->GetFlags() & FL_ONGROUND)
		return;

	auto rotate_movement = [](CUserCmd& cmd, float target_yaw)
	{		auto pUserCmd = cmd.m_csgoUserCmd.m_pBaseCmd;

	const float rot = M_DEG2RAD(pUserCmd->m_pViewangles->m_angValue.y - target_yaw);

	const float new_forward = std::cos(rot) * pUserCmd->m_flForwardMove - std::sin(rot) * pUserCmd->m_flSideMove;
	const float new_side = std::sin(rot) * pUserCmd->m_flForwardMove + std::cos(rot) * pUserCmd->m_flSideMove;

	cmd.m_nButtons.m_nValue &= ~(IN_BACK | IN_FORWARD | IN_MOVELEFT | IN_MOVERIGHT);
	pUserCmd->m_flForwardMove = std::clamp(new_forward, -1.f, 1.f);
	pUserCmd->m_flSideMove = std::clamp(new_side * -1.f, -1.f, 1.f);

	if (pUserCmd->m_flForwardMove > 0.f)
		cmd.m_nButtons.m_nValue |= IN_FORWARD;
	else if (pUserCmd->m_flForwardMove < 0.f)
		cmd.m_nButtons.m_nValue |= IN_BACK;

	if (pUserCmd->m_flSideMove > 0.f)
		cmd.m_nButtons.m_nValue |= IN_MOVELEFT;
	else if (pUserCmd->m_flSideMove < 0.f)
		cmd.m_nButtons.m_nValue |= IN_MOVERIGHT;
	};


	if (wasdstrafe)
	{
		auto offset = 0.f;
		if (last_pressed & IN_MOVELEFT)
			offset += 90.f;
		if (last_pressed & IN_MOVERIGHT)
			offset -= 90.f;
		if (last_pressed & IN_FORWARD)
			offset *= 0.5f;
		else if (last_pressed & IN_BACK)
			offset = -offset * 0.5f + 180.f;

		yaw += offset;

		pUserCmd->m_flForwardMove = 0.f;
		pUserCmd->m_flSideMove = 0.f;

		rotate_movement(cmd, MATH::normalize_yaw(yaw));

		if (!viewanglestrafe && offset == 0.f)
			return;
	}

	if (pUserCmd->m_flSideMove != 0.0f || pUserCmd->m_flForwardMove != 0.0f)
		return;

	auto velocity_angle = M_RAD2DEG(std::atan2f(velocity.y, velocity.x));
	if (velocity_angle < 0.0f)
		velocity_angle += 360.0f;

	if (velocity_angle < 0.0f)
		velocity_angle += 360.0f;

	velocity_angle -= floorf(velocity_angle / 360.0f + 0.5f) * 360.0f;

	const auto speed = velocity.Length2D();
	const auto ideal = std::clamp(M_RAD2DEG(std::atan2(15.f, speed)), 0.f, 45.f);

	const auto correct = (100.f - smoothing) * 0.02f * (ideal + ideal);

	pUserCmd->m_flForwardMove = 0.f;
	const auto velocity_delta = MATH::normalize_yaw(yaw - velocity_angle);

	/*if (throwing_nade && fabsf(velocity_delta) <=20.f)
	{
		auto &wish_angle = antiaim::wish_angles[globals::current_cmd->command_number % 150];
		wish_angle.y = math::normalize_yaw(yaw);
		globals::current_cmd->forwardmove = 450.f;

		antiaim::fix_movement(globals::current_cmd);
		return;
	}*/

	if (fabsf(velocity_delta) > 170.f && speed > 80.f || velocity_delta > correct && speed > 80.f)
	{
		yaw = correct + velocity_angle;
		pUserCmd->m_flSideMove = -1.f;
		rotate_movement(cmd, MATH::normalize_yaw(yaw));
		return;
	}
	const bool side_switch = I::Input->nSequenceNumber % 2 == 0;

	if (-correct <= velocity_delta || speed <= 80.f)
	{
		if (side_switch)
		{
			yaw = yaw - ideal;
			pUserCmd->m_flSideMove = -1.f;

		}
		else
		{
			yaw = ideal + yaw;
			pUserCmd->m_flSideMove = 1.f;

		}
		rotate_movement(cmd, MATH::normalize_yaw(yaw));
	}
	else
	{
		yaw = velocity_angle - correct;
		pUserCmd->m_flSideMove = 1.f;

		rotate_movement(cmd, MATH::normalize_yaw(yaw));
	}
}

which is pretty basic but you coul also make it so that when you have "safe mode" off it shows a new tab called RAGE or BANNABLE or something like that that has all the "detectable" or "bannable" features

if you have any problems with this just respond im a no life so you will get a fast answer also thank you for reading and considering this :)

@M3351AN M3351AN added the enhancement New feature or request label Apr 24, 2024
@FasTer69
Copy link

you fucking dumb? how could "you" made this when its 1 to 1 copied from axion, and its INTERNAL this cheat is EXTERNAL, please stop lying and learn something

@M3351AN
Copy link
Collaborator

M3351AN commented Apr 24, 2024

i noticed pUserCmd->m_flSideMove
remember,write usercmd in external will lead to immediate vac ban

@psxjtwr01
Copy link
Author

you fucking dumb? how could "you" made this when its 1 to 1 copied from axion, and its INTERNAL this cheat is EXTERNAL, please stop lying and learn something

Can you read? I said that I made the post. Next time you type something maybe read the post your replying to... I didnt quote axion because I didnt think that many people knew about it. I know its internal im not retarded but its easy to implement this in external.

@psxjtwr01
Copy link
Author

i noticed pUserCmd->m_flSideMove remember,write usercmd in external will lead to immediate vac ban

Yea no shit I made this because im too lazy to convert it to external... its obviously internal...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants