diff --git a/BigBaseV2/src/gui/window/main/tab_mobile.cpp b/BigBaseV2/src/gui/window/main/tab_mobile.cpp index 4d034ebf..f9ffdf4b 100644 --- a/BigBaseV2/src/gui/window/main/tab_mobile.cpp +++ b/BigBaseV2/src/gui/window/main/tab_mobile.cpp @@ -15,13 +15,12 @@ namespace big { int amount_fixed = mobile::mors_mutual::fix_all(); - QUEUE_JOB_BEGIN_CLAUSE(amount_fixed) + g_fiber_pool->queue_job([amount_fixed] { - char vehicles_fixed[42]; - sprintf(vehicles_fixed, "%d vehicle%s been fixed.", amount_fixed, amount_fixed == 1 ? " has" : "s have"); - - notify::above_map(vehicles_fixed); - }QUEUE_JOB_END_CLAUSE + notify::above_map( + fmt::format("{} vehicle{} been fixed.", amount_fixed, amount_fixed == 1 ? " has" : "s have") + ); + }); } ImGui::Separator(); diff --git a/BigBaseV2/src/hooks/received_event.cpp b/BigBaseV2/src/hooks/received_event.cpp index 2f624ad8..ca8d5c35 100644 --- a/BigBaseV2/src/hooks/received_event.cpp +++ b/BigBaseV2/src/hooks/received_event.cpp @@ -35,9 +35,10 @@ namespace big if (source_player->m_player_id < 32) { g_pointers->m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset); - - std::string msg = fmt::format("{} possible attempt at freezing entity.", source_player->get_name()); - notify::above_map(msg); + + notify::above_map( + fmt::format("{} possible attempt at freezing entity.", source_player->get_name()) + ); return false; } @@ -56,8 +57,9 @@ namespace big if (money >= 2000) { - std::string msg = fmt::format("{} is spawning cash.", source_player->get_name()); - notify::above_map(msg); + notify::above_map( + fmt::format("{} is spawning cash.", source_player->get_name()) + ); } break; @@ -66,17 +68,19 @@ namespace big case RockstarEvent::NETWORK_CHECK_CODE_CRCS_EVENT: case RockstarEvent::REPORT_MYSELF_EVENT: { - std::string msg = fmt::format("Detected {} as cheating.", source_player->get_name()); - notify::above_map(msg); + notify::above_map( + fmt::format("Detected {} as cheating.", source_player->get_name()) + ); break; } case RockstarEvent::REQUEST_CONTROL_EVENT: { g_pointers->m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset); - - std::string msg = fmt::format("Denied player control request from {}", source_player->get_name()); - notify::above_map(msg); + + notify::above_map( + fmt::format("Denied player control request from {}", source_player->get_name()) + ); return false; } diff --git a/BigBaseV2/src/hooks/script_event_handler.cpp b/BigBaseV2/src/hooks/script_event_handler.cpp index a3f1c858..30142683 100644 --- a/BigBaseV2/src/hooks/script_event_handler.cpp +++ b/BigBaseV2/src/hooks/script_event_handler.cpp @@ -114,8 +114,9 @@ namespace big if (strlen(type) != 0) { - std::string msg = fmt::format("~g~BLOCKED SCRIPT EVENT~s~\nFrom: {}\nEvent Type: ~b~{}", player->get_name(), type); - notify::above_map(msg); + notify::above_map( + fmt::format("~g~BLOCKED SCRIPT EVENT~s~\nFrom: {}\nEvent Type: ~b~{}", player->get_name(), type) + ); return true; } diff --git a/BigBaseV2/src/util/notify.hpp b/BigBaseV2/src/util/notify.hpp index f450f9f5..c8246ae4 100644 --- a/BigBaseV2/src/util/notify.hpp +++ b/BigBaseV2/src/util/notify.hpp @@ -5,14 +5,13 @@ namespace big::notify { - inline void above_map(const char* text) + inline void above_map(std::string_view text) { HUD::SET_TEXT_OUTLINE(); HUD::BEGIN_TEXT_COMMAND_THEFEED_POST("STRING"); - HUD::ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME(text); + HUD::ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME(text.data()); HUD::END_TEXT_COMMAND_THEFEED_POST_TICKER(false, false); } - inline void above_map(std::string text) { above_map(text.c_str()); } // deprecated/unused inline void blocked_event(const char* name, Player player) @@ -29,10 +28,10 @@ namespace big::notify } // Shows a busy spinner till the value at the address equals the value passed or if timeout is hit - inline void busy_spinner(const char* text, int* address, int value, int timeout = 15) + inline void busy_spinner(std::string_view text, int* address, int value, int timeout = 15) { HUD::BEGIN_TEXT_COMMAND_BUSYSPINNER_ON("STRING"); - HUD::ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME(text); + HUD::ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME(text.data()); HUD::END_TEXT_COMMAND_BUSYSPINNER_ON(3); for (size_t i = 0; *address != value && i < (size_t)timeout * 100; i++) @@ -41,10 +40,10 @@ namespace big::notify HUD::BUSYSPINNER_OFF(); } - inline void display_help_text(const char* text) + inline void display_help_text(std::string_view text) { HUD::BEGIN_TEXT_COMMAND_DISPLAY_HELP("STRING"); - HUD::ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME(text); + HUD::ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME(text.data()); HUD::END_TEXT_COMMAND_DISPLAY_HELP(0, 0, 1, -1); }