This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
YimMenu/src/native_hooks/freemode.hpp

62 lines
1.8 KiB
C++
Raw Normal View History

#pragma once
#include "script_function.hpp"
namespace big
{
namespace freemode
{
inline void NETWORK_BAIL(rage::scrNativeCallContext* src)
{
LOG(INFO) << "NETWORK_BAIL prevented";
}
inline void IS_PLAYER_PLAYING(rage::scrNativeCallContext* src)
{
// block undead OTR
if (g.session.decloak_players && src->get_arg<Player>(0) != self::id)
src->set_return_value<BOOL>(TRUE);
else
src->set_return_value<BOOL>(PLAYER::IS_PLAYER_PLAYING(src->get_arg<Player>(0)));
};
2022-11-21 15:42:12 +00:00
inline void SET_ENTITY_VISIBLE(rage::scrNativeCallContext* src)
{
auto entity = src->get_arg<Entity>(0);
auto toggle = src->get_arg<bool>(1);
auto outfit = src->get_arg<bool>(2);
if (g.self.invisibility && entity == self::ped && toggle)
2022-11-21 15:42:12 +00:00
return;
else
ENTITY::SET_ENTITY_VISIBLE(entity, toggle, outfit);
}
2022-12-06 16:12:02 +00:00
void SET_BIGMAP_ACTIVE(rage::scrNativeCallContext* src)
{
if (!g.m_mission_creator_thread)
2022-12-06 16:12:02 +00:00
HUD::SET_BIGMAP_ACTIVE(src->get_arg<BOOL>(0), src->get_arg<BOOL>(1));
};
void SET_BLIP_DISPLAY(rage::scrNativeCallContext* src)
{
if ((!g.m_mission_creator_thread) || src->get_arg<Blip>(0) != HUD::GET_MAIN_PLAYER_BLIP_ID())
2022-12-06 16:12:02 +00:00
HUD::SET_BLIP_DISPLAY(src->get_arg<Blip>(0), src->get_arg<BOOL>(1));
};
void NETWORK_HAS_RECEIVED_HOST_BROADCAST_DATA(rage::scrNativeCallContext* src)
{
if (SCRIPT::GET_HASH_OF_THIS_SCRIPT_NAME() == RAGE_JOAAT("freemode") && g.session.force_script_host)
{
g_fiber_pool->queue_job([]
{
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);
});
}
scr_functions::set_freemode_session_active({});
src->set_return_value<BOOL>(TRUE);
}
}
}