danielkrupinski / Osiris

Cross-platform game hack for Counter-Strike 2 with Panorama-based GUI.
MIT License
3.34k stars 963 forks source link

How to add this clantag to osiris? #1884

Closed remokoxmega closed 1 year ago

remokoxmega commented 4 years ago

I want to add clantag like this but i dont know how to add this to osiris. `{ switch (int(g_Globals->curtime * 2.4) % 27) { case 0: setclantag(XorStr(" ")); break; case 1: setclantag(XorStr(" g")); break; case 2: setclantag(XorStr(" ga")); break; case 3: setclantag(XorStr(" gam")); break; case 4: setclantag(XorStr(" game")); break; case 5: setclantag(XorStr(" games")); break; case 6: setclantag(XorStr(" gamese")); break; case 7: setclantag(XorStr(" gamesen")); break; case 8: setclantag(XorStr(" gamesens")); break; case 9: setclantag(XorStr(" gamesense")); break; case 10:setclantag(XorStr(" gamesense ")); break; case 11:setclantag(XorStr(" gamesense ")); break; case 12:setclantag(XorStr(" gamesense ")); break; case 13:setclantag(XorStr(" gamesense ")); break; case 14:setclantag(XorStr(" gamesense ")); break; case 15:setclantag(XorStr(" gamesense ")); break; case 16:setclantag(XorStr(" gamesense ")); break; case 17:setclantag(XorStr(" gamesense ")); break; case 18:setclantag(XorStr("gamesense ")); break; case 19:setclantag(XorStr("amesense ")); break; case 20:setclantag(XorStr("mesense ")); break; case 22:setclantag(XorStr("esense ")); break; case 23:setclantag(XorStr("sense ")); break; case 24:setclantag(XorStr("sens ")); break; case 25:setclantag(XorStr("sen ")); break; case 26:setclantag(XorStr("se ")); break; case 27:setclantag(XorStr("s ")); break;

}

}`

p-sw commented 4 years ago
static int prevtime;
static int prevval;
if (int(memory->globalVars->currenttime * 3.1) != prevtime)
            {
                if (prevval != int(memory->globalVars->currenttime * 3.1) % 31)
                {
                    prevval = int(memory->globalVars->currenttime * 3.1) % 31;
                    switch (int(memory->globalVars->currenttime * 3.1) % 31) {
                    case 30: { memory->setClanTag("[OsirisWare]", "[OsirisWare]"); break; }
                    case 24: { memory->setClanTag("[OsirisWar]", "[OsirisWar]");; break; }
                    case 23: { memory->setClanTag("[OsirisWa]", "[OsirisWa]"); break; }
                    case 22: { memory->setClanTag("[OsirisW]", "[OsirisW]");; break; }
                    case 21: { memory->setClanTag("[Osiris]", "[Osiris]");; break; }
                    case 20: { memory->setClanTag("[Osiri]", "[Osiri]");; break; }
                    case 19: { memory->setClanTag("[Osir]", "[Osir]");; break; }
                    case 18: { memory->setClanTag("[Osi]", "[Osi]");; break; }
                    case 17: { memory->setClanTag("[Os]", "[Os]");; break; }
                    case 16: { memory->setClanTag("[O]", "[O]");; break; }
                    case 15: { memory->setClanTag("[  -S-  ]", "[  -S-  ]"); break; }
                    case 14: { memory->setClanTag("[ --S-- ]", "[ --S-- ]"); break; }
                    case 13: { memory->setClanTag("[-O-S---]", "[-O-S---]"); break; }
                    case 12: { memory->setClanTag("[-O-S---]", "[-O-S---]"); break; }
                    case 11: { memory->setClanTag("[-O-S-W-]", "[-O-S-W-]"); break; }
                    case 10: { memory->setClanTag("[-O-S-W-]", "[-O-S-W-]"); break; }
                    case 9: { memory->setClanTag("[O]", "[O]");; break; }
                    case 8: { memory->setClanTag("[Os]", "[Os]");; break; }
                    case 7: { memory->setClanTag("[Osi]", "[Osi]");; break; }
                    case 6: { memory->setClanTag("[Osir]", "[Osir]");; break; }
                    case 5: { memory->setClanTag("[Osiri]", "[Osiri]");; break; }
                    case 4: { memory->setClanTag("[Osiris]", "[Osiris]");; break; }
                    case 3: { memory->setClanTag("[OsirisW]", "[OsirisW]");; break; }
                    case 2: { memory->setClanTag("[OsirisWa]", "[OsirisWa]");; break; }
                    case 1: { memory->setClanTag("[OsirisWar]", "[OsirisWar]");; break; }
                    case 0: { memory->setClanTag("[OsirisWare]", "[OsirisWare]");; break; }
                    default:;
                    }
                }
            }
            prevtime = int(memory->globalVars->currenttime);

