Added drive to objective feature. (#369)
This commit is contained in:
parent
f00e1faf57
commit
136efc3af8
@ -74,8 +74,7 @@ namespace big
|
||||
|
||||
while (g_running)
|
||||
{
|
||||
looped::vehicle_auto_drive_to_waypoint();
|
||||
looped::vehicle_auto_drive_wander();
|
||||
looped::vehicle_auto_drive();
|
||||
looped::vehicle_despawn_bypass();
|
||||
looped::vehicle_drive_on_water();
|
||||
looped::vehicle_god_mode();
|
||||
|
@ -41,8 +41,7 @@ namespace big
|
||||
static void system_self_globals();
|
||||
static void system_update_pointers();
|
||||
|
||||
static void vehicle_auto_drive_to_waypoint();
|
||||
static void vehicle_auto_drive_wander();
|
||||
static void vehicle_auto_drive();
|
||||
static void vehicle_despawn_bypass();
|
||||
static void vehicle_drive_on_water();
|
||||
static void vehicle_fly();
|
||||
|
133
BigBaseV2/src/backend/looped/vehicle/auto_drive.cpp
Normal file
133
BigBaseV2/src/backend/looped/vehicle/auto_drive.cpp
Normal file
@ -0,0 +1,133 @@
|
||||
#include "backend/looped/looped.hpp"
|
||||
#include "gta/enums.hpp"
|
||||
#include "natives.hpp"
|
||||
#include "util/blip.hpp"
|
||||
#include "util/entity.hpp"
|
||||
#include "util/vehicle.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
void looped::vehicle_auto_drive()
|
||||
{
|
||||
static std::map<AutoDriveStyle, int> driving_style_flags = {
|
||||
{AutoDriveStyle::LAW_ABIDING, 443},
|
||||
{AutoDriveStyle::THE_ROAD_IS_YOURS, 787004}
|
||||
};
|
||||
|
||||
static int changing_driving_styles = false;
|
||||
static AutoDriveDestination current_destination = AutoDriveDestination::STOPPED;
|
||||
static int current_driving_flag = driving_style_flags[AutoDriveStyle::LAW_ABIDING];
|
||||
static float current_speed = 8;
|
||||
static bool started = false;
|
||||
static Vector3 waypoint;
|
||||
|
||||
if (g->vehicle.auto_drive_destination != AutoDriveDestination::STOPPED)
|
||||
{
|
||||
current_destination = g->vehicle.auto_drive_destination;
|
||||
g->vehicle.auto_drive_destination = AutoDriveDestination::STOPPED;
|
||||
changing_driving_styles = true;
|
||||
}
|
||||
|
||||
if (!self::veh && current_destination != AutoDriveDestination::STOPPED)
|
||||
{
|
||||
current_destination = AutoDriveDestination::STOPPED;
|
||||
changing_driving_styles = false;
|
||||
g_notification_service->push_warning("Warning", "Please be in a car first then try again.");
|
||||
}
|
||||
else if (
|
||||
current_driving_flag != driving_style_flags[g->vehicle.auto_drive_style] ||
|
||||
current_speed != g->vehicle.auto_drive_speed
|
||||
) {
|
||||
current_driving_flag = driving_style_flags[g->vehicle.auto_drive_style];
|
||||
current_speed = g->vehicle.auto_drive_speed;
|
||||
changing_driving_styles = true;
|
||||
}
|
||||
|
||||
if (current_destination != AutoDriveDestination::STOPPED)
|
||||
{
|
||||
Vector3 last_waypoint = waypoint;
|
||||
bool does_waypoint_exist = false;
|
||||
bool to_waypoint = false;
|
||||
|
||||
if (current_destination == AutoDriveDestination::OBJECTITVE)
|
||||
{
|
||||
to_waypoint = true;
|
||||
does_waypoint_exist = blip::get_objective_location(waypoint);
|
||||
}
|
||||
else if (current_destination == AutoDriveDestination::WAYPOINT)
|
||||
{
|
||||
to_waypoint = true;
|
||||
does_waypoint_exist = blip::get_blip_location(waypoint, (int)BlipIcons::Waypoint);
|
||||
}
|
||||
|
||||
if (
|
||||
does_waypoint_exist &&
|
||||
(
|
||||
last_waypoint.x != waypoint.x ||
|
||||
last_waypoint.y != waypoint.y ||
|
||||
last_waypoint.z != waypoint.z
|
||||
)
|
||||
) {
|
||||
changing_driving_styles = true;
|
||||
}
|
||||
|
||||
bool interupted = (
|
||||
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 (
|
||||
current_destination == AutoDriveDestination::EMERGENCY_STOP ||
|
||||
(to_waypoint && !does_waypoint_exist) ||
|
||||
interupted
|
||||
) {
|
||||
TASK::CLEAR_VEHICLE_TASKS_(self::veh);
|
||||
TASK::CLEAR_PED_TASKS(self::ped);
|
||||
|
||||
if (!interupted && started)
|
||||
{
|
||||
VEHICLE::SET_VEHICLE_FORWARD_SPEED(self::veh, 0);
|
||||
}
|
||||
|
||||
current_destination = AutoDriveDestination::STOPPED;
|
||||
|
||||
if (to_waypoint && !does_waypoint_exist)
|
||||
{
|
||||
g_notification_service->push_warning("Warning", "No Waypoint found please set one first.");
|
||||
}
|
||||
else
|
||||
{
|
||||
g_notification_service->push_warning("Warning", "Auto Drive Stopped");
|
||||
}
|
||||
|
||||
started = false;
|
||||
}
|
||||
else if (changing_driving_styles)
|
||||
{
|
||||
changing_driving_styles = false;
|
||||
|
||||
TASK::CLEAR_VEHICLE_TASKS_(self::veh);
|
||||
TASK::CLEAR_PED_TASKS(self::ped);
|
||||
|
||||
if (to_waypoint)
|
||||
{
|
||||
TASK::TASK_VEHICLE_DRIVE_TO_COORD_LONGRANGE(
|
||||
self::ped, self::veh,
|
||||
waypoint.x, waypoint.y, waypoint.z, current_speed,
|
||||
current_driving_flag, 20
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
TASK::TASK_VEHICLE_DRIVE_WANDER(self::ped, self::veh, current_speed, current_driving_flag);
|
||||
}
|
||||
|
||||
started = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,100 +0,0 @@
|
||||
#include "backend/looped/looped.hpp"
|
||||
#include "gta/enums.hpp"
|
||||
#include "natives.hpp"
|
||||
#include "util/blip.hpp"
|
||||
#include "util/entity.hpp"
|
||||
#include "util/vehicle.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
void looped::vehicle_auto_drive_to_waypoint()
|
||||
{
|
||||
static Vector3 location;
|
||||
static bool driving_to_wp = true;
|
||||
static bool ran_once = false;
|
||||
static int changing_driving_styles = false;
|
||||
static int current_driving_style = false;
|
||||
static float current_speed;
|
||||
|
||||
if (g->vehicle.auto_drive_to_waypoint)
|
||||
{
|
||||
ran_once = true;
|
||||
driving_to_wp = false;
|
||||
|
||||
if (!blip::get_blip_location(location, (int)BlipIcons::Waypoint))
|
||||
{
|
||||
g_notification_service->push_warning("Warning", "No Waypoint found please set one first.");
|
||||
g->vehicle.auto_drive_to_waypoint = false;
|
||||
}
|
||||
else if (!self::veh)
|
||||
{
|
||||
g_notification_service->push_warning("Warning", "Please be in a car first then try again.");
|
||||
g->vehicle.auto_drive_to_waypoint = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
blip::get_blip_location(location, (int)BlipIcons::Waypoint);
|
||||
|
||||
if (!changing_driving_styles)
|
||||
{
|
||||
g_notification_service->push_warning("Auto Drive", "Starting Route To Destination");
|
||||
g_notification_service->push_warning("Auto Drive", "Start driving or leave car to take back control.");
|
||||
}
|
||||
|
||||
current_speed = g->vehicle.auto_drive_speed;
|
||||
current_driving_style = g->vehicle.driving_style_flags;
|
||||
|
||||
TASK::CLEAR_VEHICLE_TASKS_(self::veh);
|
||||
TASK::CLEAR_PED_TASKS(self::ped);
|
||||
TASK::TASK_VEHICLE_DRIVE_TO_COORD(
|
||||
self::ped, self::veh,
|
||||
location.x, location.y, location.z, current_speed,
|
||||
5, ENTITY::GET_ENTITY_MODEL(self::veh),
|
||||
current_driving_style, 20, true
|
||||
);
|
||||
|
||||
g->vehicle.auto_drive_to_waypoint = false;
|
||||
|
||||
driving_to_wp = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (driving_to_wp)
|
||||
{
|
||||
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))
|
||||
{
|
||||
VEHICLE::SET_VEHICLE_FORWARD_SPEED(self::veh, 8);
|
||||
}
|
||||
|
||||
g->vehicle.auto_drive_to_waypoint = false;
|
||||
|
||||
if (ran_once)
|
||||
{
|
||||
g_notification_service->push_warning("Warning", "Autodrive Stopped");
|
||||
}
|
||||
|
||||
TASK::CLEAR_VEHICLE_TASKS_(self::veh);
|
||||
TASK::CLEAR_PED_TASKS(self::ped);
|
||||
|
||||
driving_to_wp = false;
|
||||
}
|
||||
|
||||
if (!ran_once)
|
||||
{
|
||||
TASK::CLEAR_VEHICLE_TASKS_(self::veh);
|
||||
TASK::CLEAR_PED_TASKS(self::ped);
|
||||
driving_to_wp = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((current_driving_style != g->vehicle.driving_style_flags) || (current_speed != g->vehicle.auto_drive_speed))
|
||||
{
|
||||
changing_driving_styles = true;
|
||||
g->vehicle.auto_drive_to_waypoint = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,69 +0,0 @@
|
||||
#include "backend/looped/looped.hpp"
|
||||
#include "gta/enums.hpp"
|
||||
#include "natives.hpp"
|
||||
#include "util/blip.hpp"
|
||||
#include "util/entity.hpp"
|
||||
#include "util/vehicle.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
void looped::vehicle_auto_drive_wander()
|
||||
{
|
||||
static Vector3 location;
|
||||
static bool wandering = true;
|
||||
static bool ran_once = false;
|
||||
static int changing_driving_styles = false;
|
||||
static int current_driving_style = false;
|
||||
static float current_speed;
|
||||
|
||||
if (g->vehicle.auto_drive_wander)
|
||||
{
|
||||
ran_once = true;
|
||||
wandering = false;
|
||||
|
||||
if (!self::veh)
|
||||
{
|
||||
g_notification_service->push_warning("Warning", "Please be in a car first then try again.");
|
||||
|
||||
g->vehicle.auto_drive_wander = false;
|
||||
|
||||
TASK::CLEAR_VEHICLE_TASKS_(self::veh);
|
||||
}
|
||||
else
|
||||
{
|
||||
g->vehicle.auto_drive_wander = false;
|
||||
current_speed = g->vehicle.auto_drive_speed;
|
||||
current_driving_style = g->vehicle.driving_style_flags;
|
||||
|
||||
TASK::CLEAR_VEHICLE_TASKS_(self::veh);
|
||||
TASK::CLEAR_PED_TASKS(self::ped);
|
||||
TASK::TASK_VEHICLE_DRIVE_WANDER(self::ped, self::veh, current_speed, current_driving_style);
|
||||
|
||||
wandering = true;
|
||||
|
||||
if (!changing_driving_styles)
|
||||
{
|
||||
g_notification_service->push_warning("Starting Wondering", "Start driving or leave car to take back control.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (wandering && ran_once)
|
||||
{
|
||||
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_PED_TASKS(self::ped);
|
||||
|
||||
g_notification_service->push_warning("Warning", "Wandering Stopped");
|
||||
g->vehicle.auto_drive_wander = false;
|
||||
wandering = false;
|
||||
}
|
||||
if ((current_driving_style != g->vehicle.driving_style_flags) || (current_speed != g->vehicle.auto_drive_speed))
|
||||
{
|
||||
changing_driving_styles = true;
|
||||
g->vehicle.auto_drive_wander = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -175,14 +175,27 @@ namespace big
|
||||
LEAVE_ONLINE = -1
|
||||
};
|
||||
|
||||
enum class SpeedUnit : uint32_t
|
||||
enum class SpeedUnit
|
||||
{
|
||||
KMPH,
|
||||
MIPH,
|
||||
MPS
|
||||
};
|
||||
|
||||
enum class AutoDriveDestination
|
||||
{
|
||||
STOPPED,
|
||||
OBJECTITVE,
|
||||
WAYPOINT,
|
||||
WANDER,
|
||||
EMERGENCY_STOP
|
||||
};
|
||||
|
||||
enum class AutoDriveStyle
|
||||
{
|
||||
LAW_ABIDING,
|
||||
THE_ROAD_IS_YOURS
|
||||
};
|
||||
|
||||
enum class eEntityProofs : uint32_t
|
||||
{
|
||||
|
@ -240,8 +240,8 @@ namespace big
|
||||
bool proof_water = false;
|
||||
uint32_t proof_mask = 0;
|
||||
|
||||
bool auto_drive_to_waypoint = false;
|
||||
bool auto_drive_wander = false;
|
||||
AutoDriveDestination auto_drive_destination = AutoDriveDestination::STOPPED;
|
||||
AutoDriveStyle auto_drive_style = AutoDriveStyle::LAW_ABIDING;
|
||||
bool auto_turn_signals = false;
|
||||
bool drive_on_water = false;
|
||||
bool horn_boost = false;
|
||||
@ -252,8 +252,6 @@ namespace big
|
||||
bool seatbelt = false;
|
||||
bool turn_signals = false;
|
||||
float auto_drive_speed = 1;
|
||||
int driving_style_flags = 443;
|
||||
int driving_style_id = 0;
|
||||
int rainbow_paint = 0;
|
||||
bool rainbow_primary = false;
|
||||
bool rainbow_secondary = false;
|
||||
@ -556,13 +554,10 @@ namespace big
|
||||
this->vehicle.proof_steam = j["vehicle"]["proof_steam"];
|
||||
this->vehicle.proof_water = j["vehicle"]["proof_water"];
|
||||
this->vehicle.proof_mask = j["vehicle"]["proof_mask"];
|
||||
this->vehicle.auto_drive_style = j["vehicle"]["auto_drive_style"];
|
||||
this->vehicle.auto_drive_speed = j["vehicle"]["auto_drive_speed"];
|
||||
this->vehicle.auto_drive_to_waypoint = j["vehicle"]["auto_drive_to_waypoint"];
|
||||
this->vehicle.auto_drive_wander = j["vehicle"]["auto_drive_wander"];
|
||||
this->vehicle.auto_turn_signals = j["vehicle"]["auto_turn_signals"];
|
||||
this->vehicle.drive_on_water = j["vehicle"]["drive_on_water"];
|
||||
this->vehicle.driving_style_id = j["vehicle"]["driving_style_id"];
|
||||
this->vehicle.driving_style_flags = j["vehicle"]["driving_style_flag"];
|
||||
this->vehicle.horn_boost = j["vehicle"]["horn_boost"];
|
||||
this->vehicle.vehicle_jump = j["vehicle"]["vehicle_jump"];
|
||||
this->vehicle.instant_brake = j["vehicle"]["instant_brake"];
|
||||
@ -832,13 +827,10 @@ namespace big
|
||||
{ "proof_steam", this->vehicle.proof_steam },
|
||||
{ "proof_water", this->vehicle.proof_water },
|
||||
{ "proof_mask", this->vehicle.proof_mask },
|
||||
{ "auto_drive_style", this->vehicle.auto_drive_style },
|
||||
{ "auto_drive_speed", this->vehicle.auto_drive_speed },
|
||||
{ "auto_drive_to_waypoint", this->vehicle.auto_drive_to_waypoint },
|
||||
{ "auto_drive_wander", this->vehicle.auto_drive_wander },
|
||||
{ "auto_turn_signals", this->vehicle.auto_turn_signals },
|
||||
{ "drive_on_water", this->vehicle.drive_on_water },
|
||||
{ "driving_style_id", this->vehicle.driving_style_id },
|
||||
{ "driving_style_flag", this->vehicle.driving_style_flags },
|
||||
{ "horn_boost", this->vehicle.horn_boost },
|
||||
{ "vehicle_jump", this->vehicle.vehicle_jump },
|
||||
{ "instant_brake", this->vehicle.instant_brake },
|
||||
|
@ -236,13 +236,13 @@ namespace big
|
||||
static const std::map<Hash, std::map<int, std::vector<int32_t>>> mod_blacklists = {
|
||||
{ VEHICLE_BANSHEE, {
|
||||
{ MOD_SPOILERS, { 3, 4 } },
|
||||
{ MOD_COLUMNSHIFTERLEVERS, { 0, 1, 2 } },
|
||||
{ MOD_COLUMNSHIFTERLEVERS, { 0, 1, 2, 3 } },
|
||||
{ MOD_SPEAKERS, { 0 } },
|
||||
{ MOD_LIVERY, { 15, 16 } }
|
||||
} },
|
||||
{ VEHICLE_SENTINEL, {
|
||||
{ MOD_SPOILERS, { 4, 5 } },
|
||||
{ MOD_COLUMNSHIFTERLEVERS, { 0, 1, 2 } },
|
||||
{ MOD_COLUMNSHIFTERLEVERS, { 0, 1, 2, 3 } },
|
||||
{ MOD_SPEAKERS, { 0 } },
|
||||
{ MOD_LIVERY, { 0, 1 } }
|
||||
} }
|
||||
|
@ -1,17 +1,18 @@
|
||||
#pragma once
|
||||
#include "natives.hpp"
|
||||
#include "script.hpp"
|
||||
#include "gta/enums.hpp"
|
||||
|
||||
namespace big::blip
|
||||
{
|
||||
inline bool get_blip_location(Vector3 &location, int sprite, int color = -1)
|
||||
{
|
||||
Blip blip;
|
||||
for (blip = HUD::GET_FIRST_BLIP_INFO_ID(sprite);
|
||||
HUD::DOES_BLIP_EXIST(blip) &&
|
||||
color != -1 && HUD::GET_BLIP_COLOUR(blip) != color;
|
||||
for (
|
||||
blip = HUD::GET_FIRST_BLIP_INFO_ID(sprite);
|
||||
HUD::DOES_BLIP_EXIST(blip) && color != -1 && HUD::GET_BLIP_COLOUR(blip) != color;
|
||||
blip = HUD::GET_NEXT_BLIP_INFO_ID(sprite)
|
||||
) script::get_current()->yield();
|
||||
);
|
||||
|
||||
if (!HUD::DOES_BLIP_EXIST(blip) || (color != -1 && HUD::GET_BLIP_COLOUR(blip) != color)) return false;
|
||||
|
||||
@ -19,4 +20,23 @@ namespace big::blip
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
inline bool get_objective_location(Vector3& location)
|
||||
{
|
||||
if (get_blip_location(location, (int)BlipIcons::Circle, (int)BlipColors::YellowMission)) return true;
|
||||
if (get_blip_location(location, (int)BlipIcons::Circle, (int)BlipColors::YellowMission2)) return true;
|
||||
if (get_blip_location(location, (int)BlipIcons::Circle, (int)BlipColors::Mission)) return true;
|
||||
if (get_blip_location(location, (int)BlipIcons::RaceFinish, (int)BlipColors::None)) return true;
|
||||
if (get_blip_location(location, (int)BlipIcons::Circle, (int)BlipColors::Green)) return true;
|
||||
if (get_blip_location(location, (int)BlipIcons::Circle, (int)BlipColors::Blue)) return true;
|
||||
if (get_blip_location(location, (int)BlipIcons::CrateDrop)) return true;
|
||||
|
||||
static const int blips[] = { 1, 57, 128, 129, 130, 143, 144, 145, 146, 271, 286, 287, 288 };
|
||||
for (const auto& blip : blips)
|
||||
{
|
||||
if (get_blip_location(location, blip, 5)) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
@ -147,22 +147,16 @@ namespace big::teleport
|
||||
|
||||
inline bool to_objective()
|
||||
{
|
||||
if (to_blip((int)BlipIcons::Circle, (int)BlipColors::YellowMission)) return true;
|
||||
if (to_blip((int)BlipIcons::Circle, (int)BlipColors::YellowMission2)) return true;
|
||||
if (to_blip((int)BlipIcons::Circle, (int)BlipColors::Mission)) return true;
|
||||
if (to_blip((int)BlipIcons::RaceFinish, (int)BlipColors::None)) return true;
|
||||
if (to_blip((int)BlipIcons::Circle, (int)BlipColors::Green)) return true;
|
||||
if (to_blip((int)BlipIcons::Circle, (int)BlipColors::Blue)) return true;
|
||||
if (to_blip((int)BlipIcons::CrateDrop)) return true;
|
||||
static const int blips[] = { 1, 57, 128, 129, 130, 143, 144, 145, 146, 271, 286, 287, 288 };
|
||||
for (const auto& blip : blips)
|
||||
Vector3 location;
|
||||
|
||||
if (!blip::get_objective_location(location))
|
||||
{
|
||||
if (to_blip(blip, 5))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
g_notification_service->push_warning("Teleport", "Failed to find objective position");
|
||||
return false;
|
||||
}
|
||||
g_notification_service->push_warning("Teleport", "Failed to find objective position");
|
||||
|
||||
PED::SET_PED_COORDS_KEEP_VEHICLE(self::ped, location.x, location.y, location.z);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -658,11 +658,4 @@ namespace big::vehicle
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static constexpr char const* rgb_types[] = { "Off", "Fade", "Spasm" };
|
||||
|
||||
static constexpr int driving_styles[] = { 443, 524861 };
|
||||
static constexpr char const* driving_style_names[] = { "Law-Abiding", "The Road Is Yours" };
|
||||
}
|
||||
|
@ -84,22 +84,6 @@ namespace big
|
||||
|
||||
components::small_text("Auto Drive");
|
||||
|
||||
components::button("Drive To Waypoint", [] {
|
||||
g->vehicle.auto_drive_to_waypoint = true;
|
||||
});
|
||||
ImGui::SameLine();
|
||||
components::button("Wander", [] {
|
||||
g->vehicle.auto_drive_wander = true;
|
||||
});
|
||||
ImGui::SameLine();
|
||||
components::button("Emergency Stop", [] {
|
||||
g->vehicle.auto_drive_to_waypoint = false;
|
||||
g->vehicle.auto_drive_wander = false;
|
||||
VEHICLE::SET_VEHICLE_FORWARD_SPEED(self::veh, 0);
|
||||
TASK::CLEAR_VEHICLE_TASKS_(self::veh);
|
||||
TASK::CLEAR_PED_TASKS(self::ped);
|
||||
});
|
||||
|
||||
float auto_drive_speed_user_unit = vehicle::mps_to_speed(g->vehicle.auto_drive_speed, g->vehicle.speed_unit);
|
||||
if (ImGui::SliderFloat(
|
||||
fmt::format("Top Speed({})", speed_unit_strings[(int)g->vehicle.speed_unit]).c_str(),
|
||||
@ -111,18 +95,18 @@ namespace big
|
||||
g->vehicle.auto_drive_speed = vehicle::speed_to_mps(auto_drive_speed_user_unit, g->vehicle.speed_unit);
|
||||
}
|
||||
|
||||
if (ImGui::BeginCombo("Driving Style", vehicle::driving_style_names[g->vehicle.driving_style_id]))
|
||||
static constexpr char const* driving_style_names[] = { "Law-Abiding", "The Road Is Yours" };
|
||||
if (ImGui::BeginCombo("Driving Style", driving_style_names[(int)g->vehicle.auto_drive_style]))
|
||||
{
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
if (ImGui::Selectable(vehicle::driving_style_names[i], g->vehicle.driving_style_id == i))
|
||||
if (ImGui::Selectable(driving_style_names[i], g->vehicle.auto_drive_style == (AutoDriveStyle)i))
|
||||
{
|
||||
g->vehicle.driving_style_id = i;
|
||||
g->vehicle.driving_style_flags = vehicle::driving_styles[g->vehicle.driving_style_id];
|
||||
g_notification_service->push_warning("Auto Drive", fmt::format("Driving style set to {}.", vehicle::driving_style_names[i]));
|
||||
g->vehicle.auto_drive_style = (AutoDriveStyle)i;
|
||||
g_notification_service->push_warning("Auto Drive", fmt::format("Driving style set to {}.", driving_style_names[i]));
|
||||
}
|
||||
|
||||
if (g->vehicle.driving_style_id == i)
|
||||
if (g->vehicle.auto_drive_style == (AutoDriveStyle)i)
|
||||
{
|
||||
ImGui::SetItemDefaultFocus();
|
||||
}
|
||||
@ -131,6 +115,22 @@ namespace big
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
|
||||
if (components::button("To Objective")) {
|
||||
g->vehicle.auto_drive_destination = AutoDriveDestination::OBJECTITVE;
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (components::button("To Waypoint")) {
|
||||
g->vehicle.auto_drive_destination = AutoDriveDestination::WAYPOINT;
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (components::button("Wander")) {
|
||||
g->vehicle.auto_drive_destination = AutoDriveDestination::WANDER;
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (components::button("Emergency Stop")) {
|
||||
g->vehicle.auto_drive_destination = AutoDriveDestination::EMERGENCY_STOP;
|
||||
}
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
components::small_text("Rainbow Paint");
|
||||
@ -145,13 +145,15 @@ namespace big
|
||||
|
||||
if (g->vehicle.rainbow_primary || g->vehicle.rainbow_neon || g->vehicle.rainbow_secondary || g->vehicle.rainbow_smoke) {
|
||||
ImGui::SetNextItemWidth(120);
|
||||
if (ImGui::BeginCombo("RGB Type", vehicle::rgb_types[g->vehicle.rainbow_paint]))
|
||||
|
||||
static constexpr char const* rgb_types[] = { "Off", "Fade", "Spasm" };
|
||||
if (ImGui::BeginCombo("RGB Type", rgb_types[g->vehicle.rainbow_paint]))
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
bool itemSelected = g->vehicle.rainbow_paint == i;
|
||||
|
||||
if (ImGui::Selectable(vehicle::rgb_types[i], itemSelected))
|
||||
if (ImGui::Selectable(rgb_types[i], itemSelected))
|
||||
{
|
||||
g->vehicle.rainbow_paint = i;
|
||||
}
|
||||
|
Reference in New Issue
Block a user