feat(players): Vehicle Tree (#903)

* feat(player_info): Open Social Club Overlay
This commit is contained in:
JDMJay 2023-03-04 11:23:45 +00:00 committed by GitHub
parent 3e88ce77d2
commit a44c74b869
19 changed files with 516 additions and 3 deletions

View File

@ -0,0 +1,36 @@
#include "backend/player_command.hpp"
#include "natives.hpp"
#include "pointers.hpp"
#include "util/teleport.hpp"
namespace big
{
class boost_vehicle : player_command
{
using player_command::player_command;
virtual void execute(player_ptr player, const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx)
{
Ped ped = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id());
if (!PED::IS_PED_IN_ANY_VEHICLE(ped, true))
{
g_notification_service->push_warning("Toxic", "Target player is not in a vehicle.");
}
else
{
Vehicle vehicle = PED::GET_VEHICLE_PED_IS_USING(ped);
if (entity::take_control_of(vehicle))
{
VEHICLE::SET_VEHICLE_FORWARD_SPEED(vehicle, 79);
}
else
{
g_notification_service->push_warning("Toxic", "Failed to take control of player vehicle.");
}
}
}
};
boost_vehicle g_boost_vehicle("boostveh", "Boost Vehicle", "Boosts their car very fast.", 0);
}

View File

@ -0,0 +1,39 @@
#include "backend/player_command.hpp"
#include "natives.hpp"
#include "pointers.hpp"
#include "util/teleport.hpp"
namespace big
{
class burst_tyres : player_command
{
using player_command::player_command;
virtual void execute(player_ptr player, const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx)
{
Ped ped = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id());
if (!PED::IS_PED_IN_ANY_VEHICLE(ped, true))
{
g_notification_service->push_warning("Toxic", "Target player is not in a vehicle.");
}
else
{
Vehicle vehicle = PED::GET_VEHICLE_PED_IS_USING(ped);
if (entity::take_control_of(vehicle))
{
Vehicle vehicle = PED::GET_VEHICLE_PED_IS_USING(ped);
entity::take_control_of(vehicle);
VEHICLE::SET_VEHICLE_TYRES_CAN_BURST(vehicle, true);
static int tireID = 0;
for (tireID = 0; tireID < 8; tireID++)
{
VEHICLE::SET_VEHICLE_TYRE_BURST(vehicle, tireID, true, 1000.0);
}
}
}
}
};
burst_tyres g_burst_tyres("burstwheels", "Burst Vehicle Tyres", "Removes their tyres.", 0);
}

View File

@ -0,0 +1,35 @@
#include "backend/player_command.hpp"
#include "natives.hpp"
#include "pointers.hpp"
#include "util/teleport.hpp"
namespace big
{
class close_doors : player_command
{
using player_command::player_command;
virtual void execute(player_ptr player, const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx)
{
Ped ped = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id());
if (!PED::IS_PED_IN_ANY_VEHICLE(ped, true))
{
g_notification_service->push_warning("Toxic", "Target player is not in a vehicle.");
}
else
{
Vehicle vehicle = PED::GET_VEHICLE_PED_IS_USING(ped);
if (entity::take_control_of(vehicle))
{
VEHICLE::SET_VEHICLE_DOORS_SHUT(vehicle, false);
}
else
{
g_notification_service->push_warning("Toxic", "Failed to take control of vehicle.");
}
}
}
};
close_doors g_close_doors("closedoors", "Close Vehicle Doors", "Closes all vehicle doors", 0);
}

View File

