Add more spoofing options and added clang-format (#1020)

* feat(Spoofing): add spoofing
* feat(Spoofing): prepare code for player attach
* remove(PlayerAttach): isn't going to work due to netsync architecture
* fix(GUI): fix scaling
* feat(Project): add clang-format file
* feat(Classes): update classes
* fix(BlackHole): remove unnecessary cleanup
* fix(Formatting): fix formatting for initializer lists
* feat(clang-format): Set tab width and 1 space before comment

Co-authored-by: Yimura <24669514+Yimura@users.noreply.github.com>
This commit is contained in:
maybegreat48 2023-03-01 21:27:15 +00:00 committed by GitHub
parent 92aea20cd6
commit 97a8c5d60b
466 changed files with 55224 additions and 35596 deletions

74
.clang-format Normal file
View File

@ -0,0 +1,74 @@
BasedOnStyle: Microsoft
AccessModifierOffset: '-4'
AlignAfterOpenBracket: DontAlign
AlignConsecutiveAssignments: 'true'
AlignEscapedNewlines: Left
AlignOperands: 'false'
AlignTrailingComments: 'true'
AllowAllArgumentsOnNextLine: 'false'
AllowAllConstructorInitializersOnNextLine: 'false'
AllowAllParametersOfDeclarationOnNextLine: 'false'
AllowShortBlocksOnASingleLine: 'false'
AllowShortCaseLabelsOnASingleLine: 'true'
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: 'false'
AlwaysBreakTemplateDeclarations: 'Yes'
BinPackArguments: 'false'
BinPackParameters: 'true'
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeBraces: Allman
BreakBeforeTernaryOperators: 'false'
BreakConstructorInitializers: AfterColon
BreakInheritanceList: AfterColon
BreakStringLiterals: 'false'
CompactNamespaces: 'false'
ConstructorInitializerAllOnOneLineOrOnePerLine: 'false'
ConstructorInitializerIndentWidth: '4'
Cpp11BracedListStyle: 'true'
DerivePointerAlignment: 'false'
FixNamespaceComments: 'false'
IncludeBlocks: Regroup
IndentCaseLabels: 'false'
IndentPPDirectives: BeforeHash
IndentWidth: '4'
TabWidth: 4
IndentWrappedFunctionNames: 'true'
KeepEmptyLinesAtTheStartOfBlocks: 'false'
Language: Cpp
MacroBlockBegin: '0'
MaxEmptyLinesToKeep: '2'
NamespaceIndentation: All
PenaltyExcessCharacter: '0'
PenaltyReturnTypeOnItsOwnLine: '0'
PointerAlignment: Left
ReflowComments: 'false'
SortIncludes: 'true'
SortUsingDeclarations: 'true'
SpaceAfterCStyleCast: 'false'
SpaceAfterLogicalNot: 'false'
SpaceAfterTemplateKeyword: 'false'
SpaceBeforeAssignmentOperators: 'true'
SpaceBeforeCpp11BracedList: 'false'
SpaceBeforeCtorInitializerColon: 'true'
SpaceBeforeInheritanceColon: 'true'
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: 'true'
SpaceInEmptyParentheses: 'false'
SpacesBeforeTrailingComments: '1'
SpacesInAngles: 'false'
SpacesInCStyleCastParentheses: 'false'
SpacesInContainerLiterals: 'false'
SpacesInParentheses: 'false'
SpacesInSquareBrackets: 'false'
Standard: Auto
UseTab: ForIndentation
BreakBeforeBraces: Custom
BraceWrapping:
BeforeLambdaBody: 'false'
AfterCaseLabel: 'true'
PackConstructorInitializers: Never

View File

@ -3,7 +3,7 @@ include(FetchContent)
FetchContent_Declare( FetchContent_Declare(
gtav_classes gtav_classes
GIT_REPOSITORY https://github.com/Yimura/GTAV-Classes.git GIT_REPOSITORY https://github.com/Yimura/GTAV-Classes.git
GIT_TAG 9bf112e0431e3618978a8dd2fec12ffeeb7dd7ce GIT_TAG f71748dd1dfac7b1c678e0e8b87d2739bde314b6
GIT_PROGRESS TRUE GIT_PROGRESS TRUE
CONFIGURE_COMMAND "" CONFIGURE_COMMAND ""
BUILD_COMMAND "" BUILD_COMMAND ""

View File

@ -1,10 +1,11 @@
#include "backend.hpp" #include "backend.hpp"
#include "script.hpp"
#include "thread_pool.hpp"
#include "looped/looped.hpp" #include "looped/looped.hpp"
#include "services/context_menu/context_menu_service.hpp"
#include "script_patches.hpp"
#include "looped_command.hpp" #include "looped_command.hpp"
#include "script.hpp"
#include "script_patches.hpp"
#include "services/context_menu/context_menu_service.hpp"
#include "thread_pool.hpp"
namespace big namespace big
{ {
@ -15,7 +16,7 @@ namespace big
register_script_patches(); register_script_patches();
while (g_running) while (g_running)
{ {
looped::system_self_globals(); looped::system_self_globals();
looped::system_update_pointers(); looped::system_update_pointers();
@ -169,7 +170,6 @@ namespace big
while (g_running) while (g_running)
{ {
looped::custom_gun_disable_control_action(); looped::custom_gun_disable_control_action();
context_menu_service::disable_control_action_loop(); context_menu_service::disable_control_action_loop();
@ -183,7 +183,6 @@ namespace big
while (g_running) while (g_running)
{ {
looped::world_spawn_ped(); looped::world_spawn_ped();
script::get_current()->yield(); script::get_current()->yield();
} }

View File

@ -3,8 +3,8 @@
namespace big namespace big
{ {
bool_command::bool_command(const std::string& name, const std::string& label, const std::string& description, bool& toggle) : bool_command::bool_command(const std::string& name, const std::string& label, const std::string& description, bool& toggle) :
command(name, label, description, std::nullopt), command(name, label, description, std::nullopt),
m_toggle(toggle) m_toggle(toggle)
{ {
} }

View File

@ -9,12 +9,22 @@ namespace big
bool& m_toggle; bool& m_toggle;
virtual void execute(const std::vector<std::uint64_t>& args, const std::shared_ptr<command_context> ctx = std::make_shared<default_command_context>()) override; virtual void execute(const std::vector<std::uint64_t>& args, const std::shared_ptr<command_context> ctx = std::make_shared<default_command_context>()) override;
virtual std::optional<std::vector<std::uint64_t>> parse_args(const std::vector<std::string>& args, const std::shared_ptr<command_context> ctx = std::make_shared<default_command_context>()) override; virtual std::optional<std::vector<std::uint64_t>> parse_args(const std::vector<std::string>& args, const std::shared_ptr<command_context> ctx = std::make_shared<default_command_context>()) override;
public: public:
bool_command(const std::string& name, const std::string& label, const std::string& description, bool& toggle); bool_command(const std::string& name, const std::string& label, const std::string& description, bool& toggle);
inline bool& is_enabled() { return m_toggle; } inline bool& is_enabled()
{
return m_toggle;
}
virtual void refresh() {}; virtual void refresh(){};
virtual void enable() { m_toggle = true; }; virtual void enable()
virtual void disable() { m_toggle = false; }; {
m_toggle = true;
};
virtual void disable()
{
m_toggle = false;
};
}; };
} }

View File

@ -1,4 +1,5 @@
#include "command.hpp" #include "command.hpp"
#include "fiber_pool.hpp" #include "fiber_pool.hpp"
namespace namespace
@ -27,11 +28,11 @@ namespace
namespace big namespace big
{ {
command::command(const std::string& name, const std::string& label, const std::string& description, std::optional<std::uint8_t> num_args, bool fiber_pool) : command::command(const std::string& name, const std::string& label, const std::string& description, std::optional<std::uint8_t> num_args, bool fiber_pool) :
m_name(name), m_name(name),
m_label(label), m_label(label),
m_description(description), m_description(description),
m_num_args(num_args), m_num_args(num_args),
m_fiber_pool(fiber_pool) m_fiber_pool(fiber_pool)
{ {
g_commands[rage::joaat(name)] = this; g_commands[rage::joaat(name)] = this;
} }
@ -40,7 +41,10 @@ namespace big
{ {
if (m_num_args.has_value() && args.size() != m_num_args.value()) if (m_num_args.has_value() && args.size() != m_num_args.value())
{ {
ctx->report_error(std::format("Command {} called with the wrong number of arguments. Expected {}, got {}", m_name, m_num_args.value(), args.size())); ctx->report_error(std::format("Command {} called with the wrong number of arguments. Expected {}, got {}",
m_name,
m_num_args.value(),
args.size()));
return; return;
} }
@ -51,7 +55,9 @@ namespace big
} }
if (m_fiber_pool) if (m_fiber_pool)
g_fiber_pool->queue_job([this, args, ctx] { execute(args, ctx); }); g_fiber_pool->queue_job([this, args, ctx] {
execute(args, ctx);
});
else else
execute(args, ctx); execute(args, ctx);
} }
@ -60,7 +66,10 @@ namespace big
{ {
if (m_num_args.has_value() && args.size() != m_num_args.value()) if (m_num_args.has_value() && args.size() != m_num_args.value())
{ {
ctx->report_error(std::format("Command {} called with the wrong number of arguments. Expected {}, got {}", m_name, m_num_args.value(), args.size())); ctx->report_error(std::format("Command {} called with the wrong number of arguments. Expected {}, got {}",
m_name,
m_num_args.value(),
args.size()));
return; return;
} }
@ -98,7 +107,7 @@ namespace big
ctx->report_error("No command to call"); ctx->report_error("No command to call");
return; return;
} }
std::uint32_t hash = rage::joaat(args[0]); std::uint32_t hash = rage::joaat(args[0]);
if (!g_commands.contains(hash)) if (!g_commands.contains(hash))
{ {

View File

@ -1,8 +1,8 @@
#pragma once #pragma once
#include "gta/joaat.hpp"
#include "core/enums.hpp"
#include "context/command_context.hpp" #include "context/command_context.hpp"
#include "context/default_command_context.hpp" #include "context/default_command_context.hpp"
#include "core/enums.hpp"
#include "gta/joaat.hpp"
namespace big namespace big
{ {
@ -16,14 +16,29 @@ namespace big
bool m_fiber_pool; bool m_fiber_pool;
virtual void execute(const std::vector<std::uint64_t>& args, const std::shared_ptr<command_context> ctx = std::make_shared<default_command_context>()) = 0; virtual void execute(const std::vector<std::uint64_t>& args, const std::shared_ptr<command_context> ctx = std::make_shared<default_command_context>()) = 0;
virtual std::optional<std::vector<std::uint64_t>> parse_args(const std::vector<std::string>& args, const std::shared_ptr<command_context> ctx = std::make_shared<default_command_context>()) { return std::vector<std::uint64_t>(); }; virtual std::optional<std::vector<std::uint64_t>> parse_args(const std::vector<std::string>& args, const std::shared_ptr<command_context> ctx = std::make_shared<default_command_context>())
virtual CommandAccessLevel get_access_level() { return CommandAccessLevel::ADMIN; } {
return std::vector<std::uint64_t>();
};
virtual CommandAccessLevel get_access_level()
{
return CommandAccessLevel::ADMIN;
}
public: public:
command(const std::string& name, const std::string& label, const std::string& description, std::optional<std::uint8_t> num_args, bool fiber_pool = true); command(const std::string& name, const std::string& label, const std::string& description, std::optional<std::uint8_t> num_args, bool fiber_pool = true);
inline const std::string& get_name() { return m_name; } inline const std::string& get_name()
inline const std::string& get_label() { return m_label; } {
inline const std::string& get_description() { return m_description; } return m_name;
}
inline const std::string& get_label()
{
return m_label;
}
inline const std::string& get_description()
{
return m_description;
}
void call(const std::vector<std::uint64_t>& args, const std::shared_ptr<command_context> ctx = std::make_shared<default_command_context>()); void call(const std::vector<std::uint64_t>& args, const std::shared_ptr<command_context> ctx = std::make_shared<default_command_context>());
void call(const std::vector<std::string>& args, const std::shared_ptr<command_context> ctx = std::make_shared<default_command_context>()); void call(const std::vector<std::string>& args, const std::shared_ptr<command_context> ctx = std::make_shared<default_command_context>());
@ -36,5 +51,5 @@ namespace big
static void process(const std::string& text, const std::shared_ptr<command_context> ctx = std::make_shared<default_command_context>()); static void process(const std::string& text, const std::shared_ptr<command_context> ctx = std::make_shared<default_command_context>());
}; };
inline std::unordered_map<rage::joaat_t, command*> g_commands; inline std::unordered_map<rage::joaat_t, command*> g_commands;
} }

View File

@ -1,7 +1,7 @@
#include "backend/player_command.hpp" #include "backend/player_command.hpp"
#include "core/scr_globals.hpp"
#include "natives.hpp" #include "natives.hpp"
#include "pointers.hpp" #include "pointers.hpp"
#include "core/scr_globals.hpp"
#include <script/globals/GPBD_FM_3.hpp> #include <script/globals/GPBD_FM_3.hpp>
@ -18,13 +18,10 @@ namespace big
virtual void execute(player_ptr player, const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx) virtual void execute(player_ptr player, const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx)
{ {
const size_t arg_count = 3; const size_t arg_count = 3;
int64_t args[arg_count] = int64_t args[arg_count] = {(int64_t)eRemoteEvent::NetworkBail,
{ (int64_t)self::id,
(int64_t)eRemoteEvent::NetworkBail, scr_globals::gpbd_fm_3.as<GPBD_FM_3*>()->Entries[player->id()].ScriptEventReplayProtectionCounter};
(int64_t)self::id,
scr_globals::gpbd_fm_3.as<GPBD_FM_3*>()->Entries[player->id()].ScriptEventReplayProtectionCounter
};
g_pointers->m_trigger_script_event(1, args, arg_count, 1 << player->id()); g_pointers->m_trigger_script_event(1, args, arg_count, 1 << player->id());
} }

View File

@ -1,9 +1,9 @@
#include "backend/player_command.hpp"
#include "backend/bool_command.hpp" #include "backend/bool_command.hpp"
#include "natives.hpp" #include "backend/player_command.hpp"
#include "pointers.hpp"
#include "core/scr_globals.hpp" #include "core/scr_globals.hpp"
#include "gta_util.hpp" #include "gta_util.hpp"
#include "natives.hpp"
#include "pointers.hpp"
#include <network/Network.hpp> #include <network/Network.hpp>
@ -21,8 +21,8 @@ namespace big
virtual void execute(player_ptr player, const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx) virtual void execute(player_ptr player, const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx)
{ {
rage::snMsgRemoveGamersFromSessionCmd cmd{}; rage::snMsgRemoveGamersFromSessionCmd cmd{};
cmd.m_session_id = gta_util::get_network()->m_game_session_ptr->m_rline_session.m_session_id; cmd.m_session_id = gta_util::get_network()->m_game_session_ptr->m_rline_session.m_session_id;
cmd.m_num_peers = 1; cmd.m_num_peers = 1;
cmd.m_peer_ids[0] = player->get_session_peer()->m_peer_data.m_peer_id_2; cmd.m_peer_ids[0] = player->get_session_peer()->m_peer_data.m_peer_id_2;
if (g.session.show_cheating_message) if (g.session.show_cheating_message)
@ -38,8 +38,11 @@ namespace big
{ {
if (plyr->id() != player->id()) if (plyr->id() != player->id())
g_pointers->m_send_remove_gamer_cmd(gta_util::get_network()->m_game_session_ptr->m_net_connection_mgr, g_pointers->m_send_remove_gamer_cmd(gta_util::get_network()->m_game_session_ptr->m_net_connection_mgr,
g_pointers->m_get_connection_peer(gta_util::get_network()->m_game_session_ptr->m_net_connection_mgr, (int)plyr->get_session_player()->m_player_data.m_peer_id_2), g_pointers->m_get_connection_peer(gta_util::get_network()->m_game_session_ptr->m_net_connection_mgr,
gta_util::get_network()->m_game_session_ptr->m_connection_identifier, &cmd, 0x1000000); (int)plyr->get_session_player()->m_player_data.m_peer_id_2),
gta_util::get_network()->m_game_session_ptr->m_connection_identifier,
&cmd,
0x1000000);
} }
g_pointers->m_handle_remove_gamer_cmd(gta_util::get_network()->m_game_session_ptr, player->get_session_player(), &cmd); g_pointers->m_handle_remove_gamer_cmd(gta_util::get_network()->m_game_session_ptr, player->get_session_player(), &cmd);
@ -51,8 +54,11 @@ namespace big
if (plyr->is_host()) if (plyr->is_host())
{ {
g_pointers->m_send_remove_gamer_cmd(gta_util::get_network()->m_game_session_ptr->m_net_connection_mgr, g_pointers->m_send_remove_gamer_cmd(gta_util::get_network()->m_game_session_ptr->m_net_connection_mgr,
g_pointers->m_get_connection_peer(gta_util::get_network()->m_game_session_ptr->m_net_connection_mgr, (int)plyr->get_session_player()->m_player_data.m_peer_id_2), g_pointers->m_get_connection_peer(gta_util::get_network()->m_game_session_ptr->m_net_connection_mgr,
gta_util::get_network()->m_game_session_ptr->m_connection_identifier, &cmd, 0x1000000); (int)plyr->get_session_player()->m_player_data.m_peer_id_2),
gta_util::get_network()->m_game_session_ptr->m_connection_identifier,
&cmd,
0x1000000);
break; break;
} }
@ -62,5 +68,6 @@ namespace big
}; };
breakup_kick g_breakup_kick("breakup", "Breakup Kick", "Nearly unblockable but could be detected by others", 0, false); breakup_kick g_breakup_kick("breakup", "Breakup Kick", "Nearly unblockable but could be detected by others", 0, false);
bool_command g_show_cheating_message("breakupcheating", "Show Cheating Message", "Shows a \"was detected cheating and has been removed from the session\" instead of the usual leave message when the player gets kicked", g.session.show_cheating_message); bool_command g_show_cheating_message("breakupcheating", "Show Cheating Message", "Shows a \"was detected cheating and has been removed from the session\" instead of the usual leave message when the player gets kicked",
g.session.show_cheating_message);
} }

View File

@ -1,8 +1,8 @@
#include "backend/player_command.hpp" #include "backend/player_command.hpp"
#include "natives.hpp"
#include "pointers.hpp"
#include "core/scr_globals.hpp" #include "core/scr_globals.hpp"
#include "gta_util.hpp" #include "gta_util.hpp"
#include "natives.hpp"
#include "pointers.hpp"
#include <network/Network.hpp> #include <network/Network.hpp>
@ -29,5 +29,5 @@ namespace big
} }
}; };
complaint_kick g_complaint_kick("desync", "Desync Kick", "This may take around 10 seconds to kick the player. Does not work against the host", 0); // this is pretty much desync except we don't actually remove the player from CNetworkPlayerMgr complaint_kick g_complaint_kick("desync", "Desync Kick", "This may take around 10 seconds to kick the player. Does not work against the host", 0);// this is pretty much desync except we don't actually remove the player from CNetworkPlayerMgr
} }

View File

@ -1,7 +1,7 @@
#include "backend/player_command.hpp" #include "backend/player_command.hpp"
#include "core/scr_globals.hpp"
#include "natives.hpp" #include "natives.hpp"
#include "pointers.hpp" #include "pointers.hpp"
#include "core/scr_globals.hpp"
#include "util/scripts.hpp" #include "util/scripts.hpp"
namespace big namespace big
@ -24,7 +24,7 @@ namespace big
} }
g_player_service->m_player_to_use_end_session_kick = player; g_player_service->m_player_to_use_end_session_kick = player;
*scr_globals::gsbd.as<int*>() = (int)(__rdtsc() % 50000) + 6; // making the game trigger the broadcast is a bit difficult and requires a little bit of tampering with the value and luck *scr_globals::gsbd.as<int*>() = (int)(__rdtsc() % 50000) + 6;// making the game trigger the broadcast is a bit difficult and requires a little bit of tampering with the value and luck
} }
}; };

