Osiris: CLOSE [SOLVED]

Created on 27 Aug 2019  路  29Comments  路  Source: danielkrupinski/Osiris

Tried to implement left hand on wielding knife but I failed after numerous attempts...

anyone who can tell me whats wrong?

//Misc.cpp(Including some snippets so you know where I am at)
void Misc::leftKnife() noexcept
{
    if (config.misc.leftKnife) {

        static auto leftKnife = interfaces.cvar->findVar("cl_righthand");

        if (leftKnife->getInt()) return;

        const auto localPlayer = interfaces.entityList->getEntity(interfaces.engine->getLocalPlayer());
        const auto activeWeapon = localPlayer->getActiveWeapon();

        if (!activeWeapon || activeWeapon->getClientClass()->classId != ClassId::Knife)
            return;

        if (activeWeapon->getClientClass()->classId == ClassId::Knife && localPlayer->isAlive())
        {
            leftKnife->setValue("0");
        }
        else
        {
            leftKnife->setValue("1");
        }
    }
}
//GUI.cpp (Included some snippet so u know where I am)
        ImGui::Checkbox("Name stealer", &config.misc.nameStealer);
        ImGui::Checkbox("Fast plant", &config.misc.fastPlant);
        ImGui::Checkbox("Left Knife", &config.misc.leftKnife);
        ImGui::Checkbox("Bomb timer", &config.misc.bombTimer);
        ImGui::Checkbox("Quick reload", &config.misc.quickReload);
        ImGui::Checkbox("Prepare revolver", &config.misc.prepareRevolver);
//Config.cpp
        if (miscJson.isMember("Fast plant")) misc.fastPlant = miscJson["Fast plant"].asBool();
        if (miscJson.isMember("Left knife")) misc.leftKnife = miscJson["Left knife"].asBool();

//.. blablblabla

        miscJson["Name stealer"] = misc.nameStealer;
        miscJson["Fast plant"] = misc.fastPlant;
        miscJson["Left knife"] = misc.leftKnife;

//Config.h
        bool nameStealer{ false };
        bool fastPlant{ false };
        bool leftKnife{ 0 };
        bool bombTimer{ false };

All 29 comments

Did you call it ?
In hooks.cpp

Did you call it ?
In hooks.cpp

Why would I need to call it, it's not a hook... I'm literally changing a cvar value*? It's in the Misc Struct so I'd guess everything is already being called.

D

Add Misc::leftKnife();
In Hooks.cpp line 110 and see the magic.
If it didn't work then there's something wrong in your code.

Add Misc::leftKnife();
In Hooks.cpp line 110 and see the magic.
If it didn't work then there's something wrong in your code.

I was looking at Hooks.h the whole time I'm so fucking dumb LMFAOO...

EDIT: still doesnt work probs shit code, can you take a look at what I'm doing wrong please?
EDIT2:HALP PLZ @effex1337

it's because you tell it to return if righthand = 1
it never gets the chance to see what weapon you have equiped

@deprale

void Misc::swaphandonknife() noexcept {
    if (interfaces.engine->isInGame()) {
        const auto localPlayer = interfaces.entityList->getEntity(interfaces.engine->getLocalPlayer());
        if (localPlayer->isAlive()) {
            const auto activeWeapon = localPlayer->getActiveWeapon();
            auto swapknife = interfaces.cvar->findVar("cl_righthand");
            if (config.misc.knifeonleft)
            {
                if (activeWeapon->getClientClass()->classId == ClassId::Knife)
                    swapknife->setValue(0);
                if (activeWeapon->getClientClass()->classId != ClassId::Knife)
                    swapknife->setValue(1);
            }
        }
    }
}

if you cant make this work i cant help you as this is the exact code i'm using straight from my source.
@ijre i agree if (leftKnife->getInt()) return; was useless there but it shouldn't impact the code.

i agree if (leftKnife->getInt()) return; was useless there but it shouldn't impact the code.

It will though, righthand is set to 1, it's acting as a bool:
if (leftKnife->getInt()) return; means that if leftKnife == true/1 then return, and because it will always be set to 1 by OP's settings, it will just return

i agree if (leftKnife->getInt()) return; was useless there but it shouldn't impact the code. ...

@ijre oh wow im dumb ill check that later tonight when im at home thanks I forgot I even had that in... I鈥檓 so dumb lol. It was a debug if and SEEMS LIKE I DIDNT DELETE IT COMPLETELY.

