mirror of
https://github.com/Mr-X-GTA/YimMenu.git
synced 2025-06-18 07:07:32 +08:00

* feat(Spoofing): add spoofing * feat(Spoofing): prepare code for player attach * remove(PlayerAttach): isn't going to work due to netsync architecture * fix(GUI): fix scaling * feat(Project): add clang-format file * feat(Classes): update classes * fix(BlackHole): remove unnecessary cleanup * fix(Formatting): fix formatting for initializer lists * feat(clang-format): Set tab width and 1 space before comment Co-authored-by: Yimura <24669514+Yimura@users.noreply.github.com>
48 lines
1.2 KiB
C++
48 lines
1.2 KiB
C++
#include "backend/looped_command.hpp"
|
|
#include "gta/enums.hpp"
|
|
#include "natives.hpp"
|
|
|
|
namespace big
|
|
{
|
|
class no_recoil : looped_command
|
|
{
|
|
using looped_command::looped_command;
|
|
|
|
CWeaponInfo* p_modified_weapon = nullptr;
|
|
float og_recoil_value = 0.0f;
|
|
|
|
virtual void on_tick() override
|
|
{
|
|
if (!g_local_player)
|
|
{
|
|
return;
|
|
}
|
|
|
|
auto* const weapon_mgr = g_local_player->m_weapon_manager;
|
|
if (weapon_mgr)
|
|
{
|
|
if (p_modified_weapon != weapon_mgr->m_weapon_info && weapon_mgr->m_weapon_info)
|
|
{
|
|
if (p_modified_weapon)
|
|
p_modified_weapon->m_explosion_shake_amplitude = og_recoil_value;
|
|
|
|
og_recoil_value = weapon_mgr->m_weapon_info->m_explosion_shake_amplitude;
|
|
p_modified_weapon = weapon_mgr->m_weapon_info;
|
|
weapon_mgr->m_weapon_info->m_explosion_shake_amplitude = 0.0f;
|
|
}
|
|
}
|
|
}
|
|
|
|
virtual void on_disable() override
|
|
{
|
|
if (g_local_player && p_modified_weapon)
|
|
{
|
|
p_modified_weapon->m_explosion_shake_amplitude = og_recoil_value;
|
|
p_modified_weapon = nullptr;
|
|
}
|
|
}
|
|
};
|
|
|
|
no_recoil g_no_recoil("norecoil", "No Recoil", "Removes weapon recoil when shooting", g.weapons.no_recoil);
|
|
}
|