Osiris
Osiris copied to clipboard
Viewmodel weapon XYZ location changer
Decided to revive my old viewmodel mover project (based on #584), thanks #2019 for the inspiration.
Changes the location of the viewmodel onscreen in a kind of neat menu.
Code may be long or something, but this gets the job done quite good.
Warning: You will lose your current viewmodel settings, so save them or write them down if you want to not forget what they were.
Notes:
- Dual berretas/Elites are locked to 0,0,0, currently as they look wierd if moved, might change this later
- C4/Bomb is locked to zeroes as well.
- when unloading cheat in misc tab "unhook" button viewmodel gets reset to 0, and so does cl_righthand to 1. (here we would need a system to get the viewmodel values before inject (or enabling viewmodel mover) and set them back to defaults when needed. As currently this only sets the XYZ location to 0.0.0 when disabling this feature in the GUI and unhooking the cheat, not what it was before/user settings.)
- Added grenades and misc/dangerzone equipables to WeaponId.h to make my life more easy.
- This is mainly aimed at people who use cl_righthand 1 all the time, i say this because it resets to 1 when disabling the function/unhooking, this needs to change to the users set values.
Can someone help me optimize this? it works in local server if inject after connected but crashes sometimes otherwise in casual any maybe comp too
Nice! maybe see if you can add roll?
Nice! maybe see if you can add roll?
I got this far but i cant figure out how to full port it. (this code snippet [ 1 ] is not functional)
Can someone take a look?
[ 1 ]
if (interfaces->engine->isInGame() && localPlayer && localPlayer->isWeapon())
{
auto ViewModel = reinterpret_cast<Entity*>(interfaces->entityList->getEntityFromHandle(localPlayer->viewModel()));
if (ViewModel)
{
auto vsView = Utils::GetVFunc<13, CViewSetup*>(ecx);
auto eyeAng = vsView->angles;
eyeAng.z -= 90.f;
ViewModel->SetAbsAngles(eyeAng);
}
}
[source]
uintptr_t __fastcall Hooks::Func::OnRenderStart(PVOID ecx, PVOID)
{
static auto oOnRenderStart = Hooks::ViewRender->GetOriginalFunction<onrenderstart_t>(4);
auto retval = oOnRenderStart(ecx);
if (Interfaces::EngineClient->IsInGame() && CG::Local && CG::LocalWeapon)
{
auto ViewModel = reinterpret_cast<C_BaseEntity*>(Interfaces::ClientEntList->GetClientEntityFromHandle(*CG::Local->GetViewModel()));
if (ViewModel)
{
auto vsView = Utils::GetVFunc<13, CViewSetup*>(ecx);
auto eyeAng = vsView->angles;
eyeAng.z -= 90.f;
ViewModel->SetAbsAngles(eyeAng);
}
}
return retval;
}
pretty sure you can reduce the amount of code by using the config system similar to how it saves the chams... This should remove all those unique variables. idk ive not looked at the config system recently and i know its changed slightly
also i'd move this to somewhere else so it doesn't get looped constantly that might be causing the crashes from first glance
static ConVar* viewmodel_x = interfaces->cvar->findVar("viewmodel_offset_x");
static ConVar* viewmodel_y = interfaces->cvar->findVar("viewmodel_offset_y");
static ConVar* viewmodel_z = interfaces->cvar->findVar("viewmodel_offset_z");
static ConVar* cl_righthand = interfaces->cvar->findVar("cl_righthand");
static ConVar* sv_minspec = interfaces->cvar->findVar("sv_competitive_minspec");
Thank you for looking in to this Rem.
config rework would be needed yes, even more if i want to add more types of guns, or each gun independent like aimbot does.
where would i move the static cons then? makes sense in retrospect to not loop const
Hello, i use other osiris version which has other cfg saving method i like this version because it has jb and better esp than new osiris i tried to redo the config from your post but still have errors, any help pls?
if (visualsJson.isMember("Playermodel CT")); visuals.playerModelCT = visualsJson["Playermodel CT"].asInt(); if (visualsJson.isMember("ViewmodelXYZ")); v.viewmodelxyz = visualsJson["ViewmodelXYZ"].asBool(); if (visualsJson.isMember("ViewmodelXYZ cl_right")); v.viewmodel_clright = visualsJson["ViewmodelXYZ cl_right"].asBool(); if (visualsJson.isMember("ViewmodelXYZ X")); v.viewmodel_x = visualsJson["ViewmodelXYZ X"].asBool(); if (visualsJson.isMember("ViewmodelXYZ Y")); v.viewmodel_y = visualsJson["ViewmodelXYZ Y"].asBool(); if (visualsJson.isMember("ViewmodelXYZ Z")); v.viewmodel_z = visualsJson["ViewmodelXYZ Z"].asBool(); if (visualsJson.isMember("Color correction")) { const auto& cc = visualsJson["Color correction"];
visualsJson["Playermodel T"] = visuals.playerModelT; visualsJson["Playermodel CT"] = visuals.playerModelCT; visualsJson["ViewmodelXYZ"] = v.viewmodelxyz; visualsJson["ViewmodelXYZ cl_right"] = v.viewmodel_clright; visualsJson["ViewmodelXYZ X"] = v.viewmodel_x; visualsJson["ViewmodelXYZ Y"] = v.viewmodel_y; visualsJson["ViewmodelXYZ Z"] = v.viewmodel_z;
Hello, i use other osiris version which has other cfg saving method i like this version because it has jb and better esp than new osiris i tried to redo the config from your post but still have errors, any help pls?
if (visualsJson.isMember("Playermodel CT")); visuals.playerModelCT = visualsJson["Playermodel CT"].asInt(); if (visualsJson.isMember("ViewmodelXYZ")); v.viewmodelxyz = visualsJson["ViewmodelXYZ"].asBool(); if (visualsJson.isMember("ViewmodelXYZ cl_right")); v.viewmodel_clright = visualsJson["ViewmodelXYZ cl_right"].asBool(); if (visualsJson.isMember("ViewmodelXYZ X")); v.viewmodel_x = visualsJson["ViewmodelXYZ X"].asBool(); if (visualsJson.isMember("ViewmodelXYZ Y")); v.viewmodel_y = visualsJson["ViewmodelXYZ Y"].asBool(); if (visualsJson.isMember("ViewmodelXYZ Z")); v.viewmodel_z = visualsJson["ViewmodelXYZ Z"].asBool(); if (visualsJson.isMember("Color correction")) { const auto& cc = visualsJson["Color correction"];
visualsJson["Playermodel T"] = visuals.playerModelT; visualsJson["Playermodel CT"] = visuals.playerModelCT; visualsJson["ViewmodelXYZ"] = v.viewmodelxyz; visualsJson["ViewmodelXYZ cl_right"] = v.viewmodel_clright; visualsJson["ViewmodelXYZ X"] = v.viewmodel_x; visualsJson["ViewmodelXYZ Y"] = v.viewmodel_y; visualsJson["ViewmodelXYZ Z"] = v.viewmodel_z;
oh nvm i fixed it by replading v.viewmodel_z by visuals.viewmodel_z
haha i pasted the first version which dont have the opposite cl_righthand feature on knife ggggg
would you mind creating a simple opposite hand knife feature -_- im dumb and cant make this code work, the first one worked but didnt saved to cfg
would you mind creating a simple opposite hand knife feature -_- im dumb and cant make this code work, the first one worked but didnt saved to cfg
///////// in Visuals.cpp for example
void Visuals::KnifeSwapper() noexcept{
static ConVar* cl_righthand = interfaces->cvar->findVar("cl_righthand");
const bool config_righthand = config->visuals.viewmodelXYZ.viewmodel_clright;
auto activeWeapon = localPlayer->getActiveWeapon();
if (!localPlayer->isAlive())
{
if (!localPlayer->getObserverTarget())
return;
if (localPlayer->getObserverMode() != ObsMode::InEye)
return;
const auto activeWeapon = localPlayer->getObserverTarget()->getActiveWeapon();
}
const auto classid = activeWeapon->getClientClass()->classId;
if (classid == ClassId::Knife) {
if(cl_righthand->getInt() != static_cast<int>(config_righthand) ){
cl_righthand = config_righthand ;
}
}
}
/////// in Gui.cpp
ImGui::Checkbox("Knife Swap", &config->visuals.viewmodelXYZ.viewmodel_clright);
i hope that helps, figure out the hooks and .h file yourself if you can
would you mind creating a simple opposite hand knife feature -_- im dumb and cant make this code work, the first one worked but didnt saved to cfg
///////// in Visuals.cpp for example void Visuals::KnifeSwapper() noexcept{ static ConVar* cl_righthand = interfaces->cvar->findVar("cl_righthand"); const bool config_righthand = config->visuals.viewmodelXYZ.viewmodel_clright; auto activeWeapon = localPlayer->getActiveWeapon(); if (!localPlayer->isAlive()) { if (!localPlayer->getObserverTarget()) return; if (localPlayer->getObserverMode() != ObsMode::InEye) return; const auto activeWeapon = localPlayer->getObserverTarget()->getActiveWeapon(); } const auto classid = activeWeapon->getClientClass()->classId; if (classid == ClassId::Knife) { if(cl_righthand->getInt() != config_righthand ){ cl_righthand = config_righthand ; } } } /////// in Gui.cpp ImGui::Checkbox("Knife Swap", &config->visuals.viewmodelXYZ.viewmodel_clright);
i hope that helps, figure out the hooks and .h file yourself if you can
ill try it thanks
I hope it works for you i did not test it wrote it just now, so you might have to fix some stuff
I hope it works for you i did not test it wrote it just now, so you might have to fix some stuff
i guess this only works with xyz changer const bool config_righthand = config->visuals.viewmodelXYZ.viewmodel_clright; not as code itself?
I hope it works for you i did not test it wrote it just now, so you might have to fix some stuff
i guess this only works with xyz changer const bool config_righthand = config->visuals.viewmodelXYZ.viewmodel_clright; not as code itself?
Yes but make that config path yourself, i just made it to be close to the end product. Like
const bool config_righthand = config->visuals.Knife_cl_clright;
the config is not hard currently, in config.h in
struct Visuals {
bool config_righthand { false };
}
and in config.cpp
static void from_json(const json& j, Config::Visuals& v) //This is to LOAD config.
{
read<value_t::boolean>(j, "Config Righthand", v.config_righthand ); (THIS IS FOR bool )
read_number(j, "Config Righthand", v.config_righthand ); (THIS IS FOR int , float , etc )
}
static void to_json(json& j, const Config::Misc& o) //This is to save config.
{
WRITE("Config Righthand", config_righthand);
}
//////////////////// so figur out wich one you need (bool)
and this code is not completekly copy pastable, so just try to figure it out, coding is like a puzzle game when you dont know the basics imho, so beat the puzzle my friend. :)
https://cdn.discordapp.com/attachments/724638912248807465/740312005520523364/Screenshot_2020-08-04-22-55-27-834_com.android.chrome.jpg
im done
getWeaponIndex()
and getWeaponClass()
are used in aimbot and triggerbot, it crashes because of modifications you've made to those functions.
Sadly it still crashes even without the changes to getWeaponIndex() and getWeaponClass(). (although a lot less.)
i did not change the existing funtion definitions, just added new ones, how would that crash? (trying to understand )
hey, maybe im missing something but i still get 2 errors
i tried to fix 1 and had another 200 so i am asking for help
1st error looks like you need a pointer to the function viewmodelxyz in visuals.h 2nd looks like yuo are missing a { before a }
crashes when afk/tabbed out