mirror of
https://github.com/Mr-X-GTA/YimMenu.git
synced 2025-01-05 17:13:29 +08:00
feat(CustomWeapons): Added Cage and Delete guns
This commit is contained in:
parent
ab28148e87
commit
b63bf4b0e4
@ -21,6 +21,8 @@ namespace big
|
||||
|
||||
QUEUE_JOB_BEGIN_CLAUSE()
|
||||
{
|
||||
looped::weapons_cage_gun();
|
||||
looped::weapons_delete_gun();
|
||||
looped::weapons_gravity_gun();
|
||||
looped::weapons_repair_gun();
|
||||
}QUEUE_JOB_END_CLAUSE
|
||||
|
@ -8,9 +8,11 @@ namespace big
|
||||
static void self_godmode();
|
||||
static void self_noclip();
|
||||
|
||||
static void weapons_cage_gun();
|
||||
static void weapons_gravity_gun();
|
||||
static void weapons_repair_gun();
|
||||
|
||||
static void vehicle_speedo_meter();
|
||||
static void weapons_delete_gun();
|
||||
};
|
||||
}
|
38
BigBaseV2/src/backend/looped/weapons/cage_gun.cpp
Normal file
38
BigBaseV2/src/backend/looped/weapons/cage_gun.cpp
Normal file
@ -0,0 +1,38 @@
|
||||
#include "backend/looped/looped.hpp"
|
||||
#include "core/enums.hpp"
|
||||
#include "util/entity.hpp"
|
||||
#include "util/notify.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
static const int controls[] = { 14, 15, 24 };
|
||||
|
||||
void looped::weapons_cage_gun()
|
||||
{
|
||||
bool bCageGun = g.weapons.custom_weapon == CustomWeapon::CAGE_GUN;
|
||||
|
||||
if (bCageGun)
|
||||
{
|
||||
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, 25))
|
||||
{
|
||||
PLAYER::DISABLE_PLAYER_FIRING(PLAYER::PLAYER_ID(), true);
|
||||
for (int control : controls)
|
||||
PAD::DISABLE_CONTROL_ACTION(0, control, true);
|
||||
|
||||
if (PAD::IS_DISABLED_CONTROL_JUST_RELEASED(0, 24))
|
||||
{
|
||||
Entity entity;
|
||||
|
||||
if (entity::raycast(&entity))
|
||||
{
|
||||
if (ENTITY::IS_ENTITY_A_PED(entity))
|
||||
{
|
||||
entity::cage_ped(entity);
|
||||
}
|
||||
}
|
||||
else notify::above_map("No entity found.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
58
BigBaseV2/src/backend/looped/weapons/delete_gun.cpp
Normal file
58
BigBaseV2/src/backend/looped/weapons/delete_gun.cpp
Normal file
@ -0,0 +1,58 @@
|
||||
#include "backend/looped/looped.hpp"
|
||||
#include "core/enums.hpp"
|
||||
#include "util/entity.hpp"
|
||||
#include "util/math.hpp"
|
||||
#include "util/notify.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
static const int controls[] = { 14, 15, 24 };
|
||||
|
||||
void looped::weapons_delete_gun()
|
||||
{
|
||||
bool bCageGun = g.weapons.custom_weapon == CustomWeapon::DELETE_GUN;
|
||||
|
||||
if (bCageGun)
|
||||
{
|
||||
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, 25))
|
||||
{
|
||||
PLAYER::DISABLE_PLAYER_FIRING(PLAYER::PLAYER_ID(), true);
|
||||
for (int control : controls)
|
||||
PAD::DISABLE_CONTROL_ACTION(0, control, true);
|
||||
|
||||
if (PAD::IS_DISABLED_CONTROL_JUST_RELEASED(0, 24))
|
||||
{
|
||||
Entity entity;
|
||||
|
||||
if (entity::raycast(&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::PLAYER_PED_ID(), true);
|
||||
Vector3 entLoc = ENTITY::GET_ENTITY_COORDS(entity, true);
|
||||
double dist = math::distance_between_vectors(player, entLoc);
|
||||
|
||||
if (dist > 500)
|
||||
{
|
||||
notify::above_map("Entity is too far.");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (entity::take_control_of(entity))
|
||||
{
|
||||
entity::delete_entity(entity);
|
||||
}
|
||||
else notify::above_map("~r~Failed to take control of entity.");
|
||||
}
|
||||
}
|
||||
}
|
||||
else notify::above_map("No entity found.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -8,6 +8,8 @@ struct custom_weapon {
|
||||
|
||||
const custom_weapon custom_weapons[] = {
|
||||
{ big::CustomWeapon::NONE, "No weapon" },
|
||||
{ big::CustomWeapon::CAGE_GUN, "Cage Gun" },
|
||||
{ big::CustomWeapon::DELETE_GUN, "Delete Gun" },
|
||||
{ big::CustomWeapon::GRAVITY_GUN, "Gravity Gun" },
|
||||
{ big::CustomWeapon::REPAIR_GUN, "Repair Gun" }
|
||||
};
|
@ -5,6 +5,8 @@ namespace big
|
||||
enum class CustomWeapon
|
||||
{
|
||||
NONE,
|
||||
CAGE_GUN,
|
||||
DELETE_GUN,
|
||||
GRAVITY_GUN,
|
||||
REPAIR_GUN
|
||||
};
|
||||
|
@ -14,6 +14,17 @@ namespace big::entity
|
||||
OBJECT::CREATE_OBJECT(hash, location.x, location.y, location.z - 1.f, true, false, false);
|
||||
}
|
||||
|
||||
inline void delete_entity(Entity ent)
|
||||
{
|
||||
ENTITY::DETACH_ENTITY(ent, 1, 1);
|
||||
ENTITY::SET_ENTITY_VISIBLE(ent, false, false);
|
||||
NETWORK::_NETWORK_SET_ENTITY_INVISIBLE_TO_NETWORK(ent, true);
|
||||
ENTITY::SET_ENTITY_COORDS_NO_OFFSET(ent, 0, 0, 0, 0, 0, 0);
|
||||
ENTITY::SET_ENTITY_AS_MISSION_ENTITY(ent, 1, 1);
|
||||
ENTITY::SET_ENTITY_AS_NO_LONGER_NEEDED(&ent);
|
||||
ENTITY::DELETE_ENTITY(&ent);
|
||||
}
|
||||
|
||||
inline bool raycast(Entity* ent)
|
||||
{
|
||||
BOOL hit;
|
||||
|
Loading…
x
Reference in New Issue
Block a user