working great.

remokoxmega commented 4 years ago
static int prevtime;
static int prevval;
if (int(memory->globalVars->currenttime * 3.1) != prevtime)
            {
                if (prevval != int(memory->globalVars->currenttime * 3.1) % 31)
                {
                    prevval = int(memory->globalVars->currenttime * 3.1) % 31;
                    switch (int(memory->globalVars->currenttime * 3.1) % 31) {
                    case 30: { memory->setClanTag("[OsirisWare]", "[OsirisWare]"); break; }
                    case 24: { memory->setClanTag("[OsirisWar]", "[OsirisWar]");; break; }
                    case 23: { memory->setClanTag("[OsirisWa]", "[OsirisWa]"); break; }
                    case 22: { memory->setClanTag("[OsirisW]", "[OsirisW]");; break; }
                    case 21: { memory->setClanTag("[Osiris]", "[Osiris]");; break; }
                    case 20: { memory->setClanTag("[Osiri]", "[Osiri]");; break; }
                    case 19: { memory->setClanTag("[Osir]", "[Osir]");; break; }
                    case 18: { memory->setClanTag("[Osi]", "[Osi]");; break; }
                    case 17: { memory->setClanTag("[Os]", "[Os]");; break; }
                    case 16: { memory->setClanTag("[O]", "[O]");; break; }
                    case 15: { memory->setClanTag("[  -S-  ]", "[  -S-  ]"); break; }
                    case 14: { memory->setClanTag("[ --S-- ]", "[ --S-- ]"); break; }
                    case 13: { memory->setClanTag("[-O-S---]", "[-O-S---]"); break; }
                    case 12: { memory->setClanTag("[-O-S---]", "[-O-S---]"); break; }
                    case 11: { memory->setClanTag("[-O-S-W-]", "[-O-S-W-]"); break; }
                    case 10: { memory->setClanTag("[-O-S-W-]", "[-O-S-W-]"); break; }
                    case 9: { memory->setClanTag("[O]", "[O]");; break; }
                    case 8: { memory->setClanTag("[Os]", "[Os]");; break; }
                    case 7: { memory->setClanTag("[Osi]", "[Osi]");; break; }
                    case 6: { memory->setClanTag("[Osir]", "[Osir]");; break; }
                    case 5: { memory->setClanTag("[Osiri]", "[Osiri]");; break; }
                    case 4: { memory->setClanTag("[Osiris]", "[Osiris]");; break; }
                    case 3: { memory->setClanTag("[OsirisW]", "[OsirisW]");; break; }
                    case 2: { memory->setClanTag("[OsirisWa]", "[OsirisWa]");; break; }
                    case 1: { memory->setClanTag("[OsirisWar]", "[OsirisWar]");; break; }
                    case 0: { memory->setClanTag("[OsirisWare]", "[OsirisWare]");; break; }
                    default:;
                    }
                }
            }
            prevtime = int(memory->globalVars->currenttime);

working great.

Can i replace clock clantag wirh this and its be working?

p-sw commented 4 years ago

i'm delete Animated and Clock tag checkbox on my source code GUI.cpp, And add combo "Animated\0Clock tag" then I use switch in misc.cpp to more clean code. Here's my example,

In GUI.cpp

    ImGui::Checkbox("Animated clan tag", &config->misc.animatedClanTag);
    ImGui::Checkbox("Clock tag", &config->misc.clocktag);
    ImGui::Checkbox("Custom clantag", &config->misc.customClanTag);

