feat(CustomWeapons): Added steal vehicle gun

This commit is contained in:
Yimura 2021-05-20 22:40:13 +02:00
parent ccc8212003
commit 7765700439
5 changed files with 47 additions and 1 deletions

View File

@ -24,6 +24,7 @@ namespace big
looped::weapons_cage_gun();
looped::weapons_delete_gun();
looped::weapons_gravity_gun();
looped::weapons_steal_vehicle_gun();
looped::weapons_repair_gun();
looped::weapons_vehicle_gun();
}QUEUE_JOB_END_CLAUSE

View File

@ -12,6 +12,7 @@ namespace big
static void weapons_delete_gun();
static void weapons_gravity_gun();
static void weapons_repair_gun();
static void weapons_steal_vehicle_gun();
static void weapons_vehicle_gun();
static void vehicle_speedo_meter();

View File

@ -0,0 +1,42 @@
#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 };
static Entity ent;
void looped::weapons_steal_vehicle_gun()
{
bool bStealVehicleGun = g.weapons.custom_weapon == CustomWeapon::STEAL_VEHICLE_GUN;
if (bStealVehicleGun)
{
Ped player = PLAYER::PLAYER_PED_ID();
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))
{
if (entity::raycast(&ent))
{
if (ENTITY::IS_ENTITY_A_VEHICLE(ent))
{
Ped ped = VEHICLE::GET_PED_IN_VEHICLE_SEAT(ent, -1, 0);
TASK::CLEAR_PED_TASKS_IMMEDIATELY(ped);
PED::SET_PED_INTO_VEHICLE(PLAYER::PLAYER_PED_ID(), ent, -1);
}
}
else notify::above_map("No entity found.");
}
}
}
}
}

View File

@ -3,7 +3,7 @@
struct custom_weapon {
big::CustomWeapon id;
const char name[16];
const char name[32];
};
const custom_weapon custom_weapons[] = {
@ -11,6 +11,7 @@ const custom_weapon custom_weapons[] = {
{ big::CustomWeapon::CAGE_GUN, "Cage Gun" },
{ big::CustomWeapon::DELETE_GUN, "Delete Gun" },
{ big::CustomWeapon::GRAVITY_GUN, "Gravity Gun" },
{ big::CustomWeapon::STEAL_VEHICLE_GUN, "Steal Vehicle Gun" },
{ big::CustomWeapon::REPAIR_GUN, "Repair Gun" },
{ big::CustomWeapon::VEHICLE_GUN, "Vehicle Gun" }
};

View File

@ -8,6 +8,7 @@ namespace big
CAGE_GUN,
DELETE_GUN,
GRAVITY_GUN,
STEAL_VEHICLE_GUN,
REPAIR_GUN,
VEHICLE_GUN
};