remove(Toxic): remove toxic options

This commit is contained in:
Maddy 2022-05-24 15:59:54 -04:00 committed by GitHub
parent e52ba9a02f
commit d3d231375c
5 changed files with 17 additions and 127 deletions

View File

@ -1,6 +1,6 @@
#include "backend/looped/looped.hpp"
#include "services/player_service.hpp"
#include "util/toxic.hpp"
#include "util/globals.hpp"
namespace big
{
@ -8,7 +8,7 @@ namespace big
{
if (g->player.player_never_wanted && g_player_service->get_selected()->is_valid())
{
toxic::clear_wanted_player(g_player_service->get_selected()->id());
globals::clear_wanted_player(g_player_service->get_selected()->id());
}
}
}

View File

@ -8,5 +8,4 @@
#include "session.hpp"
#include "system.hpp"
#include "teleport.hpp"
#include "toxic.hpp"
#include "vehicle.hpp"

View File

@ -1,5 +1,6 @@
#pragma once
#include "script_global.hpp"
#include "util/system.hpp"
namespace big::globals
{
@ -7,4 +8,16 @@ namespace big::globals
{
return *script_global(2810701).at(298).as<Vehicle*>();
}
inline void clear_wanted_player(Player target)
{
constexpr size_t arg_count = 3;
int64_t args[arg_count] = {
static_cast<int64_t>(eRemoteEvent::ClearWantedLevel),
self::id,
*script_global(1893551).at(target, 599).at(510).as<int*>()
};
g_pointers->m_trigger_script_event(1, args, arg_count, 1 << target);
}
}

View File

@ -1,98 +0,0 @@
#pragma once
#include "gta/enums.hpp"
#include "natives.hpp"
#include "script_global.hpp"
#include "system.hpp"
#include "entity.hpp"
namespace big::toxic
{
inline void blame_explode_coord(Player to_blame, Vector3 pos, eExplosionType explosion_type, float damage, bool is_audible, bool is_invisible, float camera_shake)
{
system::patch_blame(true);
FIRE::ADD_OWNED_EXPLOSION(
PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(to_blame),
pos.x, pos.y, pos.z,
explosion_type,
damage,
is_audible,
is_invisible,
camera_shake
);
system::patch_blame(false);
}
inline void blame_explode_player(Player to_blame, Player target, eExplosionType explosion_type, float damage, bool is_audible, bool is_invisible, float camera_shake)
{
Vector3 coords = ENTITY::GET_ENTITY_COORDS(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(target), true);
blame_explode_coord(to_blame, coords, explosion_type, damage, is_audible, is_invisible, camera_shake);
}
inline void bounty_player(Player target, int amount)
{
const size_t arg_count = 22;
int64_t args[arg_count] = {
static_cast<int64_t>(eRemoteEvent::Bounty),
self::id,
target,
0, // set by player or NPC?
amount,
0, 1, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
* script_global(1921039).at(9).as<int*>(),
* script_global(1921039).at(10).as<int*>()
};
g_pointers->m_trigger_script_event(1, args, arg_count, -1);
}
inline void taze_player(const Player player)
{
const Ped target = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player);
constexpr auto max_attempts = 20;
for (size_t attempts = 0; attempts < max_attempts && !ENTITY::IS_ENTITY_DEAD(target, false); attempts++)
{
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);
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);
}
}
inline void kick_from_vehicle(const Player player)
{
const Ped target = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player);
TASK::CLEAR_PED_TASKS_IMMEDIATELY(target);
}
inline void flying_vehicle(const Player player)
{
Entity ent = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player);
if (!PED::IS_PED_IN_ANY_VEHICLE(ent, true))
g_notification_service->push_warning("Toxic", "Target player is not in a 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);
else
g_notification_service->push_warning("Toxic", "Failed to take control of player vehicle.");
}
}
inline void clear_wanted_player(Player target)
{
constexpr size_t arg_count = 3;
int64_t args[arg_count] = {
static_cast<int64_t>(eRemoteEvent::ClearWantedLevel),
self::id,
*script_global(1893551).at(target, 599).at(510).as<int*>()
};
g_pointers->m_trigger_script_event(1, args, arg_count, 1 << target);
}
}

View File

@ -1,8 +1,8 @@
#include "views/view.hpp"
#include "util/toxic.hpp"
#include "services/player_service.hpp"
#include "gta_util.hpp"
#include "util/misc.hpp"
#include "util/globals.hpp"
#include "util/ped.hpp"
#include "util/teleport.hpp"
@ -35,7 +35,7 @@ namespace big
});
components::button("Clear Wanted Level", [] {
toxic::clear_wanted_player(g_player_service->get_selected()->id());
globals::clear_wanted_player(g_player_service->get_selected()->id());
});
ImGui::SameLine();
@ -109,30 +109,6 @@ namespace big
ImGui::TreePop();
}
if (ImGui::TreeNode("Toxic")) {
components::button("Explode Self", [] {
toxic::blame_explode_player(
g_player_service->get_selected()->id(),
g_player_service->get_selected()->id(),
eExplosionType::PLANE, 1000, false, true, 0.f
);
});
components::button("Taze", [] {
toxic::taze_player(g_player_service->get_selected()->id());
});
components::button("Kick From Vehicle", [] {
toxic::kick_from_vehicle(g_player_service->get_selected()->id());
});
components::button("Flying Vehicle", [] {
toxic::flying_vehicle(g_player_service->get_selected()->id());
});
ImGui::TreePop();
}
}
}
}