Sent with GitHawk

You're welcome!

@ijre sorry for tagging you
and @effex1337
I've another small and last issue if you could try and give it a look at least.
It's related to a viewmodel x/y/z changer with slider.
For some reason my game crashes if I join a multiplayer game like instantly, if I remove everything in Misc.h Misc.cpp Config.h Config.cpp and just leave the null callbacks in the Hooks.cpp I can change the value of viewmodel x y z to whatever value I want without crashing whatsoever

Behold If I implement the feature with saving and in GUI ... CRASH INSTANTLY ON JOINING THE SERVER.
Also the configs look fucked up, for example I could have my settings saved under misc.leftKnife(); but they show up under spectatorlist for some reason? The values get saved but they can't be loaded for some reason??

//Misc.h struct
namespace Misc {
    void inverseRagdollGravity() noexcept;
    void updateClanTag(bool = false) noexcept;
    void spectatorList() noexcept;
    void sniperCrosshair() noexcept;
    void recoilCrosshair() noexcept;
    void watermark() noexcept;
    void prepareRevolver(UserCmd*) noexcept;
    void fastPlant(UserCmd*) noexcept;
    void leftKnife() noexcept;
    void viewModel() noexcept; // HERE <<-
    void drawBombTimer() noexcept;
    void stealNames() noexcept;
    void quickReload(UserCmd*) noexcept;
//Misc.cpp function
void Misc::viewModel() noexcept
{
    if (config.misc.viewModel) {
        interfaces.cvar->findVar("viewmodel_offset_x")->setValue(config.misc.viewModel_x);
        interfaces.cvar->findVar("viewmodel_offset_y")->setValue(config.misc.viewModel_y);
        interfaces.cvar->findVar("viewmodel_offset_z")->setValue(config.misc.viewModel_z);
    }
}
//GUI.cpp implementation
      ImGui::Checkbox("Anti AFK kick", &config.misc.antiAfkKick);
        ImGui::Checkbox("Auto strafe", &config.misc.autoStrafe);
        ImGui::Checkbox("Circle strafe", &config.misc.circleStrafe);
        ImGui::SameLine();
        hotkey(config.misc.circleStrafeKey);
        ImGui::Checkbox("Bunny hop", &config.misc.bunnyHop);
        ImGui::PushID(0);
        ImGui::SliderInt("", &config.misc.hopsHitchance, 0, 100, "Bunny hop hitchance: %d%");
        ImGui::PopID();
        ImGui::Checkbox("Fast duck", &config.misc.fastDuck);
        ImGui::Checkbox("Sniper crosshair", &config.misc.sniperCrosshair);
        ImGui::Checkbox("Recoil crosshair", &config.misc.recoilCrosshair);
        ImGui::Checkbox("Auto pistol", &config.misc.autoPistol);
        ImGui::Checkbox("Auto reload", &config.misc.autoReload);
        ImGui::Checkbox("Auto accept", &config.misc.autoAccept);
        ImGui::Checkbox("Radar hack", &config.misc.radarHack);
        ImGui::Checkbox("Reveal ranks", &config.misc.revealRanks);
        ImGui::Checkbox("Spectator list", &config.misc.spectatorList);
        ImGui::Checkbox("Watermark", &config.misc.watermark);
        ImGui::Checkbox("Fix animation LOD", &config.misc.fixAnimationLOD);
        ImGui::Checkbox("Fix bone matrix", &config.misc.fixBoneMatrix);
        ImGui::Checkbox("Fix movement", &config.misc.fixMovement);
        ImGui::Checkbox("Disable model occlusion", &config.misc.disableModelOcclusion);
        ImGui::NextColumn();
        ImGui::Checkbox("Animated clan tag", &config.misc.animatedClanTag);
        ImGui::Checkbox("Custom clantag", &config.misc.customClanTag);
        ImGui::SameLine();
        ImGui::PushItemWidth(120.0f);
        ImGui::PushID(1);
        if (ImGui::InputText("", config.misc.clanTag, IM_ARRAYSIZE(config.misc.clanTag)))
            Misc::updateClanTag(true);
        ImGui::PopID();
        ImGui::Checkbox("Kill message", &config.misc.killMessage);
        ImGui::SameLine();
        ImGui::PushItemWidth(120.0f);
        ImGui::PushID(2);
        ImGui::InputText("", config.misc.killMessageString, IM_ARRAYSIZE(config.misc.killMessageString));
        ImGui::PopID();
        ImGui::Checkbox("Name stealer", &config.misc.nameStealer);
        ImGui::Checkbox("Fast plant", &config.misc.fastPlant);
        ImGui::Checkbox("Left knife", &config.misc.leftKnife);
        ImGui::Checkbox("ViewModel", &config.misc.viewModel); // HERE <<-
        if (config.misc.viewModel) {// HERE <<-
            ImGui::SliderFloat("ViewModel X", &config.misc.viewModel_x, -10, 30);// HERE <<-
            ImGui::SliderFloat("ViewModel Y", &config.misc.viewModel_y, -10, 30);// HERE <<-
            ImGui::SliderFloat("ViewModel Z", &config.misc.viewModel_z, -10, 30);// HERE <<-
        }
        ImGui::Checkbox("Bomb timer", &config.misc.bombTimer);
        ImGui::Checkbox("Quick reload", &config.misc.quickReload);
        ImGui::Checkbox("Prepare revolver", &config.misc.prepareRevolver);
        ImGui::SameLine();
        hotkey(config.misc.prepareRevolverKey);
        ImGui::Combo("Hit Sound", &config.misc.hitSound, "None\0Metal\0Gamesense\0Bell\0Glass\0");
        ImGui::PushItemWidth(90.0f);
        ImGui::InputInt("Choked packets", &config.misc.chokedPackets, 1, 5);
        config.misc.chokedPackets = std::clamp(config.misc.chokedPackets, 0, 64);
        ImGui::SameLine();
        hotkey(config.misc.chokedPacketsKey);
        ImGui::PushItemWidth(120.0f);
        ImGui::SliderFloat("Max angle delta", &config.misc.maxAngleDelta, 0.0f, 255.0f, "%.2f");
        ImGui::PushItemWidth(290.0f);

