feat(CustomWeapons): deactivate when weapon is holstered (#1231)
This commit is contained in:
parent
8a9c6a22c0
commit
60e1c2e3c6
@ -7,7 +7,7 @@ namespace big
|
||||
{
|
||||
void looped::weapons_cage_gun()
|
||||
{
|
||||
if (const bool bCageGun = g.weapons.custom_weapon == CustomWeapon::CAGE_GUN; bCageGun)
|
||||
if (const bool bCageGun = g.weapons.custom_weapon == CustomWeapon::CAGE_GUN; bCageGun && (!g.self.custom_weapon_stop || WEAPON::IS_PED_ARMED(self::ped, 4 | 2)))
|
||||
{
|
||||
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_AIM))
|
||||
{
|
||||
@ -28,4 +28,5 @@ namespace big
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ namespace big
|
||||
{
|
||||
void looped::weapons_delete_gun()
|
||||
{
|
||||
if (const bool bDeleteGun = g.weapons.custom_weapon == CustomWeapon::DELETE_GUN; bDeleteGun)
|
||||
if (const bool bDeleteGun = g.weapons.custom_weapon == CustomWeapon::DELETE_GUN; bDeleteGun && (!g.self.custom_weapon_stop || WEAPON::IS_PED_ARMED(self::ped, 4 | 2)))
|
||||
{
|
||||
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_AIM))
|
||||
{
|
||||
|
@ -24,16 +24,16 @@ namespace big
|
||||
dist += 5;
|
||||
|
||||
if (!entity::take_control_of(e))
|
||||
return;// TODO: remove from vector
|
||||
return; // TODO: remove from vector
|
||||
|
||||
ENTITY::SET_ENTITY_COLLISION(e, false, false);
|
||||
|
||||
other = ENTITY::GET_ENTITY_COORDS(e, true);
|
||||
|
||||
Vector3 rot = CAM::GET_GAMEPLAY_CAM_ROT(2);
|
||||
float pitch = math::deg_to_rad(rot.x);// vertical
|
||||
float pitch = math::deg_to_rad(rot.x); // vertical
|
||||
// float roll = rot.y;
|
||||
float yaw = math::deg_to_rad(rot.z + 90);// horizontal
|
||||
float yaw = math::deg_to_rad(rot.z + 90); // horizontal
|
||||
|
||||
Vector3 velocity;
|
||||
|
||||
@ -51,7 +51,7 @@ namespace big
|
||||
bool is_gravity_gun_selected = g.weapons.custom_weapon == CustomWeapon::GRAVITY_GUN;
|
||||
|
||||
auto is_zoomed_in = is_gravity_gun_selected && PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_AIM);
|
||||
if (is_zoomed_in)
|
||||
if (is_zoomed_in && (!g.self.custom_weapon_stop || WEAPON::IS_PED_ARMED(self::ped, 4 | 2)))
|
||||
{
|
||||
location = self::pos;
|
||||
|
||||
|
@ -8,7 +8,7 @@ namespace big
|
||||
{
|
||||
void looped::weapons_repair_gun()
|
||||
{
|
||||
if (const bool bRepairGun = g.weapons.custom_weapon == CustomWeapon::REPAIR_GUN; bRepairGun)
|
||||
if (const bool bRepairGun = g.weapons.custom_weapon == CustomWeapon::REPAIR_GUN; bRepairGun && (!g.self.custom_weapon_stop || WEAPON::IS_PED_ARMED(self::ped, 4 | 2)))
|
||||
{
|
||||
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_AIM))
|
||||
{
|
||||
@ -33,4 +33,4 @@ namespace big
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -9,7 +9,8 @@ namespace big
|
||||
|
||||
void looped::weapons_steal_vehicle_gun()
|
||||
{
|
||||
if (const bool bStealVehicleGun = g.weapons.custom_weapon == CustomWeapon::STEAL_VEHICLE_GUN; bStealVehicleGun)
|
||||
if (const bool bStealVehicleGun = g.weapons.custom_weapon == CustomWeapon::STEAL_VEHICLE_GUN;
|
||||
bStealVehicleGun && (!g.self.custom_weapon_stop || WEAPON::IS_PED_ARMED(self::ped, 4 | 2)))
|
||||
{
|
||||
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_AIM))
|
||||
{
|
||||
@ -38,4 +39,6 @@ namespace big
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -17,16 +17,17 @@ namespace big
|
||||
|
||||
const auto elapsed_time_in_ms = std::chrono::duration_cast<std::chrono::milliseconds>(time_now - last_time).count();
|
||||
|
||||
if (is_vehicle_gun_selected && !g_gui->is_open() && elapsed_time_in_ms >= 100 && PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_ATTACK))
|
||||
if (is_vehicle_gun_selected && !g_gui->is_open() && elapsed_time_in_ms >= 100 && PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_ATTACK)
|
||||
&& (!g.self.custom_weapon_stop || WEAPON::IS_PED_ARMED(self::ped, 4 | 2)))
|
||||
{
|
||||
Vector3 location = self::pos;
|
||||
|
||||
constexpr int rotation_order = 2;
|
||||
|
||||
Vector3 rot = CAM::GET_GAMEPLAY_CAM_ROT(rotation_order);
|
||||
float pitch = math::deg_to_rad(rot.x);// vertical
|
||||
float pitch = math::deg_to_rad(rot.x); // vertical
|
||||
//float roll = rot.y;
|
||||
float yaw = math::deg_to_rad(rot.z + 90);// horizontal
|
||||
float yaw = math::deg_to_rad(rot.z + 90); // horizontal
|
||||
|
||||
float dist = 10.f;
|
||||
location.x += dist * cos(pitch) * cos(yaw);
|
||||
@ -48,4 +49,5 @@ namespace big
|
||||
last_time = time_now;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -286,6 +286,7 @@ namespace big
|
||||
bool healthregen = false;
|
||||
float healthregenrate = 1.0f;
|
||||
bool superman = false;
|
||||
bool custom_weapon_stop = true;
|
||||
struct hud
|
||||
{
|
||||
bool hudcolor = false;
|
||||
@ -307,7 +308,7 @@ namespace big
|
||||
// do not save below entries
|
||||
bool dance_mode = false;
|
||||
|
||||
NLOHMANN_DEFINE_TYPE_INTRUSIVE(self, ptfx_effects, clean_player, force_wanted_level, free_cam, invisibility, local_visibility, never_wanted, no_ragdoll, noclip, off_radar, super_run, no_collision, unlimited_oxygen, no_water_collision, wanted_level, god_mode, part_water, proof_bullet, proof_fire, proof_collision, proof_melee, proof_explosion, proof_steam, proof_drown, proof_water, proof_mask, mobile_radio, fast_respawn, auto_tp, super_jump, beast_jump, healthregen, healthregenrate, hud, superman)
|
||||
NLOHMANN_DEFINE_TYPE_INTRUSIVE(self, ptfx_effects, clean_player, force_wanted_level, free_cam, invisibility, local_visibility, never_wanted, no_ragdoll, noclip, off_radar, super_run, no_collision, unlimited_oxygen, no_water_collision, wanted_level, god_mode, part_water, proof_bullet, proof_fire, proof_collision, proof_melee, proof_explosion, proof_steam, proof_drown, proof_water, proof_mask, mobile_radio, fast_respawn, auto_tp, super_jump, beast_jump, healthregen, healthregenrate, hud, superman, custom_weapon_stop)
|
||||
} self{};
|
||||
|
||||
struct session
|
||||
|
@ -111,6 +111,7 @@ namespace big
|
||||
|
||||
components::sub_title("CUSTOM_WEAPONS"_T);
|
||||
|
||||
ImGui::Checkbox("Custom Gun only fires when weapon is out", &g.self.custom_weapon_stop);
|
||||
CustomWeapon selected = g.weapons.custom_weapon;
|
||||
|
||||
if (ImGui::BeginCombo("WEAPON"_T.data(), custom_weapons[(int)selected].name))
|
||||
|
Reference in New Issue
Block a user