Toxic features and improve protections (#897)

This commit is contained in:
maybegreat48
2023-01-22 21:57:32 +00:00
committed by GitHub
parent ee99333f7e
commit 8173adb87f
58 changed files with 7912 additions and 6674 deletions

View File

@ -9,7 +9,7 @@ namespace big
if (ImGui::BeginTabItem("Logs"))
{
ImGui::Checkbox("Log Metrics", &g.debug.logs.metric_logs);
ImGui::Checkbox("Log Packets", &g.debug.logs.packet_logs);
ImGui::Checkbox("Native Script Hooks", &g.debug.logs.script_hook_logs);
if (ImGui::TreeNode("Script Event Logging"))

View File

@ -0,0 +1,208 @@
#include "views/view.hpp"
#include "fiber_pool.hpp"
#include "gta_util.hpp"
#include "core/scr_globals.hpp"
#include "script_local.hpp"
#include "util/scripts.hpp"
namespace big
{
static bool mission_found = false;
inline rage::scrThread* check_script(rage::joaat_t hash)
{
if (auto thread = gta_util::find_script_thread(hash))
{
mission_found = true;
return thread;
}
return nullptr;
}
void view::missions()
{
mission_found = false;
components::sub_title("Event Starter");
ImGui::BeginGroup();
components::button("Hot Target", [] { scripts::start_launcher_script(36); });
components::button("Kill List", [] { scripts::start_launcher_script(37); });
components::button("Checkpoints", [] { scripts::start_launcher_script(39); });
components::button("Challenges", [] { scripts::start_launcher_script(40); });
components::button("Penned In", [] { scripts::start_launcher_script(41); });
ImGui::EndGroup();
ImGui::SameLine();
ImGui::BeginGroup();
components::button("Hot Property", [] { scripts::start_launcher_script(43); });
components::button("King Of The Castle", [] { scripts::start_launcher_script(45); });
components::button("Criminal Damage", [] { scripts::start_launcher_script(46); });
components::button("Hunt The Beast", [] { scripts::start_launcher_script(47); });
components::button("Business Battles", [] { scripts::start_launcher_script(114); });
ImGui::EndGroup();
ImGui::SameLine();
ImGui::BeginGroup();
components::button("One-On-One Deathmatch", [] { scripts::start_launcher_script(197); });
components::button("Impromptu Race", [] { scripts::start_launcher_script(16); });
components::button("Flight School", [] { scripts::start_launcher_script(196); });
components::button("Golf", [] { scripts::start_launcher_script(193); });
components::button("Tutorial", [] { scripts::start_launcher_script(20); });
if (ImGui::IsItemHovered())
ImGui::SetTooltip("Only works on joining players");
ImGui::EndGroup();
ImGui::SameLine();
ImGui::BeginGroup();
components::button("Gunslinger", [] { scripts::start_launcher_script(211); });
components::button("Space Monkey", [] { scripts::start_launcher_script(216); });
components::button("Wizard", [] { scripts::start_launcher_script(212); });
components::button("QUB3D", [] { scripts::start_launcher_script(217); });
components::button("Camhedz", [] { scripts::start_launcher_script(218); });
ImGui::EndGroup();
ImGui::Separator();
if (check_script(RAGE_JOAAT("am_criminal_damage")))
{
components::sub_title("Criminal Damage");
components::button("Start Event##criminal_damage", [] {
if (scripts::force_host(RAGE_JOAAT("am_criminal_damage")))
if (auto script = gta_util::find_script_thread(RAGE_JOAAT("am_criminal_damage")))
*script_local(script->m_stack, scr_locals::am_criminal_damage::broadcast_idx).at(43).as<int*>() = 0;
});
ImGui::SameLine();
components::button("Finish Event##criminal_damage", []
{
if (scripts::force_host(RAGE_JOAAT("am_criminal_damage")))
if (auto script = gta_util::find_script_thread(RAGE_JOAAT("am_criminal_damage")))
*script_local(script->m_stack, scr_locals::am_criminal_damage::broadcast_idx).at(39).as<int*>() = 0;
});
components::button("Max Score", []
{
if (auto criminal_damage = gta_util::find_script_thread(RAGE_JOAAT("am_criminal_damage")))
*script_local(criminal_damage->m_stack, scr_locals::am_criminal_damage::score_idx).as<int*>() = 999'999'999;
});
}
if (check_script(RAGE_JOAAT("am_cp_collection")))
{
components::sub_title("Checkpoints");
components::button("Start Event##cp_collection", []
{
if (scripts::force_host(RAGE_JOAAT("am_cp_collection")))
if (auto script = gta_util::find_script_thread(RAGE_JOAAT("am_cp_collection")))
*script_local(script->m_stack, scr_locals::am_cp_collection::broadcast_idx).at(667).as<int*>() = 0;
});
ImGui::SameLine();
components::button("Finish Event##cp_collection", []
{
if (scripts::force_host(RAGE_JOAAT("am_cp_collection")))
if (auto script = gta_util::find_script_thread(RAGE_JOAAT("am_cp_collection")))
*script_local(script->m_stack, scr_locals::am_cp_collection::broadcast_idx).at(661).as<int*>() = 0;
});
components::button("Win Event", []
{
if (auto checkpoints = gta_util::find_script_thread(RAGE_JOAAT("am_cp_collection")))
*script_local(checkpoints->m_stack, scr_locals::am_cp_collection::player_broadcast_idx).at(checkpoints->m_net_component->m_local_participant_index, 5).at(4).as<int*>() = 999'999'999;
script::get_current()->yield(1s);
if (scripts::force_host(RAGE_JOAAT("am_cp_collection")))
{
if (auto checkpoints = gta_util::find_script_thread(RAGE_JOAAT("am_cp_collection")))
{
*script_local(checkpoints->m_stack, scr_locals::am_cp_collection::broadcast_idx).at(708).as<int*>() = 0;
}
}
});
ImGui::SameLine();
components::button("Scramble Checkpoints", []
{
std::vector<Vector3> active_player_positions;
for (auto& plyr : g_player_service->players())
{
if (plyr.second->is_valid() && NETWORK::NETWORK_IS_PLAYER_A_PARTICIPANT_ON_SCRIPT(plyr.second->id(), "am_cp_collection", -1))
{
active_player_positions.push_back(ENTITY::GET_ENTITY_COORDS(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(plyr.second->id()), false));
}
}
if (scripts::force_host(RAGE_JOAAT("am_cp_collection")))
{
if (auto checkpoints = gta_util::find_script_thread(RAGE_JOAAT("am_cp_collection")))
{
for (int i = 0; i < 100; i++)
{
*script_local(checkpoints->m_stack, scr_locals::am_cp_collection::broadcast_idx).at(10).at(i, 5).as<Vector3*>() = active_player_positions[i % active_player_positions.size()];
}
}
}
});
}
if (check_script(RAGE_JOAAT("am_king_of_the_castle")))
{
components::sub_title("King Of The Castle");
components::button("Complete Event##kotc", []
{
if (scripts::force_host(RAGE_JOAAT("am_king_of_the_castle")))
if (auto script = gta_util::find_script_thread(RAGE_JOAAT("am_king_of_the_castle")))
*script_local(script->m_stack, scr_locals::am_king_of_the_castle::broadcast_idx).at(1).at(1).as<int*>() = 0;
});
ImGui::SameLine();
components::button("Expire Event (if possible)##kotc", []
{
if (scripts::force_host(RAGE_JOAAT("am_king_of_the_castle")))
if (auto script = gta_util::find_script_thread(RAGE_JOAAT("am_king_of_the_castle")))
*script_local(script->m_stack, scr_locals::am_king_of_the_castle::broadcast_idx).at(1).at(3).as<int*>() = 0;
});
components::button("Become The King##kotc", []
{
if (scripts::force_host(RAGE_JOAAT("am_king_of_the_castle")))
{
if (auto kotc = gta_util::find_script_thread(RAGE_JOAAT("am_king_of_the_castle")))
{
*script_local(kotc->m_stack, scr_locals::am_king_of_the_castle::broadcast_idx).at(6).at(0, 204).at(74).at(0, 4).as<int*>() = 0;
*script_local(kotc->m_stack, scr_locals::am_king_of_the_castle::broadcast_idx).at(6).at(0, 204).at(74).at(0, 4).at(1).as<int*>() = self::id;
*script_local(kotc->m_stack, scr_locals::am_king_of_the_castle::broadcast_idx).at(6).at(0, 204).at(74).at(0, 4).at(2).as<int*>() = self::id;
*script_local(kotc->m_stack, scr_locals::am_king_of_the_castle::broadcast_idx).at(6).at(0, 204).at(74).at(0, 4).at(3).as<float*>() = 999999999.0f;
}
}
});
ImGui::SameLine();
components::button("Dethrone Everyone##kotc", []
{
if (scripts::force_host(RAGE_JOAAT("am_king_of_the_castle")))
{
if (auto kotc = gta_util::find_script_thread(RAGE_JOAAT("am_king_of_the_castle")))
{
for (int i = 0; i < *script_local(kotc->m_stack, scr_locals::am_king_of_the_castle::broadcast_idx).at(6).at(0, 204).at(74).as<int*>(); i++)
{
*script_local(kotc->m_stack, scr_locals::am_king_of_the_castle::broadcast_idx).at(6).at(0, 204).at(74).at(i, 4).as<int*>() = -1;
*script_local(kotc->m_stack, scr_locals::am_king_of_the_castle::broadcast_idx).at(6).at(0, 204).at(74).at(i, 4).at(1).as<int*>() = -1;
*script_local(kotc->m_stack, scr_locals::am_king_of_the_castle::broadcast_idx).at(6).at(0, 204).at(74).at(i, 4).at(2).as<int*>() = -1;
*script_local(kotc->m_stack, scr_locals::am_king_of_the_castle::broadcast_idx).at(6).at(0, 204).at(74).at(i, 4).at(3).as<float*>() = -1.0f;
}
}
}
});
}
if (!mission_found)
{
ImGui::Text("No active mission");
}
}
}

View File

@ -160,6 +160,10 @@ namespace big
scripts::force_host(RAGE_JOAAT("freemode"));
if (auto script = gta_util::find_script_thread(RAGE_JOAAT("freemode")); script && script->m_net_component)
script->m_net_component->block_host_migration(true);
scripts::force_host(RAGE_JOAAT("fmmc_launcher"));
if (auto script = gta_util::find_script_thread(RAGE_JOAAT("fmmc_launcher")); script && script->m_net_component)
script->m_net_component->block_host_migration(true);
});
}
@ -219,7 +223,6 @@ namespace big
ImGui::SameLine();
components::command_button<"beastall">({ });
if (ImGui::IsItemHovered())
ImGui::SetTooltip("Including you");
@ -233,8 +236,23 @@ namespace big
components::command_button<"vehkickall">({ });
components::command_button<"ragdollall">({ }, "Ragdoll Players");
ImGui::SameLine();
components::command_button<"intkickall">({ }, "Kick Everyone From Interiors");
components::command_button<"missionall">({ });
ImGui::SameLine();
components::command_button<"errorall">({ });
components::command_button<"ceoraidall">({ });
ImGui::SameLine();
components::button("Trigger MC Raid", [] { g_player_service->iterate([](auto& plyr) { toxic::start_activity(plyr.second, eActivityType::BikerDefend); }); });
ImGui::SameLine();
components::button("Trigger Bunker Raid", [] { g_player_service->iterate([](auto& plyr) { toxic::start_activity(plyr.second, eActivityType::GunrunningDefend); }); });
components::command_button<"sextall">({ }, "Send Sexts");
ImGui::SameLine();
components::command_button<"fakebanall">({ }, "Send Fake Ban Messages");
components::small_text("Teleports");
if (ImGui::BeginCombo("##apartment", apartment_names[g.session.send_to_apartment_idx]))
@ -311,47 +329,23 @@ namespace big
ImGui::SameLine();
components::command_button<"interiortpall">({ 161 }, "TP All To Multi Floor Garage");
components::sub_title("Event Starter");
ImGui::BeginGroup();
components::button("Hot Target", [] { scripts::start_launcher_script(36); });
components::button("Kill List", [] { scripts::start_launcher_script(37); });
components::button("Checkpoints", [] { scripts::start_launcher_script(39); });
components::button("Challenges", [] { scripts::start_launcher_script(40); });
components::button("Penned In", [] { scripts::start_launcher_script(41); });
ImGui::EndGroup();
components::command_button<"tutorialall">();
ImGui::SameLine();
ImGui::BeginGroup();
components::button("Hot Property", [] { scripts::start_launcher_script(43); });
components::button("King Of The Castle", [] { scripts::start_launcher_script(45); });
components::button("Criminal Damage", [] { scripts::start_launcher_script(46); });
components::button("Hunt The Beast", [] { scripts::start_launcher_script(47); });
components::button("Business Battles", [] { scripts::start_launcher_script(114); });
ImGui::EndGroup();
components::command_button<"golfall">();
ImGui::SameLine();
ImGui::BeginGroup();
components::button("One-On-One Deathmatch", [] { scripts::start_launcher_script(197); });
components::button("Impromptu Race", [] { scripts::start_launcher_script(16); });
components::button("Flight School", [] { scripts::start_launcher_script(196); });
components::button("Golf", [] { scripts::start_launcher_script(193); });
components::button("Tutorial", [] { scripts::start_launcher_script(20); });
if (ImGui::IsItemHovered())
ImGui::SetTooltip("Only works on joining players");
ImGui::EndGroup();
components::command_button<"flightschoolall">();
ImGui::SameLine();
components::command_button<"dartsall">();
ImGui::BeginGroup();
components::button("Gunslinger", [] { scripts::start_launcher_script(211); });
components::button("Space Monkey", [] { scripts::start_launcher_script(216); });
components::button("Wizard", [] { scripts::start_launcher_script(212); });
components::button("QUB3D", [] { scripts::start_launcher_script(217); });
components::button("Camhedz", [] { scripts::start_launcher_script(218); });
ImGui::EndGroup();
components::command_button<"badlandsall">();
ImGui::SameLine();
components::command_button<"spacemonkeyall">();
ImGui::SameLine();
components::command_button<"wizardall">();
components::command_button<"qub3dall">();
ImGui::SameLine();
components::command_button<"camhedzall">();
ImGui::Checkbox("Disable Pedestrians", &g.session.disable_peds);
ImGui::SameLine();
@ -381,5 +375,12 @@ namespace big
ImGui::SetTooltip("Blocks CEO money drops across the entire session. This can also break other stuff, use with caution");
ImGui::SameLine();
ImGui::Checkbox("Randomize CEO Colors", &g.session.randomize_ceo_colors);
ImGui::Checkbox("Block Jobs", &g.session.block_jobs);
if (ImGui::IsItemHovered())
ImGui::SetTooltip("Prevents remote players from starting jobs while in your session");
ImGui::SameLine();
components::script_patch_checkbox("Block Muggers", &g.session.block_muggers, "For the entire session");
ImGui::SameLine();
components::script_patch_checkbox("Block CEO Raids", &g.session.block_ceo_raids, "For the entire session");
}
}

