This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.

41 lines
1008 B
C++
Raw Normal View History

#include "features/custom_guns.hpp"
#include "features/notify.hpp"
2021-01-17 00:40:38 +01:00
namespace big
{
static const int controls[] = { 14, 15, 24 };
void custom_guns::cage_gun()
2021-01-17 00:40:38 +01:00
{
bool bCageGun = g_settings.options["custom_gun"]["type"] == 5;
if (bCageGun)
{
Hash currWeapon;
WEAPON::GET_CURRENT_PED_WEAPON(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(g_player.id), &currWeapon, 1);
2021-01-17 00:40:38 +01:00
if (currWeapon != RAGE_JOAAT("weapon_pistol") && currWeapon != RAGE_JOAAT("weapon_pistol_mk2")) return;
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, 25))
{
PLAYER::DISABLE_PLAYER_FIRING(g_player.id, true);
2021-01-17 00:40:38 +01:00
for (int control : controls)
PAD::DISABLE_CONTROL_ACTION(0, control, true);
if (PAD::IS_DISABLED_CONTROL_JUST_RELEASED(0, 24))
{
Entity entity;
if (func::raycast_entity(&entity))
2021-01-17 00:40:38 +01:00
{
if (ENTITY::IS_ENTITY_A_PED(entity))
{
func::cage_ped(entity);
2021-01-17 00:40:38 +01:00
}
}
else notify::above_map("No entity found.");
2021-01-17 00:40:38 +01:00
}
}
}
}
}