From 90bce8256d9fbf707aa89fbac8ce1171a618fa3d Mon Sep 17 00:00:00 2001 From: Yimura Date: Tue, 18 Jan 2022 02:05:38 +0100 Subject: [PATCH] feat(Util/Notify): Added busy spinner --- BigBaseV2/src/util/notify.hpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/BigBaseV2/src/util/notify.hpp b/BigBaseV2/src/util/notify.hpp index c823e0a2..dd7c4a83 100644 --- a/BigBaseV2/src/util/notify.hpp +++ b/BigBaseV2/src/util/notify.hpp @@ -1,5 +1,6 @@ #pragma once #include "natives.hpp" +#include "script.hpp" namespace big::notify { @@ -24,6 +25,19 @@ namespace big::notify above_map(msg); } + // 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) + { + HUD::BEGIN_TEXT_COMMAND_BUSYSPINNER_ON("STRING"); + HUD::ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME(text); + HUD::END_TEXT_COMMAND_BUSYSPINNER_ON(3); + + for (size_t i = 0; *address != value && i < (size_t)timeout * 100; i++) + script::get_current()->yield(10ms); + + HUD::BUSYSPINNER_OFF(); + } + inline void display_help_text(const char* text) { HUD::BEGIN_TEXT_COMMAND_DISPLAY_HELP("STRING");