feat: interior weapon (#974)
This commit is contained in:
parent
37199eaefa
commit
77e9c9e884
@ -614,10 +614,11 @@ namespace big
|
||||
bool increased_c4_limit = false;
|
||||
bool increased_flare_limit = false;
|
||||
bool rapid_fire = false;
|
||||
bool interior_weapon = false;
|
||||
|
||||
NLOHMANN_DEFINE_TYPE_INTRUSIVE(weapons,
|
||||
ammo_special, custom_weapon, force_crosshairs, infinite_ammo, infinite_mag, increased_damage, no_recoil,
|
||||
no_spread, vehicle_gun_model, increased_c4_limit, increased_flare_limit, rapid_fire, gravity_gun)
|
||||
no_spread, vehicle_gun_model, increased_c4_limit, increased_flare_limit, rapid_fire, gravity_gun, interior_weapon)
|
||||
} weapons{};
|
||||
|
||||
struct window
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "fiber_pool.hpp"
|
||||
#include "util/scripts.hpp"
|
||||
#include "hooking.hpp"
|
||||
#include "gta/enums.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
@ -49,5 +50,48 @@ namespace big
|
||||
|
||||
src->set_return_value<BOOL>(NETWORK::NETWORK_TRY_TO_SET_THIS_SCRIPT_IS_NETWORK_SCRIPT(src->get_arg<int>(0), src->get_arg<BOOL>(1), src->get_arg<int>(2)));
|
||||
}
|
||||
|
||||
void SET_CURRENT_PED_WEAPON(rage::scrNativeCallContext* src)
|
||||
{
|
||||
const auto ped = src->get_arg<Ped>(0);
|
||||
const auto hash = src->get_arg<rage::joaat_t>(1);
|
||||
|
||||
if (g.weapons.interior_weapon && ped == self::ped && hash == RAGE_JOAAT("WEAPON_UNARMED"))
|
||||
return;
|
||||
|
||||
WEAPON::SET_CURRENT_PED_WEAPON(ped, hash, src->get_arg<int>(2));
|
||||
}
|
||||
|
||||
void DISABLE_CONTROL_ACTION(rage::scrNativeCallContext* src)
|
||||
{
|
||||
const auto action = src->get_arg<ControllerInputs>(1);
|
||||
|
||||
if (g.weapons.interior_weapon)
|
||||
{
|
||||
switch (action)
|
||||
{
|
||||
case ControllerInputs::INPUT_SELECT_WEAPON:
|
||||
case ControllerInputs::INPUT_VEH_SELECT_NEXT_WEAPON:
|
||||
case ControllerInputs::INPUT_VEH_SELECT_PREV_WEAPON:
|
||||
case ControllerInputs::INPUT_DETONATE:
|
||||
case ControllerInputs::INPUT_PICKUP:
|
||||
case ControllerInputs::INPUT_JUMP:
|
||||
case ControllerInputs::INPUT_TALK:
|
||||
case ControllerInputs::INPUT_AIM:
|
||||
case ControllerInputs::INPUT_MELEE_ATTACK_LIGHT:
|
||||
case ControllerInputs::INPUT_MELEE_ATTACK_HEAVY:
|
||||
case ControllerInputs::INPUT_MELEE_ATTACK_ALTERNATE:
|
||||
case ControllerInputs::INPUT_MELEE_BLOCK:
|
||||
case ControllerInputs::INPUT_VEH_ATTACK:
|
||||
case ControllerInputs::INPUT_VEH_ATTACK2:
|
||||
case ControllerInputs::INPUT_VEH_AIM:
|
||||
case ControllerInputs::INPUT_VEH_PASSENGER_ATTACK:
|
||||
case ControllerInputs::INPUT_VEH_FLY_SELECT_NEXT_WEAPON:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
PAD::DISABLE_CONTROL_ACTION(src->get_arg<int>(0), (int)action, src->get_arg<int>(2));
|
||||
}
|
||||
}
|
||||
}
|
@ -106,6 +106,8 @@ namespace big
|
||||
add_native_detour(0x812595A0644CE1DE, all_scripts::IS_DLC_PRESENT);
|
||||
add_native_detour(0x1CA59E306ECB80A5, all_scripts::NETWORK_SET_THIS_SCRIPT_IS_NETWORK_SCRIPT);
|
||||
add_native_detour(0xD1110739EEADB592, all_scripts::NETWORK_TRY_TO_SET_THIS_SCRIPT_IS_NETWORK_SCRIPT);
|
||||
add_native_detour(0xADF692B254977C0C, all_scripts::SET_CURRENT_PED_WEAPON);
|
||||
add_native_detour(0xFE99B66D079CF6BC, all_scripts::DISABLE_CONTROL_ACTION);
|
||||
|
||||
add_native_detour(RAGE_JOAAT("carmod_shop"), 0x06843DA7060A026B, carmod_shop::SET_ENTITY_COORDS);
|
||||
add_native_detour(RAGE_JOAAT("carmod_shop"), 0x8E2530AA8ADA980E, carmod_shop::SET_ENTITY_HEADING);
|
||||
|
@ -17,6 +17,7 @@ namespace big
|
||||
|
||||
components::command_checkbox<"infammo">();
|
||||
components::command_checkbox<"infclip">();
|
||||
ImGui::Checkbox("Interior Weapon", &g.weapons.interior_weapon);
|
||||
|
||||
ImGui::EndGroup();
|
||||
ImGui::SameLine();
|
||||
|
Reference in New Issue
Block a user