        if (ImGui::Button("Unhook"))
            hooks.restore();

        ImGui::Columns(1);
        if (!config.style.menuStyle)
            ImGui::End();
//Hooks.cpp under createMove (?) I tried putting it up in main Hooks() funct and it still worked but i dunno why i changed it here, saw someone mention it on UC.
    interfaces.cvar->findVar("viewmodel_offset_y")->onChangeCallbacks.size = 0;
    interfaces.cvar->findVar("viewmodel_offset_x")->onChangeCallbacks.size = 0;
    interfaces.cvar->findVar("viewmodel_offset_z")->onChangeCallbacks.size = 0;
//Config.cpp
        if (miscJson.isMember("Fast plant")) misc.fastPlant = miscJson["Fast plant"].asBool();
        if (miscJson.isMember("Left knife")) misc.leftKnife = miscJson["Left knife"].asBool();
        if (miscJson.isMember("Viewmodel")) misc.viewModel = miscJson["Viewmodel"].asBool(); // HERE <<-
        if (miscJson.isMember("ViewModel x")) misc.viewModel_x = miscJson["Viewmodel x"].asFloat(); // HERE <<-
        if (miscJson.isMember("ViewModel y")) misc.viewModel_y = miscJson["Viewmodel y"].asFloat(); // HERE <<-
        if (miscJson.isMember("ViewModel z")) misc.viewModel_z = miscJson["Viewmodel z"].asFloat(); // HERE <<-
//Config.cpp
        miscJson["Name stealer"] = misc.nameStealer;
        miscJson["Fast plant"] = misc.fastPlant;
        miscJson["Left knife"] = misc.leftKnife;
        miscJson["Viewmodel"] = misc.viewModel; // HERE <<-
        miscJson["Viewmodel x"] = misc.viewModel_x; // HERE <<-
        miscJson["Viewmodel y"] = misc.viewModel_y; // HERE <<-
        miscJson["Viewmodel z"] = misc.viewModel_z; // HERE <<-
//Config.h
        bool nameStealer{ false };
        bool fastPlant{ false };
        bool leftKnife{ false };
        bool viewModel{ false }; // HERE <<-
        float viewModel_x{ 0 }; // HERE <<-
        float viewModel_y{ 0 }; // HERE <<-
        float viewModel_z{ 0 }; // HERE <<-

and this is how my config looks upon saving...

