refactor: Modernized/optimized general code, bug fixing and more (#226)

* refactor: Use self globals

* refactor: Use gui::components

* fix(Vehicle Preview): Addresses #119

Previewed vehicle set to unclimbable

Only preview when hovered on vehicle

* fix(Infinite Clip): Disabling it now works

* fix(No Ragdoll): Disabling it now works

Removed unnecessary calls to natives (0xB128377056A54E2A should be enough)

* fix(Spawn): Wrong footer placement

* fix self globals file name typo

* refactor(Mobile): Clear ped tasks when set conditions are met

Only clear ped tasks if pv_teleport_into bool is true and ped is in a vehicle

* feat(Weapons): Remove current weapon

* refactor: Added missing variable in calls to self globals

* refactor: Utilize usage of ControllerInputs

* fix(Vehicle Fly): uninitialized local variable 'ped' used

* refactor(No Ragdoll, Infinite Clip): Only run on boolean change.

* refactor(Infinite Ammo): Simplified code

* refactor: Utilize ControllerInputs in other areas of code

* refactor: Utilize ControllerInputs in other areas of code
This commit is contained in:
karifeld 2022-05-23 06:38:45 +08:00 committed by GitHub
parent cf2ae14a3e
commit 0f09234130
45 changed files with 353 additions and 269 deletions

View File

@ -8,6 +8,9 @@ namespace big
void looped::player_spectate() void looped::player_spectate()
{ {
Vehicle vehicle = self::veh;
Ped ped = self::ped;
if (!g_player_service->get_selected()->is_valid() || !g->player.spectating) if (!g_player_service->get_selected()->is_valid() || !g->player.spectating)
{ {
if (g->player.spectating) g->player.spectating = false; if (g->player.spectating) g->player.spectating = false;
@ -18,8 +21,8 @@ namespace big
NETWORK::NETWORK_SET_IN_SPECTATOR_MODE(false, -1); NETWORK::NETWORK_SET_IN_SPECTATOR_MODE(false, -1);
HUD::SET_MINIMAP_IN_SPECTATOR_MODE(false, -1); HUD::SET_MINIMAP_IN_SPECTATOR_MODE(false, -1);
ENTITY::FREEZE_ENTITY_POSITION(PLAYER::PLAYER_PED_ID(), false); ENTITY::FREEZE_ENTITY_POSITION(ped, false);
ENTITY::FREEZE_ENTITY_POSITION(PED::GET_VEHICLE_PED_IS_USING(PLAYER::PLAYER_PED_ID()), false); ENTITY::FREEZE_ENTITY_POSITION(vehicle, false);
} }
return; return;
@ -29,8 +32,8 @@ namespace big
NETWORK::NETWORK_SET_IN_SPECTATOR_MODE(true, target); NETWORK::NETWORK_SET_IN_SPECTATOR_MODE(true, target);
HUD::SET_MINIMAP_IN_SPECTATOR_MODE(true, target); HUD::SET_MINIMAP_IN_SPECTATOR_MODE(true, target);
ENTITY::FREEZE_ENTITY_POSITION(PLAYER::PLAYER_PED_ID(), true); ENTITY::FREEZE_ENTITY_POSITION(ped, true);
ENTITY::FREEZE_ENTITY_POSITION(PED::GET_VEHICLE_PED_IS_USING(PLAYER::PLAYER_PED_ID()), true); ENTITY::FREEZE_ENTITY_POSITION(vehicle, true);
bReset = false; bReset = false;
} }

View File

@ -7,7 +7,7 @@ namespace big
void looped::self_clean_player() void looped::self_clean_player()
{ {
if (g->self.clean_player) { if (g->self.clean_player) {
entity::clean_ped(PLAYER::PLAYER_PED_ID()); entity::clean_ped(self::ped);
} }
} }
} }

View File

@ -1,4 +1,5 @@
#include "backend/looped/looped.hpp" #include "backend/looped/looped.hpp"
#include "gta/enums.hpp"
#include "natives.hpp" #include "natives.hpp"
#include "util/math.hpp" #include "util/math.hpp"
@ -17,7 +18,8 @@ namespace big
{ {
if (g_local_player == nullptr) return; if (g_local_player == nullptr) return;
Entity ent = PLAYER::PLAYER_PED_ID(); Vehicle vehicle = self::veh;
Ped ped = self::ped;
if (!g->self.free_cam && !bLastFreeCam) return; if (!g->self.free_cam && !bLastFreeCam) return;
if (g->self.free_cam && !bLastFreeCam) if (g->self.free_cam && !bLastFreeCam)
@ -27,7 +29,7 @@ namespace big
vecPosition = CAM::GET_GAMEPLAY_CAM_COORD(); vecPosition = CAM::GET_GAMEPLAY_CAM_COORD();
vecRot = CAM::GET_GAMEPLAY_CAM_ROT(2); vecRot = CAM::GET_GAMEPLAY_CAM_ROT(2);
ENTITY::FREEZE_ENTITY_POSITION(PED::GET_VEHICLE_PED_IS_USING(PLAYER::PLAYER_PED_ID()), true); ENTITY::FREEZE_ENTITY_POSITION(vehicle, true);
CAM::SET_CAM_COORD(cCam, vecPosition.x, vecPosition.y, vecPosition.z); CAM::SET_CAM_COORD(cCam, vecPosition.x, vecPosition.y, vecPosition.z);
CAM::SET_CAM_ROT(cCam, vecRot.x, vecRot.y, vecRot.z, 2); CAM::SET_CAM_ROT(cCam, vecRot.x, vecRot.y, vecRot.z, 2);
CAM::SET_CAM_ACTIVE(cCam, true); CAM::SET_CAM_ACTIVE(cCam, true);
@ -37,11 +39,11 @@ namespace big
} }
else if (!g->self.free_cam && bLastFreeCam) else if (!g->self.free_cam && bLastFreeCam)
{ {
ENTITY::FREEZE_ENTITY_POSITION(PED::GET_VEHICLE_PED_IS_USING(PLAYER::PLAYER_PED_ID()), false); ENTITY::FREEZE_ENTITY_POSITION(vehicle, false);
CAM::SET_CAM_ACTIVE(cCam, false); CAM::SET_CAM_ACTIVE(cCam, false);
CAM::RENDER_SCRIPT_CAMS(false, true, 500, true, true, 0); CAM::RENDER_SCRIPT_CAMS(false, true, 500, true, true, 0);
CAM::DESTROY_CAM(cCam, false); CAM::DESTROY_CAM(cCam, false);
STREAMING::SET_FOCUS_ENTITY(PLAYER::PLAYER_PED_ID()); STREAMING::SET_FOCUS_ENTITY(ped);
bLastFreeCam = false; bLastFreeCam = false;
@ -49,29 +51,42 @@ namespace big
} }
PAD::DISABLE_ALL_CONTROL_ACTIONS(0); PAD::DISABLE_ALL_CONTROL_ACTIONS(0);
const int controls[] = { 1, 2, 3, 4, 5, 6, 270, 271, 272, 273 };
const int controls[] = {
(int)ControllerInputs::INPUT_LOOK_LR,
(int)ControllerInputs::INPUT_LOOK_UD,
(int)ControllerInputs::INPUT_LOOK_UP_ONLY,
(int)ControllerInputs::INPUT_LOOK_DOWN_ONLY,
(int)ControllerInputs::INPUT_LOOK_LEFT_ONLY,
(int)ControllerInputs::INPUT_LOOK_RIGHT_ONLY,
(int)ControllerInputs::INPUT_LOOK_LEFT,
(int)ControllerInputs::INPUT_LOOK_RIGHT,
(int)ControllerInputs::INPUT_LOOK_UP,
(int)ControllerInputs::INPUT_LOOK_DOWN
};
for (int control : controls) for (int control : controls)
PAD::ENABLE_CONTROL_ACTION(2, control, true); PAD::ENABLE_CONTROL_ACTION(2, control, true);
Vector3 vecChange = { 0.f, 0.f, 0.f }; Vector3 vecChange = { 0.f, 0.f, 0.f };
// Left Shift // Left Shift
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, 21)) if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_SPRINT))
vecChange.z += speed / 2; vecChange.z += speed / 2;
// Left Control // Left Control
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, 36)) if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_DUCK))
vecChange.z -= speed / 2; vecChange.z -= speed / 2;
// Forward // Forward
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, 32)) if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_MOVE_UP_ONLY))
vecChange.y += speed; vecChange.y += speed;
// Backward // Backward
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, 33)) if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_MOVE_DOWN_ONLY))
vecChange.y -= speed; vecChange.y -= speed;
// Left // Left
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, 34)) if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_MOVE_LEFT_ONLY))
vecChange.x -= speed; vecChange.x -= speed;
// Right // Right
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, 35)) if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_MOVE_RIGHT_ONLY))
vecChange.x += speed; vecChange.x += speed;
if (vecChange.x == 0.f && vecChange.y == 0.f && vecChange.z == 0.f) if (vecChange.x == 0.f && vecChange.y == 0.f && vecChange.z == 0.f)

View File

@ -11,7 +11,7 @@ namespace big
if (bGodMode || (!bGodMode && bGodMode != bLastGodMode)) if (bGodMode || (!bGodMode && bGodMode != bLastGodMode))
{ {
ENTITY::SET_ENTITY_INVINCIBLE(PLAYER::PLAYER_PED_ID(), g->self.godmode); ENTITY::SET_ENTITY_INVINCIBLE(self::ped, g->self.godmode);
bLastGodMode = g->self.godmode; bLastGodMode = g->self.godmode;
} }

View File

@ -7,11 +7,13 @@ namespace big
void looped::self_invisibility() void looped::self_invisibility()
{ {
Ped ped = self::ped;
bool bInvisibility = g->self.invisibility; bool bInvisibility = g->self.invisibility;
if (bInvisibility || (!bInvisibility && bInvisibility != bLastInvisibility)) if (bInvisibility || (!bInvisibility && bInvisibility != bLastInvisibility))
{ {
ENTITY::SET_ENTITY_VISIBLE(PLAYER::PLAYER_PED_ID(), !g->self.invisibility, 0); ENTITY::SET_ENTITY_VISIBLE(ped, !g->self.invisibility, 0);
bLastInvisibility = g->self.invisibility; bLastInvisibility = g->self.invisibility;
} }
@ -20,14 +22,14 @@ namespace big
{ {
if (g->self.invisibility && g->self.local_visibility) if (g->self.invisibility && g->self.local_visibility)
{ {
NETWORK::SET_ENTITY_LOCALLY_VISIBLE(PLAYER::PLAYER_PED_ID()); NETWORK::SET_ENTITY_LOCALLY_VISIBLE(ped);
} }
} }
else else
{ {
if (g->self.local_visibility) if (g->self.local_visibility)
{ {
ENTITY::SET_ENTITY_VISIBLE(PLAYER::PLAYER_PED_ID(), true, 0); ENTITY::SET_ENTITY_VISIBLE(ped, true, 0);
} }
} }
} }