Changed GUI.cpp

    ImGui::Combo("", &config->misc.tagAnimType, "SortedAnimation\0ClockTag\0OsirisWare\0");
    ImGui::Checkbox("Custom clantag", &config->misc.customClanTag);

misc.cpp

void Misc::updateClanTag(bool tagChanged) noexcept
{
    if (config->misc.clocktag) {
        const auto time = std::time(nullptr);
        const auto localTime = std::localtime(&time);
        char s[11];
        s[0] = '\0';
        sprintf_s(s, "[%02d:%02d:%02d]", localTime->tm_hour, localTime->tm_min, localTime->tm_sec);
        memory->setClanTag(s, s);
    }
    if (config->misc.customClanTag) {
        static std::string clanTag;
        if (tagChanged) {
            clanTag = config->misc.clanTag;
            if (!isblank(clanTag.front()) && !isblank(clanTag.back()))
                clanTag.push_back(' ');
        }
        static auto lastTime = 0.0f;
        if (memory->globalVars->realtime - lastTime < 0.6f)
            return;
        lastTime = memory->globalVars->realtime;
        if (config->misc.animatedClanTag && !clanTag.empty())
            std::rotate(clanTag.begin(), clanTag.begin() + 1, clanTag.end());

        memory->setClanTag(clanTag.c_str(), clanTag.c_str());
    }
}

Changed misc.cpp

void Misc::updateClanTag(bool tagChanged) noexcept
{
    if (config->misc.customClanTag) {
        static std::string clanTag;
        static int prevtime;
        static int prevval;

        if (tagChanged) {
            clanTag = config->misc.clanTag;
            if (!isblank(clanTag.front()) && !isblank(clanTag.back()))
                clanTag.push_back(' ');
        }

        const auto time = std::time(nullptr);
        const auto localTime = std::localtime(&time);

        switch (config->misc.tagAnimType) {
        case 0: {
            if (!clanTag.empty()) {
                std::rotate(clanTag.begin(), clanTag.begin() + 1, clanTag.end());
            }
            memory->setClanTag(clanTag.c_str(), clanTag.c_str());
            break;
        }
        case 1: {
            char s[11];
            s[0] = '\0';
            sprintf_s(s, "[%02d:%02d:%02d]", localTime->tm_hour, localTime->tm_min, localTime->tm_sec);
            memory->setClanTag(s, s);
        }
        case 2: {
            if (int(memory->globalVars->currenttime * 3.1) != prevtime)
            {
                if (prevval != int(memory->globalVars->currenttime * 3.1) % 31)
                {
                    prevval = int(memory->globalVars->currenttime * 3.1) % 31;
                    switch (int(memory->globalVars->currenttime * 3.1) % 31) {
                    case 30: { memory->setClanTag("[OsirisWare]", "[OsirisWare]"); break; }
                    case 24: { memory->setClanTag("[OsirisWar]", "[OsirisWar]");; break; }
                    case 23: { memory->setClanTag("[OsirisWa]", "[OsirisWa]"); break; }
                    case 22: { memory->setClanTag("[OsirisW]", "[OsirisW]");; break; }
                    case 21: { memory->setClanTag("[Osiris]", "[Osiris]");; break; }
                    case 20: { memory->setClanTag("[Osiri]", "[Osiri]");; break; }
                    case 19: { memory->setClanTag("[Osir]", "[Osir]");; break; }
                    case 18: { memory->setClanTag("[Osi]", "[Osi]");; break; }
                    case 17: { memory->setClanTag("[Os]", "[Os]");; break; }
                    case 16: { memory->setClanTag("[O]", "[O]");; break; }
                    case 15: { memory->setClanTag("[  -S-  ]", "[  -S-  ]"); break; }
                    case 14: { memory->setClanTag("[ --S-- ]", "[ --S-- ]"); break; }
                    case 13: { memory->setClanTag("[-O-S---]", "[-O-S---]"); break; }
                    case 12: { memory->setClanTag("[-O-S---]", "[-O-S---]"); break; }
                    case 11: { memory->setClanTag("[-O-S-W-]", "[-O-S-W-]"); break; }
                    case 10: { memory->setClanTag("[-O-S-W-]", "[-O-S-W-]"); break; }
                    case 9: { memory->setClanTag("[O]", "[O]");; break; }
                    case 8: { memory->setClanTag("[Os]", "[Os]");; break; }
                    case 7: { memory->setClanTag("[Osi]", "[Osi]");; break; }
                    case 6: { memory->setClanTag("[Osir]", "[Osir]");; break; }
                    case 5: { memory->setClanTag("[Osiri]", "[Osiri]");; break; }
                    case 4: { memory->setClanTag("[Osiris]", "[Osiris]");; break; }
                    case 3: { memory->setClanTag("[OsirisW]", "[OsirisW]");; break; }
                    case 2: { memory->setClanTag("[OsirisWa]", "[OsirisWa]");; break; }
                    case 1: { memory->setClanTag("[OsirisWar]", "[OsirisWar]");; break; }
                    case 0: { memory->setClanTag("[OsirisWare]", "[OsirisWare]");; break; }
                    default:;
                    }
                }
            }
            prevtime = int(memory->globalVars->currenttime);
            break;
        }
        default:
            break;
        }

        static auto lastTime = 0.0f;
        if (memory->globalVars->realtime - lastTime < 0.6f)
            return;
        lastTime = memory->globalVars->realtime;

        if (config->misc.tagAnimType != 1 && config->misc.tagAnimType != 2) {
            memory->setClanTag(clanTag.c_str(), clanTag.c_str());
        }
    }
}

