mirror of
https://github.com/Mr-X-GTA/YimMenu.git
synced 2025-06-17 14:57:27 +08:00
59 lines
1.6 KiB
C++
59 lines
1.6 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;
|
|
uint32_t og_recoil_hash = 0;
|
|
uint32_t og_recoil_hash_fp = 0;
|
|
|
|
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)
|
|
{
|
|
if (p_modified_weapon)
|
|
{
|
|
p_modified_weapon->m_recoil_shake_hash = og_recoil_hash;
|
|
p_modified_weapon->m_recoil_shake_hash_first_person = og_recoil_hash_fp;
|
|
}
|
|
|
|
p_modified_weapon = weapon_mgr->m_weapon_info;
|
|
|
|
if (weapon_mgr->m_weapon_info)
|
|
{
|
|
og_recoil_hash = weapon_mgr->m_weapon_info->m_recoil_shake_hash;
|
|
og_recoil_hash_fp = weapon_mgr->m_weapon_info->m_recoil_shake_hash_first_person;
|
|
weapon_mgr->m_weapon_info->m_recoil_shake_hash = 0;
|
|
weapon_mgr->m_weapon_info->m_recoil_shake_hash_first_person = 0;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
virtual void on_disable() override
|
|
{
|
|
if (g_local_player && p_modified_weapon)
|
|
{
|
|
p_modified_weapon->m_recoil_shake_hash = og_recoil_hash;
|
|
p_modified_weapon->m_recoil_shake_hash_first_person = og_recoil_hash_fp;
|
|
p_modified_weapon = nullptr;
|
|
}
|
|
}
|
|
};
|
|
|
|
no_recoil g_no_recoil("norecoil", "BACKEND_LOOPED_WEAPONS_NO_RECOIL", "BACKEND_LOOPED_WEAPONS_NO_RECOIL_DESC", g.weapons.no_recoil);
|
|
}
|