View File

@ -3,15 +3,17 @@
namespace big namespace big
{ {
static bool bLastNoRagdoll = false;
void looped::self_no_ragdoll() void looped::self_no_ragdoll()
{ {
Ped player = PLAYER::PLAYER_PED_ID(); bool bNoRagdoll = g->self.no_ragdoll;
if (g->self.no_ragdoll) { if (bNoRagdoll || (!bNoRagdoll && bNoRagdoll != bLastNoRagdoll))
PED::SET_PED_CAN_RAGDOLL(player, !g->self.no_ragdoll); {
PED::SET_PED_CAN_RAGDOLL_FROM_PLAYER_IMPACT(player, !g->self.no_ragdoll); PED::SET_PED_CAN_RAGDOLL(self::ped, !g->self.no_ragdoll);
PED::SET_PED_RAGDOLL_ON_COLLISION(player, !g->self.no_ragdoll);
}
bLastNoRagdoll = g->self.no_ragdoll;
}
} }
} }

View File

@ -1,12 +1,21 @@
#include "backend/looped/looped.hpp" #include "backend/looped/looped.hpp"
#include "fiber_pool.hpp" #include "fiber_pool.hpp"
#include "gta/enums.hpp"
#include "natives.hpp" #include "natives.hpp"
#include "script.hpp" #include "script.hpp"
#include "util/entity.hpp" #include "util/entity.hpp"
namespace big namespace big
{ {
static const int controls[] = { 21, 32, 33, 34, 35, 36 }; static const int controls[] = {
(int)ControllerInputs::INPUT_SPRINT,
(int)ControllerInputs::INPUT_MOVE_UP_ONLY,
(int)ControllerInputs::INPUT_MOVE_DOWN_ONLY,
(int)ControllerInputs::INPUT_MOVE_LEFT_ONLY,
(int)ControllerInputs::INPUT_MOVE_RIGHT_ONLY,
(int)ControllerInputs::INPUT_DUCK
};
static float speed = 20.f; static float speed = 20.f;
static float mult = 0.f; static float mult = 0.f;
@ -18,9 +27,8 @@ namespace big
void looped::self_noclip() { void looped::self_noclip() {
bool bNoclip = g->self.noclip; bool bNoclip = g->self.noclip;
Entity ent = PLAYER::PLAYER_PED_ID(); Vector3 location = self::pos;
bool bInVehicle = PED::IS_PED_IN_ANY_VEHICLE(ent, true); Entity ent = self::veh != NULL ? self::veh : self::ped;
if (bInVehicle) ent = PED::GET_VEHICLE_PED_IS_IN(ent, false);
// cleanup when changing entities // cleanup when changing entities
if (prev != ent) if (prev != ent)
@ -40,22 +48,22 @@ namespace big
float heading = 0.f; float heading = 0.f;
// Left Shift // Left Shift
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, 21)) if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_SPRINT))
vel.z += speed / 2; vel.z += speed / 2;
// Left Control // Left Control
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, 36)) if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_DUCK))
vel.z -= speed / 2; vel.z -= speed / 2;
// Forward // Forward
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, 32)) if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_MOVE_UP_ONLY))
vel.y += speed; vel.y += speed;
// Backward // Backward
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, 33)) if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_MOVE_DOWN_ONLY))
vel.y -= speed; vel.y -= speed;
// Left // Left
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, 34)) if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_MOVE_LEFT_ONLY))
vel.x -= speed; vel.x -= speed;
// Right // Right
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, 35)) if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_MOVE_RIGHT_ONLY))
vel.x += speed; vel.x += speed;
rot = CAM::GET_GAMEPLAY_CAM_ROT(2); rot = CAM::GET_GAMEPLAY_CAM_ROT(2);
@ -76,8 +84,8 @@ namespace big
ENTITY::FREEZE_ENTITY_POSITION(ent, false); ENTITY::FREEZE_ENTITY_POSITION(ent, false);
Vector3 offset = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(ent, vel.x, vel.y, 0.f); Vector3 offset = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(ent, vel.x, vel.y, 0.f);
vel.x = offset.x - self::pos.x; vel.x = offset.x - location.x;
vel.y = offset.y - self::pos.y; vel.y = offset.y - location.y;
ENTITY::SET_ENTITY_VELOCITY(ent, vel.x * mult, vel.y * mult, vel.z * mult); ENTITY::SET_ENTITY_VELOCITY(ent, vel.x * mult, vel.y * mult, vel.z * mult);
} }

View File

@ -1,4 +1,5 @@
#include "backend/looped/looped.hpp" #include "backend/looped/looped.hpp"
#include "gta/enums.hpp"
#include "natives.hpp" #include "natives.hpp"
#include "util/math.hpp" #include "util/math.hpp"
@ -10,28 +11,30 @@ namespace big
void looped::self_super_run() void looped::self_super_run()
{ {
if (g->self.super_run && PAD::IS_CONTROL_PRESSED(0, 21)) if (g->self.super_run && PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_SPRINT))
{ {
if (run_speed < run_cap) run_speed += .5f; if (run_speed < run_cap) run_speed += .5f;
Vector3 location = self::pos;
Ped ped = self::ped;
//Vector3 rot = CAM::GET_GAMEPLAY_CAM_ROT(2); //Vector3 rot = CAM::GET_GAMEPLAY_CAM_ROT(2);
Vector3 rot = ENTITY::GET_ENTITY_ROTATION(self::ped, 2); Vector3 rot = ENTITY::GET_ENTITY_ROTATION(ped, 2);
float yaw = math::deg_to_rad(rot.z + 90); float yaw = math::deg_to_rad(rot.z + 90);
Vector3 offset; Vector3 offset;
offset.x = self::pos.x + (run_speed * cos(yaw)); offset.x = location.x + (run_speed * cos(yaw));
offset.y = self::pos.y + (run_speed * sin(yaw)); offset.y = location.y + (run_speed * sin(yaw));
offset.z = self::pos.z + .2f; offset.z = location.z + .2f;
float groundZ; float groundZ;
MISC::GET_GROUND_Z_FOR_3D_COORD(offset.x, offset.y, 1000.f, &groundZ, false, false); MISC::GET_GROUND_Z_FOR_3D_COORD(offset.x, offset.y, 1000.f, &groundZ, false, false);
if (groundZ < self::pos.z) if (groundZ < location.z)
offset.z = groundZ; offset.z = groundZ;
Vector3 vel = offset - self::pos; Vector3 vel = offset - location;
ENTITY::SET_ENTITY_VELOCITY(self::ped, vel.x, vel.y, vel.z); ENTITY::SET_ENTITY_VELOCITY(ped, vel.x, vel.y, vel.z);
g_local_player->m_player_info->m_run_speed = .7f; g_local_player->m_player_info->m_run_speed = .7f;
} }
@ -39,7 +42,7 @@ namespace big
{ {
g_local_player->m_player_info->m_run_speed = 1.f; g_local_player->m_player_info->m_run_speed = 1.f;
} }
else if (PAD::IS_CONTROL_JUST_RELEASED(0, 21)) else if (PAD::IS_CONTROL_JUST_RELEASED(0, (int)ControllerInputs::INPUT_SPRINT))
{ {
run_speed = 10.f; run_speed = 10.f;
g_local_player->m_player_info->m_run_speed = 1.f; g_local_player->m_player_info->m_run_speed = 1.f;

View File

@ -8,6 +8,8 @@ namespace big
{ {
void looped::vehicle_auto_drive() void looped::vehicle_auto_drive()
{ {
Vehicle vehicle = self::veh;
Ped ped = self::ped;
static Vector3 location; static Vector3 location;
static bool running = true; static bool running = true;
static bool wandering = true; static bool wandering = true;
@ -23,7 +25,7 @@ namespace big
g_notification_service->push_warning("Warning", "No Waypoint found please set one first."); g_notification_service->push_warning("Warning", "No Waypoint found please set one first.");
g->vehicle.auto_drive_to_waypoint = false; g->vehicle.auto_drive_to_waypoint = false;
} }
else if (!self::veh) else if (!vehicle)
{ {
g_notification_service->push_warning("Warning", "Please be in a car first then try again."); g_notification_service->push_warning("Warning", "Please be in a car first then try again.");
} }
@ -35,10 +37,10 @@ namespace big
g_notification_service->push_warning("Auto Drive", "Start driving or leave car to take back control."); g_notification_service->push_warning("Auto Drive", "Start driving or leave car to take back control.");
TASK::CLEAR_VEHICLE_TASKS_(self::veh); TASK::CLEAR_VEHICLE_TASKS_(vehicle);
TASK::TASK_VEHICLE_DRIVE_TO_COORD(self::ped, self::veh, location.x, location.y, location.z, TASK::TASK_VEHICLE_DRIVE_TO_COORD(ped, vehicle, location.x, location.y, location.z,
static_cast<float>(g->vehicle.auto_drive_speed), 5, ENTITY::GET_ENTITY_MODEL(self::veh), g->vehicle.driving_style_flags, 20, true); static_cast<float>(g->vehicle.auto_drive_speed), 5, ENTITY::GET_ENTITY_MODEL(vehicle), g->vehicle.driving_style_flags, 20, true);
g->vehicle.auto_drive_to_waypoint = false; g->vehicle.auto_drive_to_waypoint = false;
@ -51,23 +53,23 @@ namespace big
ran_once = true; ran_once = true;
wandering = false; wandering = false;
if (!self::veh) if (!vehicle)
{ {
g_notification_service->push_warning("Warning", "Please be in a car first then try again."); g_notification_service->push_warning("Warning", "Please be in a car first then try again.");
g->vehicle.auto_drive_wander = false; g->vehicle.auto_drive_wander = false;
TASK::CLEAR_VEHICLE_TASKS_(self::veh); TASK::CLEAR_VEHICLE_TASKS_(vehicle);
} }
else else
{ {
g->vehicle.auto_drive_wander = false; g->vehicle.auto_drive_wander = false;
TASK::CLEAR_VEHICLE_TASKS_(self::veh); TASK::CLEAR_VEHICLE_TASKS_(vehicle);
TASK::CLEAR_PED_TASKS(self::ped); TASK::CLEAR_PED_TASKS(ped);
TASK::TASK_VEHICLE_DRIVE_WANDER(self::ped, self::veh, static_cast<float>(g->vehicle.auto_drive_speed), g->vehicle.driving_style_flags); TASK::TASK_VEHICLE_DRIVE_WANDER(ped, vehicle, static_cast<float>(g->vehicle.auto_drive_speed), g->vehicle.driving_style_flags);
wandering = true; wandering = true;
@ -77,10 +79,10 @@ namespace big
if (wandering && ran_once) if (wandering && ran_once)
{ {
if (PAD::IS_CONTROL_PRESSED(0, 63) || PAD::IS_CONTROL_PRESSED(0, 64) || PAD::IS_CONTROL_PRESSED(0, 71) || PAD::IS_CONTROL_PRESSED(0, 72) || PAD::IS_CONTROL_PRESSED(0, 75) || PAD::IS_CONTROL_PRESSED(0, 76)) if (PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_MOVE_LEFT_ONLY) || PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_MOVE_RIGHT_ONLY) || PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_ACCELERATE) || PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_BRAKE) || PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_EXIT) || PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_HANDBRAKE))
{ {
TASK::CLEAR_VEHICLE_TASKS_(self::veh); TASK::CLEAR_VEHICLE_TASKS_(vehicle);
TASK::CLEAR_PED_TASKS(self::ped); TASK::CLEAR_PED_TASKS(ped);
g_notification_service->push_warning("Warning", "Wandering Stopped"); g_notification_service->push_warning("Warning", "Wandering Stopped");
g->vehicle.auto_drive_wander = false; g->vehicle.auto_drive_wander = false;
wandering = false; wandering = false;
@ -89,11 +91,11 @@ namespace big
if (running) if (running)
{ {
if (!blip::get_blip_location(location, (int)BlipIcons::Waypoint) || PAD::IS_CONTROL_PRESSED(0, 75) || PAD::IS_CONTROL_PRESSED(0, 63) || PAD::IS_CONTROL_PRESSED(0, 64)) if (!blip::get_blip_location(location, (int)BlipIcons::Waypoint) || PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_MOVE_LEFT_ONLY) || PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_MOVE_RIGHT_ONLY) || PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_ACCELERATE) || PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_BRAKE) || PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_EXIT) || PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_HANDBRAKE))
{ {
if (!blip::get_blip_location(location, (int)BlipIcons::Waypoint)) if (!blip::get_blip_location(location, (int)BlipIcons::Waypoint))
{ {
VEHICLE::SET_VEHICLE_FORWARD_SPEED(self::veh, 8); VEHICLE::SET_VEHICLE_FORWARD_SPEED(vehicle, 8);
} }
g->vehicle.auto_drive_to_waypoint = false; g->vehicle.auto_drive_to_waypoint = false;
@ -103,8 +105,8 @@ namespace big
g_notification_service->push_warning("Warning", "Autodrive Stopped"); g_notification_service->push_warning("Warning", "Autodrive Stopped");
} }
TASK::CLEAR_VEHICLE_TASKS_(self::veh); TASK::CLEAR_VEHICLE_TASKS_(vehicle);
TASK::CLEAR_PED_TASKS(self::ped); TASK::CLEAR_PED_TASKS(ped);
running = false; running = false;
} }