Don't forget to add tagAnimType in Config.h and Config.cpp.

remokoxmega commented 4 years ago

When i try to compile i get 4 errors (C2661 and 3x C2039)

aljawary commented 4 years ago

i'm delete Animated and Clock tag checkbox on my source code GUI.cpp, And add combo "Animated\0Clock tag" then I use switch in misc.cpp to more clean code. Here's my example,

In GUI.cpp

    ImGui::Checkbox("Animated clan tag", &config->misc.animatedClanTag);
    ImGui::Checkbox("Clock tag", &config->misc.clocktag);
    ImGui::Checkbox("Custom clantag", &config->misc.customClanTag);

Changed GUI.cpp

    ImGui::Combo("", &config->misc.tagAnimType, "SortedAnimation\0ClockTag\0OsirisWare\0");
    ImGui::Checkbox("Custom clantag", &config->misc.customClanTag);

misc.cpp

void Misc::updateClanTag(bool tagChanged) noexcept
{
    if (config->misc.clocktag) {
        const auto time = std::time(nullptr);
        const auto localTime = std::localtime(&time);
        char s[11];
        s[0] = '\0';
        sprintf_s(s, "[%02d:%02d:%02d]", localTime->tm_hour, localTime->tm_min, localTime->tm_sec);
        memory->setClanTag(s, s);
    }
    if (config->misc.customClanTag) {
        static std::string clanTag;
        if (tagChanged) {
            clanTag = config->misc.clanTag;
            if (!isblank(clanTag.front()) && !isblank(clanTag.back()))
                clanTag.push_back(' ');
        }
        static auto lastTime = 0.0f;
        if (memory->globalVars->realtime - lastTime < 0.6f)
            return;
        lastTime = memory->globalVars->realtime;
        if (config->misc.animatedClanTag && !clanTag.empty())
            std::rotate(clanTag.begin(), clanTag.begin() + 1, clanTag.end());

        memory->setClanTag(clanTag.c_str(), clanTag.c_str());
    }
}

Changed misc.cpp