@ -0,0 +1,36 @@
#include "backend/player_command.hpp"
#include "natives.hpp"
#include "pointers.hpp"
#include "util/teleport.hpp"
namespace big
{
class downgrade_vehicle : player_command
{
using player_command::player_command;
virtual void execute(player_ptr player, const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx)
{
Ped ped = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id());
Vehicle vehicle = PED::GET_VEHICLE_PED_IS_IN(ped, false);
if (!PED::IS_PED_IN_ANY_VEHICLE(vehicle, true))
{
g_notification_service->push_warning("Toxic", "Target player is not in a vehicle.");
}
else
{
Vehicle vehicle = PED::GET_VEHICLE_PED_IS_USING(ped);
if (entity::take_control_of(vehicle))
{
VEHICLE::SET_VEHICLE_MOD_KIT(vehicle, 0);
for (int i = 0; i < 50; i++)
{
VEHICLE::REMOVE_VEHICLE_MOD(vehicle, i);
}
}
}
}
};
downgrade_vehicle g_downgrade_vehicle("downgradeveh", "Downgrade Vehicle", "Removes all upgrades", 0);
}

View File

@ -0,0 +1,44 @@
#include "backend/player_command.hpp"
#include "natives.hpp"
#include "pointers.hpp"
#include "util/teleport.hpp"
namespace big
{
class flip_180 : player_command
{
using player_command::player_command;
virtual void execute(player_ptr player, const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx)
{
Entity ent = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id());
float Heading = ENTITY::GET_ENTITY_HEADING(ent);
Vector3 flipCar180Coords = ENTITY::GET_ENTITY_COORDS(ent, 1);
if (!PED::IS_PED_IN_ANY_VEHICLE(ent, true))
{
g_notification_service->push_warning("Toxic", "Target player is not in any vehicle.");
}
else
{
if (entity::take_control_of(ent))
{
if (Heading > 180.0)
{
Heading -= 180.0;
}
else
{
Heading += 180.0;
ENTITY::SET_ENTITY_COORDS(ent, flipCar180Coords.x, flipCar180Coords.y, flipCar180Coords.z, 0, 0, 0, 1);
ENTITY::SET_ENTITY_HEADING(ent, Heading);
VEHICLE::SET_VEHICLE_FORWARD_SPEED(ent, ENTITY::GET_ENTITY_SPEED(ent));
}
}
}
}
};
flip_180
g_flip_180("flip180", "Rotate 180", "Rotates their car around", 0)
;
}

View File

@ -0,0 +1,32 @@
#include "backend/player_command.hpp"
#include "natives.hpp"
#include "pointers.hpp"
#include "util/teleport.hpp"
namespace big
{
class flying_vehicle : player_command
{
using player_command::player_command;
virtual void execute(player_ptr player, const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx)
{
Entity ent = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id());
if (!PED::IS_PED_IN_ANY_VEHICLE(ent, true))
{
g_notification_service->push_warning("Toxic", "Target player is not in any vehicle.");
}
else
{
ent = PED::GET_VEHICLE_PED_IS_IN(ent, false);
if (entity::take_control_of(ent))
{
ENTITY::APPLY_FORCE_TO_ENTITY(ent, 1, 0.f, 0.f, 50000.f, 0.f, 0.f, 0.f, 0, 0, 1, 1, 0, 1);
}
}
}
};
flying_vehicle g_flying_vehicle("flyingveh", "Flying Vehicle", "Catapults their car to the sky.", 0);
}

View File

@ -0,0 +1,35 @@
#include "backend/player_command.hpp"
#include "natives.hpp"
#include "pointers.hpp"
#include "util/teleport.hpp"
namespace big
{
class kill_engine : player_command
{
using player_command::player_command;
virtual void execute(player_ptr player, const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx)
{
Ped ped = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id());
if (!PED::IS_PED_IN_ANY_VEHICLE(ped, true))
{
g_notification_service->push_warning("Toxic", "Target player is not in a vehicle.");
}
else
{
Vehicle vehicle = PED::GET_VEHICLE_PED_IS_USING(ped);
if (entity::take_control_of(vehicle))
{
VEHICLE::SET_VEHICLE_ENGINE_HEALTH(vehicle, -4000);
}
else
{
g_notification_service->push_warning("Toxic", "Failed to take control of player vehicle.");
}
}
}
};
kill_engine g_kill_engine("killengine", "Kill Vehicle Engine", "Breaks their engine", 0);
}

