-
Автор темы
- #1
misc.cpp
C++:
auto g_ChatElement = FindHudElement <C_HudChat>("CHudChat");
if (GetAsyncKeyState(g_Options.edgebug_keyy)) {
g_ChatElement->ChatPrintf(0, 0, std::string("").
append(" \x0B").
append("bebra").
append(" \x01").
append("edgebugged").c_str());
C++:
class CHud
{
public:
template <typename T>
T* FindHudElement(const char* name)
{
static auto ptr = Utils::PatternScan(GetModuleHandleW(L"client.dll"), "55 8B EC 53 8B 5D 08 56 57 8B F9 33 F6 39 77 28");
static auto fn = reinterpret_cast<DWORD(__thiscall*)(void*, const char*)>(ptr);
return (T*)fn(this, name);
}
};
C++:
class CHudChat
{
public:
enum ChatFilters
{
CHAT_FILTER_NONE = 0,
CHAT_FILTER_JOINLEAVE = 0x000001,
CHAT_FILTER_NAMECHANGE = 0x000002,
CHAT_FILTER_PUBLICCHAT = 0x000004,
CHAT_FILTER_SERVERMSG = 0x000008,
CHAT_FILTER_TEAMCHANGE = 0x000010,
//=============================================================================
// HPE_BEGIN:
// [tj]Added a filter for achievement announce
//=============================================================================
CHAT_FILTER_ACHIEVEMENT = 0x000020,
//=============================================================================
// HPE_END
//=============================================================================
};
void ChatPrintf(int iPlayerIndex, int iFilter, const char* fmt, ...)
{
char msg[1024];
va_list args;
va_start(args, fmt);
vsprintf(msg, fmt, args);
CallVFunction<void(__cdecl*)(void*, int, int, const char*, ...)>(this, 27)(this, iPlayerIndex, iFilter, fmt);
va_end(args);
}
}; extern CHudChat* g_HudChat;