General improvements (#1693)
* remove(replay): remove replay interface * fix(context_menu): better console controls * feat(protections): improve protections * feat(protections): actually fix parachute crash * feat(protections): kick rejoin * feat(context_menu): more context menu stuff
This commit is contained in:
@ -1,12 +1,13 @@
|
||||
#include "context_menu_service.hpp"
|
||||
|
||||
#include "fiber_pool.hpp"
|
||||
#include "gta/replay.hpp"
|
||||
#include "gui.hpp"
|
||||
#include "natives.hpp"
|
||||
#include "pointers.hpp"
|
||||
#include "util/misc.hpp"
|
||||
|
||||
#include <network/ChatData.hpp>
|
||||
|
||||
namespace big
|
||||
{
|
||||
context_menu_service::context_menu_service()
|
||||
@ -228,11 +229,11 @@ namespace big
|
||||
ControllerInputs::INPUT_VEH_SELECT_NEXT_WEAPON,
|
||||
ControllerInputs::INPUT_SELECT_NEXT_WEAPON,
|
||||
ControllerInputs::INPUT_SELECT_PREV_WEAPON,
|
||||
ControllerInputs::INPUT_WEAPON_WHEEL_NEXT,
|
||||
ControllerInputs::INPUT_WEAPON_WHEEL_PREV,
|
||||
ControllerInputs::INPUT_ATTACK,
|
||||
ControllerInputs::INPUT_ATTACK2,
|
||||
ControllerInputs::INPUT_SPECIAL_ABILITY,
|
||||
ControllerInputs::INPUT_VEH_MOUSE_CONTROL_OVERRIDE,
|
||||
ControllerInputs::INPUT_SNIPER_ZOOM,
|
||||
};
|
||||
|
||||
void context_menu_service::disable_control_action_loop()
|
||||
@ -248,11 +249,13 @@ namespace big
|
||||
{
|
||||
while (g_running)
|
||||
{
|
||||
if (g_gui->is_open())
|
||||
if (g_gui->is_open() || HUD::IS_PAUSE_MENU_ACTIVE()
|
||||
|| (*g_pointers->m_gta.m_chat_data && (*g_pointers->m_gta.m_chat_data)->m_chat_open))
|
||||
{
|
||||
script::get_current()->yield();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!g.context_menu.enabled)
|
||||
{
|
||||
g_context_menu_service->enabled = false;
|
||||
@ -261,9 +264,19 @@ namespace big
|
||||
continue;
|
||||
}
|
||||
|
||||
if (PAD::IS_DISABLED_CONTROL_JUST_RELEASED(0, (int)ControllerInputs::INPUT_VEH_DUCK))
|
||||
if (PAD::IS_USING_KEYBOARD_AND_MOUSE(0))
|
||||
{
|
||||
g_context_menu_service->enabled = !g_context_menu_service->enabled;
|
||||
if (PAD::IS_DISABLED_CONTROL_JUST_RELEASED(0, (int)ControllerInputs::INPUT_VEH_DUCK))
|
||||
{
|
||||
g_context_menu_service->enabled = !g_context_menu_service->enabled;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_AIM) && PAD::IS_DISABLED_CONTROL_JUST_RELEASED(0, (int)ControllerInputs::INPUT_FRONTEND_Y))
|
||||
{
|
||||
g_context_menu_service->enabled = !g_context_menu_service->enabled;
|
||||
}
|
||||
}
|
||||
|
||||
if (g_context_menu_service->enabled)
|
||||
@ -279,12 +292,20 @@ namespace big
|
||||
continue;
|
||||
}
|
||||
|
||||
if (PAD::IS_DISABLED_CONTROL_JUST_PRESSED(0, (int)ControllerInputs::INPUT_WEAPON_WHEEL_NEXT))
|
||||
ControllerInputs next_key = PAD::IS_USING_KEYBOARD_AND_MOUSE(0) ? ControllerInputs::INPUT_WEAPON_WHEEL_NEXT : ControllerInputs::INPUT_SCRIPT_PAD_DOWN;
|
||||
ControllerInputs prev_key = PAD::IS_USING_KEYBOARD_AND_MOUSE(0) ? ControllerInputs::INPUT_WEAPON_WHEEL_PREV : ControllerInputs::INPUT_SCRIPT_PAD_UP;
|
||||
ControllerInputs execute_key = PAD::IS_USING_KEYBOARD_AND_MOUSE(0) ? ControllerInputs::INPUT_ATTACK : ControllerInputs::INPUT_FRONTEND_ACCEPT;
|
||||
|
||||
PAD::DISABLE_CONTROL_ACTION(0, static_cast<int>(next_key), true);
|
||||
PAD::DISABLE_CONTROL_ACTION(0, static_cast<int>(prev_key), true);
|
||||
PAD::DISABLE_CONTROL_ACTION(0, static_cast<int>(execute_key), true);
|
||||
|
||||
if (PAD::IS_DISABLED_CONTROL_JUST_PRESSED(0, (int)next_key))
|
||||
cm->current_option = cm->options.size() <= cm->current_option + 1 ? 0 : cm->current_option + 1;
|
||||
if (PAD::IS_DISABLED_CONTROL_JUST_PRESSED(0, (int)ControllerInputs::INPUT_WEAPON_WHEEL_PREV))
|
||||
if (PAD::IS_DISABLED_CONTROL_JUST_PRESSED(0, (int)prev_key))
|
||||
cm->current_option = 0 > cm->current_option - 1 ? static_cast<int>(cm->options.size()) - 1 : cm->current_option - 1;
|
||||
|
||||
if (PAD::IS_DISABLED_CONTROL_JUST_PRESSED(0, (int)ControllerInputs::INPUT_ATTACK) || PAD::IS_DISABLED_CONTROL_JUST_PRESSED(0, (int)ControllerInputs::INPUT_SPECIAL_ABILITY))
|
||||
if (PAD::IS_DISABLED_CONTROL_JUST_PRESSED(0, (int)execute_key))
|
||||
{
|
||||
if (!g_context_menu_service->m_pointer)
|
||||
{
|
||||
|
@ -85,7 +85,7 @@ namespace big
|
||||
else
|
||||
g_notification_service->push_warning("Toxic", "Failed to take control of vehicle.");
|
||||
}},
|
||||
{"HALT",
|
||||
{"HALT",
|
||||
[this] {
|
||||
if (entity::take_control_of(m_handle))
|
||||
{
|
||||
@ -137,18 +137,22 @@ namespace big
|
||||
for (auto& [_, weapon] : g_gta_data_service->weapons())
|
||||
WEAPON::REMOVE_WEAPON_FROM_PED(m_handle, weapon.m_hash);
|
||||
}},
|
||||
{"KILL",
|
||||
[this] {
|
||||
ped::kill_ped(m_handle);
|
||||
}},
|
||||
{"RAGDOLL",
|
||||
[this] {
|
||||
PED::SET_PED_TO_RAGDOLL(m_handle, 2000, 2000, 0, 0, 0, 0);
|
||||
}},
|
||||
{"DANCE",
|
||||
[this] {
|
||||
ped::ped_play_animation(m_handle, "mini@strip_club@private_dance@part1", "priv_dance_p1");
|
||||
ped::ped_play_animation(m_handle, "mini@strip_club@private_dance@part1", "priv_dance_p1", 3.5f, -4.0f, -1, 1);
|
||||
}},
|
||||
{"RECRUIT", [this] {
|
||||
TASK::CLEAR_PED_TASKS(m_handle);
|
||||
PED::SET_PED_AS_GROUP_MEMBER(m_handle, PED::GET_PED_GROUP_INDEX(self::ped));
|
||||
PED::SET_PED_RELATIONSHIP_GROUP_HASH(m_handle, PED::GET_PED_RELATIONSHIP_GROUP_HASH(self::ped));
|
||||
PED::SET_PED_RELATIONSHIP_GROUP_HASH(m_handle, PED::GET_PED_RELATIONSHIP_GROUP_HASH(self::ped));
|
||||
PED::SET_PED_NEVER_LEAVES_GROUP(m_handle, true);
|
||||
PED::SET_CAN_ATTACK_FRIENDLY(m_handle, 0, 1);
|
||||
PED::SET_PED_COMBAT_ABILITY(m_handle, 2);
|
||||
@ -158,7 +162,7 @@ namespace big
|
||||
PED::SET_PED_COMBAT_ATTRIBUTES(m_handle, 13, true);
|
||||
PED::SET_PED_CONFIG_FLAG(m_handle, 394, true);
|
||||
PED::SET_PED_CONFIG_FLAG(m_handle, 400, true);
|
||||
PED::SET_PED_CONFIG_FLAG(m_handle, 134, true);
|
||||
PED::SET_PED_CONFIG_FLAG(m_handle, 134, true);
|
||||
WEAPON::GIVE_WEAPON_TO_PED(m_handle, RAGE_JOAAT("weapon_microsmg"), 9999, false, false);
|
||||
WEAPON::GIVE_WEAPON_TO_PED(m_handle, RAGE_JOAAT("weapon_carbinerifle"), 9999, false, true);
|
||||
TASK::TASK_COMBAT_HATED_TARGETS_AROUND_PED(self::ped, 100, 67108864);
|
||||
@ -177,19 +181,19 @@ namespace big
|
||||
[this] {
|
||||
ped::steal_identity(m_handle);
|
||||
}},
|
||||
{"BREAKUP KICK",
|
||||
[this] {
|
||||
static player_command* command = dynamic_cast<player_command*>(command::get(rage::consteval_joaat("breakup")));
|
||||
command->call(ped::get_player_from_ped(m_handle), {});
|
||||
}},
|
||||
{"KICK",
|
||||
[this] {
|
||||
static player_command* command = dynamic_cast<player_command*>(command::get(rage::consteval_joaat("nfkick")));
|
||||
static player_command* command1 = dynamic_cast<player_command*>(command::get(rage::consteval_joaat("shkick")));
|
||||
static player_command* command2 = dynamic_cast<player_command*>(command::get(rage::consteval_joaat("endkick")));
|
||||
static player_command* command3 = dynamic_cast<player_command*>(command::get(rage::consteval_joaat("desync")));
|
||||
static player_command* command4 = dynamic_cast<player_command*>(command::get(rage::consteval_joaat("breakup")));
|
||||
command->call(ped::get_player_from_ped(m_handle), {});
|
||||
command1->call(ped::get_player_from_ped(m_handle), {});
|
||||
command2->call(ped::get_player_from_ped(m_handle), {});
|
||||
command3->call(ped::get_player_from_ped(m_handle), {});
|
||||
script::get_current()->yield(500ms);
|
||||
command4->call(ped::get_player_from_ped(m_handle), {});
|
||||
}},
|
||||
{"DISARM",
|
||||
[this] {
|
||||
@ -218,6 +222,25 @@ namespace big
|
||||
[this] {
|
||||
teleport::tp_on_top(m_handle, true);
|
||||
}},
|
||||
{"BRING",
|
||||
[this] {
|
||||
rage::fvector3 pos = *g_local_player->m_navigation->get_position();
|
||||
|
||||
if (PED::IS_PED_A_PLAYER(m_handle))
|
||||
{
|
||||
if (auto plyr = g_player_service->get_by_id(NETWORK::NETWORK_GET_PLAYER_INDEX_FROM_PED(m_handle)))
|
||||
{
|
||||
teleport::teleport_player_to_coords(plyr, {pos.x, pos.y, pos.z});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (entity::take_control_of(m_handle))
|
||||
{
|
||||
ENTITY::SET_ENTITY_COORDS(m_handle, pos.x, pos.y, pos.z, false, false, false, false);
|
||||
}
|
||||
}
|
||||
}},
|
||||
{"ENFLAME",
|
||||
[this] {
|
||||
Vector3 pos = ENTITY::GET_ENTITY_COORDS(m_handle, TRUE);
|
||||
|
@ -378,21 +378,9 @@ namespace big
|
||||
Vector3 campos = CAM::GET_CAM_COORD(m_cam);
|
||||
Vector3 entpos = ENTITY::GET_ENTITY_COORDS(entity::get_entity_closest_to_middle_of_screen(), 0);
|
||||
|
||||
if (*g_pointers->m_gta.m_is_session_started && g_player_service->get_selected()->is_valid()
|
||||
&& ENTITY::DOES_ENTITY_EXIST(g_pointers->m_gta.m_ptr_to_handle(g_player_service->get_selected()->get_ped())))
|
||||
{
|
||||
toxic::blame_explode_coord(g_player_service->get_selected(), m_ground_pos, eExplosionTag::EXP_TAG_ORBITAL_CANNON, 1.f, TRUE, TRUE, 1.f);
|
||||
|
||||
if (MISC::GET_DISTANCE_BETWEEN_COORDS(campos.x, campos.y, campos.z, entpos.x, entpos.y, entpos.z, false) < 10)
|
||||
toxic::blame_explode_coord(g_player_service->get_selected(), entpos, eExplosionTag::EXP_TAG_ORBITAL_CANNON, 1.f, TRUE, TRUE, 1.f);
|
||||
}
|
||||
else
|
||||
{
|
||||
toxic::blame_explode_coord(*g_pointers->m_gta.m_is_session_started ? g_player_service->get_self() : nullptr, m_ground_pos, eExplosionTag::EXP_TAG_ORBITAL_CANNON, 1.f, TRUE, TRUE, 1.f);
|
||||
if (MISC::GET_DISTANCE_BETWEEN_COORDS(campos.x, campos.y, campos.z, entpos.x, entpos.y, entpos.z, false) < 10)
|
||||
toxic::blame_explode_coord(*g_pointers->m_gta.m_is_session_started ? g_player_service->get_self() : nullptr, entpos, eExplosionTag::EXP_TAG_ORBITAL_CANNON, 1.f, TRUE, TRUE, 1.f);
|
||||
}
|
||||
|
||||
toxic::blame_explode_coord(*g_pointers->m_gta.m_is_session_started ? g_player_service->get_self() : nullptr, m_ground_pos, eExplosionTag::EXP_TAG_ORBITAL_CANNON, 1.f, TRUE, TRUE, 1.f);
|
||||
if (MISC::GET_DISTANCE_BETWEEN_COORDS(campos.x, campos.y, campos.z, entpos.x, entpos.y, entpos.z, false) < 10)
|
||||
toxic::blame_explode_coord(*g_pointers->m_gta.m_is_session_started ? g_player_service->get_self() : nullptr, entpos, eExplosionTag::EXP_TAG_ORBITAL_CANNON, 1.f, TRUE, TRUE, 1.f);
|
||||
|
||||
if (!STREAMING::HAS_NAMED_PTFX_ASSET_LOADED("scr_xm_orbital"))
|
||||
{
|
||||
|
@ -85,6 +85,8 @@ namespace big
|
||||
|
||||
bool block_explosions = false;
|
||||
|
||||
int spectating_player = -1;
|
||||
|
||||
protected:
|
||||
bool equals(const CNetGamePlayer* net_game_player) const;
|
||||
|
||||
|
@ -41,7 +41,7 @@ namespace big
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
LOG(WARNING) << "Failed fetching xml vehicles: " << e.what() << std::endl;
|
||||
LOG(WARNING) << "Failed fetching XML vehicles: " << e.what() << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -213,6 +213,7 @@ namespace big
|
||||
|
||||
ENTITY::SET_ENTITY_VISIBLE(vehicle_handle, vehicle_node.child("IsVisible").text().as_bool(), false);
|
||||
ENTITY::SET_ENTITY_INVINCIBLE(vehicle_handle, vehicle_node.child("IsInvincible").text().as_bool());
|
||||
ENTITY::SET_ENTITY_ALPHA(vehicle_handle, vehicle_node.child("OpacityLevel").text().as_int(), false);
|
||||
ENTITY::SET_ENTITY_PROOFS(vehicle_handle,
|
||||
vehicle_node.child("IsBulletProof").text().as_bool(),
|
||||
vehicle_node.child("IsFireProof").text().as_bool(),
|
||||
@ -255,19 +256,35 @@ namespace big
|
||||
attachment_handle = vehicle_attachment(attachment_item, entity_model, position, rotation, offset, vehicle_handle, bone);
|
||||
else if (type == 3)
|
||||
attachment_handle = object_attachment(attachment_item, entity_model, position, rotation, offset, vehicle_handle, bone);
|
||||
|
||||
if(!attachment_item.child("PtfxLopAsset").text().empty())
|
||||
|
||||
if (!attachment_item.child("PtfxLopAsset").text().empty())
|
||||
{
|
||||
const char* asset = const_cast<PCHAR>(attachment_item.child("PtfxLopAsset").text().as_string());
|
||||
STREAMING::REQUEST_NAMED_PTFX_ASSET(asset);
|
||||
|
||||
for (int i = 0; i < 35 && !STREAMING::HAS_NAMED_PTFX_ASSET_LOADED(asset); i++)
|
||||
STREAMING::REQUEST_NAMED_PTFX_ASSET(asset), script::get_current()->yield();
|
||||
|
||||
if(STREAMING::HAS_NAMED_PTFX_ASSET_LOADED(asset))
|
||||
|
||||
if (STREAMING::HAS_NAMED_PTFX_ASSET_LOADED(asset))
|
||||
{
|
||||
GRAPHICS::USE_PARTICLE_FX_ASSET(asset);
|
||||
GRAPHICS::START_NETWORKED_PARTICLE_FX_LOOPED_ON_ENTITY(const_cast<PCHAR>(attachment_item.child("PtfxLopEffect").text().as_string()), attachment_handle, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1);
|
||||
GRAPHICS::START_NETWORKED_PARTICLE_FX_LOOPED_ON_ENTITY(
|
||||
const_cast<PCHAR>(attachment_item.child("PtfxLopEffect").text().as_string()),
|
||||
attachment_handle,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1);
|
||||
STREAMING::REMOVE_NAMED_PTFX_ASSET(asset);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user