View File

@ -0,0 +1,32 @@
#include "backend/player_command.hpp"
#include "natives.hpp"
#include "pointers.hpp"
#include "util/teleport.hpp"
namespace big
{
class lock_vehicle : player_command
{
using player_command::player_command;
virtual void execute(player_ptr player, const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx)
{
int lockStatus = VEHICLE::GET_VEHICLE_DOOR_LOCK_STATUS(player->id());
Entity ent = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id());
if (!PED::IS_PED_IN_ANY_VEHICLE(ent, true))
{
g_notification_service->push_warning("Toxic", "Target player is not in a vehicle.");
}
else
{
if (entity::take_control_of(ent))
{
entity::take_control_of(PED::GET_VEHICLE_PED_IS_USING(player->id()));
VEHICLE::SET_VEHICLE_DOORS_LOCKED(PED::GET_VEHICLE_PED_IS_USING(player->id()), 4);
}
}
}
};
lock_vehicle g_lock_vehicle("lockveh", "Lock Vehicle", "Locks vehicle doors", 0);
}

View File

@ -0,0 +1,39 @@
#include "backend/player_command.hpp"
#include "natives.hpp"
#include "pointers.hpp"
#include "util/teleport.hpp"
namespace big
{
class open_doors : player_command
{
using player_command::player_command;
virtual void execute(player_ptr player, const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx)
{
Ped ped = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id());
if (!PED::IS_PED_IN_ANY_VEHICLE(ped, true))
{
g_notification_service->push_warning("Toxic", "Target player is not in a vehicle.");
}
else
{
Vehicle vehicle = PED::GET_VEHICLE_PED_IS_USING(ped);
if (entity::take_control_of(vehicle))
{
for (int i = 0; i < 7; i++)
{
VEHICLE::SET_VEHICLE_DOOR_OPEN(vehicle, i, true, false);
}
}
else
{
g_notification_service->push_warning("Toxic", "Failed to take control of vehicle");
}
}
}
};
open_doors g_open_doors("opendoors", "Opens Vehicle Doors", "Opens all vehicle doors", 0);
}

View File

@ -0,0 +1,29 @@
#include "backend/player_command.hpp"
#include "natives.hpp"
#include "pointers.hpp"
#include "util/teleport.hpp"
namespace big
{
class smash_windows : player_command
{
using player_command::player_command;
virtual void execute(player_ptr player, const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx)
{
Ped ped = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id());
if (PED::IS_PED_IN_ANY_VEHICLE(ped, false))
{
entity::take_control_of(PED::GET_VEHICLE_PED_IS_USING(ped));
Vehicle UserVeh = PED::GET_VEHICLE_PED_IS_IN(ped, false);
static int windowID = 0;
for (windowID = 0; windowID < 10; windowID++)
{
VEHICLE::SMASH_VEHICLE_WINDOW(UserVeh, windowID);
}
}
}
};
smash_windows g_smash_windows("smashwindows", "Smash Vehicle Windows", "Smashes all their windows", 0);
}

View File

@ -0,0 +1,34 @@
#include "backend/player_command.hpp"
#include "natives.hpp"
#include "pointers.hpp"
#include "util/teleport.hpp"
namespace big
{
class stop_vehicle : player_command
{
using player_command::player_command;
virtual void execute(player_ptr player, const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx)
{
Ped ped = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id());
if (!PED::IS_PED_IN_ANY_VEHICLE(ped, true))
{
g_notification_service->push_warning("Toxic", "Target player is not in a vehicle.");
}
else
{
Vehicle vehicle = PED::GET_VEHICLE_PED_IS_USING(ped);
if (entity::take_control_of(vehicle))
{
VEHICLE::SET_VEHICLE_FORWARD_SPEED(vehicle, 0);
}
else
{
g_notification_service->push_warning("Toxic", "Failed to take control of player vehicle.");
}
}
}
};
stop_vehicle g_stop_vehicle("stopveh", "Stop Vehicle", "Stops players vehicle", 0);
}

