danielkrupinski / Osiris

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

FasterWalk Implementation. HELP NEEDED. #1031

Closed TheFantasticLoki closed 1 year ago

TheFantasticLoki commented 4 years ago

I want to change the slow walk to better shift walking. What I mean by this is to have it so when your shift walking your speed never goes above 134 units but not below 130. I'd like it to be a constant 134 speed no matter what when walking cause the default shift walk is 130 max with a knife out. It refuses to surpass 130 when strafe walking too. But when I set the slow walk divider to 1.89 if you strafe walk your speed exceeds 135 Units causing you to make footstep noise. I am REALLY bad at coding so I am hoping someone else could accomplish this for me.

noteffex commented 4 years ago

There is primarily 2 uses of slow walk

  1. You move with no inaccuracy
  2. No footstep
noteffex commented 4 years ago

const float maxSpeed = ( localPlayer->isScoped() ? weaponData->maxSpeedAlt : weaponData->maxSpeed) / 3;

Change this line to const float maxSpeed = speed u want here.

danielkrupinski commented 4 years ago

I think your walking speed is clamped on the server.

noteffex commented 4 years ago

Yes it's clamped, Dont remember the exact values but you can use a float slider for it.

TheFantasticLoki commented 4 years ago

So I just tried to make a new option by copy pasting the slow walk feature and changing the code a bit to hopefully make it work the way I want it to but now I am getting tons of errors.

ghost commented 4 years ago

could you fork the project and commit your changes? we can't do anything without seeing your code.

if you upload it in plain text or as a zip/rar i won't review it

TheFantasticLoki commented 4 years ago

I got it fixed I had a case error. going to test it then I will commit to my project.

TheFantasticLoki commented 4 years ago

Well it kinda works but it still goes above 134 units when strafing and I don't know how to clamp it. any ideas. I'll commit changes as well so you can take a look.

ghost commented 4 years ago

when strafing you gain velocity because your converting side speed to forward speed, you could probably snap the angle outside of the max delta causing you to lose speed or momentarily reverse directions until you drop enough under a threshold.

TheFantasticLoki commented 4 years ago

Committed Changes you can look at the code here: https://github.com/TheFantasticLoki/Osiris

TheFantasticLoki commented 4 years ago

Also I am trying to get it to work like shift walking just faster. I just don't know how to do it.

TheFantasticLoki commented 4 years ago

Since IK that the commit is going to be ass to find the fastwalk code since there is so much other stuff I just added to that commit Here is the code.

`void Misc::fastwalk(UserCmd* cmd) noexcept { if (!config.misc.fastwalk || !GetAsyncKeyState(config.misc.fastwalkKey)) return;

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

if (!localPlayer || !localPlayer->isAlive())
    return;

const auto activeWeapon = localPlayer->getActiveWeapon();
if (!activeWeapon)
    return;

const auto weaponData = activeWeapon->getWeaponData();
if (!weaponData)
    return;

const float maxSpeed = 134;

if (cmd->forwardmove && cmd->sidemove) {
    const float maxSpeedRoot = maxSpeed * static_cast<float>(M_SQRT1_2);
    cmd->forwardmove = cmd->forwardmove < 0.0f ? -maxSpeedRoot : maxSpeedRoot;
    cmd->sidemove = cmd->sidemove < 0.0f ? -maxSpeedRoot : maxSpeedRoot;
}
else if (cmd->forwardmove) {
    cmd->forwardmove = cmd->forwardmove < 0.0f ? -maxSpeed : maxSpeed;
}
else if (cmd->sidemove) {
    cmd->sidemove = cmd->sidemove < 0.0f ? -maxSpeed : maxSpeed;
}

}`

TheFantasticLoki commented 4 years ago

Again I have basically no idea what I am doing I am just diving into the deep end and trying to figure it out. Adding features that I want you know the usual. after this I want to attempt to add the bhop hitchance but the code I found in the pull requests is super old and Not sure how to fix it.

TheFantasticLoki commented 4 years ago

Oh also could you recommend a good program for randomising the code. Like how p2c have unique builds? I'd like to set something up for myself rn to stay UD while using this but progress to offering Unique builds for anyone who wants this cheat. But that comes later and probably with money soooo.

ghost commented 4 years ago

https://github.com/TheFantasticLoki/Osiris/blob/master/Osiris/Hacks/Misc.cpp#L56 ^ you can probably change this line to be your units per second (knife being 250 u/s)

what your looking for is polymorphic code. compile time polymorphism is way worse than injection time polymorphism. ^ injection time has the benefit of changing it every single time you inject, not just on distribution. i don't know any polymorphic injectors however on unknowncheats there is a thread about making one, just not any implementation i know of. to enforce the use of a polymorphic injector you would have to make your own loader instead of just giving out a DLL.

TheFantasticLoki commented 4 years ago

The line you are refering to I have already changed to 134 Units. The problem is that it wants to also add strafe speed and I don't know how to cancel that out like shift walking does.