spirthack / CSGOSimple

A simple base for CS:GO internal hacks
http://csgosimple.eu
MIT License
399 stars 150 forks source link

Chams not drawing on agents with patches #123

Open ghost opened 4 years ago

ghost commented 4 years ago

the title, anyone know how to fix this.

InfernoLum commented 4 years ago

You could try the following ( I am not sure if it works since I haven't met people who have patches but in theory it should. There is this netvar called m_vecPlayerPatchEconIndices, the vec in infront hints at this being some kind of an array. so itterating through the array like so and setting every element to null should in theory remove player patches.

It Infact does work I specifically bought an agent and a patch to try this and it does infact work.

void Chams::RemovePlayerPatches()
{
    if (!g_Options.chams_player_enabled) return;

    for (size_t i = 0; i < g_EngineClient->GetMaxClients(); i++)
    {
        C_BasePlayer* plr = (C_BasePlayer*)g_EntityList->GetClientEntity(g_EngineClient->GetLocalPlayer());

        if (!plr) continue;
        if (!plr->IsAlive()) continue;

        for (size_t patchIndex = 0; patchIndex < 5; patchIndex++)
        {
            plr->m_vecPlayerPatchEconIndices()[patchIndex] = Vector(0, 0, 0);
        }
    }
}

Call in framestagenotify. m_vecPlayerPatchEconIndices is defined as follows:

    std::array<Vector, 5>& m_vecPlayerPatchEconIndices()
    {
        static int _m_vecPlayerPatchEconIndices = NetvarSys::GetOffset("DT_CSPlayer", "m_vecPlayerPatchEconIndices");
        return *(std::array<Vector, 5>*)((uintptr_t)this + _m_vecPlayerPatchEconIndices);
    }
InfernoLum commented 3 years ago

You could try the following ( I am not sure if it works since I haven't met people who have patches but in theory it should. There is this netvar called m_vecPlayerPatchEconIndices, the vec in infront hints at this being some kind of an array. so itterating through the array like so and setting every element to null should in theory remove player patches.

It Infact does work I specifically bought an agent and a patch to try this and it does infact work.

void Chams::RemovePlayerPatches()
{
  if (!g_Options.chams_player_enabled) return;

  for (size_t i = 0; i < g_EngineClient->GetMaxClients(); i++)
  {
      C_BasePlayer* plr = (C_BasePlayer*)g_EntityList->GetClientEntity(i);

      if (!plr) continue;
      if (!plr->IsAlive()) continue;

      for (size_t patchIndex = 0; patchIndex < 5; patchIndex++)
      {
          plr->m_vecPlayerPatchEconIndices()[patchIndex] = Vector(0, 0, 0);
      }
  }
}

Call in framestagenotify. m_vecPlayerPatchEconIndices is defined as follows:

  std::array<Vector, 5>& m_vecPlayerPatchEconIndices()
  {
      static int _m_vecPlayerPatchEconIndices = NetvarSys::GetOffset("DT_CSPlayer", "m_vecPlayerPatchEconIndices");
      return *(std::array<Vector, 5>*)((uintptr_t)this + _m_vecPlayerPatchEconIndices);
  }

This for some reason refuses to work on other players, it works only when I am the player with patches for some odd reason. I would recommend taking a look at osiris' implementation of isforcedmaterialoverride: https://github.com/danielkrupinski/Osiris/blob/b8ef099a9d67e4856a08e327b64cabfbbdec4a8a/Osiris/SDK/StudioRender.h#L25

ZippoKs commented 3 years ago

@InfernoLum Take a look at your code, this particularly: C_BasePlayer* plr = (C_BasePlayer*)g_EntityList->GetClientEntity(g_EngineClient->GetLocalPlayer()); You are looping through players, but applying this to a local for every player. I'd do it like this (didn't test it, not sure if it'll work, but you said it only works on local, so it should work on others as well with this change): C_BasePlayer* plr = (C_BasePlayer*)C_BaseEntity::GetEntityByIndex(i);

InfernoLum commented 3 years ago

@InfernoLum Take a look at your code, this particularly: C_BasePlayer* plr = (C_BasePlayer*)g_EntityList->GetClientEntity(g_EngineClient->GetLocalPlayer()); You are looping through players, but applying this to a local for every player. I'd do it like this (didn't test it, not sure if it'll work, but you said it only works on local, so it should work on others as well with this change): C_BasePlayer* plr = (C_BasePlayer*)C_BaseEntity::GetEntityByIndex(i);

That piece of code C_BasePlayer* plr = (C_BasePlayer*)g_EntityList->GetClientEntity(g_EngineClient->GetLocalPlayer()); is actually really funny, Im not sure what time it was when I wrote this code but I doubt it was before midnight. Thanks a lot for pointing out my silly mistake, hope you have a great one :)