View File

@ -9,30 +9,32 @@ namespace big
{ {
if (g->vehicle.drive_on_water) { if (g->vehicle.drive_on_water) {
Player player = PLAYER::PLAYER_ID(); Vector3 location = self::pos;
Ped playerPed = PLAYER::PLAYER_PED_ID(); Vehicle vehicle = self::veh;
DWORD model = ENTITY::GET_ENTITY_MODEL(self::veh); Player player = self::id;
Ped playerPed = self::ped;
DWORD model = ENTITY::GET_ENTITY_MODEL(vehicle);
Hash hash = MISC::GET_HASH_KEY("prop_container_ld2"); Hash hash = MISC::GET_HASH_KEY("prop_container_ld2");
float height = 0; float height = 0;
WATER::SET_DEEP_OCEAN_SCALER(height); WATER::SET_DEEP_OCEAN_SCALER(height);
if ((!(VEHICLE::IS_THIS_MODEL_A_PLANE(ENTITY::GET_ENTITY_MODEL(self::veh)))) && WATER::GET_WATER_HEIGHT_NO_WAVES(self::pos.x, self::pos.y, self::pos.z, &height)) { if ((!(VEHICLE::IS_THIS_MODEL_A_PLANE(model))) && WATER::GET_WATER_HEIGHT_NO_WAVES(location.x, location.y, location.z, &height)) {
Object container = OBJECT::GET_CLOSEST_OBJECT_OF_TYPE(self::pos.x, self::pos.y, self::pos.z, 4.0, hash, 0, 0, 1); Object container = OBJECT::GET_CLOSEST_OBJECT_OF_TYPE(location.x, location.y, location.z, 4.0, hash, 0, 0, 1);
if (ENTITY::DOES_ENTITY_EXIST(container) && height > -50.0f) { if (ENTITY::DOES_ENTITY_EXIST(container) && height > -50.0f) {
Vector3 pRot = ENTITY::GET_ENTITY_ROTATION(playerPed, 0); Vector3 pRot = ENTITY::GET_ENTITY_ROTATION(playerPed, 0);
if (PED::IS_PED_IN_ANY_VEHICLE(playerPed, 1)) pRot = ENTITY::GET_ENTITY_ROTATION(self::veh, 0); if (PED::IS_PED_IN_ANY_VEHICLE(playerPed, 1)) pRot = ENTITY::GET_ENTITY_ROTATION(vehicle, 0);
entity::take_control_of(container); entity::take_control_of(container);
ENTITY::SET_ENTITY_COORDS(container, self::pos.x, self::pos.y, height - 2.5f, 0, 0, 0, 1); ENTITY::SET_ENTITY_COORDS(container, location.x, location.y, height - 2.5f, 0, 0, 0, 1);
ENTITY::SET_ENTITY_ROTATION(container, 0, 0, pRot.z, 0, 1); ENTITY::SET_ENTITY_ROTATION(container, 0, 0, pRot.z, 0, 1);
Vector3 containerCoords = ENTITY::GET_ENTITY_COORDS(container, 1); Vector3 containerCoords = ENTITY::GET_ENTITY_COORDS(container, 1);
if (self::pos.z < containerCoords.z) { if (location.z < containerCoords.z) {
if (!PED::IS_PED_IN_ANY_VEHICLE(playerPed, 0)) { if (!PED::IS_PED_IN_ANY_VEHICLE(playerPed, 0)) {
ENTITY::SET_ENTITY_COORDS(playerPed, self::pos.x, self::pos.y, containerCoords.z + 2.0f, 0, 0, 0, 1); ENTITY::SET_ENTITY_COORDS(playerPed, location.x, location.y, containerCoords.z + 2.0f, 0, 0, 0, 1);
} }
else { else {
entity::take_control_of(self::veh); entity::take_control_of(vehicle);
Vector3 vehc = ENTITY::GET_ENTITY_COORDS(self::veh, 1); Vector3 vehc = ENTITY::GET_ENTITY_COORDS(vehicle, 1);
ENTITY::SET_ENTITY_COORDS(self::veh, vehc.x, vehc.y, containerCoords.z + 2.0f, 0, 0, 0, 1); ENTITY::SET_ENTITY_COORDS(vehicle, vehc.x, vehc.y, containerCoords.z + 2.0f, 0, 0, 0, 1);
} }
} }
} }
@ -40,7 +42,7 @@ namespace big
Hash model = hash; Hash model = hash;
STREAMING::REQUEST_MODEL(model); STREAMING::REQUEST_MODEL(model);
while (!STREAMING::HAS_MODEL_LOADED(model)) script::get_current()->yield(0ms); while (!STREAMING::HAS_MODEL_LOADED(model)) script::get_current()->yield(0ms);
container = OBJECT::CREATE_OBJECT(model, self::pos.x, self::pos.y, self::pos.z, 1, 1, 0); container = OBJECT::CREATE_OBJECT(model, location.x, location.y, location.z, 1, 1, 0);
entity::take_control_of(container); entity::take_control_of(container);
ENTITY::FREEZE_ENTITY_POSITION(container, 1); ENTITY::FREEZE_ENTITY_POSITION(container, 1);
ENTITY::SET_ENTITY_ALPHA(container, 0, 1); ENTITY::SET_ENTITY_ALPHA(container, 0, 1);
@ -48,7 +50,7 @@ namespace big
} }
} }
else { else {
Object container = OBJECT::GET_CLOSEST_OBJECT_OF_TYPE(self::pos.x, self::pos.y, self::pos.z, 4.0, hash, 0, 0, 1); Object container = OBJECT::GET_CLOSEST_OBJECT_OF_TYPE(location.x, location.y, location.z, 4.0, hash, 0, 0, 1);
if (ENTITY::DOES_ENTITY_EXIST(container)) { if (ENTITY::DOES_ENTITY_EXIST(container)) {
entity::take_control_of(container); entity::take_control_of(container);
ENTITY::SET_ENTITY_COORDS(container, 0, 0, -1000.0f, 0, 0, 0, 1); ENTITY::SET_ENTITY_COORDS(container, 0, 0, -1000.0f, 0, 0, 0, 1);

View File

@ -1,4 +1,5 @@
#include "backend/looped/looped.hpp" #include "backend/looped/looped.hpp"
#include "gta/enums.hpp"
#include "natives.hpp" #include "natives.hpp"
#include "util/entity.hpp" #include "util/entity.hpp"
@ -9,108 +10,111 @@ namespace big
void do_vehicle_fly() void do_vehicle_fly()
{ {
Vehicle vehicle = self::veh;
Vector3 cam_pos = CAM::GET_GAMEPLAY_CAM_ROT(0); Vector3 cam_pos = CAM::GET_GAMEPLAY_CAM_ROT(0);
ENTITY::SET_ENTITY_ROTATION(self::veh, cam_pos.x, cam_pos.y, cam_pos.z, 1, true); ENTITY::SET_ENTITY_ROTATION(vehicle, cam_pos.x, cam_pos.y, cam_pos.z, 1, true);
ENTITY::SET_ENTITY_COLLISION(self::veh, !g->vehicle.fly.no_collision, true); ENTITY::SET_ENTITY_COLLISION(vehicle, !g->vehicle.fly.no_collision, true);
float locspeed = (g->vehicle.fly.speed * 10); float locspeed = (g->vehicle.fly.speed * 10);
float locspeed2 = g->vehicle.fly.speed; float locspeed2 = g->vehicle.fly.speed;
if (PAD::IS_CONTROL_PRESSED(0, 61)) if (PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_MOVE_UP_ONLY))
{ {
locspeed = (locspeed * 2); locspeed *= 2;
locspeed2 = (locspeed2 * 2); locspeed2 *= 2;
} }
if (PAD::IS_CONTROL_PRESSED(2, 71)) if (PAD::IS_CONTROL_PRESSED(2, (int)ControllerInputs::INPUT_VEH_ACCELERATE))
{ {
if (g->vehicle.fly.dont_stop) if (g->vehicle.fly.dont_stop)
{ {
ENTITY::APPLY_FORCE_TO_ENTITY(self::veh, 1, 0.0, g->vehicle.fly.speed, 0.0, 0.0, 0.0, 0.0, 0, 1, 1, 1, 0, 1); ENTITY::APPLY_FORCE_TO_ENTITY(vehicle, 1, 0.0, g->vehicle.fly.speed, 0.0, 0.0, 0.0, 0.0, 0, 1, 1, 1, 0, 1);
} }
else else
{ {
VEHICLE::SET_VEHICLE_FORWARD_SPEED(self::veh, locspeed); VEHICLE::SET_VEHICLE_FORWARD_SPEED(vehicle, locspeed);
} }
} }
if (PAD::IS_CONTROL_PRESSED(2, 72)) if (PAD::IS_CONTROL_PRESSED(2, (int)ControllerInputs::INPUT_VEH_BRAKE))
{ {
float lsp = g->vehicle.fly.speed; float lsp = g->vehicle.fly.speed;
if (!PAD::IS_CONTROL_PRESSED(0, 61)) if (!PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_MOVE_UP_ONLY))
{ {
lsp = (g->vehicle.fly.speed * 2); lsp = (g->vehicle.fly.speed * 2);
} }
if (g->vehicle.fly.dont_stop) if (g->vehicle.fly.dont_stop)
{ {
ENTITY::APPLY_FORCE_TO_ENTITY(self::veh, 1, 0.0, 0 - (lsp), 0.0, 0.0, 0.0, 0.0, 0, 1, 1, 1, 0, 1); ENTITY::APPLY_FORCE_TO_ENTITY(vehicle, 1, 0.0, 0 - (lsp), 0.0, 0.0, 0.0, 0.0, 0, 1, 1, 1, 0, 1);
} }
else else
{ {
VEHICLE::SET_VEHICLE_FORWARD_SPEED(self::veh, (0 - locspeed)); VEHICLE::SET_VEHICLE_FORWARD_SPEED(vehicle, (0 - locspeed));
} }
} }
if (PAD::IS_CONTROL_PRESSED(2, 63)) if (PAD::IS_CONTROL_PRESSED(2, (int)ControllerInputs::INPUT_VEH_MOVE_LEFT_ONLY))
{ {
float lsp = ((0 - g->vehicle.fly.speed) * 2); float lsp = ((0 - g->vehicle.fly.speed) * 2);
if (!PAD::IS_CONTROL_PRESSED(0, 61)) if (!PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_MOVE_UP_ONLY))
{ {
lsp = (0 - g->vehicle.fly.speed); lsp = (0 - g->vehicle.fly.speed);
} }
if (g->vehicle.fly.dont_stop) if (g->vehicle.fly.dont_stop)
{ {
ENTITY::APPLY_FORCE_TO_ENTITY(self::veh, 1, (lsp), 0.0, 0.0, 0.0, 0.0, 0.0, 0, 1, 1, 1, 0, 1); ENTITY::APPLY_FORCE_TO_ENTITY(vehicle, 1, (lsp), 0.0, 0.0, 0.0, 0.0, 0.0, 0, 1, 1, 1, 0, 1);
} }
else else
{ {
ENTITY::APPLY_FORCE_TO_ENTITY(self::veh, 1, (0 - (locspeed)), 0.0, 0.0, 0.0, 0.0, 0.0, 0, 1, 1, 1, 0, 1); ENTITY::APPLY_FORCE_TO_ENTITY(vehicle, 1, (0 - (locspeed)), 0.0, 0.0, 0.0, 0.0, 0.0, 0, 1, 1, 1, 0, 1);
} }
} }
if (PAD::IS_CONTROL_PRESSED(2, 64)) if (PAD::IS_CONTROL_PRESSED(2, (int)ControllerInputs::INPUT_VEH_MOVE_RIGHT_ONLY))
{ {
float lsp = g->vehicle.fly.speed; float lsp = g->vehicle.fly.speed;
if (!PAD::IS_CONTROL_PRESSED(0, 61)) if (!PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_MOVE_UP_ONLY))
{ {
lsp = (g->vehicle.fly.speed * 2); lsp = (g->vehicle.fly.speed * 2);
} }
if (g->vehicle.fly.dont_stop) if (g->vehicle.fly.dont_stop)
{ {
ENTITY::APPLY_FORCE_TO_ENTITY(self::veh, 1, lsp, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 1, 1, 1, 0, 1); ENTITY::APPLY_FORCE_TO_ENTITY(vehicle, 1, lsp, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 1, 1, 1, 0, 1);
} }
else else
{ {
ENTITY::APPLY_FORCE_TO_ENTITY(self::veh, 1, locspeed, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 1, 1, 1, 0, 1); ENTITY::APPLY_FORCE_TO_ENTITY(vehicle, 1, locspeed, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 1, 1, 1, 0, 1);
} }
} }
if (!g->vehicle.fly.dont_stop && !PAD::IS_CONTROL_PRESSED(2, 71) && !PAD::IS_CONTROL_PRESSED(2, 72)) if (!g->vehicle.fly.dont_stop && !PAD::IS_CONTROL_PRESSED(2, (int)ControllerInputs::INPUT_VEH_ACCELERATE) && !PAD::IS_CONTROL_PRESSED(2, (int)ControllerInputs::INPUT_VEH_BRAKE))
{ {
VEHICLE::SET_VEHICLE_FORWARD_SPEED(self::veh, 0.0); VEHICLE::SET_VEHICLE_FORWARD_SPEED(vehicle, 0.0);
} }
if (TASK::GET_IS_TASK_ACTIVE(self::ped, 2)) if (TASK::GET_IS_TASK_ACTIVE(self::ped, 2))
{ {
g->vehicle.fly.enabled = false; g->vehicle.fly.enabled = false;
VEHICLE::SET_VEHICLE_GRAVITY(self::veh, true); VEHICLE::SET_VEHICLE_GRAVITY(vehicle, true);
ENTITY::SET_ENTITY_COLLISION(self::veh, true, true); ENTITY::SET_ENTITY_COLLISION(vehicle, true, true);
if (g->vehicle.fly.stop_on_exit) if (g->vehicle.fly.stop_on_exit)
{ {
VEHICLE::SET_VEHICLE_FORWARD_SPEED(self::veh, 0.0); VEHICLE::SET_VEHICLE_FORWARD_SPEED(vehicle, 0.0);
} }
} }
} }
void looped::vehicle_fly() void looped::vehicle_fly()
{ {
Vehicle vehicle = self::veh;
if (g->vehicle.fly.enabled) if (g->vehicle.fly.enabled)
{ {
last_fly_tick = true; last_fly_tick = true;
if (!self::veh) if (!vehicle)
{ {
g_notification_service->push_warning("Warning", "Please be in a vehicle before enabling vehicle fly."); g_notification_service->push_warning("Warning", "Please be in a vehicle before enabling vehicle fly.");
g->vehicle.fly.enabled = false; g->vehicle.fly.enabled = false;
@ -118,16 +122,16 @@ namespace big
} }
else else
{ {
if (NETWORK::NETWORK_HAS_CONTROL_OF_ENTITY(self::veh)) if (NETWORK::NETWORK_HAS_CONTROL_OF_ENTITY(vehicle))
{ {
do_vehicle_fly(); do_vehicle_fly();
VEHICLE::SET_VEHICLE_GRAVITY(self::veh, false); VEHICLE::SET_VEHICLE_GRAVITY(vehicle, false);
} }
else else
{ {
for (int i = 0; i < 5; i++) for (int i = 0; i < 5; i++)
{ {
entity::take_control_of(self::veh); entity::take_control_of(vehicle);
g_notification_service->push_warning("Warning", "Failed to take control of the vehicle."); g_notification_service->push_warning("Warning", "Failed to take control of the vehicle.");
} }
@ -138,8 +142,8 @@ namespace big
{ {
if (last_fly_tick) if (last_fly_tick)
{ {
ENTITY::SET_ENTITY_COLLISION(self::veh, true, true); ENTITY::SET_ENTITY_COLLISION(vehicle, true, true);
VEHICLE::SET_VEHICLE_GRAVITY(self::veh, true); VEHICLE::SET_VEHICLE_GRAVITY(vehicle, true);
last_fly_tick = false; last_fly_tick = false;
} }
} }

View File

@ -12,7 +12,9 @@ namespace big
{ {
if (!g->vehicle.horn_boost) return; if (!g->vehicle.horn_boost) return;
if (self::veh == 0) Vehicle vehicle = self::veh;
if (vehicle == 0)
{ {
hornBoostSpeed = hornBoostSpeedDefault; hornBoostSpeed = hornBoostSpeedDefault;
@ -20,15 +22,15 @@ namespace big
} }
if (PAD::IS_CONTROL_JUST_PRESSED(0, (int)ControllerInputs::INPUT_VEH_HORN)) if (PAD::IS_CONTROL_JUST_PRESSED(0, (int)ControllerInputs::INPUT_VEH_HORN))
hornBoostSpeed = ENTITY::GET_ENTITY_SPEED(self::veh); hornBoostSpeed = ENTITY::GET_ENTITY_SPEED(vehicle);
if (PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_HORN)) if (PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_HORN))
{ {
if (hornBoostSpeed < hostBoostSpeedMax) hornBoostSpeed++; if (hornBoostSpeed < hostBoostSpeedMax) hornBoostSpeed++;
const auto velocity = const auto velocity =
ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(self::veh, 0.f, hornBoostSpeed, 0.f) - ENTITY::GET_ENTITY_COORDS(self::veh, true); ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(vehicle, 0.f, hornBoostSpeed, 0.f) - ENTITY::GET_ENTITY_COORDS(vehicle, true);
ENTITY::SET_ENTITY_VELOCITY(self::veh, velocity.x, velocity.y, velocity.z); ENTITY::SET_ENTITY_VELOCITY(vehicle, velocity.x, velocity.y, velocity.z);
} }
else if (PAD::IS_CONTROL_JUST_RELEASED(0, (int)ControllerInputs::INPUT_VEH_HORN)) else if (PAD::IS_CONTROL_JUST_RELEASED(0, (int)ControllerInputs::INPUT_VEH_HORN))
hornBoostSpeed = hornBoostSpeedDefault; hornBoostSpeed = hornBoostSpeedDefault;

View File

@ -9,12 +9,14 @@ namespace big
{ {
if (!g->vehicle.instant_brake) return; if (!g->vehicle.instant_brake) return;
if (self::veh == 0 || ENTITY::GET_ENTITY_SPEED_VECTOR(self::veh, true).y < 1.f) Vehicle vehicle = self::veh;
if (vehicle == 0 || ENTITY::GET_ENTITY_SPEED_VECTOR(vehicle, true).y < 1.f || !VEHICLE::IS_VEHICLE_ON_ALL_WHEELS(vehicle))
{ {
return; return;
} }
if (PAD::IS_CONTROL_PRESSED(0, 33)) if (PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_BRAKE) || PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_HANDBRAKE))
VEHICLE::SET_VEHICLE_FORWARD_SPEED(self::veh, 0); VEHICLE::SET_VEHICLE_FORWARD_SPEED(vehicle, 0);
} }
} }

View File

@ -31,7 +31,7 @@ namespace big
if (g->vehicle.ls_customs && g->vehicle.ls_customs != state) if (g->vehicle.ls_customs && g->vehicle.ls_customs != state)
{ {
Vehicle veh = PED::GET_VEHICLE_PED_IS_USING(PLAYER::PLAYER_PED_ID()); Vehicle veh = self::veh;
if (!ENTITY::DOES_ENTITY_EXIST(veh) || ENTITY::IS_ENTITY_DEAD(veh, false)) if (!ENTITY::DOES_ENTITY_EXIST(veh) || ENTITY::IS_ENTITY_DEAD(veh, false))
{ {
busy = false; busy = false;

View File

@ -6,8 +6,10 @@ namespace big
void looped::vehicle_rainbow_paint() void looped::vehicle_rainbow_paint()
{ {
if (self::veh && g->vehicle.rainbow_paint) if (g->vehicle.rainbow_paint)
{ {
Vehicle vehicle = self::veh;
if (g->vehicle.rainbow_paint == 1) if (g->vehicle.rainbow_paint == 1)
{ {
g->rgb.fade = true; g->rgb.fade = true;
@ -19,8 +21,8 @@ namespace big
g->rgb.fade = false; g->rgb.fade = false;
} }
VEHICLE::SET_VEHICLE_CUSTOM_PRIMARY_COLOUR(self::veh, g->rgb.r, g->rgb.g, g->rgb.b); VEHICLE::SET_VEHICLE_CUSTOM_PRIMARY_COLOUR(vehicle, g->rgb.r, g->rgb.g, g->rgb.b);
VEHICLE::SET_VEHICLE_CUSTOM_PRIMARY_COLOUR(self::veh, g->rgb.r, g->rgb.g, g->rgb.b); VEHICLE::SET_VEHICLE_CUSTOM_PRIMARY_COLOUR(vehicle, g->rgb.r, g->rgb.g, g->rgb.b);
} }
} }
} }

View File

@ -1,10 +1,15 @@
#include "backend/looped/looped.hpp" #include "backend/looped/looped.hpp"
#include "core/enums.hpp" #include "core/enums.hpp"
#include "gta/enums.hpp"
#include "util/entity.hpp" #include "util/entity.hpp"
namespace big namespace big
{ {
static const int controls[] = { 14, 15, 24 }; static const int controls[] = {
(int)ControllerInputs::INPUT_WEAPON_WHEEL_NEXT,
(int)ControllerInputs::INPUT_WEAPON_WHEEL_PREV,
(int)ControllerInputs::INPUT_ATTACK
};
void looped::weapons_cage_gun() void looped::weapons_cage_gun()
{ {
@ -12,13 +17,13 @@ namespace big
if (bCageGun) if (bCageGun)
{ {
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, 25)) if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_AIM))
{ {
PLAYER::DISABLE_PLAYER_FIRING(PLAYER::GET_PLAYER_INDEX(), true); PLAYER::DISABLE_PLAYER_FIRING(self::id, true);
for (int control : controls) for (int control : controls)
PAD::DISABLE_CONTROL_ACTION(0, control, true); PAD::DISABLE_CONTROL_ACTION(0, control, true);
if (PAD::IS_DISABLED_CONTROL_JUST_RELEASED(0, 24)) if (PAD::IS_DISABLED_CONTROL_JUST_RELEASED(0, (int)ControllerInputs::INPUT_ATTACK))
{ {
Entity entity; Entity entity;

View File

@ -1,11 +1,16 @@
#include "backend/looped/looped.hpp" #include "backend/looped/looped.hpp"
#include "core/enums.hpp" #include "core/enums.hpp"
#include "gta/enums.hpp"
#include "util/entity.hpp" #include "util/entity.hpp"
#include "util/math.hpp" #include "util/math.hpp"
namespace big namespace big
{ {
static const int controls[] = { 14, 15, 24 }; static const int controls[] = {
(int)ControllerInputs::INPUT_WEAPON_WHEEL_NEXT,
(int)ControllerInputs::INPUT_WEAPON_WHEEL_PREV,
(int)ControllerInputs::INPUT_ATTACK
};
void looped::weapons_delete_gun() void looped::weapons_delete_gun()
{ {
@ -13,13 +18,13 @@ namespace big
if (bCageGun) if (bCageGun)
{ {
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, 25)) if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_AIM))
{ {
PLAYER::DISABLE_PLAYER_FIRING(PLAYER::GET_PLAYER_INDEX(), true); PLAYER::DISABLE_PLAYER_FIRING(self::id, true);
for (int control : controls) for (int control : controls)
PAD::DISABLE_CONTROL_ACTION(0, control, true); PAD::DISABLE_CONTROL_ACTION(0, control, true);
if (PAD::IS_DISABLED_CONTROL_JUST_RELEASED(0, 24)) if (PAD::IS_DISABLED_CONTROL_JUST_RELEASED(0, (int)ControllerInputs::INPUT_ATTACK))
{ {
Entity entity; Entity entity;

View File

@ -1,5 +1,6 @@
#include "backend/looped/looped.hpp" #include "backend/looped/looped.hpp"
#include "core/enums.hpp" #include "core/enums.hpp"
#include "gta/enums.hpp"
#include "util/entity.hpp" #include "util/entity.hpp"
#include "util/math.hpp" #include "util/math.hpp"
@ -11,7 +12,11 @@ namespace big
static float dist; static float dist;
static const int scroll = 0; static const int scroll = 0;
static const int controls[] = { 14, 15, 24 }; static const int controls[] = {
(int)ControllerInputs::INPUT_WEAPON_WHEEL_NEXT,
(int)ControllerInputs::INPUT_WEAPON_WHEEL_PREV,
(int)ControllerInputs::INPUT_ATTACK
};
void looped::weapons_gravity_gun() void looped::weapons_gravity_gun()
{ {
@ -19,16 +24,16 @@ namespace big
double multiplier = 3.0; double multiplier = 3.0;
// ZOOMED IN // ZOOMED IN
if (bGravityGun && PAD::IS_DISABLED_CONTROL_PRESSED(0, 25)) if (bGravityGun && PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_AIM))
{ {
PLAYER::DISABLE_PLAYER_FIRING(PLAYER::GET_PLAYER_INDEX(), true); PLAYER::DISABLE_PLAYER_FIRING(self::id, true);
for (int control : controls) for (int control : controls)
PAD::DISABLE_CONTROL_ACTION(0, control, true); PAD::DISABLE_CONTROL_ACTION(0, control, true);
location = ENTITY::GET_ENTITY_COORDS(PLAYER::PLAYER_PED_ID(), true); location = self::pos;
// Attack RELEASED // Attack RELEASED
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, 24) && ent == 0) if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_ATTACK) && ent == 0)
{ {
if (entity::raycast(&ent)) if (entity::raycast(&ent))
{ {
@ -70,9 +75,9 @@ namespace big
if (ENTITY::DOES_ENTITY_EXIST(ent)) if (ENTITY::DOES_ENTITY_EXIST(ent))
{ {
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, 14)) if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_WEAPON_WHEEL_NEXT))
dist -= 5; dist -= 5;
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, 15)) if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_WEAPON_WHEEL_PREV))
dist += 5; dist += 5;
if (!entity::take_control_of(ent)) if (!entity::take_control_of(ent))

View File

@ -5,11 +5,9 @@ namespace big
{ {
void looped::weapons_increased_damage() void looped::weapons_increased_damage()
{ {
auto const player_ped = PLAYER::PLAYER_PED_ID();
if (g->weapons.increased_damage != 1) { if (g->weapons.increased_damage != 1) {
Hash weapon{}; Hash weapon{};
WEAPON::GET_CURRENT_PED_WEAPON(player_ped, &weapon, 0); WEAPON::GET_CURRENT_PED_WEAPON(self::ped, &weapon, 0);
WEAPON::SET_WEAPON_DAMAGE_MODIFIER_THIS_FRAME_(weapon, g->weapons.increased_damage); WEAPON::SET_WEAPON_DAMAGE_MODIFIER_THIS_FRAME_(weapon, g->weapons.increased_damage);
} }
} }

View File

@ -1,19 +1,19 @@
#include "backend/looped/looped.hpp" #include "backend/looped/looped.hpp"
#include "gta/joaat.hpp"
#include "natives.hpp" #include "natives.hpp"
namespace big namespace big
{ {
static bool bLastInfiniteAmmo = false;
void looped::weapons_infinite_ammo() void looped::weapons_infinite_ammo()
{ {
if (g->weapons.infinite_ammo) { bool bInfiniteAmmo = g->weapons.infinite_ammo;
Hash weaponHash;
auto const ped = PLAYER::PLAYER_PED_ID();
WEAPON::GET_CURRENT_PED_WEAPON(ped, &weaponHash, 1); if (bInfiniteAmmo || (!bInfiniteAmmo && bInfiniteAmmo != bLastInfiniteAmmo))
if (weaponHash != RAGE_JOAAT("WEAPON_UNARMED")) { {
WEAPON::GIVE_WEAPON_TO_PED(ped, weaponHash, 9999, false, false); WEAPON::SET_PED_INFINITE_AMMO(self::ped, g->weapons.infinite_ammo, NULL);
}
bLastInfiniteAmmo = g->weapons.infinite_ammo;
} }
} }
} }

View File

@ -3,10 +3,17 @@
namespace big namespace big
{ {
static bool bLastInfiniteMag = false;
void looped::weapons_infinite_mag() void looped::weapons_infinite_mag()
{ {
if (g->weapons.infinite_mag) { bool bInfiniteMag = g->weapons.infinite_mag;
WEAPON::SET_PED_INFINITE_AMMO_CLIP(PLAYER::PLAYER_PED_ID(), g->weapons.infinite_mag);
if (bInfiniteMag || (!bInfiniteMag && bInfiniteMag != bLastInfiniteMag))
{
WEAPON::SET_PED_INFINITE_AMMO_CLIP(self::ped, g->weapons.infinite_mag);
bLastInfiniteMag = g->weapons.infinite_mag;
} }
} }
} }

View File

@ -5,7 +5,11 @@
namespace big namespace big
{ {
static const int controls[] = { 14, 15, 24 }; static const int controls[] = {
(int)ControllerInputs::INPUT_WEAPON_WHEEL_NEXT,
(int)ControllerInputs::INPUT_WEAPON_WHEEL_PREV,
(int)ControllerInputs::INPUT_ATTACK
};
void looped::weapons_repair_gun() void looped::weapons_repair_gun()
{ {
@ -13,13 +17,13 @@ namespace big
if (bRepairGun) if (bRepairGun)
{ {
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, 25)) if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_AIM))
{ {
PLAYER::DISABLE_PLAYER_FIRING(PLAYER::GET_PLAYER_INDEX(), true); PLAYER::DISABLE_PLAYER_FIRING(self::id, true);
for (int control : controls) for (int control : controls)
PAD::DISABLE_CONTROL_ACTION(0, control, true); PAD::DISABLE_CONTROL_ACTION(0, control, true);
if (PAD::IS_DISABLED_CONTROL_JUST_RELEASED(0, 24)) if (PAD::IS_DISABLED_CONTROL_JUST_RELEASED(0, (int)ControllerInputs::INPUT_ATTACK))
{ {
Entity entity; Entity entity;

View File

@ -1,25 +1,28 @@
#include "backend/looped/looped.hpp" #include "backend/looped/looped.hpp"
#include "core/enums.hpp" #include "core/enums.hpp"
#include "gta/enums.hpp"
#include "util/entity.hpp" #include "util/entity.hpp"
namespace big namespace big
{ {
static const int controls[] = { 14, 15, 24 }; static const int controls[] = {
(int)ControllerInputs::INPUT_WEAPON_WHEEL_NEXT,
(int)ControllerInputs::INPUT_WEAPON_WHEEL_PREV,
(int)ControllerInputs::INPUT_ATTACK
};
static Entity ent; static Entity ent;
void looped::weapons_steal_vehicle_gun() 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)
{ {
Ped player = PLAYER::PLAYER_PED_ID(); if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_AIM))
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, 25))
{ {
PLAYER::DISABLE_PLAYER_FIRING(PLAYER::GET_PLAYER_INDEX(), true); PLAYER::DISABLE_PLAYER_FIRING(self::id, true);
for (const int control : controls) for (const int control : controls)
PAD::DISABLE_CONTROL_ACTION(0, control, true); PAD::DISABLE_CONTROL_ACTION(0, control, true);
if (PAD::IS_DISABLED_CONTROL_JUST_RELEASED(0, 24)) if (PAD::IS_DISABLED_CONTROL_JUST_RELEASED(0, (int)ControllerInputs::INPUT_ATTACK))
{ {
if (entity::raycast(&ent)) if (entity::raycast(&ent))
{ {
@ -33,7 +36,7 @@ namespace big
script::get_current()->yield(100ms); script::get_current()->yield(100ms);
} }
PED::SET_PED_INTO_VEHICLE(PLAYER::PLAYER_PED_ID(), ent, -1); PED::SET_PED_INTO_VEHICLE(self::ped, ent, -1);
} }
else g_notification_service->push_warning("Weapons", "Entity is not a vehicle."); else g_notification_service->push_warning("Weapons", "Entity is not a vehicle.");
} }

View File

@ -5,7 +5,11 @@
namespace big namespace big
{ {
static const int controls[] = { 14, 15, 24 }; static const int controls[] = {
(int)ControllerInputs::INPUT_WEAPON_WHEEL_NEXT,
(int)ControllerInputs::INPUT_WEAPON_WHEEL_PREV,
(int)ControllerInputs::INPUT_ATTACK
};
void looped::weapons_vehicle_gun() void looped::weapons_vehicle_gun()
{ {
@ -14,13 +18,13 @@ namespace big
if (bVehicleGun) if (bVehicleGun)
{ {
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, 25)) if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_AIM))
{ {
PLAYER::DISABLE_PLAYER_FIRING(PLAYER::GET_PLAYER_INDEX(), true); PLAYER::DISABLE_PLAYER_FIRING(self::id, true);
for (int control : controls) for (int control : controls)
PAD::DISABLE_CONTROL_ACTION(0, control, true); PAD::DISABLE_CONTROL_ACTION(0, control, true);
if (PAD::IS_DISABLED_CONTROL_JUST_RELEASED(0, 24)) if (PAD::IS_DISABLED_CONTROL_JUST_RELEASED(0, (int)ControllerInputs::INPUT_ATTACK))
{ {
Vector3 location = self::pos; Vector3 location = self::pos;

View File

@ -14,14 +14,14 @@ namespace big
if (g_vehicle_service->get_active_profile(g_local_player->m_vehicle->m_handling->m_model_hash).empty()) if (g_vehicle_service->get_active_profile(g_local_player->m_vehicle->m_handling->m_model_hash).empty())
{ {
if (ImGui::Button("Save Profile")) if (components::button("Save Profile"))
{ {
ImGui::OpenPopup("Save Handling"); ImGui::OpenPopup("Save Handling");
} }
} }
else else
{ {
if (ImGui::Button("Update Profile")) if (components::button("Update Profile"))
{ {
ImGui::OpenPopup("Update Handling"); ImGui::OpenPopup("Update Handling");
} }
@ -30,7 +30,7 @@ namespace big
modal_handling::modal_save_handling(); modal_handling::modal_save_handling();
modal_handling::modal_update_handling(); modal_handling::modal_update_handling();
ImGui::SameLine(); ImGui::SameLine();
if (ImGui::Button("Restore Handling")) if (components::button("Restore Handling"))
g_vehicle_service->restore_vehicle(); g_vehicle_service->restore_vehicle();
ImGui::Separator(); ImGui::Separator();

View File

@ -44,7 +44,7 @@ namespace big
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::TextWrapped(profile.description.c_str()); ImGui::TextWrapped(profile.description.c_str());
ImGui::TableNextColumn(); ImGui::TableNextColumn();
if (ImGui::Button("Load Profile")) if (components::button("Load Profile"))
g_vehicle_service->set_handling_profile(profile); g_vehicle_service->set_handling_profile(profile);
ImGui::EndTable(); ImGui::EndTable();

View File

@ -44,7 +44,7 @@ namespace big
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::TextWrapped(profile.description.c_str()); ImGui::TextWrapped(profile.description.c_str());
ImGui::TableNextColumn(); ImGui::TableNextColumn();
if (ImGui::Button("Load Profile")) if (components::button("Load Profile"))
g_vehicle_service->set_handling_profile(profile); g_vehicle_service->set_handling_profile(profile);
ImGui::EndTable(); ImGui::EndTable();

View File

@ -22,7 +22,7 @@ namespace big
g_thread_pool->push([&] { g_vehicle_service->get_by_share_code(search); }); g_thread_pool->push([&] { g_vehicle_service->get_by_share_code(search); });
}); });
ImGui::SameLine(); ImGui::SameLine();
if (ImGui::Button("Search")) if (components::button("Search"))
g_thread_pool->push([&] { g_vehicle_service->get_by_share_code(search); }); g_thread_pool->push([&] { g_vehicle_service->get_by_share_code(search); });
switch (g_vehicle_service->m_search_status) switch (g_vehicle_service->m_search_status)
@ -65,10 +65,10 @@ namespace big
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::TextWrapped(profile.description.c_str()); ImGui::TextWrapped(profile.description.c_str());
ImGui::TableNextColumn(); ImGui::TableNextColumn();
if (ImGui::Button("Load Profile")) if (components::button("Load Profile"))
g_vehicle_service->set_handling_profile(profile); g_vehicle_service->set_handling_profile(profile);
ImGui::SameLine(); ImGui::SameLine();
if (ImGui::Button("Save Profile")) if (components::button("Save Profile"))
{ {
g_thread_pool->push([&] g_thread_pool->push([&]
{ {

View File

@ -4,6 +4,7 @@
#include "natives.hpp" #include "natives.hpp"
#include "script.hpp" #include "script.hpp"
#include "services/vehicle_service.hpp" #include "services/vehicle_service.hpp"
#include "views/view.hpp"
namespace big namespace big
{ {
@ -55,7 +56,7 @@ namespace big
ImGui::EndGroup(); ImGui::EndGroup();
if (ImGui::Button("Cancel")) if (components::button("Cancel"))
{ {
strcpy(name, ""); strcpy(name, "");
strcpy(description, "No description."); strcpy(description, "No description.");
@ -63,7 +64,7 @@ namespace big
ImGui::CloseCurrentPopup(); ImGui::CloseCurrentPopup();
} }
ImGui::SameLine(); ImGui::SameLine();
if (ImGui::Button("Save")) if (components::button("Save"))
{ {
g_thread_pool->push([&] g_thread_pool->push([&]
{ {

View File

@ -4,6 +4,7 @@
#include "natives.hpp" #include "natives.hpp"
#include "script.hpp" #include "script.hpp"
#include "services/vehicle_service.hpp" #include "services/vehicle_service.hpp"
#include "views/view.hpp"
namespace big namespace big
{ {
@ -70,7 +71,7 @@ namespace big
ImGui::EndGroup(); ImGui::EndGroup();
if (ImGui::Button("Cancel")) if (components::button("Cancel"))
{ {
strcpy(name, ""); strcpy(name, "");
strcpy(description, "No description."); strcpy(description, "No description.");
@ -78,7 +79,7 @@ namespace big
ImGui::CloseCurrentPopup(); ImGui::CloseCurrentPopup();
} }
ImGui::SameLine(); ImGui::SameLine();
if (ImGui::Button("Update")) if (components::button("Update"))
{ {
g_thread_pool->push([&] g_thread_pool->push([&]
{ {

View File

@ -48,7 +48,7 @@ namespace big
{ {
while (g_running && m_running && g->spawn.preview_vehicle && g_gui.m_opened) while (g_running && m_running && g->spawn.preview_vehicle && g_gui.m_opened)
{ {
auto location = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(PLAYER::PLAYER_PED_ID(), 2.5f, 2.5f, .5f); auto location = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(self::ped, 2.5f, 2.5f, .5f);
if (m_current_veh == -1) if (m_current_veh == -1)
{ {
m_new_model = false; m_new_model = false;
@ -57,6 +57,8 @@ namespace big
ENTITY::FREEZE_ENTITY_POSITION(m_current_veh, true); ENTITY::FREEZE_ENTITY_POSITION(m_current_veh, true);
ENTITY::SET_ENTITY_ALPHA(m_current_veh, 0, 0); ENTITY::SET_ENTITY_ALPHA(m_current_veh, 0, 0);
ENTITY::SET_ENTITY_COLLISION(m_current_veh, false, false); ENTITY::SET_ENTITY_COLLISION(m_current_veh, false, false);
ENTITY::SET_CAN_CLIMB_ON_ENTITY(m_current_veh, false);
OBJECT::SET_OBJECT_ALLOW_LOW_LOD_BUOYANCY(m_current_veh, false);
} }
else if (m_new_model) else if (m_new_model)
{ {

View File

@ -16,10 +16,12 @@ namespace big::entity
inline void clean_ped(Ped ped) inline void clean_ped(Ped ped)
{ {
PED::CLEAR_PED_BLOOD_DAMAGE(PLAYER::PLAYER_PED_ID()); Ped player_ped = self::ped;
PED::CLEAR_PED_WETNESS(PLAYER::PLAYER_PED_ID());
PED::CLEAR_PED_ENV_DIRT(PLAYER::PLAYER_PED_ID()); PED::CLEAR_PED_BLOOD_DAMAGE(player_ped);
PED::RESET_PED_VISIBLE_DAMAGE(PLAYER::PLAYER_PED_ID()); PED::CLEAR_PED_WETNESS(player_ped);
PED::CLEAR_PED_ENV_DIRT(player_ped);
PED::RESET_PED_VISIBLE_DAMAGE(player_ped);
} }
inline void delete_entity(Entity ent) inline void delete_entity(Entity ent)

View File

@ -89,6 +89,7 @@ namespace big::mobile
if (*mechanic_global.at(958).as<int*>() != -1) if (*mechanic_global.at(958).as<int*>() != -1)
return g_notification_service->push_warning("Vehicle", "Mechanic is not ready to deliver a vehicle right now."); return g_notification_service->push_warning("Vehicle", "Mechanic is not ready to deliver a vehicle right now.");
if (g->vehicle.pv_teleport_into && self::veh)
TASK::CLEAR_PED_TASKS_IMMEDIATELY(PLAYER::PLAYER_PED_ID()); TASK::CLEAR_PED_TASKS_IMMEDIATELY(PLAYER::PLAYER_PED_ID());
// despawn current veh // despawn current veh

View File

@ -5,14 +5,16 @@ namespace big::ped
{ {
inline void steal_outfit(const Ped target) inline void steal_outfit(const Ped target)
{ {
if (ENTITY::GET_ENTITY_MODEL(PLAYER::PLAYER_PED_ID()) != ENTITY::GET_ENTITY_MODEL(target)) { Ped ped = self::ped;
if (ENTITY::GET_ENTITY_MODEL(ped) != ENTITY::GET_ENTITY_MODEL(target)) {
g_notification_service->push("Error", "Model mismatch, use steal identity instead."); g_notification_service->push("Error", "Model mismatch, use steal identity instead.");
return; return;
} }
for (int i = 0; i < 12; i++) { for (int i = 0; i < 12; i++) {
PED::SET_PED_COMPONENT_VARIATION PED::SET_PED_COMPONENT_VARIATION
( (
PLAYER::PLAYER_PED_ID(), ped,
i, i,
PED::GET_PED_DRAWABLE_VARIATION(target, i), PED::GET_PED_DRAWABLE_VARIATION(target, i),
PED::GET_PED_TEXTURE_VARIATION(target, i), PED::GET_PED_TEXTURE_VARIATION(target, i),
@ -23,14 +25,16 @@ namespace big::ped
inline void steal_identity(const Ped target) inline void steal_identity(const Ped target)
{ {
const int max_health = ENTITY::GET_ENTITY_MAX_HEALTH(PLAYER::PLAYER_PED_ID()); Ped ped = self::ped;
const int current_health = ENTITY::GET_ENTITY_HEALTH(PLAYER::PLAYER_PED_ID());
const int current_armor = PED::GET_PED_ARMOUR(PLAYER::PLAYER_PED_ID());
PLAYER::SET_PLAYER_MODEL(PLAYER::PLAYER_ID(), ENTITY::GET_ENTITY_MODEL(target)); const int max_health = ENTITY::GET_ENTITY_MAX_HEALTH(ped);
PED::CLONE_PED_TO_TARGET(target, PLAYER::PLAYER_PED_ID()); const int current_health = ENTITY::GET_ENTITY_HEALTH(ped);
ENTITY::SET_ENTITY_MAX_HEALTH(PLAYER::PLAYER_PED_ID(), max_health); const int current_armor = PED::GET_PED_ARMOUR(ped);
ENTITY::SET_ENTITY_HEALTH(PLAYER::PLAYER_PED_ID(), current_health, 0);
PED::SET_PED_ARMOUR(PLAYER::PLAYER_PED_ID(), current_armor); PLAYER::SET_PLAYER_MODEL(self::id , ENTITY::GET_ENTITY_MODEL(target));
PED::CLONE_PED_TO_TARGET(target, ped);
ENTITY::SET_ENTITY_MAX_HEALTH(ped, max_health);
ENTITY::SET_ENTITY_HEALTH(ped, current_health, 0);
PED::SET_PED_ARMOUR(ped, current_armor);
} }
} }

View File

@ -24,9 +24,10 @@ namespace big::teleport
} }
ent = PED::GET_VEHICLE_PED_IS_IN(ent, false); ent = PED::GET_VEHICLE_PED_IS_IN(ent, false);
Vector3 location = self::pos;
if (entity::take_control_of(ent)) if (entity::take_control_of(ent))
ENTITY::SET_ENTITY_COORDS(ent, self::pos.x, self::pos.y, self::pos.z, 0, 0, 0, 0); ENTITY::SET_ENTITY_COORDS(ent, location.x, location.y, location.z, 0, 0, 0, 0);
else else
g_notification_service->push_warning("Teleport", "Failed to take control of player vehicle."); g_notification_service->push_warning("Teleport", "Failed to take control of player vehicle.");
@ -88,18 +89,20 @@ namespace big::teleport
Vector3 location = ENTITY::GET_ENTITY_COORDS(veh, true); Vector3 location = ENTITY::GET_ENTITY_COORDS(veh, true);
load_ground_at_3dcoord(location); load_ground_at_3dcoord(location);
ENTITY::SET_ENTITY_COORDS(PLAYER::PLAYER_PED_ID(), location.x, location.y, location.z, 0, 0, 0, 0); Ped ped = self::ped;
ENTITY::SET_ENTITY_COORDS(ped, location.x, location.y, location.z, 0, 0, 0, 0);
script::get_current()->yield(); script::get_current()->yield();
PED::SET_PED_INTO_VEHICLE(PLAYER::PLAYER_PED_ID(), veh, seat_index); PED::SET_PED_INTO_VEHICLE(ped, veh, seat_index);
return true; return true;
} }
inline void to_coords(Vector3 location) inline void to_coords(Vector3 location)
{ {
PED::SET_PED_COORDS_KEEP_VEHICLE(PLAYER::PLAYER_PED_ID(), location.x, location.y, location.z + 1.f); PED::SET_PED_COORDS_KEEP_VEHICLE(self::ped, location.x, location.y, location.z + 1.f);
} }
inline bool to_blip(int sprite, int color = -1) inline bool to_blip(int sprite, int color = -1)
@ -111,7 +114,7 @@ namespace big::teleport
load_ground_at_3dcoord(location); load_ground_at_3dcoord(location);
PED::SET_PED_COORDS_KEEP_VEHICLE(PLAYER::PLAYER_PED_ID(), location.x, location.y, location.z); PED::SET_PED_COORDS_KEEP_VEHICLE(self::ped, location.x, location.y, location.z);
return true; return true;
} }
@ -120,7 +123,7 @@ namespace big::teleport
{ {
Vector3 location = ENTITY::GET_ENTITY_COORDS(ent, true); Vector3 location = ENTITY::GET_ENTITY_COORDS(ent, true);
PED::SET_PED_COORDS_KEEP_VEHICLE(PLAYER::PLAYER_PED_ID(), location.x, location.y, location.z); PED::SET_PED_COORDS_KEEP_VEHICLE(self::ped, location.x, location.y, location.z);
return true; return true;
} }

View File

@ -56,7 +56,7 @@ namespace big::toxic
const Vector3 destination = PED::GET_PED_BONE_COORDS(target, (int)PedBones::SKEL_ROOT, 0.0f, 0.0f, 0.0f); const Vector3 destination = PED::GET_PED_BONE_COORDS(target, (int)PedBones::SKEL_ROOT, 0.0f, 0.0f, 0.0f);
const Vector3 origin = PED::GET_PED_BONE_COORDS(target, (int)PedBones::SKEL_R_Hand, 0.0f, 0.0f, 0.2f); const Vector3 origin = PED::GET_PED_BONE_COORDS(target, (int)PedBones::SKEL_R_Hand, 0.0f, 0.0f, 0.2f);
MISC::SHOOT_SINGLE_BULLET_BETWEEN_COORDS(origin.x, origin.y, origin.z, destination.x, destination.y, destination.z, 1, 0, RAGE_JOAAT("WEAPON_STUNGUN"), PLAYER::PLAYER_PED_ID(), false, true, 1); MISC::SHOOT_SINGLE_BULLET_BETWEEN_COORDS(origin.x, origin.y, origin.z, destination.x, destination.y, destination.z, 1, 0, RAGE_JOAAT("WEAPON_STUNGUN"), self::ped, false, true, 1);
} }
} }

View File

@ -22,15 +22,17 @@ namespace big::vehicle
if (!entity::take_control_of(veh)) if (!entity::take_control_of(veh))
return g_notification_service->push_warning("Vehicle", "Failed to take control of remote vehicle."); return g_notification_service->push_warning("Vehicle", "Failed to take control of remote vehicle.");
Ped ped = self::ped;
ENTITY::SET_ENTITY_COORDS(veh, location.x, location.y, location.z + 1.f, 0, 0, 0, 0); ENTITY::SET_ENTITY_COORDS(veh, location.x, location.y, location.z + 1.f, 0, 0, 0, 0);
ENTITY::SET_ENTITY_HEADING(veh, ENTITY::GET_ENTITY_HEADING(PLAYER::PLAYER_PED_ID())); ENTITY::SET_ENTITY_HEADING(veh, ENTITY::GET_ENTITY_HEADING(ped));
if (put_in) if (put_in)
{ {
for (size_t i = 0; i < 100 && math::distance_between_vectors(location, ENTITY::GET_ENTITY_COORDS(veh, true)) > 10; i++) for (size_t i = 0; i < 100 && math::distance_between_vectors(location, ENTITY::GET_ENTITY_COORDS(veh, true)) > 10; i++)
script::get_current()->yield(); script::get_current()->yield();
PED::SET_PED_INTO_VEHICLE(PLAYER::PLAYER_PED_ID(), veh, -1); PED::SET_PED_INTO_VEHICLE(ped, veh, -1);
} }
} }
@ -93,7 +95,7 @@ namespace big::vehicle
inline void telport_into_veh(Vehicle veh) inline void telport_into_veh(Vehicle veh)
{ {
PED::SET_PED_INTO_VEHICLE(PLAYER::PLAYER_PED_ID(), veh, -1); PED::SET_PED_INTO_VEHICLE(self::ped, veh, -1);
} }
inline void max_vehicle(Vehicle veh) inline void max_vehicle(Vehicle veh)

View File

@ -27,13 +27,9 @@ namespace big
} }
if (ImGui::TreeNode("Local Weather")) if (ImGui::TreeNode("Local Weather"))
{ {
if (ImGui::Button("Clear Override")) components::button("Clear Override", [] {
{
g_fiber_pool->queue_job([]
{
MISC::CLEAR_OVERRIDE_WEATHER(); MISC::CLEAR_OVERRIDE_WEATHER();
}); });
}
if(ImGui::ListBox("", &g->session.local_weather, session::weathers, 15)) if(ImGui::ListBox("", &g->session.local_weather, session::weathers, 15))
{ {

View File

@ -17,7 +17,7 @@ namespace big
if (g_player_service->get_selected()->is_valid()) if (g_player_service->get_selected()->is_valid())
{ {
// if (ImGui::Button("Desync")) { gta_util::get_network_player_mgr()->RemovePlayer(g_player_service->get_selected()->get_net_game_player()); } //components::button("Desync", [] { gta_util::get_network_player_mgr()->RemovePlayer(g_player_service->get_selected()->get_net_game_player()); });
if (ImGui::TreeNode("Misc")) { if (ImGui::TreeNode("Misc")) {
components::button("Steal Outfit", [] { components::button("Steal Outfit", [] {

View File

@ -6,7 +6,7 @@ namespace big
{ {
void view::self() { void view::self() {
components::button("Suicide", [] { components::button("Suicide", [] {
ENTITY::SET_ENTITY_HEALTH(PLAYER::PLAYER_PED_ID(), 0, 0); ENTITY::SET_ENTITY_HEALTH(self::ped, 0, 0);
}); });
ImGui::SameLine(); ImGui::SameLine();
@ -35,7 +35,7 @@ namespace big
} }
PLAYER::SET_PLAYER_MODEL(PLAYER::GET_PLAYER_INDEX(), hash); PLAYER::SET_PLAYER_MODEL(PLAYER::GET_PLAYER_INDEX(), hash);
PED::SET_PED_DEFAULT_COMPONENT_VARIATION(PLAYER::PLAYER_PED_ID()); PED::SET_PED_DEFAULT_COMPONENT_VARIATION(self::ped);
script::get_current()->yield(); script::get_current()->yield();
STREAMING::SET_MODEL_AS_NO_LONGER_NEEDED(hash); STREAMING::SET_MODEL_AS_NO_LONGER_NEEDED(hash);
}); });
@ -72,14 +72,10 @@ namespace big
} }
ImGui::Checkbox("Keep Player Clean", &g->self.clean_player); ImGui::Checkbox("Keep Player Clean", &g->self.clean_player);
if (ImGui::Button("Clean Player"))
{ components::button("Clean Player", [] {
QUEUE_JOB_BEGIN_CLAUSE() entity::clean_ped(self::ped);
{ });
entity::clean_ped(PLAYER::PLAYER_PED_ID());
}
QUEUE_JOB_END_CLAUSE
}
ImGui::EndGroup(); ImGui::EndGroup();

View File

@ -19,7 +19,7 @@ namespace big
eAmmoSpecialType selected_ammo = g->weapons.ammo_special.type; eAmmoSpecialType selected_ammo = g->weapons.ammo_special.type;
if (ImGui::BeginCombo("Ammo Special", SPECIAL_AMMOS[(int)selected_ammo].name)) if (ImGui::BeginCombo("Special Ammo", SPECIAL_AMMOS[(int)selected_ammo].name))
{ {
for (const auto& special_ammo : SPECIAL_AMMOS) for (const auto& special_ammo : SPECIAL_AMMOS)
{ {
@ -47,17 +47,20 @@ namespace big
ImGui::Checkbox("No Spread", &g->weapons.no_spread); ImGui::Checkbox("No Spread", &g->weapons.no_spread);
if (ImGui::Button("Get All Weapons")) components::button("Get All Weapons", [] {
{
QUEUE_JOB_BEGIN_CLAUSE()
{
for (auto const& weapon : weapon_list) { for (auto const& weapon : weapon_list) {
WEAPON::GIVE_DELAYED_WEAPON_TO_PED(PLAYER::PLAYER_PED_ID(), weapon, 9999, false); WEAPON::GIVE_DELAYED_WEAPON_TO_PED(self::ped, weapon, 9999, false);
} }
WEAPON::GIVE_DELAYED_WEAPON_TO_PED(PLAYER::PLAYER_PED_ID(), -72657034, 0, true); WEAPON::GIVE_DELAYED_WEAPON_TO_PED(self::ped, -72657034, 0, true);
} });
QUEUE_JOB_END_CLAUSE ImGui::SameLine();
components::button("Remove Current Weapon", [] {
Hash weaponHash;
WEAPON::GET_CURRENT_PED_WEAPON(self::ped, &weaponHash, 1);
if (weaponHash != RAGE_JOAAT("WEAPON_UNARMED")) {
WEAPON::REMOVE_WEAPON_FROM_PED(self::ped, weaponHash);
} }
});
ImGui::SliderFloat("Damage Multiplier", &g->weapons.increased_damage, 1.f, 10.f, "%.1f"); ImGui::SliderFloat("Damage Multiplier", &g->weapons.increased_damage, 1.f, 10.f, "%.1f");

View File

@ -15,10 +15,10 @@ namespace big
if (ImGui::Checkbox("Enable Freezing", &g_globals_service->m_running) && g_globals_service->m_running) if (ImGui::Checkbox("Enable Freezing", &g_globals_service->m_running) && g_globals_service->m_running)
g_thread_pool->push([&]() { g_globals_service->loop(); }); g_thread_pool->push([&]() { g_globals_service->loop(); });
if (ImGui::Button("Load")) if (components::button("Load"))
g_globals_service->load(); g_globals_service->load();
ImGui::SameLine(); ImGui::SameLine();
if (ImGui::Button("Save")) if (components::button("Save"))
g_globals_service->save(); g_globals_service->save();
components::button("Network Bail", [] components::button("Network Bail", []
@ -27,7 +27,7 @@ namespace big
}); });
ImGui::SameLine(); ImGui::SameLine();
if (ImGui::Button("Add Global")) if (components::button("Add Global"))
{ {
ImGui::OpenPopup("New Global"); ImGui::OpenPopup("New Global");
} }
@ -87,7 +87,7 @@ namespace big
} }
ImGui::PopItemWidth(); ImGui::PopItemWidth();
if (ImGui::Button("Cancel")) if (components::button("Cancel"))
{ {
strcpy(name, ""); strcpy(name, "");
freeze = false; freeze = false;
@ -99,7 +99,7 @@ namespace big
ImGui::CloseCurrentPopup(); ImGui::CloseCurrentPopup();
} }
ImGui::SameLine(); ImGui::SameLine();
if (ImGui::Button("Save")) if (components::button("Save"))
{ {
auto new_global = global(name, base_address, freeze, offsets, offset_count); auto new_global = global(name, base_address, freeze, offsets, offset_count);
new_global.build_cache(); new_global.build_cache();
@ -152,7 +152,7 @@ namespace big
ImGui::BeginGroup(); ImGui::BeginGroup();
sprintf(label, "Delete##%d", global.get_id()); sprintf(label, "Delete##%d", global.get_id());
if (ImGui::Button(label)) if (components::button(label))
{ {
for (int i = 0; i < g_globals_service->m_globals.size(); i++) for (int i = 0; i < g_globals_service->m_globals.size(); i++)
if (auto& it = g_globals_service->m_globals.at(i); it.get_id() == global.get_id()) if (auto& it = g_globals_service->m_globals.at(i); it.get_id() == global.get_id())
@ -162,7 +162,7 @@ namespace big
} }
sprintf(label, "Write###%d", global.get_id()); sprintf(label, "Write###%d", global.get_id());
if (ImGui::Button(label)) if (components::button(label))
global.write(); global.write();
ImGui::EndGroup(); ImGui::EndGroup();
@ -224,7 +224,7 @@ namespace big
ImGui::Checkbox("Script Event Logging", &g->debug.script_event_logging); ImGui::Checkbox("Script Event Logging", &g->debug.script_event_logging);
if (ImGui::Button("Dump entrypoints")) if (components::button("Dump entrypoints"))
{ {
system::dump_entry_points(); system::dump_entry_points();
} }

View File

@ -26,7 +26,9 @@ namespace big
components::input_text_with_hint("Model Name", "Search", model, sizeof(model), ImGuiInputTextFlags_EnterReturnsTrue, [] components::input_text_with_hint("Model Name", "Search", model, sizeof(model), ImGuiInputTextFlags_EnterReturnsTrue, []
{ {
const auto location = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(PLAYER::PLAYER_PED_ID(), 2.f, 2.f, 0.f); Ped ped = self::ped;
const auto location = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(ped, 2.f, 2.f, 0.f);
const Vehicle veh = vehicle::spawn(model, location, g_local_player->m_player_info->m_ped->m_navigation->m_heading + 90.f); const Vehicle veh = vehicle::spawn(model, location, g_local_player->m_player_info->m_ped->m_navigation->m_heading + 90.f);
if (g->spawn.spawn_inside) if (g->spawn.spawn_inside)
@ -82,11 +84,13 @@ namespace big
if (g->spawn.preview_vehicle && ImGui::IsItemHovered()) if (g->spawn.preview_vehicle && ImGui::IsItemHovered())
g_vehicle_preview_service->set_preview_vehicle(item); g_vehicle_preview_service->set_preview_vehicle(item);
else if (g->spawn.preview_vehicle && !ImGui::IsAnyItemHovered())
g_vehicle_preview_service->stop_preview();
} }
} }
ImGui::ListBoxFooter();
} }
else ImGui::Text("No vehicles in registry."); else ImGui::Text("No vehicles in registry.");
ImGui::ListBoxFooter();
} }
} }
} }

View File

@ -23,7 +23,6 @@ namespace big
ImGui::Checkbox("Seatbelt", &g->vehicle.seatbelt); ImGui::Checkbox("Seatbelt", &g->vehicle.seatbelt);
components::button("Repair", [] { components::button("Repair", [] {
vehicle::repair(self::veh); vehicle::repair(self::veh);
}); });
@ -31,7 +30,6 @@ namespace big
if (!*g_pointers->m_is_session_started) return g_notification_service->push_warning("WARNING", "Go into GTA V Online to use this option"); if (!*g_pointers->m_is_session_started) return g_notification_service->push_warning("WARNING", "Go into GTA V Online to use this option");
vehicle::go_into_personal_vehicle(); vehicle::go_into_personal_vehicle();
}); });
if (ImGui::TreeNode("Paint")) if (ImGui::TreeNode("Paint"))
@ -53,28 +51,21 @@ namespace big
components::small_text("Auto Drive"); components::small_text("Auto Drive");
components::button("Drive To Waypoint", [] { components::button("Drive To Waypoint", [] {
g->vehicle.auto_drive_to_waypoint = true; g->vehicle.auto_drive_to_waypoint = true;
}); });
components::button("Wander", [] { components::button("Wander", [] {
g->vehicle.auto_drive_wander = true; g->vehicle.auto_drive_wander = true;
}); });
ImGui::SliderInt("Top Speed", &g->vehicle.auto_drive_speed, 1, 200); ImGui::SliderInt("Top Speed", &g->vehicle.auto_drive_speed, 1, 200);
components::button("E-Stop", [] { components::button("E-Stop", [] {
QUEUE_JOB_BEGIN_CLAUSE()
{
g->vehicle.auto_drive_to_waypoint = false; g->vehicle.auto_drive_to_waypoint = false;
g->vehicle.auto_drive_wander = false; g->vehicle.auto_drive_wander = false;
VEHICLE::SET_VEHICLE_FORWARD_SPEED(self::veh, 0); VEHICLE::SET_VEHICLE_FORWARD_SPEED(self::veh, 0);
TASK::CLEAR_VEHICLE_TASKS_(self::veh); TASK::CLEAR_VEHICLE_TASKS_(self::veh);
TASK::CLEAR_PED_TASKS(self::ped); TASK::CLEAR_PED_TASKS(self::ped);
}
QUEUE_JOB_END_CLAUSE
}); });
if (ImGui::ListBox("Driving Style", &g->vehicle.driving_style_id, vehicle::driving_style_names, 3)) if (ImGui::ListBox("Driving Style", &g->vehicle.driving_style_id, vehicle::driving_style_names, 3))