View File

@ -18,5 +18,5 @@ namespace big
}
};
teleport_into_vehicle g_teleport_into_vehicle("playervehtp", "Teleport Into Vehicle", "Take control of the player's vehicle. Spectate the player beforehand for best results", 0, false);
teleport_into_vehicle g_teleport_into_vehicle("playervehtp", "Teleport Into Vehicle", "Teleports into the players vehicle. Spectate the player beforehand for best results", 0, false);
}

View File

@ -0,0 +1,22 @@
#include "backend/player_command.hpp"
#include "natives.hpp"
#include "pointers.hpp"
#include "util/teleport.hpp"
namespace big
{
class unlock_vehicle : player_command
{
using player_command::player_command;
virtual void execute(player_ptr player, const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx)
{
if (PED::IS_PED_IN_ANY_VEHICLE((player->id()), false))
{
entity::take_control_of(PED::GET_VEHICLE_PED_IS_USING(player->id()));
VEHICLE::SET_VEHICLE_DOORS_LOCKED(PED::GET_VEHICLE_PED_IS_USING(player->id()), 0);
}
}
};
unlock_vehicle g_unlock_vehicle("unlockveh", "Unlock Vehicle Doors", "Unlocks Vehicle Doors", 0);
}

View File

@ -0,0 +1,21 @@
#include "backend/player_command.hpp"
#include "natives.hpp"
#include "pointers.hpp"
#include "util/teleport.hpp"
#include "util/vehicle.hpp"
namespace big
{
class upgrade_vehicle : player_command
{
using player_command::player_command;
virtual void execute(player_ptr player, const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx)
{
Vehicle vehicle = PED::GET_VEHICLE_PED_IS_IN(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id()), false);
vehicle::max_vehicle(vehicle);
}
};
upgrade_vehicle g_upgrade_vehicle("upgradeveh", "Upgrade Vehicle", "Upgrades players vehicle", 0);
}

View File

@ -0,0 +1,27 @@
#include "backend/player_command.hpp"
#include "natives.hpp"
#include "pointers.hpp"
#include "util/teleport.hpp"
#include "util/vehicle.hpp"
namespace big
{
class black_tint : player_command
{
using player_command::player_command;
virtual void execute(player_ptr player, const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx)
{
Ped ped = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id());
if (PED::IS_PED_IN_ANY_VEHICLE(ped, false))
{
entity::take_control_of(PED::GET_VEHICLE_PED_IS_USING(ped));
Vehicle UserVeh = PED::GET_VEHICLE_PED_IS_IN(ped, false);
VEHICLE::SET_VEHICLE_WINDOW_TINT(UserVeh, WINDOWTINT_BLACK);
}
}
};
black_tint g_black_tint("blacktint", "Black Window Tint", "Makes their windows black.", 0);
}

View File