        "Left knife" : true, // HELLO ITS ME, LEFT KNIFE... I MISS YOU VIEWMODEL :(
        "Max angle delta" : 255.0,
        "Menu key" : 45,
        "Name stealer" : false,
        "Prepare revolver" : false,
        "Prepare revolver key" : 0,
        "Quick reload" : false,
        "Radar hack" : true,
        "Recoil crosshair" : false,
        "Reveal ranks" : true,
        "Sniper crosshair" : false,
        "Spectator list" : true,
        "Viewmodel" : true, // WTF?? <<-
        "Viewmodel x" : 8.9860000610351563, // HALLO WHAT THE FUCK <<-
        "Viewmodel y" : -3.7679998874664307, HALLO WHAT THE FUCK <<-
        "Viewmodel z" : 6.6669998168945313, HALLO WHAT THE FUCK <<-
        "Watermark" : false

Which looks pretty stupid as I clearly put it under left knife? So the values get saved, albeit not correctly (for some reason?) but they cannot be loaded back because whatever the hell I did is fucked up and it loads it somewhere hwere it can't take these values hence the crash? I couldn't debug.

EDIT: only thing in GUI.CPP I have different from original is the fact that I have 3 PushID's vs 2 in the Original GUI.CPP Misc, the extra pushID is for the bhop hitchance slider 馃挴

I'll just create a pull request(maybe xd depends on my mood) I've been successful in it.

And i literally gave my code for left hand knife it works just had it :man_shrugging:

I fixed it long ago this is about something else please read it xd

Sent with GitHawk

All I had to do was to remove the useless check/return now I have another small issue with a viewmodel x y z uncapper/changer

Sent with GitHawk

@effex1337 the problem is that I'm just plain crashing when I'm dead with left knife on...
EDIT: noticed if i keep console on and type kill then it says world.pvg failed to load or something then instant crash o_o
EDIT: Nvm... fixed... I was compiling debug mode, pepega...

Lemme ask you something @deparle
Do you have a weapon when you're dead?
If you get this you should be able to debug better.

Lemme ask you something @deparle
Do you have a weapon when you're dead?
If you get this you should be able to debug better.

I fixed it, I was compiling an old version of my .dll using Debug preset instead of Release. Just a small bug.
Can you take a look at this, if im not bothering u ? @effex1337 https://github.com/danielkrupinski/Osiris/issues/497

void Visuals::custom_viewmodel() noexcept {
static ConVar* view_x = interfaces.cvar->findVar("viewmodel_offset_x");
static ConVar* view_y = interfaces.cvar->findVar("viewmodel_offset_y");
static ConVar* view_z = interfaces.cvar->findVar("viewmodel_offset_z");
static ConVar* bob = interfaces.cvar->findVar("cl_bobcycle");
static ConVar* impacts = interfaces.cvar->findVar("sv_showimpacts");//showimpacts (lazy to make new void for this)

ConVar* sv_minspec = interfaces.cvar->findVar("sv_competitive_minspec");
(int)((DWORD)& sv_minspec->onChangeCallbacks + 0xC) = 0;
sv_minspec->setValue(0);

bob->setValue(0.98f);
view_x->setValue(config.visuals.customviewmodel_x);
view_y->setValue(config.visuals.customviewmodel_z);
view_z->setValue(config.visuals.customviewmodel_y);
impacts->setValue(config.misc.showimpacts);//showimpacts (lazy to make new void for this)
}

Hf

Hf

@effex1337
I have already this feature the problem is saving it in the config...
for example I have everything with custom_viewmodel() under leftknife() yeah?
In the config, my custom_viewmodel x y z appear somewhere under spectator list so it never gets to be loaded, just saved...

EDIT: Its better if I show you a demonstration, I'll make a recording in a few sec

ViewModel
viewModel

It's case sensitive while loading and saving Config

omggggggg thank you so much <3 love u man!
I'm RETARDED! didnt know that lol

literally wasted about 10-15 hours (2 days) trying to fix it lmfao

:)

do u have discord?

Yeah discord.io/effex

Hey, sorry for the super late comment, but it's worth letting you know since effex didn't say anything; the reason the viewmodel stuff doesn't save under left knife is because when it saves it organizes everything alphabetically

No it doesnt need to be ordered correctly
It's just case sensitive and hes already fixed it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

LeYesnt picture LeYesnt  路  3Comments

deprale picture deprale  路  3Comments

noteffex picture noteffex  路  4Comments

bruhmoment21 picture bruhmoment21  路  3Comments

ogosirisfan picture ogosirisfan  路  4Comments