Вопрос Вывод сообщения в чат

Участник
Статус
Оффлайн
Регистрация
22 Дек 2018
Сообщения
617
Реакции[?]
182
Поинты[?]
12K
1621161839020.png

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());
csgostructs.hpp

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;
 
Разработчик
Статус
Оффлайн
Регистрация
1 Сен 2018
Сообщения
1,596
Реакции[?]
878
Поинты[?]
117K
Посмотреть вложение 148878

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());
csgostructs.hpp

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;
у тебя ошибка в названии класса

Посмотреть вложение 148878

misc.cpp
C++:
        auto g_ChatElement = FindHudElement <C_HudChat>("CHudChat");
Исправленная функция:
C++:
        auto g_ChatElement = FindHudElement <CHudChat>("CHudChat");

        if (GetAsyncKeyState(g_Options.edgebug_keyy)) {
            g_ChatElement->ChatPrintf(0, 0, std::string("").
                append(" \x0B").
                append("bebra").
                append(" \x01").
                append("edgebugged").c_str());
 
Последнее редактирование:
Участник
Статус
Оффлайн
Регистрация
22 Дек 2018
Сообщения
617
Реакции[?]
182
Поинты[?]
12K
Во первых зачем тебе 2 разных класса?
Это можно переместить в CHudChat

C++:
    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);
    }

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);

}; extern CHudChat* g_HudChat;
Исправленная функция:
C++:
        auto g_ChatElement = FindHudElement <CHudChat>("CHudChat");

        if (GetAsyncKeyState(g_Options.edgebug_keyy)) {
            g_ChatElement->ChatPrintf(0, 0, std::string("").
                append(" \x0B").
                append("bebra").
                append(" \x01").
                append("edgebugged").c_str());
[/QUOTE]
если переместить все в один класс получится миллиард ошибок. Можешь пойти в дс, я тебе покажу
 
Сверху Снизу