
* feat(Commands): Prototype command system * feat(Commands): Chat commands * refactor(Toxic): convert most options into commands * feat(Protections): block breakup kicks on other players as host * refactor(Kicks): convert most options into commands * refactor(Commands): add labels and descriptions to all commands * feat(Commands): cleanup on unload * refactor(Troll): convert most options into commands * refactor(Misc): convert most options into commands * refactor(Teleport): convert most options into commands * feat(Commands): Variadic commands and toggleable bools * feat(Hotkeys): hotkeys now use commands * fix(Chat): fix the chat window locking up when a message is sent * fix(Commands): properly handle spoofed username * fix(Spam): update filter Co-authored-by: Yimura <24669514+Yimura@users.noreply.github.com>
48 lines
1.1 KiB
C++
48 lines
1.1 KiB
C++
#include "gta/enums.hpp"
|
|
#include "natives.hpp"
|
|
#include "backend/looped_command.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);
|
|
}
|