View File

@ -137,7 +137,7 @@ namespace big
ImGui::Text("Language: %s", languages[boss_goon.Language].name);
ImGui::Text("CEO Name: %s", boss_goon.GangName);
ImGui::Text("MC Name: %s", boss_goon.MCName);
ImGui::Text("MC Name: %s", boss_goon.ClubhouseName);
ImGui::Text("Money In Wallet: %d", stats.WalletBalance);
ImGui::Text("Money In Bank: %d", stats.Money - stats.WalletBalance);
ImGui::Text("Total Money: %d", stats.Money);

View File

@ -18,10 +18,13 @@ namespace big
components::player_command_button<"lckick">(g_player_service->get_selected());
});
components::player_command_button<"bailkick">(g_player_service->get_selected());
ImGui::SameLine();
components::player_command_button<"nfkick">(g_player_service->get_selected());
components::player_command_button<"oomkick">(g_player_service->get_selected());
ImGui::SameLine();
components::player_command_button<"gikick">(g_player_service->get_selected());
components::player_command_button<"shkick">(g_player_service->get_selected());
ImGui::SameLine();
components::player_command_button<"endkick">(g_player_service->get_selected());
components::player_command_button<"desync">(g_player_service->get_selected());

View File

@ -1,4 +1,5 @@
#include "views/view.hpp"
#include "util/scripts.hpp"
namespace big
{
@ -22,6 +23,13 @@ namespace big
ImGui::Checkbox("Off The Radar", &g_player_service->get_selected()->off_radar);
ImGui::Checkbox("Never Wanted", &g_player_service->get_selected()->never_wanted);
ImGui::Checkbox("Semi Godmode", &g_player_service->get_selected()->semi_godmode);
components::button("Gooch Test", []
{
*script_global(1890140).at(244).at(1).as<Player*>() = g_player_service->get_selected()->id();
scripts::start_launcher_script(171);
});
ImGui::TreePop();
}
}