View File

@ -1,9 +1,9 @@
#include "backend/player_command.hpp" #include "backend/player_command.hpp"
#include "natives.hpp"
#include "pointers.hpp"
#include "core/scr_globals.hpp" #include "core/scr_globals.hpp"
#include "packet.hpp"
#include "gta_util.hpp" #include "gta_util.hpp"
#include "natives.hpp"
#include "packet.hpp"
#include "pointers.hpp"
#include <network/Network.hpp> #include <network/Network.hpp>

View File

@ -1,7 +1,7 @@
#include "backend/player_command.hpp" #include "backend/player_command.hpp"
#include "core/scr_globals.hpp"
#include "natives.hpp" #include "natives.hpp"
#include "pointers.hpp" #include "pointers.hpp"
#include "core/scr_globals.hpp"
namespace big namespace big
{ {
@ -16,13 +16,8 @@ namespace big
virtual void execute(player_ptr player, const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx) virtual void execute(player_ptr player, const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx)
{ {
const size_t arg_count = 15; const size_t arg_count = 15;
int64_t args[arg_count] = int64_t args[arg_count] = {(int64_t)eRemoteEvent::InteriorControl, (int64_t)self::id, (int64_t)(int)-1};
{
(int64_t)eRemoteEvent::InteriorControl,
(int64_t)self::id,
(int64_t)(int)-1
};
g_pointers->m_trigger_script_event(1, args, arg_count, 1 << player->id()); g_pointers->m_trigger_script_event(1, args, arg_count, 1 << player->id());
} }

View File

@ -1,9 +1,9 @@
#include "backend/player_command.hpp" #include "backend/player_command.hpp"
#include "natives.hpp"
#include "pointers.hpp"
#include "core/scr_globals.hpp" #include "core/scr_globals.hpp"
#include "util/scripts.hpp" #include "natives.hpp"
#include "packet.hpp" #include "packet.hpp"
#include "pointers.hpp"
#include "util/scripts.hpp"
namespace big namespace big
{ {

View File

@ -1,7 +1,7 @@
#include "backend/player_command.hpp" #include "backend/player_command.hpp"
#include "core/scr_globals.hpp"
#include "natives.hpp" #include "natives.hpp"
#include "pointers.hpp" #include "pointers.hpp"
#include "core/scr_globals.hpp"
#include "util/scripts.hpp" #include "util/scripts.hpp"
namespace big namespace big

View File

@ -1,11 +1,11 @@
#include "backend/player_command.hpp" #include "backend/player_command.hpp"
#include "core/scr_globals.hpp"
#include "natives.hpp" #include "natives.hpp"
#include "pointers.hpp" #include "pointers.hpp"
#include "core/scr_globals.hpp"
#include "util/misc.hpp" #include "util/misc.hpp"
#include <script/globals/GlobalPlayerBD.hpp>
#include <script/globals/GPBD_FM.hpp> #include <script/globals/GPBD_FM.hpp>
#include <script/globals/GlobalPlayerBD.hpp>
namespace big namespace big
{ {
@ -18,22 +18,28 @@ namespace big
int id = player->id(); int id = player->id();
if (scr_globals::gpbd_fm_1.as<GPBD_FM*>()->Entries[id].PropertyData.Index != -1) if (scr_globals::gpbd_fm_1.as<GPBD_FM*>()->Entries[id].PropertyData.Index != -1)
{ {
const size_t arg_count = 9; const size_t arg_count = 9;
int64_t args[arg_count] = { int64_t args[arg_count] = {(int64_t)eRemoteEvent::Teleport,
(int64_t)eRemoteEvent::Teleport, self::id,
self::id, (int64_t)player->id(),
(int64_t)player->id(), (int64_t)(int)-1,
(int64_t)(int)-1, 1, (int64_t)scr_globals::gpbd_fm_1.as<GPBD_FM*>()->Entries[id].PropertyData.Index, 1, 0, 1 1,
}; (int64_t)scr_globals::gpbd_fm_1.as<GPBD_FM*>()->Entries[id].PropertyData.Index,
1,
0,
1};
g_pointers->m_trigger_script_event(1, args, arg_count, 1 << self::id); g_pointers->m_trigger_script_event(1, args, arg_count, 1 << self::id);
} }
else if (scr_globals::globalplayer_bd.as<GlobalPlayerBD*>()->Entries[id].SimpleInteriorData.Index != eSimpleInteriorIndex::SIMPLE_INTERIOR_INVALID) else if (scr_globals::globalplayer_bd.as<GlobalPlayerBD*>()->Entries[id].SimpleInteriorData.Index != eSimpleInteriorIndex::SIMPLE_INTERIOR_INVALID)
{ {
*script_global(1950108).at(3346).as<Player*>() = scr_globals::globalplayer_bd.as<GlobalPlayerBD*>()->Entries[id].SimpleInteriorData.Owner; *script_global(1950108).at(3346).as<Player*>() =
*script_global(1950108).at(3683).as<eSimpleInteriorIndex*>() = scr_globals::globalplayer_bd.as<GlobalPlayerBD*>()->Entries[id].SimpleInteriorData.Index; scr_globals::globalplayer_bd.as<GlobalPlayerBD*>()->Entries[id].SimpleInteriorData.Owner;
*script_global(1950108).at(3683).as<eSimpleInteriorIndex*>() =
scr_globals::globalplayer_bd.as<GlobalPlayerBD*>()->Entries[id].SimpleInteriorData.Index;
*script_global(1950108).at(3682).as<bool*>() = true; *script_global(1950108).at(3682).as<bool*>() = true;
scr_globals::globalplayer_bd.as<GlobalPlayerBD*>()->Entries[self::id].SimpleInteriorData.InteriorSubtype = scr_globals::globalplayer_bd.as<GlobalPlayerBD*>()->Entries[id].SimpleInteriorData.InteriorSubtype; scr_globals::globalplayer_bd.as<GlobalPlayerBD*>()->Entries[self::id].SimpleInteriorData.InteriorSubtype =
scr_globals::globalplayer_bd.as<GlobalPlayerBD*>()->Entries[id].SimpleInteriorData.InteriorSubtype;
} }
else else
{ {

View File

@ -1,8 +1,8 @@
#include "backend/player_command.hpp" #include "backend/player_command.hpp"
#include "natives.hpp" #include "natives.hpp"
#include "pointers.hpp" #include "pointers.hpp"
#include "util/globals.hpp"
#include "services/pickups/pickup_service.hpp" #include "services/pickups/pickup_service.hpp"
#include "util/globals.hpp"
namespace big namespace big
{ {

View File

@ -1,8 +1,8 @@
#include "backend/player_command.hpp" #include "backend/player_command.hpp"
#include "natives.hpp" #include "natives.hpp"
#include "pointers.hpp" #include "pointers.hpp"
#include "util/globals.hpp"
#include "services/pickups/pickup_service.hpp" #include "services/pickups/pickup_service.hpp"
#include "util/globals.hpp"
namespace big namespace big
{ {

View File

@ -1,8 +1,8 @@
#include "backend/player_command.hpp" #include "backend/player_command.hpp"
#include "natives.hpp" #include "natives.hpp"
#include "pointers.hpp" #include "pointers.hpp"
#include "util/globals.hpp"
#include "services/pickups/pickup_service.hpp" #include "services/pickups/pickup_service.hpp"
#include "util/globals.hpp"
namespace big namespace big
{ {

View File

@ -1,7 +1,7 @@
#include "backend/player_command.hpp" #include "backend/player_command.hpp"
#include "core/scr_globals.hpp"
#include "natives.hpp" #include "natives.hpp"
#include "pointers.hpp" #include "pointers.hpp"
#include "core/scr_globals.hpp"
#include "script_function.hpp" #include "script_function.hpp"
namespace big namespace big
@ -12,7 +12,7 @@ namespace big
virtual void execute(player_ptr player, const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx) virtual void execute(player_ptr player, const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx)
{ {
scr_functions::join_ceo({ player->id(), 0, false, false }); scr_functions::join_ceo({player->id(), 0, false, false});
} }
}; };

View File

@ -11,11 +11,9 @@ namespace big
virtual void execute(player_ptr player, const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx) virtual void execute(player_ptr player, const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx)
{ {
ped::steal_identity( ped::steal_identity(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id()));
PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id())
);
} }
}; };
steal_identity g_steal_identity("copymodel", "Steal Identity", "Copies the player's model to your ped", 0, false); // do we really need this? steal_identity g_steal_identity("copymodel", "Steal Identity", "Copies the player's model to your ped", 0, false);// do we really need this?
} }

View File

@ -11,9 +11,7 @@ namespace big
virtual void execute(player_ptr player, const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx) virtual void execute(player_ptr player, const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx)
{ {
ped::steal_outfit( ped::steal_outfit(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id()));
PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id())
);
} }
}; };

View File

@ -1,7 +1,7 @@
#include "backend/player_command.hpp" #include "backend/player_command.hpp"
#include "core/scr_globals.hpp"
#include "natives.hpp" #include "natives.hpp"
#include "pointers.hpp" #include "pointers.hpp"
#include "core/scr_globals.hpp"
namespace big namespace big
{ {
@ -23,11 +23,8 @@ namespace big
else if (leader == player->id()) else if (leader == player->id())
{ {
const size_t arg_count = 2; const size_t arg_count = 2;
int64_t args[arg_count] = { int64_t args[arg_count] = {(int64_t)eRemoteEvent::CeoKick, (int64_t)self::id};
(int64_t)eRemoteEvent::CeoKick,
(int64_t)self::id
};
g_pointers->m_trigger_script_event(1, args, arg_count, 1 << player->id()); g_pointers->m_trigger_script_event(1, args, arg_count, 1 << player->id());
return; return;
@ -35,12 +32,8 @@ namespace big
else else
{ {
// use a more private method to remove associate // use a more private method to remove associate
const size_t arg_count = 3; const size_t arg_count = 3;
int64_t args[arg_count] = { int64_t args[arg_count] = {(int64_t)eRemoteEvent::MarkPlayerAsBeast, (int64_t)self::id, leader};
(int64_t)eRemoteEvent::MarkPlayerAsBeast,
(int64_t)self::id,
leader
};
g_pointers->m_trigger_script_event(1, args, arg_count, 1 << player->id()); g_pointers->m_trigger_script_event(1, args, arg_count, 1 << player->id());
} }

View File

@ -1,7 +1,7 @@
#include "backend/player_command.hpp" #include "backend/player_command.hpp"
#include "core/scr_globals.hpp"
#include "natives.hpp" #include "natives.hpp"
#include "pointers.hpp" #include "pointers.hpp"
#include "core/scr_globals.hpp"
namespace big namespace big
{ {
@ -16,13 +16,8 @@ namespace big
virtual void execute(player_ptr player, const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx) virtual void execute(player_ptr player, const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx)
{ {
const size_t arg_count = 3; const size_t arg_count = 3;
int64_t args[arg_count] = int64_t args[arg_count] = {(int64_t)eRemoteEvent::ForceMission, (int64_t)self::id, 0};
{
(int64_t)eRemoteEvent::ForceMission,
(int64_t)self::id,
0
};
g_pointers->m_trigger_script_event(1, args, arg_count, 1 << player->id()); g_pointers->m_trigger_script_event(1, args, arg_count, 1 << player->id());
} }

View File

@ -1,8 +1,8 @@
#include "backend/player_command.hpp" #include "backend/player_command.hpp"
#include "natives.hpp" #include "natives.hpp"
#include "pointers.hpp" #include "pointers.hpp"
#include "services/gta_data/gta_data_service.hpp"
#include "script.hpp" #include "script.hpp"
#include "services/gta_data/gta_data_service.hpp"
namespace big namespace big
{ {
@ -33,10 +33,10 @@ namespace big
virtual void execute(const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx) virtual void execute(const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx)
{ {
g_player_service->iterate([](auto& plyr) { g_player_service->iterate([](auto& plyr) {
for (auto& weapon : g_gta_data_service->weapons()) for (auto& weapon : g_gta_data_service->weapons())
WEAPON::GIVE_WEAPON_TO_PED(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(plyr.second->id()), weapon.second.m_hash, 9999, FALSE, FALSE); WEAPON::GIVE_WEAPON_TO_PED(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(plyr.second->id()), weapon.second.m_hash, 9999, FALSE, FALSE);
script::get_current()->yield(500ms); script::get_current()->yield(500ms);
}); });
} }
}; };

View File

@ -1,11 +1,11 @@
#include "hooking.hpp"
#include "backend/player_command.hpp" #include "backend/player_command.hpp"
#include "natives.hpp"
#include "pointers.hpp"
#include "gta/net_object_mgr.hpp"
#include "core/scr_globals.hpp" #include "core/scr_globals.hpp"
#include "fiber_pool.hpp" #include "fiber_pool.hpp"
#include "gta/net_object_mgr.hpp"
#include "gta/script_handler.hpp" #include "gta/script_handler.hpp"
#include "hooking.hpp"
#include "natives.hpp"
#include "pointers.hpp"
#include "util/scripts.hpp" #include "util/scripts.hpp"
#include <script/globals/GPBD_FM.hpp> #include <script/globals/GPBD_FM.hpp>
@ -24,10 +24,9 @@ namespace big
virtual void execute(player_ptr player, const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx) virtual void execute(player_ptr player, const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx)
{ {
if (scr_globals::gpbd_fm_1.as<GPBD_FM*>()->Entries[player->id()].PropertyData.Index != -1) if (scr_globals::gpbd_fm_1.as<GPBD_FM*>()->Entries[player->id()].PropertyData.Index != -1)
{ {
int id = player->id(); int id = player->id();
g_fiber_pool->queue_job([id] g_fiber_pool->queue_job([id] {
{
int instance = -1; int instance = -1;
for (int i = 0; i < 32; i++) for (int i = 0; i < 32; i++)
@ -38,7 +37,7 @@ namespace big
break; break;
} }
} }
if (instance == -1) if (instance == -1)
{ {
@ -53,7 +52,7 @@ namespace big
auto program = gta_util::find_script_program(RAGE_JOAAT("am_mp_property_int")); auto program = gta_util::find_script_program(RAGE_JOAAT("am_mp_property_int"));
int count = program->m_local_count; int count = program->m_local_count;
program->m_local_count = 2; program->m_local_count = 2;
int id = SYSTEM::START_NEW_SCRIPT_WITH_NAME_HASH(RAGE_JOAAT("am_mp_property_int"), 1424); int id = SYSTEM::START_NEW_SCRIPT_WITH_NAME_HASH(RAGE_JOAAT("am_mp_property_int"), 1424);
program->m_local_count = count; program->m_local_count = count;
@ -64,11 +63,11 @@ namespace big
return; return;
script->m_context.m_state = rage::eThreadState::unk_3; script->m_context.m_state = rage::eThreadState::unk_3;
gta_util::execute_as_script(script, [instance]
{ gta_util::execute_as_script(script, [instance] {
if (auto hook = g_hooking->m_handler_hooks[(CGameScriptHandler*)rage::scrThread::get()->m_handler].get()) if (auto hook =
g_hooking->m_handler_hooks[(CGameScriptHandler*)rage::scrThread::get()->m_handler].get())
{ {
hook->disable(); hook->disable();
g_hooking->m_handler_hooks.erase((CGameScriptHandler*)rage::scrThread::get()->m_handler); g_hooking->m_handler_hooks.erase((CGameScriptHandler*)rage::scrThread::get()->m_handler);
@ -80,7 +79,9 @@ namespace big
for (int i = 0; i < 100; i++) for (int i = 0; i < 100; i++)
{ {
int status = 0; int status = 0;
gta_util::execute_as_script(script, [&status] { status = NETWORK::NETWORK_GET_SCRIPT_STATUS(); }); gta_util::execute_as_script(script, [&status] {
status = NETWORK::NETWORK_GET_SCRIPT_STATUS();
});
if (status == 2) if (status == 2)
break; break;
@ -97,8 +98,7 @@ namespace big
static uint64_t server_vars[1358]{}; static uint64_t server_vars[1358]{};
static uint64_t client_vars[1185]{}; static uint64_t client_vars[1185]{};
gta_util::execute_as_script(script, [] gta_util::execute_as_script(script, [] {
{
NETWORK::NETWORK_REGISTER_HOST_BROADCAST_VARIABLES((int*)server_vars, 1358, 0); NETWORK::NETWORK_REGISTER_HOST_BROADCAST_VARIABLES((int*)server_vars, 1358, 0);
NETWORK::NETWORK_REGISTER_PLAYER_BROADCAST_VARIABLES((int*)client_vars, 1185, 0); NETWORK::NETWORK_REGISTER_PLAYER_BROADCAST_VARIABLES((int*)client_vars, 1185, 0);
}); });
@ -106,7 +106,9 @@ namespace big
for (int i = 0; i < 3600; i++) for (int i = 0; i < 3600; i++)
{ {
bool received = false; bool received = false;
gta_util::execute_as_script(script, [&received] { received = NETWORK::NETWORK_HAS_RECEIVED_HOST_BROADCAST_DATA(); }); gta_util::execute_as_script(script, [&received] {
received = NETWORK::NETWORK_HAS_RECEIVED_HOST_BROADCAST_DATA();
});
if (received) if (received)
break; break;
@ -130,15 +132,14 @@ namespace big
{ {
const size_t arg_count = 8; const size_t arg_count = 8;
int64_t args[arg_count]{ int64_t args[arg_count]{
(int64_t)eRemoteEvent::KickFromInterior, (int64_t)eRemoteEvent::KickFromInterior,
(int64_t)self::id, (int64_t)self::id,
*scr_globals::globalplayer_bd.at(player->id(), scr_globals::size::globalplayer_bd).at(321).at(7).as<int64_t*>(), *scr_globals::globalplayer_bd.at(player->id(), scr_globals::size::globalplayer_bd).at(321).at(7).as<int64_t*>(),
*scr_globals::globalplayer_bd.at(player->id(), scr_globals::size::globalplayer_bd).at(321).at(8).as<int64_t*>(), *scr_globals::globalplayer_bd.at(player->id(), scr_globals::size::globalplayer_bd).at(321).at(8).as<int64_t*>(),
}; };
g_pointers->m_trigger_script_event(1, args, arg_count, 1 << player->id()); g_pointers->m_trigger_script_event(1, args, arg_count, 1 << player->id());
} }
} }
}; };

View File

@ -1,7 +1,7 @@
#include "backend/player_command.hpp" #include "backend/player_command.hpp"
#include "gta/net_object_mgr.hpp"
#include "natives.hpp" #include "natives.hpp"
#include "pointers.hpp" #include "pointers.hpp"
#include "gta/net_object_mgr.hpp"
namespace big namespace big
{ {
@ -21,11 +21,8 @@ namespace big
if (!vehicle || !vehicle->m_net_object) if (!vehicle || !vehicle->m_net_object)
{ {
// vehicle hasn't synced yet, use TSE // vehicle hasn't synced yet, use TSE
const size_t arg_count = 9; const size_t arg_count = 9;
int64_t args[arg_count] = { int64_t args[arg_count] = {(int64_t)eRemoteEvent::VehicleKick, self::id, 0, 0, 0, 0, 0, 0, 0};
(int64_t)eRemoteEvent::VehicleKick,
self::id, 0, 0, 0, 0, 0, 0, 0
};
g_pointers->m_trigger_script_event(1, args, arg_count, 1 << player->id()); g_pointers->m_trigger_script_event(1, args, arg_count, 1 << player->id());
} }

View File

@ -18,8 +18,24 @@ namespace big
if (!player->get_ped()) if (!player->get_ped())
return; return;
g_pointers->m_send_network_damage((CEntity*)g_player_service->get_self()->get_ped(), (CEntity*)player->get_ped(), player->get_ped()->m_navigation->get_position(), g_pointers->m_send_network_damage((CEntity*)g_player_service->get_self()->get_ped(),
0, true, RAGE_JOAAT("weapon_explosion"), 10000.0f, 2, 0, (1 << 4), 0, 0, 0, false, false, true, true, nullptr); (CEntity*)player->get_ped(),
player->get_ped()->m_navigation->get_position(),
0,
true,
RAGE_JOAAT("weapon_explosion"),
10000.0f,
2,
0,
(1 << 4),
0,
0,
0,
false,
false,
true,
true,
nullptr);
} }
}; };

View File

@ -1,7 +1,7 @@
#include "backend/player_command.hpp" #include "backend/player_command.hpp"
#include "core/scr_globals.hpp"
#include "natives.hpp" #include "natives.hpp"
#include "pointers.hpp" #include "pointers.hpp"
#include "core/scr_globals.hpp"
#include <script/globals/GPBD_FM_3.hpp> #include <script/globals/GPBD_FM_3.hpp>
@ -18,12 +18,8 @@ namespace big
virtual void execute(player_ptr player, const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx) virtual void execute(player_ptr player, const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx)
{ {
const size_t arg_count = 8; const size_t arg_count = 8;
int64_t args[arg_count] = int64_t args[arg_count] = {(int64_t)eRemoteEvent::SendTextLabelSMS, self::id};
{
(int64_t)eRemoteEvent::SendTextLabelSMS,
self::id
};
strcpy((char*)&args[2], "HUD_ROSBANPERM"); strcpy((char*)&args[2], "HUD_ROSBANPERM");

View File

@ -1,22 +1,15 @@
#include "backend/player_command.hpp" #include "backend/player_command.hpp"
#include "core/scr_globals.hpp"
#include "natives.hpp" #include "natives.hpp"
#include "pointers.hpp" #include "pointers.hpp"
#include "core/scr_globals.hpp"
#include <script/globals/GPBD_FM_3.hpp> #include <script/globals/GPBD_FM_3.hpp>
namespace big namespace big
{ {
static constexpr auto strippers = std::to_array({ static constexpr auto strippers = std::to_array({"HCH", "INF", "JUL", "NIK", "SAP", "TXI"});
"HCH",
"INF",
"JUL",
"NIK",
"SAP",
"TXI"
});
static constexpr auto sext_types = std::to_array({ "1ST", "2ND", "NEED" }); static constexpr auto sext_types = std::to_array({"1ST", "2ND", "NEED"});
class send_sext : player_command class send_sext : player_command
{ {
@ -29,14 +22,12 @@ namespace big
virtual void execute(player_ptr player, const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx) virtual void execute(player_ptr player, const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx)
{ {
const size_t arg_count = 8; const size_t arg_count = 8;
int64_t args[arg_count] = int64_t args[arg_count] = {(int64_t)eRemoteEvent::SendTextLabelSMS, self::id};
{
(int64_t)eRemoteEvent::SendTextLabelSMS,
self::id
};
strcpy((char*)&args[2], (std::string("SXT_") + strippers[rand() % strippers.size()] + "_" + sext_types[rand() % sext_types.size()]).data()); strcpy((char*)&args[2],
(std::string("SXT_") + strippers[rand() % strippers.size()] + "_" + sext_types[rand() % sext_types.size()])
.data());
g_pointers->m_trigger_script_event(1, args, arg_count, 1 << player->id()); g_pointers->m_trigger_script_event(1, args, arg_count, 1 << player->id());
} }
}; };

View File

@ -1,7 +1,7 @@
#include "backend/player_command.hpp" #include "backend/player_command.hpp"
#include "core/scr_globals.hpp"
#include "natives.hpp" #include "natives.hpp"
#include "pointers.hpp" #include "pointers.hpp"
#include "core/scr_globals.hpp"
namespace big namespace big
{ {
@ -11,7 +11,7 @@ namespace big
virtual std::optional<std::vector<std::uint64_t>> parse_args_p(const std::vector<std::string>& args, const std::shared_ptr<command_context> ctx) virtual std::optional<std::vector<std::uint64_t>> parse_args_p(const std::vector<std::string>& args, const std::shared_ptr<command_context> ctx)
{ {
return std::vector<std::uint64_t>{ (uint64_t)std::atoi(args[0].c_str()) }; return std::vector<std::uint64_t>{(uint64_t)std::atoi(args[0].c_str())};
} }
virtual CommandAccessLevel get_access_level() virtual CommandAccessLevel get_access_level()
@ -22,12 +22,7 @@ namespace big
virtual void execute(player_ptr player, const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx) virtual void execute(player_ptr player, const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx)
{ {
const size_t arg_count = 9; const size_t arg_count = 9;
int64_t args[arg_count] = { int64_t args[arg_count] = {(int64_t)eRemoteEvent::Teleport, self::id, (int64_t)player->id(), (int64_t)(int)-1, 1, (int64_t)_args[0], 1, 1, 1};
(int64_t)eRemoteEvent::Teleport,
self::id,
(int64_t)player->id(),
(int64_t)(int)-1, 1, (int64_t)_args[0], 1, 1, 1
};
g_pointers->m_trigger_script_event(1, args, arg_count, 1 << player->id()); g_pointers->m_trigger_script_event(1, args, arg_count, 1 << player->id());
} }

View File

@ -10,7 +10,7 @@ namespace big
virtual std::optional<std::vector<std::uint64_t>> parse_args_p(const std::vector<std::string>& args, const std::shared_ptr<command_context> ctx) virtual std::optional<std::vector<std::uint64_t>> parse_args_p(const std::vector<std::string>& args, const std::shared_ptr<command_context> ctx)
{ {
return std::vector<std::uint64_t>{ (uint64_t)std::atoi(args[0].c_str()) }; return std::vector<std::uint64_t>{(uint64_t)std::atoi(args[0].c_str())};
} }
virtual CommandAccessLevel get_access_level() virtual CommandAccessLevel get_access_level()
@ -20,27 +20,24 @@ namespace big
virtual void execute(player_ptr player, const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx) virtual void execute(player_ptr player, const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx)
{ {
float max = 1e+38f; float max = 1e+38f;
auto coords = ENTITY::GET_ENTITY_COORDS(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id()), FALSE); auto coords = ENTITY::GET_ENTITY_COORDS(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id()), FALSE);
const size_t arg_count = 15; const size_t arg_count = 15;
int64_t args[arg_count] = int64_t args[arg_count] = {(int64_t)eRemoteEvent::InteriorControl,
{ (int64_t)self::id,
(int64_t)eRemoteEvent::InteriorControl, (int64_t)(int)_args[0],
(int64_t)self::id, (int64_t)self::id,
(int64_t)(int)_args[0], (int64_t) false,
(int64_t)self::id, (int64_t) true,// true means enter sender interior
(int64_t)false, (int64_t) * (uint32_t*)&coords.x,
(int64_t)true, // true means enter sender interior (int64_t) * (uint32_t*)&coords.y,
(int64_t) * (uint32_t*)&coords.x, (int64_t) * (uint32_t*)&coords.z,
(int64_t) * (uint32_t*)&coords.y, 0,
(int64_t) * (uint32_t*)&coords.z, 0,
0, 1,
0, (int64_t) * (uint32_t*)&max,
1, (int64_t) true,
(int64_t) * (uint32_t*)&max, -1};
(int64_t)true,
-1
};
g_pointers->m_trigger_script_event(1, args, arg_count, 1 << player->id()); g_pointers->m_trigger_script_event(1, args, arg_count, 1 << player->id());
} }

View File

@ -1,7 +1,7 @@
#include "backend/player_command.hpp" #include "backend/player_command.hpp"
#include "core/scr_globals.hpp"
#include "natives.hpp" #include "natives.hpp"
#include "pointers.hpp" #include "pointers.hpp"
#include "core/scr_globals.hpp"
namespace big namespace big
{ {
@ -16,10 +16,10 @@ namespace big
virtual void execute(player_ptr player, const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx) virtual void execute(player_ptr player, const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx)
{ {
const size_t arg_count = 2; const size_t arg_count = 2;
int64_t args[arg_count] = { int64_t args[arg_count] = {
(int64_t)eRemoteEvent::SendToCayoPerico, (int64_t)eRemoteEvent::SendToCayoPerico,
(int64_t)self::id, (int64_t)self::id,
}; };
g_pointers->m_trigger_script_event(1, args, arg_count, 1 << player->id()); g_pointers->m_trigger_script_event(1, args, arg_count, 1 << player->id());

View File

@ -1,7 +1,7 @@
#include "backend/player_command.hpp" #include "backend/player_command.hpp"
#include "core/scr_globals.hpp"
#include "natives.hpp" #include "natives.hpp"
#include "pointers.hpp" #include "pointers.hpp"
#include "core/scr_globals.hpp"
namespace big namespace big
{ {
@ -11,7 +11,7 @@ namespace big
virtual std::optional<std::vector<std::uint64_t>> parse_args_p(const std::vector<std::string>& args, const std::shared_ptr<command_context> ctx) virtual std::optional<std::vector<std::uint64_t>> parse_args_p(const std::vector<std::string>& args, const std::shared_ptr<command_context> ctx)
{ {
return std::vector<std::uint64_t>{ (uint64_t)std::atoi(args[0].c_str()) }; return std::vector<std::uint64_t>{(uint64_t)std::atoi(args[0].c_str())};
} }
virtual CommandAccessLevel get_access_level() virtual CommandAccessLevel get_access_level()
@ -22,13 +22,7 @@ namespace big
virtual void execute(player_ptr player, const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx) virtual void execute(player_ptr player, const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx)
{ {
const size_t arg_count = 6; const size_t arg_count = 6;
int64_t args[arg_count] = { int64_t args[arg_count] = {(int64_t)eRemoteEvent::TeleportToWarehouse, self::id, (int64_t)player->id(), 1, (int64_t)_args[0]};
(int64_t)eRemoteEvent::TeleportToWarehouse,
self::id,
(int64_t)player->id(),
1,
(int64_t)_args[0]
};
g_pointers->m_trigger_script_event(1, args, arg_count, 1 << player->id()); g_pointers->m_trigger_script_event(1, args, arg_count, 1 << player->id());
} }

View File

@ -1,9 +1,9 @@
#include "backend/player_command.hpp" #include "backend/player_command.hpp"
#include "core/scr_globals.hpp"
#include "natives.hpp" #include "natives.hpp"
#include "pointers.hpp" #include "pointers.hpp"
#include "core/scr_globals.hpp"
#include "util/globals.hpp"
#include "script.hpp" #include "script.hpp"
#include "util/globals.hpp"
#include <script/globals/GlobalPlayerBD.hpp> #include <script/globals/GlobalPlayerBD.hpp>
@ -23,7 +23,7 @@ namespace big
return std::nullopt; return std::nullopt;
} }
return std::vector<std::uint64_t>{ level }; return std::vector<std::uint64_t>{level};
} }
virtual CommandAccessLevel get_access_level() virtual CommandAccessLevel get_access_level()

View File

@ -1,7 +1,7 @@
#include "backend/player_command.hpp" #include "backend/player_command.hpp"
#include "core/scr_globals.hpp"
#include "natives.hpp" #include "natives.hpp"
#include "pointers.hpp" #include "pointers.hpp"
#include "core/scr_globals.hpp"
#include <script/globals/GPBD_FM_3.hpp> #include <script/globals/GPBD_FM_3.hpp>
@ -18,18 +18,15 @@ namespace big
virtual void execute(player_ptr player, const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx) virtual void execute(player_ptr player, const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx)
{ {
const size_t arg_count = 8; const size_t arg_count = 8;
int64_t args[arg_count] = int64_t args[arg_count] = {(int64_t)eRemoteEvent::TransactionError,
{ (int64_t)self::id,
(int64_t)eRemoteEvent::TransactionError, 1,
(int64_t)self::id, 0,
1, 0,
0, scr_globals::gpbd_fm_3.as<GPBD_FM_3*>()->Entries[player->id()].ScriptEventReplayProtectionCounter,
0, *scr_globals::gsbd_fm_events.at(9).as<int*>(),
scr_globals::gpbd_fm_3.as<GPBD_FM_3*>()->Entries[player->id()].ScriptEventReplayProtectionCounter, *scr_globals::gsbd_fm_events.at(10).as<int*>()};
*scr_globals::gsbd_fm_events.at(9).as<int*>(),
*scr_globals::gsbd_fm_events.at(10).as<int*>()
};
g_pointers->m_trigger_script_event(1, args, arg_count, 1 << player->id()); g_pointers->m_trigger_script_event(1, args, arg_count, 1 << player->id());
} }

View File

@ -1,14 +1,14 @@
#include "backend/player_command.hpp" #include "backend/player_command.hpp"
#include "core/scr_globals.hpp"
#include "natives.hpp" #include "natives.hpp"
#include "pointers.hpp" #include "pointers.hpp"
#include "script.hpp" #include "script.hpp"
#include <script/globals/GPBD_FM_3.hpp> #include <script/globals/GPBD_FM_3.hpp>
#include "core/scr_globals.hpp"
namespace big namespace big
{ {
template <int scriptId, int arg19 = 0> template<int scriptId, int arg19 = 0>
class start_script : player_command class start_script : player_command
{ {
using player_command::player_command; using player_command::player_command;
@ -20,12 +20,8 @@ namespace big
virtual void execute(player_ptr player, const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx) virtual void execute(player_ptr player, const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx)
{ {
const size_t arg_count = 25; const size_t arg_count = 25;
int64_t args[arg_count] = int64_t args[arg_count] = {(int64_t)eRemoteEvent::StartScriptBegin, (int64_t)self::id};
{
(int64_t)eRemoteEvent::StartScriptBegin,
(int64_t)self::id
};
args[2] = scriptId; args[2] = scriptId;
strcpy((char*)&args[2 + 3], "0"); strcpy((char*)&args[2 + 3], "0");
@ -38,13 +34,9 @@ namespace big
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
const size_t arg_count_2 = 25; const size_t arg_count_2 = 25;
int64_t args_2[arg_count_2] = int64_t args_2[arg_count_2] = {(int64_t)eRemoteEvent::StartScriptProceed, (int64_t)self::id};
{ args_2[2 + 17] = 1337;
(int64_t)eRemoteEvent::StartScriptProceed,
(int64_t)self::id
};
args_2[2 + 17] = 1337;
g_pointers->m_trigger_script_event(1, args_2, arg_count_2, 1 << player->id()); g_pointers->m_trigger_script_event(1, args_2, arg_count_2, 1 << player->id());
script::get_current()->yield(20ms); script::get_current()->yield(20ms);

View File

@ -15,13 +15,8 @@ namespace big
virtual void execute(player_ptr player, const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx) virtual void execute(player_ptr player, const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx)
{ {
const size_t arg_count = 3; const size_t arg_count = 3;
int64_t args[arg_count] = int64_t args[arg_count] = {(int64_t)eRemoteEvent::TriggerCEORaid, (int64_t)self::id, 0};
{
(int64_t)eRemoteEvent::TriggerCEORaid,
(int64_t)self::id,
0
};
g_pointers->m_trigger_script_event(1, args, arg_count, 1 << player->id()); g_pointers->m_trigger_script_event(1, args, arg_count, 1 << player->id());
} }

View File

@ -1,7 +1,7 @@
#include "backend/player_command.hpp" #include "backend/player_command.hpp"
#include "core/scr_globals.hpp"
#include "natives.hpp" #include "natives.hpp"
#include "pointers.hpp" #include "pointers.hpp"
#include "core/scr_globals.hpp"
#include "util/scripts.hpp" #include "util/scripts.hpp"
namespace big namespace big
@ -52,23 +52,23 @@ namespace big
return; return;
} }
auto thread = gta_util::find_script_thread(RAGE_JOAAT("am_hunt_the_beast")); auto thread = gta_util::find_script_thread(RAGE_JOAAT("am_hunt_the_beast"));
auto stack = thread->m_stack; auto stack = thread->m_stack;
auto net_component = thread->m_net_component; auto net_component = thread->m_net_component;
auto idx = scr_locals::am_hunt_the_beast::broadcast_idx; auto idx = scr_locals::am_hunt_the_beast::broadcast_idx;
if (!stack || !net_component || !player->is_valid()) if (!stack || !net_component || !player->is_valid())
return; return;
*script_local(stack, idx).as<int*>() = 1; *script_local(stack, idx).as<int*>() = 1;
*script_local(stack, idx).at(1).as<int*>() = 2; // stage *script_local(stack, idx).at(1).as<int*>() = 2;// stage
*script_local(stack, idx).at(1).at(6).as<int*>() = net_component->get_participant_index(player->get_net_game_player()); // beast participant idx *script_local(stack, idx).at(1).at(6).as<int*>() = net_component->get_participant_index(player->get_net_game_player());// beast participant idx
*script_local(stack, idx).at(1).at(7).as<Player*>() = id; // beast player idx *script_local(stack, idx).at(1).at(7).as<Player*>() = id; // beast player idx
*script_local(stack, idx).at(1).at(2).as<int*>() = INT_MAX; // stopwatch time *script_local(stack, idx).at(1).at(2).as<int*>() = INT_MAX;// stopwatch time
*script_local(stack, idx).at(1).at(2).at(1).as<bool*>() = true; // stopwatch initialized *script_local(stack, idx).at(1).at(2).at(1).as<bool*>() = true; // stopwatch initialized
*script_local(stack, idx).at(1).at(4).at(1).as<bool*>() = false; // destroy old stage 1 stopwatch *script_local(stack, idx).at(1).at(4).at(1).as<bool*>() = false; // destroy old stage 1 stopwatch
*script_local(stack, idx).at(1).at(9).as<int*>() = 2; // some distance check *script_local(stack, idx).at(1).at(9).as<int*>() = 2; // some distance check
*script_local(stack, idx).at(83).as<int*>() = 0; // transformed bitset *script_local(stack, idx).at(83).as<int*>() = 0; // transformed bitset
} }
}; };
@ -111,9 +111,9 @@ namespace big
if (!thread) if (!thread)
return; return;
auto stack = thread->m_stack; auto stack = thread->m_stack;
auto net_component = thread->m_net_component; auto net_component = thread->m_net_component;
auto idx = scr_locals::am_hunt_the_beast::broadcast_idx; auto idx = scr_locals::am_hunt_the_beast::broadcast_idx;
if (!stack || !net_component) if (!stack || !net_component)
return; return;
@ -124,24 +124,24 @@ namespace big
for (int i = 0; i < 15; i++) for (int i = 0; i < 15; i++)
{ {
*script_local(stack, idx).as<int*>() = 1; *script_local(stack, idx).as<int*>() = 1;
*script_local(stack, idx).at(1).as<int*>() = 2; // stage *script_local(stack, idx).at(1).as<int*>() = 2; // stage
*script_local(stack, idx).at(1).at(6).as<int*>() = __rdtsc(); // participant idx *script_local(stack, idx).at(1).at(6).as<int*>() = __rdtsc();// participant idx
*script_local(stack, idx).at(1).at(7).as<Player*>() = __rdtsc(); // beast player idx *script_local(stack, idx).at(1).at(7).as<Player*>() = __rdtsc();// beast player idx
*script_local(stack, idx).at(1).at(2).as<int*>() = INT_MAX; // stopwatch time *script_local(stack, idx).at(1).at(2).as<int*>() = INT_MAX; // stopwatch time
*script_local(stack, idx).at(1).at(2).at(1).as<bool*>() = true; // stopwatch initialized *script_local(stack, idx).at(1).at(2).at(1).as<bool*>() = true; // stopwatch initialized
*script_local(stack, idx).at(1).at(4).at(1).as<bool*>() = false; // destroy old stage 1 stopwatch *script_local(stack, idx).at(1).at(4).at(1).as<bool*>() = false; // destroy old stage 1 stopwatch
*script_local(stack, idx).at(1).at(9).as<int*>() = 2; // some distance check *script_local(stack, idx).at(1).at(9).as<int*>() = 2; // some distance check
*script_local(stack, idx).at(83).as<int*>() = 0; // transformed bitset *script_local(stack, idx).at(83).as<int*>() = 0; // transformed bitset
script::get_current()->yield(350ms); script::get_current()->yield(350ms);
} }
// unfortunately we must also turn ourselves into the beast to prevent the script from exiting due to a "missing player" // unfortunately we must also turn ourselves into the beast to prevent the script from exiting due to a "missing player"
*script_local(stack, idx).at(1).at(6).as<int*>() = net_component->m_local_participant_index; // participant idx *script_local(stack, idx).at(1).at(6).as<int*>() = net_component->m_local_participant_index;// participant idx
*script_local(stack, idx).at(1).at(7).as<Player*>() = self::id; // beast player idx *script_local(stack, idx).at(1).at(7).as<Player*>() = self::id;// beast player idx
*script_local(stack, idx).at(1).at(2).as<int*>() = INT_MAX; // stopwatch time *script_local(stack, idx).at(1).at(2).as<int*>() = INT_MAX; // stopwatch time
*script_local(stack, idx).at(83).as<int*>() = 0; // transformed bitset *script_local(stack, idx).at(83).as<int*>() = 0; // transformed bitset
thread->m_context.m_state = rage::eThreadState::running; thread->m_context.m_state = rage::eThreadState::running;
} }

View File

@ -1,5 +1,5 @@
#include "backend/player_command.hpp"
#include "backend/bool_command.hpp" #include "backend/bool_command.hpp"
#include "backend/player_command.hpp"
#include "natives.hpp" #include "natives.hpp"
#include "pointers.hpp" #include "pointers.hpp"
#include "util/troll.hpp" #include "util/troll.hpp"
@ -17,5 +17,6 @@ namespace big
}; };
set_bounty g_bounty("bounty", "Bounty", "Sets a 10k bounty on the player", 0); set_bounty g_bounty("bounty", "Bounty", "Sets a 10k bounty on the player", 0);
bool_command g_anonymous_bounty("anonbounty", "Anonymous Bounty", "Don't show your name when setting a bounty on someone", g.session.anonymous_bounty); bool_command g_anonymous_bounty("anonbounty", "Anonymous Bounty", "Don't show your name when setting a bounty on someone",
g.session.anonymous_bounty);
} }

View File

@ -1,7 +1,8 @@
#include "util/teleport.hpp"
#include "backend/player_command.hpp" #include "backend/player_command.hpp"
#include "natives.hpp" #include "natives.hpp"
#include "pointers.hpp" #include "pointers.hpp"
#include "util/teleport.hpp"
namespace big namespace big
{ {
@ -14,6 +15,6 @@ namespace big
teleport::to_player(player->id()); teleport::to_player(player->id());
} }
}; };
teleport_to_player g_teleport_to_player("playertp", "Teleport", "Teleports you to the player", 0, false); teleport_to_player g_teleport_to_player("playertp", "Teleport", "Teleports you to the player", 0, false);
} }

View File

@ -11,7 +11,8 @@ namespace big
virtual void execute(player_ptr player, const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx) virtual void execute(player_ptr player, const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx)
{ {
Vehicle veh = PED::GET_VEHICLE_PED_IS_IN(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(g_player_service->get_selected()->id()), false); Vehicle veh =
PED::GET_VEHICLE_PED_IS_IN(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(g_player_service->get_selected()->id()), false);
teleport::into_vehicle(veh); teleport::into_vehicle(veh);
} }

View File

@ -1,5 +1,5 @@
#include "backend/command.hpp"
#include "backend/bool_command.hpp" #include "backend/bool_command.hpp"
#include "backend/command.hpp"
#include "natives.hpp" #include "natives.hpp"
#include "pointers.hpp" #include "pointers.hpp"
#include "util/vehicle.hpp" #include "util/vehicle.hpp"
@ -13,7 +13,7 @@ namespace big
virtual std::optional<std::vector<std::uint64_t>> parse_args(const std::vector<std::string>& args, const std::shared_ptr<command_context> ctx) virtual std::optional<std::vector<std::uint64_t>> parse_args(const std::vector<std::string>& args, const std::shared_ptr<command_context> ctx)
{ {
auto hash = rage::joaat(args[0]); auto hash = rage::joaat(args[0]);
return std::vector<std::uint64_t>{ hash }; return std::vector<std::uint64_t>{hash};
} }
virtual CommandAccessLevel get_access_level() virtual CommandAccessLevel get_access_level()
@ -29,7 +29,9 @@ namespace big
return; return;
} }
const auto spawn_location = vehicle::get_spawn_location(ctx->get_sender()->id() == self::id ? g.spawn_vehicle.spawn_inside : false, PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(ctx->get_sender()->id())); const auto spawn_location =
vehicle::get_spawn_location(ctx->get_sender()->id() == self::id ? g.spawn_vehicle.spawn_inside : false,
PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(ctx->get_sender()->id()));
const auto spawn_heading = ENTITY::GET_ENTITY_HEADING(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(ctx->get_sender()->id())); const auto spawn_heading = ENTITY::GET_ENTITY_HEADING(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(ctx->get_sender()->id()));
const auto veh = vehicle::spawn(args[0], spawn_location, spawn_heading); const auto veh = vehicle::spawn(args[0], spawn_location, spawn_heading);
@ -54,6 +56,8 @@ namespace big
}; };
spawn_vehicle g_spawn_vehicle("spawn", "Spawn Vehicle", "Spawn a vehicle with the specified model", 1); spawn_vehicle g_spawn_vehicle("spawn", "Spawn Vehicle", "Spawn a vehicle with the specified model", 1);
bool_command g_spawn_maxed("spawnmaxed", "Spawn Maxed", "Controls whether the vehicle spawned will have its mods maxed out", g.spawn_vehicle.spawn_maxed); bool_command g_spawn_maxed("spawnmaxed", "Spawn Maxed", "Controls whether the vehicle spawned will have its mods maxed out",
bool_command g_spawn_inside("spawnin", "Spawn Inside", "Controls whether the player should be set inside the vehicle after it spawns", g.spawn_vehicle.spawn_inside); g.spawn_vehicle.spawn_maxed);
bool_command g_spawn_inside("spawnin", "Spawn Inside", "Controls whether the player should be set inside the vehicle after it spawns",
g.spawn_vehicle.spawn_inside);
} }

View File

@ -1,7 +1,7 @@
#include "backend/command.hpp" #include "backend/command.hpp"
#include "natives.hpp" #include "natives.hpp"
#include "util/vehicle.hpp"
#include "util/mobile.hpp" #include "util/mobile.hpp"
#include "util/vehicle.hpp"
namespace big namespace big
{ {

View File

@ -1,7 +1,7 @@
#include "backend/command.hpp" #include "backend/command.hpp"
#include "natives.hpp" #include "natives.hpp"
#include "util/vehicle.hpp"
#include "util/mobile.hpp" #include "util/mobile.hpp"
#include "util/vehicle.hpp"
namespace big namespace big
{ {

View File

@ -1,7 +1,7 @@
#include "backend/command.hpp" #include "backend/command.hpp"
#include "natives.hpp" #include "natives.hpp"
#include "util/vehicle.hpp"
#include "util/mobile.hpp" #include "util/mobile.hpp"
#include "util/vehicle.hpp"
namespace big namespace big
{ {

View File

@ -1,11 +1,12 @@
#include "chat_command_context.hpp" #include "chat_command_context.hpp"
#include "util/notify.hpp"
#include "hooking.hpp" #include "hooking.hpp"
#include "util/notify.hpp"
namespace big namespace big
{ {
chat_command_context::chat_command_context(player_ptr player) : chat_command_context::chat_command_context(player_ptr player) :
m_player(player) m_player(player)
{ {
} }
@ -24,14 +25,16 @@ namespace big
void chat_command_context::report_output(const std::string& output) const void chat_command_context::report_output(const std::string& output) const
{ {
g_fiber_pool->queue_job([this, output] g_fiber_pool->queue_job([this, output] {
{
char msg[265]{}; char msg[265]{};
msg[0] = g.session.chat_output_prefix; msg[0] = g.session.chat_output_prefix;
msg[1] = ' '; msg[1] = ' ';
strncpy(msg + 2, output.c_str(), sizeof(msg) - 2); strncpy(msg + 2, output.c_str(), sizeof(msg) - 2);
if (g_hooking->get_original<hooks::send_chat_message>()(*g_pointers->m_send_chat_ptr, g_player_service->get_self()->get_net_data(), msg, false)) if (g_hooking->get_original<hooks::send_chat_message>()(*g_pointers->m_send_chat_ptr,
g_player_service->get_self()->get_net_data(),
msg,
false))
notify::draw_chat(msg, g_player_service->get_self()->get_name(), false); notify::draw_chat(msg, g_player_service->get_self()->get_name(), false);
}); });
} }

View File

@ -6,6 +6,7 @@ namespace big
class chat_command_context : public command_context class chat_command_context : public command_context
{ {
player_ptr m_player; player_ptr m_player;
public: public:
virtual player_ptr get_sender() const override; virtual player_ptr get_sender() const override;
virtual CommandAccessLevel get_access_level() const override; virtual CommandAccessLevel get_access_level() const override;

View File

@ -1,15 +1,15 @@
#pragma once #pragma once
#include "services/players/player_service.hpp"
#include "core/enums.hpp" #include "core/enums.hpp"
#include "services/players/player_service.hpp"
namespace big namespace big
{ {
class command_context class command_context
{ {
public: public:
virtual player_ptr get_sender() const = 0; virtual player_ptr get_sender() const = 0;
virtual CommandAccessLevel get_access_level() const = 0; virtual CommandAccessLevel get_access_level() const = 0;
virtual void report_output(const std::string& output) const = 0; virtual void report_output(const std::string& output) const = 0;
virtual void report_error(const std::string& error) const = 0; virtual void report_error(const std::string& error) const = 0;
}; };
} }

View File

@ -10,6 +10,6 @@ namespace big
virtual CommandAccessLevel get_access_level() const override; virtual CommandAccessLevel get_access_level() const override;
virtual void report_output(const std::string& output) const override; virtual void report_output(const std::string& output) const override;
virtual void report_error(const std::string& error) const override; virtual void report_error(const std::string& error) const override;
default_command_context() {}; default_command_context(){};
}; };
} }

View File

@ -3,10 +3,10 @@
namespace big namespace big
{ {
int_command::int_command(const std::string& name, const std::string& label, const std::string& description, int& value, int lower_bound, int upper_bound) : int_command::int_command(const std::string& name, const std::string& label, const std::string& description, int& value, int lower_bound, int upper_bound) :
command(name, label, description, 1), command(name, label, description, 1),
m_value(value), m_value(value),
m_lower_bound(lower_bound), m_lower_bound(lower_bound),
m_upper_bound(upper_bound) m_upper_bound(upper_bound)
{ {
} }

View File

@ -12,8 +12,12 @@ namespace big
virtual void execute(const std::vector<std::uint64_t>& args, const std::shared_ptr<command_context> ctx = std::make_shared<default_command_context>()) override; virtual void execute(const std::vector<std::uint64_t>& args, const std::shared_ptr<command_context> ctx = std::make_shared<default_command_context>()) override;
virtual std::optional<std::vector<std::uint64_t>> parse_args(const std::vector<std::string>& args, const std::shared_ptr<command_context> ctx = std::make_shared<default_command_context>()) override; virtual std::optional<std::vector<std::uint64_t>> parse_args(const std::vector<std::string>& args, const std::shared_ptr<command_context> ctx = std::make_shared<default_command_context>()) override;
public: public:
int_command(const std::string& name, const std::string& label, const std::string& description, int& value, int lower_bound, int upper_bound); int_command(const std::string& name, const std::string& label, const std::string& description, int& value, int lower_bound, int upper_bound);
inline int& get_value() { return m_value; } inline int& get_value()
{
return m_value;
}
}; };
} }

View File

@ -1,86 +1,14 @@
#include "backend/looped/looped.hpp" #include "backend/looped/looped.hpp"
#include "core/scr_globals.hpp"
#include "gta/joaat.hpp"
#include "natives.hpp" #include "natives.hpp"
#include "script_global.hpp" #include "script_global.hpp"
#include "gta/joaat.hpp"
#include "services/players/player_service.hpp" #include "services/players/player_service.hpp"
#include "core/scr_globals.hpp"
// Credits: QuickNET // Credits: QuickNET
namespace big namespace big
{ {
constexpr char transition_states[][48] = constexpr char transition_states[][48] = {"TRANSITION_STATE_EMPTY", "Singleplayer Swoop Up", "Multiplayer Swoop Up", "Creator Swoop Up", "Pre-HUD Checks", "Wait HUD Exit", "Wait For Summon", "Singleplayer Swoop Down", "Multiplayer Swoop Down", "Cancel Joining", "Retry Loading", "Retry Loading Slot 1", "Retry Loading Slot 2", "Retry Loading Slot 3", "Retry Loading Slot 4", "Wait On Invite", "Prejoining Freemode Session Checks", "Look For Fresh Join Freemode", "Look To Join Another Session Freemode", "Confirm Freemode Session Joining", "Wait Join Freemode Session", "Creation Enter Session", "Pre-Freemode Launch Script", "Freemode Teamfull Check", "Start Freemode Launch Script", "Freemode Transition Create Player", "Is Freemode And Transition Ready", "Freemode Swoop Down", "Post Bink Video Warp", "Freemode Final Setup Player", "Move Freemode To Running State", "Freemode How To Terminate", "Start Creator Pre-Launch Script Check", "Start Creator Launch Script", "Creator Transition Create Player", "Is Creator And Transition Ready", "Creator Swoop Down", "Creator Final Setup Player", "Move Creator To Running State", "Prejoining Testbed Session Checks", "Look For Fresh Join Testbed", "Look For Fresh Host Testbed", "Look To Join Another Session Testbed", "Look To Host Session Testbed", "Confirm Testbed Session Joining", "Wait Join Testbed Session", "Start Testbed Launch Script", "Testbed Transition Create Player", "Is Testbed And Transition Ready", "Testbed Swoop Down", "Testbed Final Setup Player", "Move Testbed To Running State", "Testbed How To Terminate", "Quit Current Session Prompt", "Wait For Transition Session To Setup", "Terminate Singleplayer", "Wait Terminate Singleplayer", "Kick Terminate Session", "Terminate Session", "Wait Terminate Session", "Terminate Session And Hold", "Terminate Session And Move Into Holding State", "Team Swapping Checks", "Return To Singleplayer", "Wait For Singleplayer To Start", "Waiting For External Termination Call", "Terminate Maintransition", "Wait For Dirty Load Confirm", "DLC Intro Bink", "Spawn Into Personal Vehicle"};
{
"TRANSITION_STATE_EMPTY",
"Singleplayer Swoop Up",
"Multiplayer Swoop Up",
"Creator Swoop Up",
"Pre-HUD Checks",
"Wait HUD Exit",
"Wait For Summon",
"Singleplayer Swoop Down",
"Multiplayer Swoop Down",
"Cancel Joining",
"Retry Loading",
"Retry Loading Slot 1",
"Retry Loading Slot 2",
"Retry Loading Slot 3",
"Retry Loading Slot 4",
"Wait On Invite",
"Prejoining Freemode Session Checks",
"Look For Fresh Join Freemode",
"Look To Join Another Session Freemode",
"Confirm Freemode Session Joining",
"Wait Join Freemode Session",
"Creation Enter Session",
"Pre-Freemode Launch Script",
"Freemode Teamfull Check",
"Start Freemode Launch Script",
"Freemode Transition Create Player",
"Is Freemode And Transition Ready",
"Freemode Swoop Down",
"Post Bink Video Warp",
"Freemode Final Setup Player",
"Move Freemode To Running State",
"Freemode How To Terminate",
"Start Creator Pre-Launch Script Check",
"Start Creator Launch Script",
"Creator Transition Create Player",
"Is Creator And Transition Ready",
"Creator Swoop Down",
"Creator Final Setup Player",
"Move Creator To Running State",
"Prejoining Testbed Session Checks",
"Look For Fresh Join Testbed",
"Look For Fresh Host Testbed",
"Look To Join Another Session Testbed",
"Look To Host Session Testbed",
"Confirm Testbed Session Joining",
"Wait Join Testbed Session",
"Start Testbed Launch Script",
"Testbed Transition Create Player",
"Is Testbed And Transition Ready",
"Testbed Swoop Down",
"Testbed Final Setup Player",
"Move Testbed To Running State",
"Testbed How To Terminate",
"Quit Current Session Prompt",
"Wait For Transition Session To Setup",
"Terminate Singleplayer",
"Wait Terminate Singleplayer",
"Kick Terminate Session",
"Terminate Session",
"Wait Terminate Session",
"Terminate Session And Hold",
"Terminate Session And Move Into Holding State",
"Team Swapping Checks",
"Return To Singleplayer",
"Wait For Singleplayer To Start",
"Waiting For External Termination Call",
"Terminate Maintransition",
"Wait For Dirty Load Confirm",
"DLC Intro Bink",
"Spawn Into Personal Vehicle"
};
eTransitionState last_state = eTransitionState::TRANSITION_STATE_EMPTY; eTransitionState last_state = eTransitionState::TRANSITION_STATE_EMPTY;
void looped::hud_transition_state() void looped::hud_transition_state()
@ -91,15 +19,12 @@ namespace big
return; return;
// When freemode script loaded remove loading screen. // When freemode script loaded remove loading screen.
if (state == eTransitionState::TRANSITION_STATE_WAIT_JOIN_FM_SESSION if (state == eTransitionState::TRANSITION_STATE_WAIT_JOIN_FM_SESSION && DLC::GET_IS_LOADING_SCREEN_ACTIVE())
&& DLC::GET_IS_LOADING_SCREEN_ACTIVE())
{ {
SCRIPT::SHUTDOWN_LOADING_SCREEN(); SCRIPT::SHUTDOWN_LOADING_SCREEN();
} }
if (last_state == state if (last_state == state || state == eTransitionState::TRANSITION_STATE_EMPTY || state > eTransitionState::TRANSITION_STATE_SPAWN_INTO_PERSONAL_VEHICLE)
|| state == eTransitionState::TRANSITION_STATE_EMPTY
|| state > eTransitionState::TRANSITION_STATE_SPAWN_INTO_PERSONAL_VEHICLE)
{ {
return; return;
} }

View File

@ -14,7 +14,7 @@ namespace big
inline std::vector<spawned_ped> spawned_peds; inline std::vector<spawned_ped> spawned_peds;
class looped class looped
{ {
public: public:
static void hud_transition_state(); static void hud_transition_state();

View File

@ -1,5 +1,5 @@
#include "gta/pickup_rewards.hpp"
#include "backend/looped/looped.hpp" #include "backend/looped/looped.hpp"
#include "gta/pickup_rewards.hpp"
#include "services/players/player_service.hpp" #include "services/players/player_service.hpp"
#include "util/globals.hpp" #include "util/globals.hpp"
#include "util/misc.hpp" #include "util/misc.hpp"
@ -7,7 +7,7 @@
namespace big namespace big
{ {
// rate limit script events to prevent crashes // rate limit script events to prevent crashes
static int offRadarPlayer = 0; static int offRadarPlayer = 0;
static int neverWantedPlayer = 0; static int neverWantedPlayer = 0;
void looped::player_good_options() void looped::player_good_options()
{ {
@ -22,15 +22,14 @@ namespace big
if (neverWantedPlayer > 32) if (neverWantedPlayer > 32)
neverWantedPlayer = 0; neverWantedPlayer = 0;
g_player_service->iterate([](const player_entry& entry) g_player_service->iterate([](const player_entry& entry) {
{
if ((g.session.off_radar_all || entry.second->off_radar) && offRadarPlayer == entry.second->id()) if ((g.session.off_radar_all || entry.second->off_radar) && offRadarPlayer == entry.second->id())
globals::give_remote_otr(entry.second->id()); globals::give_remote_otr(entry.second->id());
}); });
g_player_service->iterate([](const player_entry& entry) g_player_service->iterate([](const player_entry& entry) {
{ if ((g.session.never_wanted_all || entry.second->never_wanted)
if ((g.session.never_wanted_all || entry.second->never_wanted) && PLAYER::GET_PLAYER_WANTED_LEVEL(entry.second->id()) > 0 && neverWantedPlayer == entry.second->id()) && PLAYER::GET_PLAYER_WANTED_LEVEL(entry.second->id()) > 0 && neverWantedPlayer == entry.second->id())
globals::clear_wanted_player(entry.second->id()); globals::clear_wanted_player(entry.second->id());
}); });
@ -41,8 +40,7 @@ namespace big
} }
else else
{ {
g_player_service->iterate([](const player_entry& entry) g_player_service->iterate([](const player_entry& entry) {
{
if (entry.second->semi_godmode) if (entry.second->semi_godmode)
{ {
if (CPed* ped = entry.second->get_ped()) if (CPed* ped = entry.second->get_ped())

View File

@ -1,14 +1,14 @@
#include "backend/looped/looped.hpp" #include "backend/looped/looped.hpp"
#include "pointers.hpp"
#include "natives.hpp"
#include "util/entity.hpp"
#include "fiber_pool.hpp" #include "fiber_pool.hpp"
#include "natives.hpp"
#include "pointers.hpp"
#include "util/entity.hpp"
namespace big namespace big
{ {
void looped::player_remote_control_vehicle() void looped::player_remote_control_vehicle()
{ {
if (g.m_remote_controller_vehicle == -1) if (g.m_remote_controller_vehicle == -1)
return; return;
if (!ENTITY::DOES_ENTITY_EXIST(g.m_remote_controlled_vehicle)) if (!ENTITY::DOES_ENTITY_EXIST(g.m_remote_controlled_vehicle))
@ -29,8 +29,7 @@ namespace big
{ {
auto controlled = g.m_remote_controlled_vehicle; auto controlled = g.m_remote_controlled_vehicle;
auto controller = g.m_remote_controller_vehicle; auto controller = g.m_remote_controller_vehicle;
g_fiber_pool->queue_job([controlled, controller] g_fiber_pool->queue_job([controlled, controller] {
{
if (entity::take_control_of(controlled)) if (entity::take_control_of(controlled))
{ {
ENTITY::SET_ENTITY_COLLISION(g.m_remote_controlled_vehicle, TRUE, TRUE); ENTITY::SET_ENTITY_COLLISION(g.m_remote_controlled_vehicle, TRUE, TRUE);

View File

@ -10,11 +10,12 @@ namespace big
void looped::player_spectate() void looped::player_spectate()
{ {
const auto vehicle = self::veh; const auto vehicle = self::veh;
const auto ped = self::ped; const auto ped = self::ped;
if (!g_player_service->get_selected()->is_valid() || !g.player.spectating) if (!g_player_service->get_selected()->is_valid() || !g.player.spectating)
{ {
if (g.player.spectating) g.player.spectating = false; if (g.player.spectating)
g.player.spectating = false;
if (!bReset) if (!bReset)
{ {

View File

@ -1,5 +1,5 @@
#include "gta/pickup_rewards.hpp"
#include "backend/looped/looped.hpp" #include "backend/looped/looped.hpp"
#include "gta/pickup_rewards.hpp"
#include "services/players/player_service.hpp" #include "services/players/player_service.hpp"
#include "util/globals.hpp" #include "util/globals.hpp"
#include "util/misc.hpp" #include "util/misc.hpp"
@ -14,13 +14,28 @@ namespace big
int rotate_cam_bits = 0; int rotate_cam_bits = 0;
g_player_service->iterate([&rotate_cam_bits](const player_entry& entry) g_player_service->iterate([&rotate_cam_bits](const player_entry& entry) {
{
if (g_player_service->get_self()->get_ped() && entry.second->get_ped() && entry.second->get_ped()->m_health > 0) if (g_player_service->get_self()->get_ped() && entry.second->get_ped() && entry.second->get_ped()->m_health > 0)
{ {
if (entry.second->kill_loop && !(entry.second->get_ped()->m_damage_bits & (1 << 8))) if (entry.second->kill_loop && !(entry.second->get_ped()->m_damage_bits & (1 << 8)))
g_pointers->m_send_network_damage((CEntity*)g_player_service->get_self()->get_ped(), (CEntity*)entry.second->get_ped(), entry.second->get_ped()->m_navigation->get_position(), g_pointers->m_send_network_damage((CEntity*)g_player_service->get_self()->get_ped(),
0, true, RAGE_JOAAT("weapon_explosion"), 10000.0f, 2, 0, (1 << 4), 0, 0, 0, false, false, true, true, nullptr); (CEntity*)entry.second->get_ped(),
entry.second->get_ped()->m_navigation->get_position(),
0,
true,
RAGE_JOAAT("weapon_explosion"),
10000.0f,
2,
0,
(1 << 4),
0,
0,
0,
false,
false,
true,
true,
nullptr);
if (entry.second->explosion_loop) if (entry.second->explosion_loop)
toxic::blame_explode_player(entry.second, entry.second, EXP_TAG_SUBMARINE_BIG, 9999.0f, true, false, 9999.0f); toxic::blame_explode_player(entry.second, entry.second, EXP_TAG_SUBMARINE_BIG, 9999.0f, true, false, 9999.0f);
@ -38,12 +53,7 @@ namespace big
if (rotate_cam_bits) if (rotate_cam_bits)
{ {
const size_t arg_count = 3; const size_t arg_count = 3;
int64_t args[arg_count] = int64_t args[arg_count] = {(int64_t)eRemoteEvent::TSECommand, (int64_t)self::id, (int64_t)eRemoteEvent::TSECommandRotateCam};
{
(int64_t)eRemoteEvent::TSECommand,
(int64_t)self::id,
(int64_t)eRemoteEvent::TSECommandRotateCam
};
g_pointers->m_trigger_script_event(1, args, arg_count, rotate_cam_bits); g_pointers->m_trigger_script_event(1, args, arg_count, rotate_cam_bits);
} }

View File

@ -1,6 +1,6 @@
#include "natives.hpp"
#include "backend/looped_command.hpp" #include "backend/looped_command.hpp"
#include "gta/enums.hpp" #include "gta/enums.hpp"
#include "natives.hpp"
namespace big namespace big
{ {
@ -17,6 +17,7 @@ namespace big
} }
} }
}; };
beast_jump_looped g_beast_jump_looped("beastjump", "Beast Jump", "Allows you to jump as if you were the beast like in the Hunt the Beast event", g.self.beast_jump); beast_jump_looped g_beast_jump_looped("beastjump", "Beast Jump", "Allows you to jump as if you were the beast like in the Hunt the Beast event",
g.self.beast_jump);
} }

View File

@ -1,5 +1,5 @@
#include "natives.hpp"
#include "backend/looped_command.hpp" #include "backend/looped_command.hpp"
#include "natives.hpp"
#include "util/entity.hpp" #include "util/entity.hpp"
namespace big namespace big
@ -14,5 +14,6 @@ namespace big
} }
}; };
clean_player_looped g_clean_player_looped("cleanloop", "Keep Player Clean", "Prevents wetness and decals from being applied on you", g.self.clean_player); clean_player_looped g_clean_player_looped("cleanloop", "Keep Player Clean", "Prevents wetness and decals from being applied on you",
g.self.clean_player);
} }

View File

@ -1,10 +1,10 @@
#include "backend/looped/looped.hpp" #include "backend/looped/looped.hpp"
#include "hooking.hpp"
#include "natives.hpp" #include "natives.hpp"
#include "util/entity.hpp"
#include "util/scripts.hpp"
#include "script_function.hpp" #include "script_function.hpp"
#include "services/script_patcher/script_patcher_service.hpp" #include "services/script_patcher/script_patcher_service.hpp"
#include "hooking.hpp" #include "util/entity.hpp"
#include "util/scripts.hpp"
namespace big namespace big
{ {
@ -27,7 +27,7 @@ namespace big
if (!thread) if (!thread)
return; return;
g.m_dance_thread = gta_util::find_script_thread_by_id(thread); g.m_dance_thread = gta_util::find_script_thread_by_id(thread);
g.m_dance_program = gta_util::find_script_program(RAGE_JOAAT("am_mp_nightclub")); g.m_dance_program = gta_util::find_script_program(RAGE_JOAAT("am_mp_nightclub"));
(*g_pointers->m_script_handler_mgr)->attach_thread(g.m_dance_thread); (*g_pointers->m_script_handler_mgr)->attach_thread(g.m_dance_thread);
@ -35,8 +35,7 @@ namespace big
g.m_dance_thread->m_context.m_state = rage::eThreadState::unk_3; g.m_dance_thread->m_context.m_state = rage::eThreadState::unk_3;
// perform initial setup // perform initial setup
gta_util::execute_as_script(g.m_dance_thread, [] gta_util::execute_as_script(g.m_dance_thread, [] {
{
if (auto hook = g_hooking->m_handler_hooks[(CGameScriptHandler*)rage::scrThread::get()->m_handler].get()) if (auto hook = g_hooking->m_handler_hooks[(CGameScriptHandler*)rage::scrThread::get()->m_handler].get())
{ {
hook->disable(); hook->disable();
@ -57,7 +56,7 @@ namespace big
if (g.m_dance_thread) if (g.m_dance_thread)
g.m_dance_thread->kill(); g.m_dance_thread->kill();
g.m_dance_thread = nullptr; g.m_dance_thread = nullptr;
g.m_dance_program = nullptr; g.m_dance_program = nullptr;
g_script_patcher_service->update(); g_script_patcher_service->update();

View File

@ -1,8 +1,8 @@
#include "backend/looped/looped.hpp" #include "backend/looped/looped.hpp"
#include "backend/looped_command.hpp"
#include "fiber_pool.hpp" #include "fiber_pool.hpp"
#include "gta/enums.hpp" #include "gta/enums.hpp"
#include "natives.hpp" #include "natives.hpp"
#include "backend/looped_command.hpp"
namespace big namespace big
{ {

View File

@ -1,36 +1,24 @@
#include "backend/looped/looped.hpp" #include "backend/looped/looped.hpp"
#include "backend/looped_command.hpp"
#include "fiber_pool.hpp" #include "fiber_pool.hpp"
#include "gta/enums.hpp" #include "gta/enums.hpp"
#include "natives.hpp" #include "natives.hpp"
#include "backend/looped_command.hpp"
#include "util/math.hpp" #include "util/math.hpp"
namespace big namespace big
{ {
static const ControllerInputs controls[] = static const ControllerInputs controls[] = {ControllerInputs::INPUT_LOOK_LR, ControllerInputs::INPUT_LOOK_UD, ControllerInputs::INPUT_LOOK_UP_ONLY, ControllerInputs::INPUT_LOOK_DOWN_ONLY, ControllerInputs::INPUT_LOOK_LEFT_ONLY, ControllerInputs::INPUT_LOOK_RIGHT_ONLY, ControllerInputs::INPUT_LOOK_LEFT, ControllerInputs::INPUT_LOOK_RIGHT, ControllerInputs::INPUT_LOOK_UP, ControllerInputs::INPUT_LOOK_DOWN};
{
ControllerInputs::INPUT_LOOK_LR,
ControllerInputs::INPUT_LOOK_UD,
ControllerInputs::INPUT_LOOK_UP_ONLY,
ControllerInputs::INPUT_LOOK_DOWN_ONLY,
ControllerInputs::INPUT_LOOK_LEFT_ONLY,
ControllerInputs::INPUT_LOOK_RIGHT_ONLY,
ControllerInputs::INPUT_LOOK_LEFT,
ControllerInputs::INPUT_LOOK_RIGHT,
ControllerInputs::INPUT_LOOK_UP,
ControllerInputs::INPUT_LOOK_DOWN
};
class free_cam : looped_command class free_cam : looped_command
{ {
using looped_command::looped_command; using looped_command::looped_command;
float speed = 0.5f; float speed = 0.5f;
float mult = 0.f; float mult = 0.f;
Cam camera = -1; Cam camera = -1;
Vector3 position; Vector3 position;
Vector3 rotation; Vector3 rotation;
virtual void on_enable() override virtual void on_enable() override
{ {
@ -54,7 +42,7 @@ namespace big
for (const auto& control : controls) for (const auto& control : controls)
PAD::ENABLE_CONTROL_ACTION(0, static_cast<int>(control), true); PAD::ENABLE_CONTROL_ACTION(0, static_cast<int>(control), true);
Vector3 vecChange = { 0.f, 0.f, 0.f }; Vector3 vecChange = {0.f, 0.f, 0.f};
// Left Shift // Left Shift
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_SPRINT)) if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_SPRINT))
@ -83,7 +71,7 @@ namespace big
Vector3 rot = CAM::GET_CAM_ROT(camera, 2); Vector3 rot = CAM::GET_CAM_ROT(camera, 2);
//float pitch = math::deg_to_rad(rot.x); // vertical //float pitch = math::deg_to_rad(rot.x); // vertical
//float roll = rot.y; //float roll = rot.y;
float yaw = math::deg_to_rad(rot.z); // horizontal float yaw = math::deg_to_rad(rot.z);// horizontal
position.x += (vecChange.x * cos(yaw) - vecChange.y * sin(yaw)) * mult; position.x += (vecChange.x * cos(yaw) - vecChange.y * sin(yaw)) * mult;
position.y += (vecChange.x * sin(yaw) + vecChange.y * cos(yaw)) * mult; position.y += (vecChange.x * sin(yaw) + vecChange.y * cos(yaw)) * mult;

View File

@ -1,6 +1,6 @@
#include "backend/looped/looped.hpp" #include "backend/looped/looped.hpp"
#include "natives.hpp"
#include "backend/looped_command.hpp" #include "backend/looped_command.hpp"
#include "natives.hpp"
namespace big namespace big
{ {
@ -17,15 +17,15 @@ namespace big
return; return;
} }
uint32_t bits = g.self.proof_mask; uint32_t bits = g.self.proof_mask;
uint32_t changed_bits = bits ^ last_bits; uint32_t changed_bits = bits ^ last_bits;
uint32_t changed_or_enabled_bits = bits | changed_bits; uint32_t changed_or_enabled_bits = bits | changed_bits;
if (changed_or_enabled_bits) if (changed_or_enabled_bits)
{ {
uint32_t unchanged_bits = g_local_player->m_damage_bits & ~changed_or_enabled_bits; uint32_t unchanged_bits = g_local_player->m_damage_bits & ~changed_or_enabled_bits;
g_local_player->m_damage_bits = unchanged_bits | bits; g_local_player->m_damage_bits = unchanged_bits | bits;
last_bits = bits; last_bits = bits;
} }
} }

View File

@ -1,19 +1,19 @@
#include "backend/looped/looped.hpp" #include "backend/looped/looped.hpp"
#include "natives.hpp"
#include "core/data/hud_component_names.hpp" #include "core/data/hud_component_names.hpp"
#include "natives.hpp"
namespace big namespace big
{ {
static bool bLastHideRadar = false; static bool bLastHideRadar = false;
static bool bHasHUDBeenHidden = false; static bool bHasHUDBeenHidden = false;
void looped::self_hud() void looped::self_hud()
{ {
const bool bHideRadar = g.self.hide_radar; const bool bHideRadar = g.self.hide_radar;
const bool bHideAmmo = g.self.hide_ammo; const bool bHideAmmo = g.self.hide_ammo;
const bool bForceShowElement = g.self.force_show_hud_element; const bool bForceShowElement = g.self.force_show_hud_element;
const bool bForceShowHUD = g.self.force_show_hud; const bool bForceShowHUD = g.self.force_show_hud;
auto& bHudComponents = g.self.hud_components_states; auto& bHudComponents = g.self.hud_components_states;
if (bHideRadar) if (bHideRadar)
{ {
@ -30,18 +30,16 @@ namespace big
HUD::DISPLAY_AMMO_THIS_FRAME(false); HUD::DISPLAY_AMMO_THIS_FRAME(false);
} }
if (bForceShowHUD) { if (bForceShowHUD)
{
HUD::DISPLAY_HUD_WHEN_NOT_IN_STATE_OF_PLAY_THIS_FRAME(); HUD::DISPLAY_HUD_WHEN_NOT_IN_STATE_OF_PLAY_THIS_FRAME();
HUD::DISPLAY_HUD_WHEN_PAUSED_THIS_FRAME(); HUD::DISPLAY_HUD_WHEN_PAUSED_THIS_FRAME();
} }
if ( if (std::all_of(std::begin(bHudComponents), std::end(bHudComponents), [](bool i) {
std::all_of( return i;
std::begin(bHudComponents), }))
std::end(bHudComponents), {
[](bool i) { return i; }
)
) {
HUD::DISPLAY_HUD(false); HUD::DISPLAY_HUD(false);
bHasHUDBeenHidden = true; bHasHUDBeenHidden = true;
} }

View File

@ -1,9 +1,10 @@
#include "backend/looped/looped.hpp" #include "backend/looped/looped.hpp"
#include "backend/looped_command.hpp"
#include "core/scr_globals.hpp"
#include "fiber_pool.hpp" #include "fiber_pool.hpp"
#include "natives.hpp" #include "natives.hpp"
#include "backend/looped_command.hpp" #include "services/script_patcher/script_patcher_service.hpp"
#include "core/scr_globals.hpp"
#include <script/globals/GlobalPlayerBD.hpp> #include <script/globals/GlobalPlayerBD.hpp>
namespace big namespace big
@ -12,6 +13,11 @@ namespace big
{ {
using looped_command::looped_command; using looped_command::looped_command;
virtual void on_enable() override
{
g_script_patcher_service->update();
}
virtual void on_tick() override virtual void on_tick() override
{ {
ENTITY::SET_ENTITY_VISIBLE(self::ped, false, 0); ENTITY::SET_ENTITY_VISIBLE(self::ped, false, 0);
@ -26,9 +32,11 @@ namespace big
{ {
ENTITY::SET_ENTITY_VISIBLE(self::ped, true, 0); ENTITY::SET_ENTITY_VISIBLE(self::ped, true, 0);
scr_globals::globalplayer_bd.as<GlobalPlayerBD*>()->Entries[self::id].IsInvisible = false; scr_globals::globalplayer_bd.as<GlobalPlayerBD*>()->Entries[self::id].IsInvisible = false;
g_script_patcher_service->update();
} }
}; };
invisibility g_invisibility("invis", "Invisiblity", "Makes you invisible", g.self.invisibility); invisibility g_invisibility("invis", "Invisiblity", "Makes you invisible", g.self.invisibility);
bool_command g_local_visibility("localvis", "Visible Locally", "Makes you visible to yourself, but other players would still not be able to see you", g.self.local_visibility); bool_command g_local_visibility("localvis", "Visible Locally", "Makes you visible to yourself, but other players would still not be able to see you",
g.self.local_visibility);
} }

View File

@ -1,5 +1,5 @@
#include "natives.hpp"
#include "backend/looped_command.hpp" #include "backend/looped_command.hpp"
#include "natives.hpp"
namespace big namespace big
{ {

View File

@ -1,7 +1,8 @@
#include "backend/looped/looped.hpp" #include "backend/looped/looped.hpp"
#include "backend/looped_command.hpp"
#include "fiber_pool.hpp" #include "fiber_pool.hpp"
#include "natives.hpp" #include "natives.hpp"
#include "backend/looped_command.hpp"
#include <base/phArchetype.hpp> #include <base/phArchetype.hpp>
#include <base/phBoundComposite.hpp> #include <base/phBoundComposite.hpp>
@ -14,14 +15,19 @@ namespace big
virtual void on_tick() override virtual void on_tick() override
{ {
if (g_local_player) if (g_local_player)
((rage::phBoundComposite*)g_local_player->m_navigation->m_damp->m_bound)->m_bounds[0]->m_bounding_box_max_xyz_margin_w.w = -1; ((rage::phBoundComposite*)g_local_player->m_navigation->m_damp->m_bound)
->m_bounds[0]
->m_bounding_box_max_xyz_margin_w.w = -1;
} }
virtual void on_disable() override virtual void on_disable() override
{ {
if (g_local_player) if (g_local_player)
((rage::phBoundComposite*)g_local_player->m_navigation->m_damp->m_bound)->m_bounds[0]->m_bounding_box_max_xyz_margin_w.w = 0.25; ((rage::phBoundComposite*)g_local_player->m_navigation->m_damp->m_bound)
->m_bounds[0]
->m_bounding_box_max_xyz_margin_w.w = 0.25;
} }
}; };
no_collision g_no_collision("nocollision", "No Collision", "Allows you to walk through vehicles and most obstacles", g.self.no_collision); no_collision
g_no_collision("nocollision", "No Collision", "Allows you to walk through vehicles and most obstacles", g.self.no_collision);
} }

View File

@ -1,7 +1,7 @@
#include "backend/looped/looped.hpp" #include "backend/looped/looped.hpp"
#include "backend/looped_command.hpp"
#include "fiber_pool.hpp" #include "fiber_pool.hpp"
#include "natives.hpp" #include "natives.hpp"
#include "backend/looped_command.hpp"
namespace big namespace big
{ {

View File

@ -1,7 +1,7 @@
#include "backend/looped/looped.hpp" #include "backend/looped/looped.hpp"
#include "backend/looped_command.hpp"
#include "fiber_pool.hpp" #include "fiber_pool.hpp"
#include "natives.hpp" #include "natives.hpp"
#include "backend/looped_command.hpp"
namespace big namespace big
{ {
@ -22,5 +22,6 @@ namespace big
} }
}; };
no_water_collision g_no_water_collision("walkunder", "Walk Underwater", "Allows you to walk and shoot underwater", g.self.no_water_collision); no_water_collision
g_no_water_collision("walkunder", "Walk Underwater", "Allows you to walk and shoot underwater", g.self.no_water_collision);
} }

View File

@ -1,21 +1,13 @@
#include "backend/looped/looped.hpp" #include "backend/looped/looped.hpp"
#include "backend/looped_command.hpp"
#include "fiber_pool.hpp" #include "fiber_pool.hpp"
#include "gta/enums.hpp" #include "gta/enums.hpp"
#include "natives.hpp" #include "natives.hpp"
#include "util/entity.hpp" #include "util/entity.hpp"
#include "backend/looped_command.hpp"
namespace big namespace big
{ {
static constexpr ControllerInputs controls[] = static constexpr ControllerInputs controls[] = {ControllerInputs::INPUT_SPRINT, ControllerInputs::INPUT_MOVE_UP_ONLY, ControllerInputs::INPUT_MOVE_DOWN_ONLY, ControllerInputs::INPUT_MOVE_LEFT_ONLY, ControllerInputs::INPUT_MOVE_RIGHT_ONLY, ControllerInputs::INPUT_DUCK};
{
ControllerInputs::INPUT_SPRINT,
ControllerInputs::INPUT_MOVE_UP_ONLY,
ControllerInputs::INPUT_MOVE_DOWN_ONLY,
ControllerInputs::INPUT_MOVE_LEFT_ONLY,
ControllerInputs::INPUT_MOVE_RIGHT_ONLY,
ControllerInputs::INPUT_DUCK
};
static constexpr float speed = 20.f; static constexpr float speed = 20.f;
@ -43,7 +35,7 @@ namespace big
m_entity = ent; m_entity = ent;
} }
Vector3 vel = { 0.f, 0.f, 0.f }; Vector3 vel = {0.f, 0.f, 0.f};
// Left Shift // Left Shift
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_SPRINT)) if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_SPRINT))
@ -81,8 +73,8 @@ namespace big
ENTITY::FREEZE_ENTITY_POSITION(ent, false); ENTITY::FREEZE_ENTITY_POSITION(ent, false);
const auto offset = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(ent, vel.x, vel.y, 0.f); const auto offset = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(ent, vel.x, vel.y, 0.f);
vel.x = offset.x - location.x; vel.x = offset.x - location.x;
vel.y = offset.y - location.y; vel.y = offset.y - location.y;
ENTITY::SET_ENTITY_VELOCITY(ent, vel.x * m_speed_multiplier, vel.y * m_speed_multiplier, vel.z * m_speed_multiplier); ENTITY::SET_ENTITY_VELOCITY(ent, vel.x * m_speed_multiplier, vel.y * m_speed_multiplier, vel.z * m_speed_multiplier);
} }

View File

@ -1,6 +1,6 @@
#include "natives.hpp"
#include "backend/looped_command.hpp" #include "backend/looped_command.hpp"
#include "core/scr_globals.hpp" #include "core/scr_globals.hpp"
#include "natives.hpp"
namespace big namespace big
{ {

View File

@ -1,6 +1,6 @@
#include "backend/looped/looped.hpp" #include "backend/looped/looped.hpp"
#include "natives.hpp"
#include "backend/looped_command.hpp" #include "backend/looped_command.hpp"
#include "natives.hpp"
namespace big namespace big
{ {
@ -13,7 +13,7 @@ namespace big
WATER::RESET_DEEP_OCEAN_SCALER(); WATER::RESET_DEEP_OCEAN_SCALER();
Vector3 coords = self::pos; Vector3 coords = self::pos;
float offset[] = { -4, 4 }; float offset[] = {-4, 4};
for (int i = 0; i < 5; i++) for (int i = 0; i < 5; i++)
{ {

View File

@ -5,7 +5,8 @@ namespace big
{ {
void looped::self_police() void looped::self_police()
{ {
if (g_local_player == nullptr || g_local_player->m_player_info == nullptr) return; if (g_local_player == nullptr || g_local_player->m_player_info == nullptr)
return;
static bool bLast = false; static bool bLast = false;

View File

@ -1,7 +1,7 @@
#include "natives.hpp"
#include "backend/looped_command.hpp" #include "backend/looped_command.hpp"
#include "gta/enums.hpp"
#include "core/data/ptfx_effects.hpp" #include "core/data/ptfx_effects.hpp"
#include "gta/enums.hpp"
#include "natives.hpp"
namespace big namespace big
{ {
@ -10,28 +10,29 @@ namespace big
{ {
using looped_command::looped_command; using looped_command::looped_command;
PedBones ptfx_ped_bones[5] = { PedBones ptfx_ped_bones[5] = {PedBones::SKEL_Head, PedBones::SKEL_L_Hand, PedBones::SKEL_R_Hand, PedBones::SKEL_L_Foot, PedBones::SKEL_R_Foot};
PedBones::SKEL_Head,
PedBones::SKEL_L_Hand,
PedBones::SKEL_R_Hand,
PedBones::SKEL_L_Foot,
PedBones::SKEL_R_Foot
};
const char* ptfx_vehicle_pos[4] = { const char* ptfx_vehicle_pos[4] = {"wheel_lf", "wheel_lr", "wheel_rf", "wheel_rr"};
"wheel_lf",
"wheel_lr",
"wheel_rf",
"wheel_rr"
};
void show_player_ptfx_effect(const char* fx_name, const char* name) void show_player_ptfx_effect(const char* fx_name, const char* name)
{ {
STREAMING::REQUEST_NAMED_PTFX_ASSET(fx_name); STREAMING::REQUEST_NAMED_PTFX_ASSET(fx_name);
for (const auto& ptfx_bone : ptfx_ped_bones) for (const auto& ptfx_bone : ptfx_ped_bones)
{ {
GRAPHICS::USE_PARTICLE_FX_ASSET(fx_name); GRAPHICS::USE_PARTICLE_FX_ASSET(fx_name);
GRAPHICS::START_NETWORKED_PARTICLE_FX_NON_LOOPED_ON_PED_BONE(name, self::ped, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, (int)ptfx_bone, g.self.ptfx_effects.size, 1, 1, 1); GRAPHICS::START_NETWORKED_PARTICLE_FX_NON_LOOPED_ON_PED_BONE(name,
self::ped,
0.f,
0.f,
0.f,
0.f,
0.f,
0.f,
(int)ptfx_bone,
g.self.ptfx_effects.size,
1,
1,
1);
STREAMING::REMOVE_PTFX_ASSET(); STREAMING::REMOVE_PTFX_ASSET();
} }
} }
@ -42,7 +43,18 @@ namespace big
{ {
GRAPHICS::USE_PARTICLE_FX_ASSET(fx_name); GRAPHICS::USE_PARTICLE_FX_ASSET(fx_name);
Vector3 bone_pos = ENTITY::GET_WORLD_POSITION_OF_ENTITY_BONE(self::veh, ENTITY::GET_ENTITY_BONE_INDEX_BY_NAME(self::veh, ptfx_bone)); Vector3 bone_pos = ENTITY::GET_WORLD_POSITION_OF_ENTITY_BONE(self::veh, ENTITY::GET_ENTITY_BONE_INDEX_BY_NAME(self::veh, ptfx_bone));
GRAPHICS::START_NETWORKED_PARTICLE_FX_NON_LOOPED_AT_COORD(name, bone_pos.x, bone_pos.y, bone_pos.z, 0.f, 0.f, 0.f, g.self.ptfx_effects.size, 0.f, 0.f, 0.f, 0); GRAPHICS::START_NETWORKED_PARTICLE_FX_NON_LOOPED_AT_COORD(name,
bone_pos.x,
bone_pos.y,
bone_pos.z,
0.f,
0.f,
0.f,
g.self.ptfx_effects.size,
0.f,
0.f,
0.f,
0);
} }
} }

View File

@ -1,6 +1,6 @@
#include "natives.hpp"
#include "backend/looped_command.hpp" #include "backend/looped_command.hpp"
#include "gta/enums.hpp" #include "gta/enums.hpp"
#include "natives.hpp"
namespace big namespace big
{ {
@ -23,7 +23,6 @@ namespace big
{ {
WEAPON::SET_CURRENT_PED_WEAPON(self::ped, RAGE_JOAAT("WEAPON_UNARMED"), true); WEAPON::SET_CURRENT_PED_WEAPON(self::ped, RAGE_JOAAT("WEAPON_UNARMED"), true);
} }
} }
}; };

View File

@ -1,6 +1,6 @@
#include "backend/looped_command.hpp"
#include "gta/enums.hpp" #include "gta/enums.hpp"
#include "natives.hpp" #include "natives.hpp"
#include "backend/looped_command.hpp"
#include "util/math.hpp" #include "util/math.hpp"
namespace big namespace big
@ -10,7 +10,7 @@ namespace big
using looped_command::looped_command; using looped_command::looped_command;
const float run_cap = 100.f; const float run_cap = 100.f;
float run_speed = 10.f; float run_speed = 10.f;
virtual void on_tick() override virtual void on_tick() override
{ {
@ -18,14 +18,14 @@ namespace big
{ {
if (PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_SPRINT)) if (PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_SPRINT))
{ {
if (run_speed < run_cap) if (run_speed < run_cap)
run_speed += .5f; run_speed += .5f;
Vector3 location = self::pos; Vector3 location = self::pos;
Ped ped = self::ped; Ped ped = self::ped;
Vector3 rot = ENTITY::GET_ENTITY_ROTATION(ped, 2); Vector3 rot = ENTITY::GET_ENTITY_ROTATION(ped, 2);
float yaw = math::deg_to_rad(rot.z + 90); float yaw = math::deg_to_rad(rot.z + 90);
Vector3 offset; Vector3 offset;
offset.x = location.x + (run_speed * cos(yaw)); offset.x = location.x + (run_speed * cos(yaw));
@ -45,7 +45,7 @@ namespace big
} }
else if (PAD::IS_CONTROL_JUST_RELEASED(0, (int)ControllerInputs::INPUT_SPRINT)) else if (PAD::IS_CONTROL_JUST_RELEASED(0, (int)ControllerInputs::INPUT_SPRINT))
{ {
run_speed = 10.f; run_speed = 10.f;
g_local_player->m_player_info->m_run_speed = 1.f; g_local_player->m_player_info->m_run_speed = 1.f;
} }
} }
@ -55,7 +55,7 @@ namespace big
{ {
if (g_local_player) if (g_local_player)
{ {
run_speed = 10.f; run_speed = 10.f;
g_local_player->m_player_info->m_run_speed = 1.f; g_local_player->m_player_info->m_run_speed = 1.f;
} }
} }

View File

@ -1,6 +1,6 @@
#include "natives.hpp"
#include "backend/looped_command.hpp" #include "backend/looped_command.hpp"
#include "gta/enums.hpp" #include "gta/enums.hpp"
#include "natives.hpp"
namespace big namespace big
{ {
class superman : looped_command class superman : looped_command
@ -20,13 +20,13 @@ namespace big
WEAPON::GIVE_DELAYED_WEAPON_TO_PED(self::ped, rage::joaat("GADGET_PARACHUTE"), 1, 1); WEAPON::GIVE_DELAYED_WEAPON_TO_PED(self::ped, rage::joaat("GADGET_PARACHUTE"), 1, 1);
if (!ENTITY::IS_ENTITY_IN_AIR(self::ped) || PED::IS_PED_RAGDOLL(self::ped)) if (!ENTITY::IS_ENTITY_IN_AIR(self::ped) || PED::IS_PED_RAGDOLL(self::ped))
return; return;
if (PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_MOVE_UP_ONLY)) if (PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_MOVE_UP_ONLY))
apply_force(3, 0, 0); apply_force(3, 0, 0);
if (PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_MOVE_DOWN_ONLY)) if (PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_MOVE_DOWN_ONLY))
apply_force(3, 6, 0); apply_force(3, 6, 0);
if (PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_SPRINT)) if (PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_SPRINT))
apply_force(6, 0, 0); apply_force(6, 0, 0);
} }

View File

@ -1,5 +1,6 @@
#include "natives.hpp"
#include "backend/looped_command.hpp" #include "backend/looped_command.hpp"
#include "natives.hpp"
#include <ped/CPedIntelligence.hpp> #include <ped/CPedIntelligence.hpp>
namespace big namespace big
@ -15,5 +16,6 @@ namespace big
} }
}; };
unlimited_oxygen g_unlimited_oxygen("infoxy", "Unlimited Oxygen", "Allows you to stay underwater without losing oxygen", g.self.unlimited_oxygen); unlimited_oxygen
g_unlimited_oxygen("infoxy", "Unlimited Oxygen", "Allows you to stay underwater without losing oxygen", g.self.unlimited_oxygen);
} }

View File

@ -1,7 +1,7 @@
#include "backend/looped/looped.hpp" #include "backend/looped/looped.hpp"
#include "backend/player_command.hpp"
#include "natives.hpp" #include "natives.hpp"
#include "pointers.hpp" #include "pointers.hpp"
#include "backend/player_command.hpp"
namespace big namespace big
{ {
@ -11,8 +11,7 @@ namespace big
bool kick_host = *g_pointers->m_is_session_started && g.session.force_session_host && g.session.kick_host_when_forcing_host; bool kick_host = *g_pointers->m_is_session_started && g.session.force_session_host && g.session.kick_host_when_forcing_host;
if (kick_host && !bLastKickHost) if (kick_host && !bLastKickHost)
{ {
g_player_service->iterate([](auto& plyr) g_player_service->iterate([](auto& plyr) {
{
if (plyr.second->is_host()) if (plyr.second->is_host())
{ {
((player_command*)(command::get(RAGE_JOAAT("lckick"))))->call(plyr.second, {}); ((player_command*)(command::get(RAGE_JOAAT("lckick"))))->call(plyr.second, {});

View File

@ -1,9 +1,9 @@
#include "backend/looped/looped.hpp" #include "backend/looped/looped.hpp"
#include "core/scr_globals.hpp"
#include "gta_util.hpp"
#include "natives.hpp" #include "natives.hpp"
#include "pointers.hpp" #include "pointers.hpp"
#include "gta_util.hpp"
#include "script_local.hpp" #include "script_local.hpp"
#include "core/scr_globals.hpp"
namespace big namespace big
{ {
@ -14,12 +14,11 @@ namespace big
bool used = g.session.block_jobs && *g_pointers->m_is_session_started; bool used = g.session.block_jobs && *g_pointers->m_is_session_started;
if (!bLastBlockJobsEnabled && used) 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 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)
&& NETWORK::NETWORK_GET_HOST_OF_SCRIPT("fmmc_launcher", -1, 0) == self::id)
{ {
auto fmmc = 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*>() = (-1 & ~(1 << self::id)); *script_local(fmmc->m_stack, scr_locals::fmmc_launcher::broadcast_idx).at(47).at(7).as<int*>() = (-1 & ~(1 << self::id));
bLastBlockJobsEnabled = true; bLastBlockJobsEnabled = true;
} }
} }
else if (bLastBlockJobsEnabled && !used) else if (bLastBlockJobsEnabled && !used)

View File

@ -1,7 +1,7 @@
#include "backend/looped/looped.hpp" #include "backend/looped/looped.hpp"
#include "gta_util.hpp"
#include "natives.hpp" #include "natives.hpp"
#include "pointers.hpp" #include "pointers.hpp"
#include "gta_util.hpp"
#include "util/session.hpp" #include "util/session.hpp"
namespace big namespace big

View File

@ -11,11 +11,15 @@ namespace big
{ {
if (toggled) if (toggled)
{ {
NETWORK::NETWORK_GET_GLOBAL_MULTIPLAYER_CLOCK(&g.session.custom_time.hour, &g.session.custom_time.minute, &g.session.custom_time.second); NETWORK::NETWORK_GET_GLOBAL_MULTIPLAYER_CLOCK(&g.session.custom_time.hour,
&g.session.custom_time.minute,
&g.session.custom_time.second);
toggled = false; toggled = false;
} }
NETWORK::NETWORK_OVERRIDE_CLOCK_TIME(g.session.custom_time.hour, g.session.custom_time.minute, g.session.custom_time.second); NETWORK::NETWORK_OVERRIDE_CLOCK_TIME(g.session.custom_time.hour,
g.session.custom_time.minute,
g.session.custom_time.second);
} }
else else
{ {

View File

@ -1,14 +1,14 @@
#include "backend/looped/looped.hpp" #include "backend/looped/looped.hpp"
#include "gta_util.hpp"
#include "natives.hpp" #include "natives.hpp"
#include "pointers.hpp" #include "pointers.hpp"
#include "gta_util.hpp"
namespace big namespace big
{ {
static bool bLastPopMultiplierAreasEnabled = false; static bool bLastPopMultiplierAreasEnabled = false;
static bool bLastBlockPeds = false; static bool bLastBlockPeds = false;
static bool bLastBlockVehs = false; static bool bLastBlockVehs = false;
static int pop_multiplier_id = -1; static int pop_multiplier_id = -1;
void looped::session_pop_multiplier_areas() void looped::session_pop_multiplier_areas()
{ {
@ -17,12 +17,18 @@ namespace big
{ {
if (!STREAMING::IS_PLAYER_SWITCH_IN_PROGRESS() && gta_util::find_script_thread(RAGE_JOAAT("freemode")) && SCRIPT::GET_NUMBER_OF_THREADS_RUNNING_THE_SCRIPT_WITH_THIS_HASH(RAGE_JOAAT("maintransition")) == 0) if (!STREAMING::IS_PLAYER_SWITCH_IN_PROGRESS() && gta_util::find_script_thread(RAGE_JOAAT("freemode")) && SCRIPT::GET_NUMBER_OF_THREADS_RUNNING_THE_SCRIPT_WITH_THIS_HASH(RAGE_JOAAT("maintransition")) == 0)
{ {
gta_util::execute_as_script(RAGE_JOAAT("freemode"), [] gta_util::execute_as_script(RAGE_JOAAT("freemode"), [] {
{ pop_multiplier_id = MISC::ADD_POP_MULTIPLIER_SPHERE(1.1f,
pop_multiplier_id = MISC::ADD_POP_MULTIPLIER_SPHERE(1.1f, 1.1f, 1.1f, 15000.0f, g.session.disable_peds ? 0.0f : 1.0f, g.session.disable_traffic ? 0.0f : 1.0f, false, true); 1.1f,
1.1f,
15000.0f,
g.session.disable_peds ? 0.0f : 1.0f,
g.session.disable_traffic ? 0.0f : 1.0f,
false,
true);
bLastBlockPeds = g.session.disable_peds; bLastBlockPeds = g.session.disable_peds;
bLastBlockVehs = g.session.disable_traffic; bLastBlockVehs = g.session.disable_traffic;
bLastPopMultiplierAreasEnabled = true; bLastPopMultiplierAreasEnabled = true;
MISC::CLEAR_AREA(1.1f, 1.1f, 1.1f, 19999.9f, true, false, false, true); MISC::CLEAR_AREA(1.1f, 1.1f, 1.1f, 19999.9f, true, false, false, true);
@ -33,21 +39,20 @@ namespace big
{ {
bLastBlockPeds = g.session.disable_peds; bLastBlockPeds = g.session.disable_peds;
bLastBlockVehs = g.session.disable_traffic; bLastBlockVehs = g.session.disable_traffic;
used = false; used = false;
} }
if (bLastPopMultiplierAreasEnabled && !used) if (bLastPopMultiplierAreasEnabled && !used)
{ {
if (gta_util::find_script_thread(RAGE_JOAAT("freemode"))) if (gta_util::find_script_thread(RAGE_JOAAT("freemode")))
{ {
gta_util::execute_as_script(RAGE_JOAAT("freemode"), [] gta_util::execute_as_script(RAGE_JOAAT("freemode"), [] {
{
MISC::REMOVE_POP_MULTIPLIER_SPHERE(pop_multiplier_id, false); MISC::REMOVE_POP_MULTIPLIER_SPHERE(pop_multiplier_id, false);
}); });
} }
bLastPopMultiplierAreasEnabled = false; bLastPopMultiplierAreasEnabled = false;
pop_multiplier_id = -1; pop_multiplier_id = -1;
} }
} }
} }

View File

@ -1,9 +1,9 @@
#include "backend/looped/looped.hpp" #include "backend/looped/looped.hpp"
#include "gta/script_handler.hpp"
#include "gta_util.hpp"
#include "natives.hpp" #include "natives.hpp"
#include "pointers.hpp" #include "pointers.hpp"
#include "gta_util.hpp"
#include "util/session.hpp" #include "util/session.hpp"
#include "gta/script_handler.hpp"
namespace big namespace big
{ {
@ -11,7 +11,8 @@ namespace big
{ {
if (g.session.randomize_ceo_colors && *g_pointers->m_is_session_started && !STREAMING::IS_PLAYER_SWITCH_IN_PROGRESS() && SCRIPT::GET_NUMBER_OF_THREADS_RUNNING_THE_SCRIPT_WITH_THIS_HASH(RAGE_JOAAT("maintransition")) == 0) if (g.session.randomize_ceo_colors && *g_pointers->m_is_session_started && !STREAMING::IS_PLAYER_SWITCH_IN_PROGRESS() && SCRIPT::GET_NUMBER_OF_THREADS_RUNNING_THE_SCRIPT_WITH_THIS_HASH(RAGE_JOAAT("maintransition")) == 0)
{ {
if (auto freemode = gta_util::find_script_thread(RAGE_JOAAT("freemode")); freemode && freemode->m_net_component && freemode->m_net_component->is_local_player_host()) if (auto freemode = gta_util::find_script_thread(RAGE_JOAAT("freemode"));
freemode && freemode->m_net_component && freemode->m_net_component->is_local_player_host())
{ {
for (int i = 0; i < *scr_globals::gsbd.at(818).at(44).as<int*>(); i++) for (int i = 0; i < *scr_globals::gsbd.at(818).at(44).as<int*>(); i++)
{ {

View File

@ -1,22 +1,23 @@
#include "natives.hpp"
#include "backend/looped_command.hpp" #include "backend/looped_command.hpp"
#include "natives.hpp"
#include "util/teleport.hpp" #include "util/teleport.hpp"
namespace big namespace big
{ {
class auto_tp_to_waypoint : looped_command class auto_tp_to_waypoint : looped_command
{ {
using looped_command::looped_command; using looped_command::looped_command;
virtual void on_tick() override virtual void on_tick() override
{ {
//this is a hack to prevent the warning notify.. //this is a hack to prevent the warning notify..
if (!teleport::to_blip((int)BlipIcons::Waypoint)) if (!teleport::to_blip((int)BlipIcons::Waypoint))
return; return;
teleport::to_waypoint(); teleport::to_waypoint();
} }
}; };
auto_tp_to_waypoint g_auto_tp_to_waypoint("autotptowp", "Auto-Teleport To Waypoint", "Automatically teleports you to a waypoint as soon as you set one.", g.self.auto_tp); auto_tp_to_waypoint g_auto_tp_to_waypoint("autotptowp", "Auto-Teleport To Waypoint", "Automatically teleports you to a waypoint as soon as you set one.",
g.self.auto_tp);
} }

View File

@ -1,9 +1,10 @@
#include "backend/looped/looped.hpp" #include "backend/looped/looped.hpp"
#include "fiber_pool.hpp" #include "fiber_pool.hpp"
#include "gta_util.hpp"
#include "natives.hpp" #include "natives.hpp"
#include "script.hpp" #include "script.hpp"
#include "services/players/player_service.hpp" #include "services/players/player_service.hpp"
#include "gta_util.hpp"
#include <network/Network.hpp> #include <network/Network.hpp>
namespace big namespace big
@ -17,12 +18,14 @@ namespace big
return; return;
memset(&gta_util::get_network()->m_game_complaint_mgr.m_host_tokens_complained, 0, 64 * sizeof(std::uint64_t)); memset(&gta_util::get_network()->m_game_complaint_mgr.m_host_tokens_complained, 0, 64 * sizeof(std::uint64_t));
if (!g_player_service->m_player_to_use_complaint_kick || !g_player_service->m_player_to_use_complaint_kick->get()->get_net_data()) if (!g_player_service->m_player_to_use_complaint_kick
|| !g_player_service->m_player_to_use_complaint_kick->get()->get_net_data())
gta_util::get_network()->m_game_complaint_mgr.m_num_tokens_complained = 0; gta_util::get_network()->m_game_complaint_mgr.m_num_tokens_complained = 0;
else else
{ {
gta_util::get_network()->m_game_complaint_mgr.m_num_tokens_complained = 1; gta_util::get_network()->m_game_complaint_mgr.m_num_tokens_complained = 1;
gta_util::get_network()->m_game_complaint_mgr.m_host_tokens_complained[0] = g_player_service->m_player_to_use_complaint_kick->get()->get_net_data()->m_host_token; gta_util::get_network()->m_game_complaint_mgr.m_host_tokens_complained[0] =
g_player_service->m_player_to_use_complaint_kick->get()->get_net_data()->m_host_token;
} }
auto old = gta_util::get_network()->m_game_complaint_mgr.m_host_token; auto old = gta_util::get_network()->m_game_complaint_mgr.m_host_token;
@ -40,7 +43,8 @@ namespace big
if (g_player_service->get_self() && g_player_service->get_self()->get_net_data()) if (g_player_service->get_self() && g_player_service->get_self()->get_net_data())
{ {
gta_util::get_network()->m_game_complaint_mgr.m_host_token = g_player_service->get_self()->get_net_data()->m_host_token; gta_util::get_network()->m_game_complaint_mgr.m_host_token =
g_player_service->get_self()->get_net_data()->m_host_token;
g_pointers->m_reset_network_complaints(&gta_util::get_network()->m_game_complaint_mgr); g_pointers->m_reset_network_complaints(&gta_util::get_network()->m_game_complaint_mgr);
} }
} }

View File

@ -1,9 +1,9 @@
#include "backend/looped/looped.hpp" #include "backend/looped/looped.hpp"
#include "core/scr_globals.hpp"
#include "fiber_pool.hpp" #include "fiber_pool.hpp"
#include "gta_util.hpp"
#include "natives.hpp" #include "natives.hpp"
#include "script.hpp" #include "script.hpp"
#include "gta_util.hpp"
#include "core/scr_globals.hpp"
namespace big namespace big
{ {

View File

@ -1,11 +1,18 @@
#include "backend/looped/looped.hpp" #include "backend/looped/looped.hpp"
#include "natives.hpp" #include "natives.hpp"
#include "pointers.hpp"
#include <network/CNetworkPlayerMgr.hpp>
namespace big namespace big
{ {
void looped::system_self_globals() void looped::system_self_globals()
{ {
self::id = PLAYER::PLAYER_ID(); if (!*g_pointers->m_network_player_mgr || !(*g_pointers->m_network_player_mgr)->m_local_net_player
|| (*g_pointers->m_network_player_mgr)->m_local_net_player->m_player_id == -1)
self::id = 0;
else
self::id = (*g_pointers->m_network_player_mgr)->m_local_net_player->m_player_id;
self::ped = PLAYER::PLAYER_PED_ID(); self::ped = PLAYER::PLAYER_PED_ID();

View File

@ -1,7 +1,12 @@
#include "backend/looped/looped.hpp" #include "backend/looped/looped.hpp"
#include "core/scr_globals.hpp"
#include "gta_util.hpp" #include "gta_util.hpp"
#include <network/Network.hpp> #include "natives.hpp"
#include <network/CCommunications.hpp> #include <network/CCommunications.hpp>
#include <network/Network.hpp>
#include <script/globals/GPBD_FM.hpp>
#include <script/globals/GlobalPlayerBD.hpp>
namespace big namespace big
{ {
@ -20,8 +25,8 @@ namespace big
if (gta_util::get_network()->m_game_session_ptr) if (gta_util::get_network()->m_game_session_ptr)
gta_util::get_network()->m_game_session_ptr->m_local_player.m_player_data.m_host_token = host_token; gta_util::get_network()->m_game_session_ptr->m_local_player.m_player_data.m_host_token = host_token;
g_pointers->m_profile_gamer_info->m_host_token = host_token; g_pointers->m_profile_gamer_info->m_host_token = host_token;
g_pointers->m_player_info_gamer_info->m_host_token = host_token; g_pointers->m_player_info_gamer_info->m_host_token = host_token;
(*g_pointers->m_communications)->m_voice.m_connections[0]->m_gamer_info.m_host_token = host_token; (*g_pointers->m_communications)->m_voice.m_connections[0]->m_gamer_info.m_host_token = host_token;
if (g_local_player && g_local_player->m_player_info) if (g_local_player && g_local_player->m_player_info)
@ -29,5 +34,31 @@ namespace big
bLastForceHost = g.session.force_session_host; bLastForceHost = g.session.force_session_host;
} }
if (*g_pointers->m_is_session_started)
{
gta_util::execute_as_script(RAGE_JOAAT("freemode"), [] {
if (NETWORK::NETWORK_GET_THIS_SCRIPT_IS_NETWORK_SCRIPT() && NETWORK::NETWORK_GET_SCRIPT_STATUS() == 2)
{
if (g.spoofing.spoof_rank)
scr_globals::gpbd_fm_1.as<GPBD_FM*>()->Entries[self::id].PlayerStats.Rank = g.spoofing.rank;
if (g.spoofing.spoof_job_points)
scr_globals::gpbd_fm_1.as<GPBD_FM*>()->Entries[self::id].JobPoints = g.spoofing.job_points;
if (g.spoofing.spoof_kd_ratio)
scr_globals::gpbd_fm_1.as<GPBD_FM*>()->Entries[self::id].PlayerStats.KdRatio = g.spoofing.kd_ratio;
if (g.spoofing.spoof_blip)
{
if (g.spoofing.blip_type == 0)// random
scr_globals::globalplayer_bd.as<GlobalPlayerBD*>()->Entries[self::id].PlayerBlip.PlayerVehicleBlipType = (eBlipType)(rand() % 90);
else
scr_globals::globalplayer_bd.as<GlobalPlayerBD*>()->Entries[self::id].PlayerBlip.PlayerVehicleBlipType =
(eBlipType)(g.spoofing.blip_type - 1);
}
}
});
}
} }
} }

View File

@ -1,6 +1,6 @@
#include "natives.hpp"
#include "backend/looped_command.hpp" #include "backend/looped_command.hpp"
#include "core/scr_globals.hpp" #include "core/scr_globals.hpp"
#include "natives.hpp"
namespace big namespace big
{ {

View File

@ -9,82 +9,62 @@ namespace big
{ {
void looped::vehicle_auto_drive() void looped::vehicle_auto_drive()
{ {
static std::map<AutoDriveStyle, int> driving_style_flags = { static std::map<AutoDriveStyle, int> driving_style_flags = {{AutoDriveStyle::LAW_ABIDING, 443}, {AutoDriveStyle::THE_ROAD_IS_YOURS, 787004}};
{AutoDriveStyle::LAW_ABIDING, 443},
{AutoDriveStyle::THE_ROAD_IS_YOURS, 787004}
};
static int changing_driving_styles = false; static int changing_driving_styles = false;
static AutoDriveDestination current_destination = AutoDriveDestination::STOPPED; static AutoDriveDestination current_destination = AutoDriveDestination::STOPPED;
static int current_driving_flag = driving_style_flags[AutoDriveStyle::LAW_ABIDING]; static int current_driving_flag = driving_style_flags[AutoDriveStyle::LAW_ABIDING];
static float current_speed = 8; static float current_speed = 8;
static bool started = false; static bool started = false;
static Vector3 waypoint; static Vector3 waypoint;
if (g.vehicle.auto_drive_destination != AutoDriveDestination::STOPPED) if (g.vehicle.auto_drive_destination != AutoDriveDestination::STOPPED)
{ {
current_destination = g.vehicle.auto_drive_destination; current_destination = g.vehicle.auto_drive_destination;
g.vehicle.auto_drive_destination = AutoDriveDestination::STOPPED; g.vehicle.auto_drive_destination = AutoDriveDestination::STOPPED;
changing_driving_styles = true; changing_driving_styles = true;
} }
if (!self::veh && current_destination != AutoDriveDestination::STOPPED) if (!self::veh && current_destination != AutoDriveDestination::STOPPED)
{ {
current_destination = AutoDriveDestination::STOPPED; current_destination = AutoDriveDestination::STOPPED;
changing_driving_styles = false; changing_driving_styles = false;
g_notification_service->push_warning("Warning", "Please be in a car first then try again."); g_notification_service->push_warning("Warning", "Please be in a car first then try again.");
} }
else if ( else if (current_driving_flag != driving_style_flags[g.vehicle.auto_drive_style] || current_speed != g.vehicle.auto_drive_speed)
current_driving_flag != driving_style_flags[g.vehicle.auto_drive_style] || {
current_speed != g.vehicle.auto_drive_speed current_driving_flag = driving_style_flags[g.vehicle.auto_drive_style];
) { current_speed = g.vehicle.auto_drive_speed;
current_driving_flag = driving_style_flags[g.vehicle.auto_drive_style];
current_speed = g.vehicle.auto_drive_speed;
changing_driving_styles = true; changing_driving_styles = true;
} }
if (current_destination != AutoDriveDestination::STOPPED) if (current_destination != AutoDriveDestination::STOPPED)
{ {
Vector3 last_waypoint = waypoint; Vector3 last_waypoint = waypoint;
bool does_waypoint_exist = false; bool does_waypoint_exist = false;
bool to_waypoint = false; bool to_waypoint = false;
if (current_destination == AutoDriveDestination::OBJECTITVE) if (current_destination == AutoDriveDestination::OBJECTITVE)
{ {
to_waypoint = true; to_waypoint = true;
does_waypoint_exist = blip::get_objective_location(waypoint); does_waypoint_exist = blip::get_objective_location(waypoint);
} }
else if (current_destination == AutoDriveDestination::WAYPOINT) else if (current_destination == AutoDriveDestination::WAYPOINT)
{ {
to_waypoint = true; to_waypoint = true;
does_waypoint_exist = blip::get_blip_location(waypoint, (int)BlipIcons::Waypoint); does_waypoint_exist = blip::get_blip_location(waypoint, (int)BlipIcons::Waypoint);
} }
if ( if (does_waypoint_exist
does_waypoint_exist && && (last_waypoint.x != waypoint.x || last_waypoint.y != waypoint.y || last_waypoint.z != waypoint.z))
( {
last_waypoint.x != waypoint.x ||
last_waypoint.y != waypoint.y ||
last_waypoint.z != waypoint.z
)
) {
changing_driving_styles = true; changing_driving_styles = true;
} }
bool interupted = ( bool interupted = (PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_MOVE_LEFT_ONLY) || PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_MOVE_RIGHT_ONLY) || PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_ACCELERATE) || PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_BRAKE) || PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_EXIT) || PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_HANDBRAKE));
PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_MOVE_LEFT_ONLY) ||
PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_MOVE_RIGHT_ONLY) ||
PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_ACCELERATE) ||
PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_BRAKE) ||
PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_EXIT) ||
PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_HANDBRAKE)
);
if ( if (current_destination == AutoDriveDestination::EMERGENCY_STOP || (to_waypoint && !does_waypoint_exist) || interupted)
current_destination == AutoDriveDestination::EMERGENCY_STOP || {
(to_waypoint && !does_waypoint_exist) ||
interupted
) {
TASK::CLEAR_PRIMARY_VEHICLE_TASK(self::veh); TASK::CLEAR_PRIMARY_VEHICLE_TASK(self::veh);
TASK::CLEAR_PED_TASKS(self::ped); TASK::CLEAR_PED_TASKS(self::ped);
@ -115,11 +95,7 @@ namespace big
if (to_waypoint) if (to_waypoint)
{ {
TASK::TASK_VEHICLE_DRIVE_TO_COORD_LONGRANGE( TASK::TASK_VEHICLE_DRIVE_TO_COORD_LONGRANGE(self::ped, self::veh, waypoint.x, waypoint.y, waypoint.z, current_speed, current_driving_flag, 20);
self::ped, self::veh,
waypoint.x, waypoint.y, waypoint.z, current_speed,
current_driving_flag, 20
);
} }
else else
{ {

View File

@ -1,6 +1,6 @@
#include "natives.hpp"
#include "backend/looped_command.hpp" #include "backend/looped_command.hpp"
#include "gta/enums.hpp" #include "gta/enums.hpp"
#include "natives.hpp"
namespace big namespace big
{ {
@ -21,5 +21,6 @@ namespace big
} }
}; };
block_homing g_block_homing("blockhoming", "Block Homing Missiles", "Prevents homing missiles from locking on to your vehicle", g.vehicle.block_homing); block_homing g_block_homing("blockhoming", "Block Homing Missiles", "Prevents homing missiles from locking on to your vehicle",
g.vehicle.block_homing);
} }

View File

@ -10,15 +10,15 @@ namespace big
if (vehicle && VEHICLE::GET_HAS_ROCKET_BOOST(self::veh)) if (vehicle && VEHICLE::GET_HAS_ROCKET_BOOST(self::veh))
{ {
if (g.vehicle.boost_behavior == eBoostBehaviors::INSTANT_REFIL && (vehicle->m_boost == 0.f || !vehicle->m_boost_state)) // Instant Refill if (g.vehicle.boost_behavior == eBoostBehaviors::INSTANT_REFIL && (vehicle->m_boost == 0.f || !vehicle->m_boost_state))// Instant Refill
{ {
vehicle->m_boost_allow_recharge = true; vehicle->m_boost_allow_recharge = true;
vehicle->m_boost = 3.f; vehicle->m_boost = 3.f;
} }
else if (g.vehicle.boost_behavior == eBoostBehaviors::INFINITE_BOOST) // Infinite Boost else if (g.vehicle.boost_behavior == eBoostBehaviors::INFINITE_BOOST)// Infinite Boost
{ {
vehicle->m_boost_allow_recharge = true; vehicle->m_boost_allow_recharge = true;
vehicle->m_boost = 3.f; vehicle->m_boost = 3.f;
} }
} }
} }

View File

@ -1,7 +1,7 @@
#include "backend/looped/looped.hpp" #include "backend/looped/looped.hpp"
#include "backend/looped_command.hpp"
#include "fiber_pool.hpp" #include "fiber_pool.hpp"
#include "natives.hpp" #include "natives.hpp"
#include "backend/looped_command.hpp"
#include "util/entity.hpp" #include "util/entity.hpp"
namespace big namespace big
@ -15,10 +15,14 @@ namespace big
void drive_on_water_hide_surface() void drive_on_water_hide_surface()
{ {
Object surface = OBJECT::GET_CLOSEST_OBJECT_OF_TYPE( Object surface = OBJECT::GET_CLOSEST_OBJECT_OF_TYPE(drive_on_water_last_loc.x,
drive_on_water_last_loc.x, drive_on_water_last_loc.y, drive_on_water_last_loc.z, drive_on_water_last_loc.y,
4.0, drive_on_water_surface_hash, 0, 0, 1 drive_on_water_last_loc.z,
); 4.0,
drive_on_water_surface_hash,
0,
0,
1);
if (surface) if (surface)
{ {
@ -33,27 +37,34 @@ namespace big
virtual void on_tick() override virtual void on_tick() override
{ {
Vector3 location = ENTITY::GET_ENTITY_COORDS(self::veh, 1); Vector3 location = ENTITY::GET_ENTITY_COORDS(self::veh, 1);
float height = 0; float height = 0;
WATER::SET_DEEP_OCEAN_SCALER(0); WATER::SET_DEEP_OCEAN_SCALER(0);
if (location.z - height < 10 && WATER::GET_WATER_HEIGHT_NO_WAVES(location.x, location.y, location.z, &height) && self::veh) if (location.z - height < 10 && WATER::GET_WATER_HEIGHT_NO_WAVES(location.x, location.y, location.z, &height) && self::veh)
{ {
Object surface = OBJECT::GET_CLOSEST_OBJECT_OF_TYPE( Object surface = OBJECT::GET_CLOSEST_OBJECT_OF_TYPE(drive_on_water_last_loc.x,
drive_on_water_last_loc.x, drive_on_water_last_loc.y, drive_on_water_last_loc.z, drive_on_water_last_loc.y,
4.0, drive_on_water_surface_hash, 0, 0, 1 drive_on_water_last_loc.z,
); 4.0,
drive_on_water_surface_hash,
0,
0,
1);
if (ENTITY::DOES_ENTITY_EXIST(surface) && height > -50.0f) if (ENTITY::DOES_ENTITY_EXIST(surface) && height > -50.0f)
{ {
entity::take_control_of(surface); entity::take_control_of(surface);
drive_on_water_last_loc = location; drive_on_water_last_loc = location;
drive_on_water_last_loc.z = height - 0.5f; drive_on_water_last_loc.z = height - 0.5f;
ENTITY::SET_ENTITY_COORDS( ENTITY::SET_ENTITY_COORDS(surface,
surface, drive_on_water_last_loc.x,
drive_on_water_last_loc.x, drive_on_water_last_loc.y, drive_on_water_last_loc.z, drive_on_water_last_loc.y,
0, 0, 0, 0 drive_on_water_last_loc.z,
); 0,
0,
0,
0);
if (location.z < height - 2.f) if (location.z < height - 2.f)
{ {
@ -69,13 +80,15 @@ namespace big
script::get_current()->yield(); script::get_current()->yield();
} }
drive_on_water_last_loc = location; drive_on_water_last_loc = location;
drive_on_water_last_loc.z = height - 0.5f; drive_on_water_last_loc.z = height - 0.5f;
surface = OBJECT::CREATE_OBJECT( surface = OBJECT::CREATE_OBJECT(drive_on_water_surface_hash,
drive_on_water_surface_hash, drive_on_water_last_loc.x,
drive_on_water_last_loc.x, drive_on_water_last_loc.y, drive_on_water_last_loc.z, drive_on_water_last_loc.y,
1, 1, 0 drive_on_water_last_loc.z,
); 1,
1,
0);
entity::take_control_of(surface); entity::take_control_of(surface);
ENTITY::FREEZE_ENTITY_POSITION(surface, 1); ENTITY::FREEZE_ENTITY_POSITION(surface, 1);

View File

@ -6,144 +6,142 @@
namespace big namespace big
{ {
static bool last_fly_tick = false; static bool last_fly_tick = false;
void do_vehicle_fly() void do_vehicle_fly()
{ {
Vehicle vehicle = self::veh; Vehicle vehicle = self::veh;
Vector3 cam_pos = CAM::GET_GAMEPLAY_CAM_ROT(0); Vector3 cam_pos = CAM::GET_GAMEPLAY_CAM_ROT(0);
ENTITY::SET_ENTITY_ROTATION(vehicle, cam_pos.x, cam_pos.y, cam_pos.z, 1, true); ENTITY::SET_ENTITY_ROTATION(vehicle, cam_pos.x, cam_pos.y, cam_pos.z, 1, true);
ENTITY::SET_ENTITY_COLLISION(vehicle, !g.vehicle.fly.no_collision, true); ENTITY::SET_ENTITY_COLLISION(vehicle, !g.vehicle.fly.no_collision, true);
float locspeed = g.vehicle.fly.speed; float locspeed = g.vehicle.fly.speed;
if (PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_MOVE_UP_ONLY)) if (PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_MOVE_UP_ONLY))
{ {
locspeed *= 2; locspeed *= 2;
} }
if (PAD::IS_CONTROL_PRESSED(2, (int)ControllerInputs::INPUT_VEH_ACCELERATE)) if (PAD::IS_CONTROL_PRESSED(2, (int)ControllerInputs::INPUT_VEH_ACCELERATE))
{ {
if (g.vehicle.fly.dont_stop) if (g.vehicle.fly.dont_stop)
{ {
ENTITY::APPLY_FORCE_TO_ENTITY(vehicle, 1, 0.0, g.vehicle.fly.speed, 0.0, 0.0, 0.0, 0.0, 0, 1, 1, 1, 0, 1); ENTITY::APPLY_FORCE_TO_ENTITY(vehicle, 1, 0.0, g.vehicle.fly.speed, 0.0, 0.0, 0.0, 0.0, 0, 1, 1, 1, 0, 1);
} }
else else
{ {
VEHICLE::SET_VEHICLE_FORWARD_SPEED(vehicle, locspeed); VEHICLE::SET_VEHICLE_FORWARD_SPEED(vehicle, locspeed);
} }
} }
if (PAD::IS_CONTROL_PRESSED(2, (int)ControllerInputs::INPUT_VEH_BRAKE)) if (PAD::IS_CONTROL_PRESSED(2, (int)ControllerInputs::INPUT_VEH_BRAKE))
{ {
float lsp = g.vehicle.fly.speed; float lsp = g.vehicle.fly.speed;
if (!PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_MOVE_UP_ONLY)) if (!PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_MOVE_UP_ONLY))
{ {
lsp = (g.vehicle.fly.speed * 2); lsp = (g.vehicle.fly.speed * 2);
} }
if (g.vehicle.fly.dont_stop) if (g.vehicle.fly.dont_stop)
{ {
ENTITY::APPLY_FORCE_TO_ENTITY(vehicle, 1, 0.0, 0 - (lsp), 0.0, 0.0, 0.0, 0.0, 0, 1, 1, 1, 0, 1); ENTITY::APPLY_FORCE_TO_ENTITY(vehicle, 1, 0.0, 0 - (lsp), 0.0, 0.0, 0.0, 0.0, 0, 1, 1, 1, 0, 1);
} }
else else
{ {
VEHICLE::SET_VEHICLE_FORWARD_SPEED(vehicle, (0 - locspeed)); VEHICLE::SET_VEHICLE_FORWARD_SPEED(vehicle, (0 - locspeed));
} }
} }
if (PAD::IS_CONTROL_PRESSED(2, (int)ControllerInputs::INPUT_VEH_MOVE_LEFT_ONLY)) if (PAD::IS_CONTROL_PRESSED(2, (int)ControllerInputs::INPUT_VEH_MOVE_LEFT_ONLY))
{ {
float lsp = ((0 - g.vehicle.fly.speed) * 2); float lsp = ((0 - g.vehicle.fly.speed) * 2);
if (!PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_MOVE_UP_ONLY)) if (!PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_MOVE_UP_ONLY))
{ {
lsp = (0 - g.vehicle.fly.speed); lsp = (0 - g.vehicle.fly.speed);
} }
if (g.vehicle.fly.dont_stop) if (g.vehicle.fly.dont_stop)
{ {
ENTITY::APPLY_FORCE_TO_ENTITY(vehicle, 1, (lsp), 0.0, 0.0, 0.0, 0.0, 0.0, 0, 1, 1, 1, 0, 1); ENTITY::APPLY_FORCE_TO_ENTITY(vehicle, 1, (lsp), 0.0, 0.0, 0.0, 0.0, 0.0, 0, 1, 1, 1, 0, 1);
} }
else else
{ {
ENTITY::APPLY_FORCE_TO_ENTITY(vehicle, 1, (0 - (locspeed)), 0.0, 0.0, 0.0, 0.0, 0.0, 0, 1, 1, 1, 0, 1); ENTITY::APPLY_FORCE_TO_ENTITY(vehicle, 1, (0 - (locspeed)), 0.0, 0.0, 0.0, 0.0, 0.0, 0, 1, 1, 1, 0, 1);
} }
} }
if (PAD::IS_CONTROL_PRESSED(2, (int)ControllerInputs::INPUT_VEH_MOVE_RIGHT_ONLY)) if (PAD::IS_CONTROL_PRESSED(2, (int)ControllerInputs::INPUT_VEH_MOVE_RIGHT_ONLY))
{ {
float lsp = g.vehicle.fly.speed; float lsp = g.vehicle.fly.speed;
if (!PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_MOVE_UP_ONLY)) if (!PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_MOVE_UP_ONLY))
{ {
lsp = (g.vehicle.fly.speed * 2); lsp = (g.vehicle.fly.speed * 2);
} }
if (g.vehicle.fly.dont_stop) if (g.vehicle.fly.dont_stop)
{ {
ENTITY::APPLY_FORCE_TO_ENTITY(vehicle, 1, lsp, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 1, 1, 1, 0, 1); ENTITY::APPLY_FORCE_TO_ENTITY(vehicle, 1, lsp, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 1, 1, 1, 0, 1);
} }
else else
{ {
ENTITY::APPLY_FORCE_TO_ENTITY(vehicle, 1, locspeed, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 1, 1, 1, 0, 1); ENTITY::APPLY_FORCE_TO_ENTITY(vehicle, 1, locspeed, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 1, 1, 1, 0, 1);
} }
} }
if (!g.vehicle.fly.dont_stop && !PAD::IS_CONTROL_PRESSED(2, (int)ControllerInputs::INPUT_VEH_ACCELERATE) && !PAD::IS_CONTROL_PRESSED(2, (int)ControllerInputs::INPUT_VEH_BRAKE)) if (!g.vehicle.fly.dont_stop && !PAD::IS_CONTROL_PRESSED(2, (int)ControllerInputs::INPUT_VEH_ACCELERATE) && !PAD::IS_CONTROL_PRESSED(2, (int)ControllerInputs::INPUT_VEH_BRAKE))
{ {
VEHICLE::SET_VEHICLE_FORWARD_SPEED(vehicle, 0.0); VEHICLE::SET_VEHICLE_FORWARD_SPEED(vehicle, 0.0);
} }
if (TASK::GET_IS_TASK_ACTIVE(self::ped, 2)) if (TASK::GET_IS_TASK_ACTIVE(self::ped, 2))
{ {
g.vehicle.fly.enabled = false; g.vehicle.fly.enabled = false;
VEHICLE::SET_VEHICLE_GRAVITY(vehicle, true); VEHICLE::SET_VEHICLE_GRAVITY(vehicle, true);
ENTITY::SET_ENTITY_COLLISION(vehicle, true, true); ENTITY::SET_ENTITY_COLLISION(vehicle, true, true);
if (g.vehicle.fly.stop_on_exit) if (g.vehicle.fly.stop_on_exit)
{ {
VEHICLE::SET_VEHICLE_FORWARD_SPEED(vehicle, 0.0); VEHICLE::SET_VEHICLE_FORWARD_SPEED(vehicle, 0.0);
} }
} }
} }
void looped::vehicle_fly() void looped::vehicle_fly()
{ {
Vehicle vehicle = self::veh; Vehicle vehicle = self::veh;
if (g.vehicle.fly.enabled) if (g.vehicle.fly.enabled)
{ {
last_fly_tick = true;
last_fly_tick = true; if (!vehicle)
{
if (!vehicle) g_notification_service->push_warning("Warning", "Please be in a vehicle before enabling vehicle fly.");
{ g.vehicle.fly.enabled = false;
g_notification_service->push_warning("Warning", "Please be in a vehicle before enabling vehicle fly."); return;
g.vehicle.fly.enabled = false; }
return; else
} {
else if (NETWORK::NETWORK_HAS_CONTROL_OF_ENTITY(vehicle))
{ {
if (NETWORK::NETWORK_HAS_CONTROL_OF_ENTITY(vehicle)) do_vehicle_fly();
{ VEHICLE::SET_VEHICLE_GRAVITY(vehicle, false);
do_vehicle_fly(); }
VEHICLE::SET_VEHICLE_GRAVITY(vehicle, false); else
} {
else for (int i = 0; i < 5; i++)
{ {
for (int i = 0; i < 5; i++) entity::take_control_of(vehicle);
{ g_notification_service->push_warning("Warning", "Failed to take control of the vehicle.");
entity::take_control_of(vehicle); }
g_notification_service->push_warning("Warning", "Failed to take control of the vehicle."); }
} }
}
} else
} {
if (last_fly_tick)
{
ENTITY::SET_ENTITY_COLLISION(vehicle, true, true);
VEHICLE::SET_VEHICLE_GRAVITY(vehicle, true);
last_fly_tick = false;
}
} }
else
{
if (last_fly_tick)
{
ENTITY::SET_ENTITY_COLLISION(vehicle, true, true);
VEHICLE::SET_VEHICLE_GRAVITY(vehicle, true);
last_fly_tick = false;
}
}
} }
} }

View File

@ -1,14 +1,14 @@
#include "natives.hpp"
#include "backend/looped_command.hpp" #include "backend/looped_command.hpp"
#include "gta/enums.hpp" #include "gta/enums.hpp"
#include "natives.hpp"
namespace big namespace big
{ {
class horn_boost : looped_command class horn_boost : looped_command
{ {
using looped_command::looped_command; using looped_command::looped_command;
static constexpr float horn_boost_speed_default = 10.f; static constexpr float horn_boost_speed_default = 10.f;
static constexpr float horn_boost_speed_max = 200.f; static constexpr float horn_boost_speed_max = 200.f;
static constexpr float horn_boost_speed_increment = 0.3f; static constexpr float horn_boost_speed_increment = 0.3f;
float horn_boost_speed = horn_boost_speed_default; float horn_boost_speed = horn_boost_speed_default;
@ -28,11 +28,10 @@ namespace big
if (PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_HORN)) if (PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_VEH_HORN))
{ {
if (horn_boost_speed < horn_boost_speed_max) if (horn_boost_speed < horn_boost_speed_max)
horn_boost_speed += horn_boost_speed_increment; horn_boost_speed += horn_boost_speed_increment;
const auto velocity = const auto velocity = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(vehicle, 0.f, horn_boost_speed, 0.f) - ENTITY::GET_ENTITY_COORDS(vehicle, true);
ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(vehicle, 0.f, horn_boost_speed, 0.f) - ENTITY::GET_ENTITY_COORDS(vehicle, true);
ENTITY::SET_ENTITY_VELOCITY(vehicle, velocity.x, velocity.y, velocity.z); ENTITY::SET_ENTITY_VELOCITY(vehicle, velocity.x, velocity.y, velocity.z);
} }
else if (PAD::IS_CONTROL_JUST_RELEASED(0, (int)ControllerInputs::INPUT_VEH_HORN)) else if (PAD::IS_CONTROL_JUST_RELEASED(0, (int)ControllerInputs::INPUT_VEH_HORN))

View File

@ -1,6 +1,6 @@
#include "natives.hpp"
#include "backend/looped_command.hpp" #include "backend/looped_command.hpp"
#include "gta/enums.hpp" #include "gta/enums.hpp"
#include "natives.hpp"
namespace big namespace big
{ {
@ -18,5 +18,6 @@ namespace big
} }
}; };
instant_brake g_instant_brake("instantbrake", "Instant Brake", "Makes your vehicle stop instantly when you press the brake", g.vehicle.instant_brake); instant_brake g_instant_brake("instantbrake", "Instant Brake", "Makes your vehicle stop instantly when you press the brake",
g.vehicle.instant_brake);
} }

View File

@ -1,7 +1,7 @@
#include "backend/looped/looped.hpp" #include "backend/looped/looped.hpp"
#include "backend/looped_command.hpp"
#include "fiber_pool.hpp" #include "fiber_pool.hpp"
#include "natives.hpp" #include "natives.hpp"
#include "backend/looped_command.hpp"
namespace big namespace big
{ {
@ -39,5 +39,6 @@ namespace big
}; };
vehinvisibility g_vehinvisibility("invisveh", "Vehicle Invisiblity", "Makes your car invisible", g.vehicle.vehinvisibility); vehinvisibility g_vehinvisibility("invisveh", "Vehicle Invisiblity", "Makes your car invisible", g.vehicle.vehinvisibility);
bool_command g_localveh_visibility("localinvisveh", "Visible Locally", "Makes your car visible to yourself, other players will still not be able to see it", g.vehicle.localveh_visibility); bool_command g_localveh_visibility("localinvisveh", "Visible Locally", "Makes your car visible to yourself, other players will still not be able to see it",
g.vehicle.localveh_visibility);
} }

View File

@ -1,5 +1,5 @@
#include "natives.hpp"
#include "backend/looped_command.hpp" #include "backend/looped_command.hpp"
#include "natives.hpp"
namespace big namespace big
{ {
@ -11,12 +11,11 @@ namespace big
{ {
auto model = ENTITY::GET_ENTITY_MODEL(self::veh); auto model = ENTITY::GET_ENTITY_MODEL(self::veh);
if (ENTITY::IS_ENTITY_IN_AIR(self::veh) && if (ENTITY::IS_ENTITY_IN_AIR(self::veh) && (VEHICLE::IS_THIS_MODEL_A_CAR(model) || VEHICLE::IS_THIS_MODEL_A_BIKE(model)))
(VEHICLE::IS_THIS_MODEL_A_CAR(model) ||
VEHICLE::IS_THIS_MODEL_A_BIKE(model)))
VEHICLE::SET_VEHICLE_ON_GROUND_PROPERLY(self::veh, 5.0); VEHICLE::SET_VEHICLE_ON_GROUND_PROPERLY(self::veh, 5.0);
} }
}; };
keep_on_ground g_keep_on_ground("keeponground", "Keep On Ground", "Makes it so your vehicle is always on the ground on all four wheels", g.vehicle.keep_on_ground); keep_on_ground g_keep_on_ground("keeponground", "Keep On Ground", "Makes it so your vehicle is always on the ground on all four wheels",
g.vehicle.keep_on_ground);
} }

Some files were not shown because too many files have changed in this diff Show More