void Misc::updateClanTag(bool tagChanged) noexcept
{
    if (config->misc.customClanTag) {
        static std::string clanTag;
        static int prevtime;
        static int prevval;

        if (tagChanged) {
            clanTag = config->misc.clanTag;
            if (!isblank(clanTag.front()) && !isblank(clanTag.back()))
                clanTag.push_back(' ');
        }

        const auto time = std::time(nullptr);
        const auto localTime = std::localtime(&time);

        switch (config->misc.tagAnimType) {
        case 0: {
            if (!clanTag.empty()) {
                std::rotate(clanTag.begin(), clanTag.begin() + 1, clanTag.end());
            }
            memory->setClanTag(clanTag.c_str(), clanTag.c_str());
            break;
        }
        case 1: {
            char s[11];
            s[0] = '\0';
            sprintf_s(s, "[%02d:%02d:%02d]", localTime->tm_hour, localTime->tm_min, localTime->tm_sec);
            memory->setClanTag(s, s);
        }
        case 2: {
            if (int(memory->globalVars->currenttime * 3.1) != prevtime)
            {
                if (prevval != int(memory->globalVars->currenttime * 3.1) % 31)
                {
                    prevval = int(memory->globalVars->currenttime * 3.1) % 31;
                    switch (int(memory->globalVars->currenttime * 3.1) % 31) {
                    case 30: { memory->setClanTag("[OsirisWare]", "[OsirisWare]"); break; }
                    case 24: { memory->setClanTag("[OsirisWar]", "[OsirisWar]");; break; }
                    case 23: { memory->setClanTag("[OsirisWa]", "[OsirisWa]"); break; }
                    case 22: { memory->setClanTag("[OsirisW]", "[OsirisW]");; break; }
                    case 21: { memory->setClanTag("[Osiris]", "[Osiris]");; break; }
                    case 20: { memory->setClanTag("[Osiri]", "[Osiri]");; break; }
                    case 19: { memory->setClanTag("[Osir]", "[Osir]");; break; }
                    case 18: { memory->setClanTag("[Osi]", "[Osi]");; break; }
                    case 17: { memory->setClanTag("[Os]", "[Os]");; break; }
                    case 16: { memory->setClanTag("[O]", "[O]");; break; }
                    case 15: { memory->setClanTag("[  -S-  ]", "[  -S-  ]"); break; }
                    case 14: { memory->setClanTag("[ --S-- ]", "[ --S-- ]"); break; }
                    case 13: { memory->setClanTag("[-O-S---]", "[-O-S---]"); break; }
                    case 12: { memory->setClanTag("[-O-S---]", "[-O-S---]"); break; }
                    case 11: { memory->setClanTag("[-O-S-W-]", "[-O-S-W-]"); break; }
                    case 10: { memory->setClanTag("[-O-S-W-]", "[-O-S-W-]"); break; }
                    case 9: { memory->setClanTag("[O]", "[O]");; break; }
                    case 8: { memory->setClanTag("[Os]", "[Os]");; break; }
                    case 7: { memory->setClanTag("[Osi]", "[Osi]");; break; }
                    case 6: { memory->setClanTag("[Osir]", "[Osir]");; break; }
                    case 5: { memory->setClanTag("[Osiri]", "[Osiri]");; break; }
                    case 4: { memory->setClanTag("[Osiris]", "[Osiris]");; break; }
                    case 3: { memory->setClanTag("[OsirisW]", "[OsirisW]");; break; }
                    case 2: { memory->setClanTag("[OsirisWa]", "[OsirisWa]");; break; }
                    case 1: { memory->setClanTag("[OsirisWar]", "[OsirisWar]");; break; }
                    case 0: { memory->setClanTag("[OsirisWare]", "[OsirisWare]");; break; }
                    default:;
                    }
                }
            }
            prevtime = int(memory->globalVars->currenttime);
            break;
        }
        default:
            break;
        }

        static auto lastTime = 0.0f;
        if (memory->globalVars->realtime - lastTime < 0.6f)
            return;
        lastTime = memory->globalVars->realtime;

        if (config->misc.tagAnimType != 1 && config->misc.tagAnimType != 2) {
            memory->setClanTag(clanTag.c_str(), clanTag.c_str());
        }
    }
}

Don't forget to add tagAnimType in Config.h and Config.cpp.

i cant change clantag mode in onewindow style https://prnt.sc/thbhm5

p-sw commented 4 years ago

Sorry about bug and error, but i don't know c++ well. (I'm studying) I just copy other code piece and paste it on my source code. So I don't know how to fix error or bug. it's working on default window mode. (idk how to fix one window mode)