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

57 lines
1.5 KiB
C++
Raw Normal View History

#pragma once
#include "CNetGamePlayer.hpp"
#include "natives.hpp"
2022-01-18 02:05:38 +01:00
#include "script.hpp"
namespace big::notify
{
inline void above_map(const char* text)
{
HUD::SET_TEXT_OUTLINE();
HUD::BEGIN_TEXT_COMMAND_THEFEED_POST("STRING");
HUD::ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME(text);
HUD::END_TEXT_COMMAND_THEFEED_POST_TICKER(false, false);
}
inline void above_map(std::string text) { above_map(text.c_str()); }
2021-05-20 20:27:07 +02:00
// deprecated/unused
inline void blocked_event(const char* name, Player player)
{
char msg[128];
strcpy(msg, "~g~BLOCKED RECEIVED EVENT~s~\n~b~");
strcat(msg, name);
strcat(msg, "~s~\nFrom: <C>");
strcat(msg, PLAYER::GET_PLAYER_NAME(player));
strcat(msg, "</C>");
above_map(msg);
}
2022-01-18 02:05:38 +01:00
// 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();
}
2021-05-20 20:27:07 +02:00
inline void display_help_text(const char* text)
{
HUD::BEGIN_TEXT_COMMAND_DISPLAY_HELP("STRING");
HUD::ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME(text);
HUD::END_TEXT_COMMAND_DISPLAY_HELP(0, 0, 1, -1);
}
inline void player_joined(CNetGamePlayer* net_game_player)
{
above_map(
fmt::format("<C>{}</C> joined.", net_game_player->get_name())
);
}
}