View File

@ -19,10 +19,25 @@ namespace big
components::player_command_button<"vehkick">(g_player_service->get_selected(), {});
components::player_command_button<"ragdoll">(g_player_service->get_selected(), {});
ImGui::SameLine();
components::player_command_button<"intkick">(g_player_service->get_selected(), {});
ImGui::SameLine();
components::player_command_button<"beast">(g_player_service->get_selected(), {});
components::player_command_button<"mission">(g_player_service->get_selected(), {});
ImGui::SameLine();
components::player_command_button<"error">(g_player_service->get_selected(), {});
components::player_command_button<"ceoraid">(g_player_service->get_selected(), {});
ImGui::SameLine();
components::button("Trigger MC Raid", [] { toxic::start_activity(g_player_service->get_selected(), eActivityType::BikerDefend); });
ImGui::SameLine();
components::button("Trigger Bunker Raid", [] { toxic::start_activity(g_player_service->get_selected(), eActivityType::GunrunningDefend); });
components::player_command_button<"sext">(g_player_service->get_selected(), {});
ImGui::SameLine();
components::player_command_button<"fakeban">(g_player_service->get_selected(), {});
static int wanted_level;
ImGui::SliderInt("Wanted Level", &wanted_level, 0, 5);
ImGui::SameLine();
@ -109,6 +124,24 @@ namespace big
ImGui::SameLine();
components::player_command_button<"remweaps">(g_player_service->get_selected(), { });
components::player_command_button<"tutorial">(g_player_service->get_selected(), { });
ImGui::SameLine();
components::player_command_button<"golf">(g_player_service->get_selected(), { });
ImGui::SameLine();
components::player_command_button<"flightschool">(g_player_service->get_selected(), { });
ImGui::SameLine();
components::player_command_button<"darts">(g_player_service->get_selected(), { });
components::player_command_button<"badlands">(g_player_service->get_selected(), { });
ImGui::SameLine();
components::player_command_button<"spacemonkey">(g_player_service->get_selected(), { });
ImGui::SameLine();
components::player_command_button<"wizard">(g_player_service->get_selected(), { });
components::player_command_button<"qub3d">(g_player_service->get_selected(), { });
ImGui::SameLine();
components::player_command_button<"camhedz">(g_player_service->get_selected(), { });
components::small_text("Warp Time (requires session host)");
components::button("+1 Minute", [] { toxic::warp_time_forward(g_player_service->get_selected(), 60 * 1000); });

