mirror of
https://github.com/Mr-X-GTA/YimMenu.git
synced 2025-07-15 23:07:59 +08:00
Toxic features and improve protections (#897)
This commit is contained in:
@ -1,12 +1,21 @@
|
||||
#pragma once
|
||||
|
||||
#include "common.hpp"
|
||||
|
||||
#include "services/players/player_service.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
class looped {
|
||||
struct spawned_ped
|
||||
{
|
||||
Ped ped_handle;
|
||||
Player spawned_for_player;
|
||||
bool is_bodyguard;
|
||||
bool is_attacker;
|
||||
};
|
||||
|
||||
inline std::vector<spawned_ped> spawned_peds;
|
||||
|
||||
class looped
|
||||
{
|
||||
public:
|
||||
static void hud_transition_state();
|
||||
|
||||
@ -23,6 +32,7 @@ namespace big
|
||||
static void session_local_time();
|
||||
static void session_pop_multiplier_areas();
|
||||
static void session_force_thunder();
|
||||
static void session_block_jobs();
|
||||
static void session_randomize_ceo_colors();
|
||||
static void session_auto_kick_host();
|
||||
|
||||
@ -54,5 +64,7 @@ namespace big
|
||||
|
||||
static void drive_train();
|
||||
static void derail_train();
|
||||
|
||||
static void world_spawn_ped();
|
||||
};
|
||||
}
|
||||
|
@ -25,8 +25,8 @@ namespace big
|
||||
if (entry.second->explosion_loop)
|
||||
toxic::blame_explode_player(entry.second, entry.second, EXP_TAG_SUBMARINE_BIG, 9999.0f, true, false, 9999.0f);
|
||||
|
||||
if (entry.second->freeze_loop)
|
||||
TASK::CLEAR_PED_TASKS_IMMEDIATELY(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(entry.second->id()));
|
||||
if (entry.second->freeze_loop && entry.second->get_ped()->m_net_object)
|
||||
g_pointers->m_clear_ped_tasks_network(entry.second->get_ped(), true);
|
||||
|
||||
if (entry.second->ragdoll_loop && entry.second->get_ped()->m_net_object)
|
||||
g_pointers->m_request_ragdoll(entry.second->get_ped()->m_net_object->m_object_id);
|
||||
|
@ -10,6 +10,8 @@ namespace big
|
||||
|
||||
virtual void on_tick() override
|
||||
{
|
||||
WATER::RESET_DEEP_OCEAN_SCALER();
|
||||
|
||||
Vector3 coords = self::pos;
|
||||
float offset[] = { -4, 4 };
|
||||
|
||||
@ -23,7 +25,7 @@ namespace big
|
||||
{
|
||||
coords.y += offset[(i % 2 == 0)];
|
||||
}
|
||||
WATER::MODIFY_WATER(coords.x, coords.y, -500000.0f, 0.2f);
|
||||
WATER::MODIFY_WATER(coords.x, coords.y, 0.0f, 300.0f);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
36
src/backend/looped/session/block_jobs.cpp
Normal file
36
src/backend/looped/session/block_jobs.cpp
Normal file
@ -0,0 +1,36 @@
|
||||
#include "backend/looped/looped.hpp"
|
||||
#include "natives.hpp"
|
||||
#include "pointers.hpp"
|
||||
#include "gta_util.hpp"
|
||||
#include "script_local.hpp"
|
||||
#include "core/scr_globals.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
static bool bLastBlockJobsEnabled = false;
|
||||
|
||||
void looped::session_block_jobs()
|
||||
{
|
||||
bool used = g.session.block_jobs && *g_pointers->m_is_session_started;
|
||||
if (!bLastBlockJobsEnabled && used)
|
||||
{
|
||||
if (!STREAMING::IS_PLAYER_SWITCH_IN_PROGRESS() && SCRIPT::GET_NUMBER_OF_THREADS_RUNNING_THE_SCRIPT_WITH_THIS_HASH(RAGE_JOAAT("maintransition")) == 0
|
||||
&& NETWORK::NETWORK_GET_HOST_OF_SCRIPT("fmmc_launcher", -1, 0) == self::id)
|
||||
{
|
||||
auto fmmc = gta_util::find_script_thread(RAGE_JOAAT("fmmc_launcher"));
|
||||
*script_local(fmmc->m_stack, scr_locals::fmmc_launcher::broadcast_idx).at(47).at(7).as<int*>() = (-1 & ~(1 << self::id));
|
||||
bLastBlockJobsEnabled = true;
|
||||
}
|
||||
}
|
||||
else if (bLastBlockJobsEnabled && !used)
|
||||
{
|
||||
if (*g_pointers->m_is_session_started && !STREAMING::IS_PLAYER_SWITCH_IN_PROGRESS() && gta_util::find_script_thread(RAGE_JOAAT("fmmc_launcher")))
|
||||
{
|
||||
auto fmmc = gta_util::find_script_thread(RAGE_JOAAT("fmmc_launcher"));
|
||||
*script_local(fmmc->m_stack, scr_locals::fmmc_launcher::broadcast_idx).at(47).at(7).as<int*>() = 0;
|
||||
}
|
||||
|
||||
bLastBlockJobsEnabled = false;
|
||||
}
|
||||
}
|
||||
}
|
@ -32,7 +32,7 @@ namespace big
|
||||
|
||||
if (g.spoofing.rockstar_id != g.spoofing.applied_spoof_rockstar_id && gta_util::get_network()->m_game_session_state == 0)
|
||||
{
|
||||
g.spoofing.applied_spoof_rockstar_id = g.spoofing.spoof_rockstar_id;
|
||||
g.spoofing.applied_spoof_rockstar_id = g.spoofing.rockstar_id;
|
||||
}
|
||||
|
||||
if (g.spoofing.spoof_rockstar_id != g.spoofing.should_spoof_rockstar_id && gta_util::get_network()->m_game_session_state == 0)
|
||||
|
86
src/backend/looped/world/spawn_ped.cpp
Normal file
86
src/backend/looped/world/spawn_ped.cpp
Normal file
@ -0,0 +1,86 @@
|
||||
#include "backend/looped/looped.hpp"
|
||||
#include "natives.hpp"
|
||||
#include "pointers.hpp"
|
||||
#include "util/entity.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
static bool last_online = false;
|
||||
|
||||
inline void cleanup_spawned_ped(spawned_ped& ped)
|
||||
{
|
||||
PED::DELETE_PED(&ped.ped_handle);
|
||||
}
|
||||
|
||||
static bool bLastLoadPathNodes = false;
|
||||
void looped::world_spawn_ped()
|
||||
{
|
||||
if (*g_pointers->m_is_session_started != last_online)
|
||||
{
|
||||
last_online = *g_pointers->m_is_session_started;
|
||||
|
||||
for (auto& ped : spawned_peds)
|
||||
cleanup_spawned_ped(ped);
|
||||
|
||||
spawned_peds.clear();
|
||||
}
|
||||
|
||||
if (bLastLoadPathNodes && (spawned_peds.size() == 0))
|
||||
{
|
||||
PATHFIND::LOAD_ALL_PATH_NODES(false);
|
||||
bLastLoadPathNodes = false;
|
||||
}
|
||||
else if (spawned_peds.size() != 0)
|
||||
{
|
||||
PATHFIND::LOAD_ALL_PATH_NODES(true);
|
||||
bLastLoadPathNodes = true;
|
||||
}
|
||||
|
||||
for (auto it = spawned_peds.begin(); it != spawned_peds.end();)
|
||||
{
|
||||
if ((*g_pointers->m_is_session_started && !NETWORK::NETWORK_IS_PLAYER_CONNECTED(it->spawned_for_player)) || !ENTITY::DOES_ENTITY_EXIST(it->ped_handle))
|
||||
{
|
||||
cleanup_spawned_ped(*it);
|
||||
it = spawned_peds.erase(it);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (it->is_attacker || it->is_bodyguard)
|
||||
{
|
||||
auto pos = ENTITY::GET_ENTITY_COORDS(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(it->spawned_for_player), false);
|
||||
auto vel = NETWORK::NETWORK_GET_LAST_VEL_RECEIVED_OVER_NETWORK(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(it->spawned_for_player));
|
||||
bool is_veh = PED::IS_PED_IN_ANY_VEHICLE(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(it->spawned_for_player), true) || PLAYER::IS_REMOTE_PLAYER_IN_NON_CLONED_VEHICLE(it->spawned_for_player);
|
||||
auto ped_pos = ENTITY::GET_ENTITY_COORDS(it->ped_handle, false);
|
||||
|
||||
float distance = is_veh ? 170.0f : 120.0f;
|
||||
float spawn_distance = is_veh ? 150.0f : 70.0f;
|
||||
|
||||
if (pos.x != 0.0f && SYSTEM::VDIST2(pos.x, pos.y, pos.z, ped_pos.x, ped_pos.y, ped_pos.z) > distance * distance)
|
||||
{
|
||||
Vector3 spawn_point;
|
||||
if (MISC::FIND_SPAWN_POINT_IN_DIRECTION(pos.x, pos.y, pos.z, vel.x, vel.y, vel.z, spawn_distance, &spawn_point) && entity::take_control_of(it->ped_handle, 0))
|
||||
{
|
||||
PED::SET_PED_COORDS_KEEP_VEHICLE(it->ped_handle, spawn_point.x, spawn_point.y, spawn_point.z);
|
||||
|
||||
if (it->is_attacker)
|
||||
TASK::TASK_COMBAT_PED(it->ped_handle, PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(it->spawned_for_player), 0, 16);
|
||||
|
||||
if (it->is_bodyguard)
|
||||
TASK::TASK_FOLLOW_TO_OFFSET_OF_ENTITY(it->ped_handle, PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(it->spawned_for_player), 0.0f, 0.0f, 0.0f, 4.0f, -1, 0.0f, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (it->is_attacker && TASK::GET_SCRIPT_TASK_STATUS(it->ped_handle, RAGE_JOAAT("SCRIPT_TASK_COMBAT")) == 7)
|
||||
{
|
||||
TASK::TASK_COMBAT_PED(it->ped_handle, PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(it->spawned_for_player), 0, 16);
|
||||
}
|
||||
else if (it->is_bodyguard && it->spawned_for_player != self::id && TASK::GET_SCRIPT_TASK_STATUS(it->ped_handle, RAGE_JOAAT("SCRIPT_TASK_FOLLOW_TO_OFFSET_OF_ENTITY")) == 7)
|
||||
{
|
||||
TASK::TASK_FOLLOW_TO_OFFSET_OF_ENTITY(it->ped_handle, PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(it->spawned_for_player), 0.0f, 0.0f, 0.0f, 4.0f, -1, 0.0f, true);
|
||||
}
|
||||
|
||||
it++;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user