mirror of
https://github.com/Mr-X-GTA/YimMenu.git
synced 2025-01-03 16:13:36 +08:00
feat(DeleteGun): Added delete gun
This commit is contained in:
parent
e2f9f01095
commit
56e7862ff1
62
BigBaseV2/src/features/looped/delete_gun.cpp
Normal file
62
BigBaseV2/src/features/looped/delete_gun.cpp
Normal file
@ -0,0 +1,62 @@
|
||||
#include "features.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
static const int controls[] = { 14, 15, 24 };
|
||||
|
||||
void features::delete_gun()
|
||||
{
|
||||
bool bDeleteGun = g_settings.options["custom_gun"]["type"] == 1;
|
||||
|
||||
if (bDeleteGun)
|
||||
{
|
||||
Hash currWeapon;
|
||||
WEAPON::GET_CURRENT_PED_WEAPON(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(g_playerId), &currWeapon, 1);
|
||||
|
||||
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_playerId, true);
|
||||
for (int control : controls)
|
||||
PAD::DISABLE_CONTROL_ACTION(0, control, true);
|
||||
|
||||
if (PAD::IS_DISABLED_CONTROL_JUST_RELEASED(0, 24))
|
||||
{
|
||||
Entity entity;
|
||||
|
||||
if (functions::raycast_entity(&entity))
|
||||
{
|
||||
if (ENTITY::IS_ENTITY_A_PED(entity) && PED::IS_PED_A_PLAYER(entity))
|
||||
{
|
||||
notify::above_map("You can't delete player entities!");
|
||||
}
|
||||
else
|
||||
{
|
||||
Vector3 player = ENTITY::GET_ENTITY_COORDS(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(g_playerId), true);
|
||||
Vector3 entLoc = ENTITY::GET_ENTITY_COORDS(entity, true);
|
||||
double dist = functions::distance_between_vectors(player, entLoc);
|
||||
|
||||
if (dist > 50)
|
||||
{
|
||||
notify::above_map("Entity is too far.");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (functions::take_control_of_entity(entity))
|
||||
{
|
||||
ENTITY::DETACH_ENTITY(entity, 1, 1);
|
||||
ENTITY::SET_ENTITY_COORDS_NO_OFFSET(entity, 0, 0, 0, 0, 0, 0);
|
||||
ENTITY::SET_ENTITY_AS_MISSION_ENTITY(entity, 0, 1);
|
||||
ENTITY::DELETE_ENTITY(&entity);
|
||||
}
|
||||
else notify::above_map("~r~Failed to take control of entity.");
|
||||
}
|
||||
}
|
||||
}
|
||||
else features::notify::above_map("No entity found.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user