View File

@ -57,15 +57,18 @@ namespace big
{
components::title("Reactions");
draw_reaction(g.reactions.bounty);
draw_reaction(g.reactions.ceo_kick);
draw_reaction(g.reactions.ceo_money);
draw_reaction(g.reactions.clear_wanted_level);
draw_reaction(g.reactions.crash);
draw_reaction(g.reactions.end_session_kick);
draw_reaction(g.reactions.destroy_personal_vehicle);
draw_reaction(g.reactions.fake_deposit);
draw_reaction(g.reactions.force_mission);
draw_reaction(g.reactions.force_teleport);
draw_reaction(g.reactions.give_collectible);
draw_reaction(g.reactions.gta_banner);
draw_reaction(g.reactions.kick_from_interior);
draw_reaction(g.reactions.mc_teleport);
draw_reaction(g.reactions.network_bail);
draw_reaction(g.reactions.null_function_kick);
@ -77,11 +80,16 @@ namespace big
draw_reaction(g.reactions.sound_spam);
draw_reaction(g.reactions.spectate_notification);
draw_reaction(g.reactions.start_activity);
draw_reaction(g.reactions.start_script);
draw_reaction(g.reactions.teleport_to_warehouse);
draw_reaction(g.reactions.transaction_error);
draw_reaction(g.reactions.trigger_business_raid);
draw_reaction(g.reactions.tse_freeze);
draw_reaction(g.reactions.tse_sender_mismatch);
draw_reaction(g.reactions.vehicle_kick);
draw_reaction(g.reactions.turn_into_beast);
draw_reaction(g.reactions.remote_wanted_level);
draw_interloper_reaction(g.reactions.remote_wanted_level_others);
ImGui::Separator();
draw_reaction(g.reactions.clear_ped_tasks);
draw_reaction(g.reactions.remote_ragdoll);

View File

@ -29,6 +29,7 @@ namespace big
static void root();
static void self();
static void session();
static void missions();
static void player_database();
static void session_browser();
static void settings();

View File

@ -7,6 +7,7 @@
#include "services/gta_data/gta_data_service.hpp"
#include "services/model_preview/model_preview_service.hpp"
#include "services/players/player_service.hpp"
#include "backend/looped/looped.hpp"
#include <imgui_internal.h>
@ -14,8 +15,43 @@
#define SPAWN_PED_ALL_WEAPONS -1
#define SPAWN_PED_NO_WEAPONS -2
#define SPAWN_PED_FOR_SELF -1
#define SPAWN_PED_FOR_EVERYONE -2
static int selected_ped_weapon_type = SPAWN_PED_ALL_WEAPONS;
static Hash selected_ped_weapon_hash = 0;
namespace big
{
void spawn_ped_give_weapon(
const Ped ped
)
{
if (selected_ped_weapon_type == SPAWN_PED_NO_WEAPONS)
{
return;
}
const auto& weapon_type_arr = g_gta_data_service->weapon_types();
for (auto& [_, weapon] : g_gta_data_service->weapons())
{
if (
selected_ped_weapon_type == SPAWN_PED_ALL_WEAPONS ||
weapon.m_weapon_type == weapon_type_arr[selected_ped_weapon_type]
)
{
if (
(selected_ped_weapon_hash == 0 ||
weapon.m_hash == selected_ped_weapon_hash)
&& weapon.m_hash != RAGE_JOAAT("WEAPON_UNARMED")
)
{
WEAPON::GIVE_WEAPON_TO_PED(ped, weapon.m_hash, 9999, false, selected_ped_weapon_hash != 0);
}
}
}
}
Ped spawn_ped_at_location(
const int selected_ped_type,
const char* ped_model_buf,
@ -55,7 +91,7 @@ namespace big
}
if (selected_ped_for_player_id == -1)
if (selected_ped_for_player_id == SPAWN_PED_FOR_SELF)
{
location = self::pos;
player = self::id;
@ -89,56 +125,77 @@ namespace big
return 0;
}
PED::SET_PED_ARMOUR(ped, 100);
ENTITY::SET_ENTITY_MAX_HEALTH(ped, 1000);
ENTITY::SET_ENTITY_HEALTH(ped, 1000, 0);
PED::SET_PED_COMBAT_ABILITY(ped, 100);
PED::SET_PED_ACCURACY(ped, 100);
PED::SET_PED_COMBAT_ATTRIBUTES(ped, 1, 1);
PED::SET_PED_COMBAT_ATTRIBUTES(ped, 3, 1);
PED::SET_PED_COMBAT_ATTRIBUTES(ped, 5, 1);
PED::SET_PED_COMBAT_ATTRIBUTES(ped, 13, 1);
PED::SET_PED_COMBAT_ATTRIBUTES(ped, 21, 1);
PED::SET_PED_COMBAT_ATTRIBUTES(ped, 27, 1);
PED::SET_PED_COMBAT_ATTRIBUTES(ped, 41, 1);
PED::SET_PED_COMBAT_ATTRIBUTES(ped, 46, 1);
PED::SET_PED_COMBAT_ATTRIBUTES(ped, 63, 0);
PED::SET_PED_COMBAT_ABILITY(ped, 2);
PED::SET_PED_COMBAT_MOVEMENT(ped, 2);
PED::SET_PED_COMBAT_RANGE(ped, 0);
PED::SET_PED_HIGHLY_PERCEPTIVE(ped, true);
PED::SET_PED_SEEING_RANGE(ped, 200.0f);
PED::SET_PED_HEARING_RANGE(ped, 200.0f);
PED::SET_PED_ID_RANGE(ped, 200.0f);
PED::SET_PED_FIRING_PATTERN(ped, RAGE_JOAAT("FIRING_PATTERN_FULL_AUTO"));
PED::SET_PED_SHOOT_RATE(ped, 150);
PED::SET_PED_RANDOM_COMPONENT_VARIATION(ped, 0);
if (is_bodyguard)
{
int player_group = PLAYER::GET_PLAYER_GROUP(player);
int player_group = PED::GET_PED_GROUP_INDEX(player_ped);
if (!PED::DOES_GROUP_EXIST(player_group))
player_group = PED::CREATE_GROUP(0);
PED::SET_PED_AS_GROUP_MEMBER(ped, player_group);
PED::SET_PED_RELATIONSHIP_GROUP_HASH(ped, PED::GET_PED_RELATIONSHIP_GROUP_HASH(player_ped));
PED::SET_PED_AS_GROUP_LEADER(player_ped, player_group);
PED::SET_PED_AS_GROUP_MEMBER(ped, player_group);
PED::SET_PED_CAN_TELEPORT_TO_GROUP_LEADER(ped, player_group, true);
PED::SET_PED_NEVER_LEAVES_GROUP(ped, true);
PED::SET_PED_RELATIONSHIP_GROUP_HASH(ped, PED::GET_PED_RELATIONSHIP_GROUP_HASH(player_ped));
PED::SET_PED_CAN_BE_TARGETTED_BY_PLAYER(ped, player, true);
PED::SET_PED_ARMOUR(ped, 100);
ENTITY::SET_ENTITY_MAX_HEALTH(ped, 1000);
ENTITY::SET_ENTITY_HEALTH(ped, 1000, 0);
PED::SET_PED_COMBAT_ABILITY(ped, 100);
PED::SET_PED_COMBAT_ATTRIBUTES(ped, 46, 1);
PED::SET_PED_COMBAT_ATTRIBUTES(ped, 63, 0);
TASK::CLEAR_PED_TASKS_IMMEDIATELY(ped);
TASK::TASK_COMBAT_HATED_TARGETS_AROUND_PED(ped, 100.f, 0);
PED::SET_PED_KEEP_TASK(ped, true);
}
return ped;
}
void spawn_ped_give_weapon(
const Ped ped,
const int selected_ped_weapon_type,
const Hash selected_ped_weapon_hash
) {
if (selected_ped_weapon_type == SPAWN_PED_NO_WEAPONS)
{
return;
}
const auto& weapon_type_arr = g_gta_data_service->weapon_types();
for (auto& [_, weapon] : g_gta_data_service->weapons())
{
if (
selected_ped_weapon_type == SPAWN_PED_ALL_WEAPONS ||
weapon.m_weapon_type == weapon_type_arr[selected_ped_weapon_type]
) {
if (
(selected_ped_weapon_hash == 0 ||
weapon.m_hash == selected_ped_weapon_hash)
&& weapon.m_hash != RAGE_JOAAT("WEAPON_UNARMED")
) {
WEAPON::GIVE_WEAPON_TO_PED(ped, weapon.m_hash, 9999, false, selected_ped_weapon_hash != 0);
}
if (player != self::id)
{
PED::SET_PED_KEEP_TASK(ped, true);
PED::SET_BLOCKING_OF_NON_TEMPORARY_EVENTS(ped, true);
TASK::TASK_SET_BLOCKING_OF_NON_TEMPORARY_EVENTS(ped, true);
TASK::TASK_FOLLOW_TO_OFFSET_OF_ENTITY(ped, player, 0.0f, 0.0f, 0.0f, 4.0f, -1, 0.0f, true);
}
}
if (g.world.spawn_ped.spawn_invincible)
{
ENTITY::SET_ENTITY_INVINCIBLE(ped, true);
}
if (g.world.spawn_ped.spawn_invisible)
{
ENTITY::SET_ENTITY_VISIBLE(ped, false, false);
}
if (g.world.spawn_ped.spawn_as_attacker)
{
PED::SET_PED_AS_ENEMY(ped, true);
PED::SET_PED_KEEP_TASK(ped, true);
PED::SET_BLOCKING_OF_NON_TEMPORARY_EVENTS(ped, true);
TASK::TASK_COMBAT_PED(ped, player_ped, 0, 16);
PED::SET_PED_RELATIONSHIP_GROUP_HASH(ped, RAGE_JOAAT("HATES_PLAYER"));
PED::SET_PED_ALERTNESS(ped, 3);
}
spawn_ped_give_weapon(ped);
spawned_peds.push_back({ ped, selected_ped_for_player_id == SPAWN_PED_FOR_SELF ? self::id : selected_ped_for_player_id, is_bodyguard, g.world.spawn_ped.spawn_as_attacker });
return ped;
}
void view::spawn_ped()
@ -148,22 +205,21 @@ namespace big
static char ped_model_buf[64];
static Player selected_ped_player_id = -1;
auto ped_type_arr = g_gta_data_service->ped_types();
auto ped_arr = g_gta_data_service->peds();
auto& ped_type_arr = g_gta_data_service->ped_types();
auto& ped_arr = g_gta_data_service->peds();
static int selected_ped_weapon_type = SPAWN_PED_ALL_WEAPONS;
static Hash selected_ped_weapon_hash = 0;
auto weapon_type_arr = g_gta_data_service->weapon_types();
auto weapon_arr = g_gta_data_service->weapons();
auto& weapon_type_arr = g_gta_data_service->weapon_types();
auto& weapon_arr = g_gta_data_service->weapons();
static Player selected_ped_for_player_id = -1;
auto player_arr = g_player_service->players();
auto& player_arr = g_player_service->players();
if (!*g_pointers->m_is_session_started)
{
selected_ped_player_id = -1;
selected_ped_for_player_id = -1;
if (selected_ped_for_player_id != SPAWN_PED_FOR_SELF && selected_ped_for_player_id != SPAWN_PED_FOR_EVERYONE)
selected_ped_for_player_id = SPAWN_PED_FOR_SELF;
}
else
{
@ -172,13 +228,12 @@ namespace big
selected_ped_player_id = -1;
}
if (g_player_service->get_by_id(selected_ped_for_player_id) == nullptr)
if (selected_ped_for_player_id != SPAWN_PED_FOR_SELF && selected_ped_for_player_id != SPAWN_PED_FOR_EVERYONE && g_player_service->get_by_id(selected_ped_for_player_id) == nullptr)
{
selected_ped_for_player_id = -1;
selected_ped_for_player_id = SPAWN_PED_FOR_SELF;
}
}
components::sub_title("Ped Model");
{
ImGui::BeginGroup();
@ -511,16 +566,29 @@ namespace big
{
if (ImGui::BeginCombo(
"##ped_for",
selected_ped_for_player_id == -1 ?
(selected_ped_for_player_id == SPAWN_PED_FOR_SELF ?
"Self" :
g_player_service->get_by_id(selected_ped_for_player_id)->get_name()
)) {
if (ImGui::Selectable("Self", selected_ped_for_player_id == -1))
(selected_ped_for_player_id == SPAWN_PED_FOR_EVERYONE ?
"Everyone" :
g_player_service->get_by_id(selected_ped_for_player_id)->get_name()))
))
{
if (ImGui::Selectable("Self", selected_ped_for_player_id == SPAWN_PED_FOR_SELF))
{
selected_ped_for_player_id = -1;
selected_ped_for_player_id = SPAWN_PED_FOR_SELF;
}
if (selected_ped_for_player_id == -1)
if (selected_ped_for_player_id == SPAWN_PED_FOR_SELF)
{
ImGui::SetItemDefaultFocus();
}
if (ImGui::Selectable("Everyone", selected_ped_for_player_id == SPAWN_PED_FOR_EVERYONE))
{
selected_ped_for_player_id = SPAWN_PED_FOR_EVERYONE;
}
if (selected_ped_for_player_id == SPAWN_PED_FOR_EVERYONE)
{
ImGui::SetItemDefaultFocus();
}
@ -559,7 +627,12 @@ namespace big
}
}
components::button("Change Player Model", [] {
ImGui::Checkbox("Invincible", &g.world.spawn_ped.spawn_invincible);
ImGui::Checkbox("Invisible", &g.world.spawn_ped.spawn_invisible);
ImGui::Checkbox("Attacker", &g.world.spawn_ped.spawn_as_attacker);
components::button("Change Player Model", []
{
if (selected_ped_type == -2)
{
if (selected_ped_player_id != -1)
@ -571,39 +644,61 @@ namespace big
ped::steal_identity(ped);
}
}
}
}
else
{
if (!ped::change_player_model(rage::joaat(ped_model_buf)))
{
g_notification_service->push_error("Ped", "Failed to spawn model, did you give an incorrect model ? ");
g_notification_service->push_error("Ped", "Failed to spawn model, did you give an incorrect model?");
return;
}
}
spawn_ped_give_weapon(self::ped, selected_ped_weapon_type, selected_ped_weapon_hash);
});
ImGui::SameLine();
components::button("Spawn Ped", [] {
Ped ped = spawn_ped_at_location(selected_ped_type, ped_model_buf, selected_ped_player_id, selected_ped_for_player_id, false);
if (ped)
{
spawn_ped_give_weapon(ped, selected_ped_weapon_type, selected_ped_weapon_hash);
PED::SET_PED_RANDOM_COMPONENT_VARIATION(self::ped, 0);
}
});
ImGui::SameLine();
components::button("Spawn Bodyguard", [] {
Ped ped = spawn_ped_at_location(selected_ped_type, ped_model_buf, selected_ped_player_id, selected_ped_for_player_id, true);
if (ped)
components::button("Spawn Ped", []
{
if (selected_ped_for_player_id == SPAWN_PED_FOR_EVERYONE)
{
spawn_ped_give_weapon(ped, selected_ped_weapon_type, selected_ped_weapon_hash);
g_player_service->iterate([](const big::player_entry& entry)
{
spawn_ped_at_location(selected_ped_type, ped_model_buf, selected_ped_player_id, entry.second->id(), false);
});
}
else
{
spawn_ped_at_location(selected_ped_type, ped_model_buf, selected_ped_player_id, selected_ped_for_player_id, false);
}
});
ImGui::SameLine();
components::button("Spawn Bodyguard", []
{
if (selected_ped_for_player_id == SPAWN_PED_FOR_EVERYONE)
{
g_player_service->iterate([](const big::player_entry& entry)
{
spawn_ped_at_location(selected_ped_type, ped_model_buf, selected_ped_player_id, entry.second->id(), true);
});
}
else
{
spawn_ped_at_location(selected_ped_type, ped_model_buf, selected_ped_player_id, selected_ped_for_player_id, true);
}
});
components::button("Cleanup Spawned Peds", []
{
for (auto& ped : spawned_peds)
{
PED::DELETE_PED(&ped.ped_handle);
}
spawned_peds.clear();
});
}
}