@ -3,6 +3,7 @@
#include "core/scr_globals.hpp"
#include "services/player_database/player_database_service.hpp"
#include "views/view.hpp"
#include "natives.hpp"
#include <script/globals/GPBD_FM.hpp>
#include <script/globals/GPBD_FM_3.hpp>
@ -14,6 +15,11 @@ namespace big
{
if (ImGui::TreeNode("INFO"_T.data()))
{
components::button("Open SC Overlay", [] {
int gamerHandle;
NETWORK::NETWORK_HANDLE_FROM_PLAYER(g_player_service->get_selected()->id(), &gamerHandle, 13);
NETWORK::NETWORK_SHOW_PROFILE_UI(&gamerHandle);
});
ImGui::Text("PLAYER_INFO_ID"_T.data(), g_player_service->get_selected()->id());
ImGui::Text("PLAYER_INFO_SESSION_HOST"_T.data(),
@ -150,7 +156,7 @@ namespace big
ImGui::Text("PLAYER_INFO_BANK"_T.data(), stats.Money - stats.WalletBalance);
ImGui::Text("PLAYER_INFO_TOTAL_MONEY"_T.data(), stats.Money);
ImGui::Text("PLAYER_INFO_RANK"_T.data(), stats.Rank, stats.RP);
ImGui::Text("Health: %d (MaxHealth: %d)", ped_health, ped_maxhealth);// TODO: translate
ImGui::Text("Health: %d (MaxHealth: %d)", ped_health, ped_maxhealth); // TODO: translate
ImGui::Text("PLAYER_INFO_KD"_T.data(), stats.KdRatio);
ImGui::Text("PLAYER_INFO_KILLS"_T.data(), stats.KillsOnPlayers);
ImGui::Text("PLAYER_INFO_DEATHS"_T.data(), stats.DeathsByPlayers);
@ -158,7 +164,7 @@ namespace big
ImGui::Text("PLAYER_INFO_LAP_DANCES"_T.data(), stats.LapDancesBought);
ImGui::Text("PLAYER_INFO_MISSIONS_CREATED"_T.data(), stats.MissionsCreated);
ImGui::Text("PLAYER_INFO_METLDOWN_COMPLETE"_T.data(),
scr_globals::gpbd_fm_1.as<GPBD_FM*>()->Entries[id].MeltdownComplete ? "YES"_T.data() : "NO"_T.data());// curious to see if anyone has actually played singleplayer
scr_globals::gpbd_fm_1.as<GPBD_FM*>()->Entries[id].MeltdownComplete ? "YES"_T.data() : "NO"_T.data()); // curious to see if anyone has actually played singleplayer
ImGui::Separator();

View File

@ -0,0 +1,44 @@
#include "views/view.hpp"
namespace big
{
void view::player_vehicle()
{
if (ImGui::TreeNode("Vehicle"))
{
components::player_command_button<"vehkick">(g_player_service->get_selected(), {});
ImGui::SameLine();
components::player_command_button<"flyingveh">(g_player_service->get_selected(), {});
components::player_command_button<"boostveh">(g_player_service->get_selected(), {});
ImGui::SameLine();
components::player_command_button<"stopveh">(g_player_service->get_selected(), {});
components::player_command_button<"flip180">(g_player_service->get_selected(), {});
ImGui::SameLine();
components::player_command_button<"rcplayer">(g_player_service->get_selected(), {});
components::player_command_button<"killengine">(g_player_service->get_selected(), {});
ImGui::SameLine();
components::player_command_button<"burstwheels">(g_player_service->get_selected(), {});
components::player_command_button<"smashwindows">(g_player_service->get_selected(), {});
ImGui::SameLine();
components::player_command_button<"blacktint">(g_player_service->get_selected(), {});
components::player_command_button<"lockveh">(g_player_service->get_selected(), {});
ImGui::SameLine();
components::player_command_button<"unlockveh">(g_player_service->get_selected(), {});
components::player_command_button<"opendoors">(g_player_service->get_selected(), {});
ImGui::SameLine();
components::player_command_button<"closedoors">(g_player_service->get_selected(), {});
components::player_command_button<"upgradeveh">(g_player_service->get_selected(), {});
ImGui::SameLine();
components::player_command_button<"downgradeveh">(g_player_service->get_selected(), {});
ImGui::TreePop();
}
}
}

View File

@ -14,6 +14,7 @@ namespace big
view::player_kick();
view::player_toxic();
view::player_misc();
view::player_vehicle();
}
}
}

View File

@ -63,5 +63,6 @@ namespace big
static void player_kick();
static void player_toxic();
static void player_misc();
static void player_vehicle();
};
}