Исходник Attachment Chams (CS2)

Начинающий
Статус
Оффлайн
Регистрация
13 Авг 2022
Сообщения
132
Реакции[?]
12
Поинты[?]
5K
I was trying to make ViewModel (Weapon) chams but failed and made attachment chams without trying LOL

Base Used: asphyxia
Note; I'm using a custom version of asphyxia, I've written about 60% of the code so I won't give source until it's finished completely.

Here is my post on the asphyxia github
Пожалуйста, авторизуйтесь для просмотра ссылки.



Attachment Chams (chams.cpp):
bool F::VISUALS::CHAMS::OnDrawObject(void* pAnimatableSceneObjectDesc, void* pDx11, CMeshData* arrMeshDraw, int nDataCount, void* pSceneView, void* pSceneLayer, void* pUnk, void* pUnk2)
{
    if (!bInitialized)
        return false;

    if (!C_GET(bool, Vars.bVisualChams))
        return false;

    if (arrMeshDraw == nullptr)
        return false;

    if (arrMeshDraw->pSceneAnimatableObject == nullptr)
        return false;

    CBaseHandle hOwner = arrMeshDraw->pSceneAnimatableObject->hOwner;

    auto pEntity = I::GameResourceService->pGameEntitySystem->Get<C_BaseEntity>(hOwner);
    if (pEntity == nullptr)
        return false;

    SchemaClassInfoData_t* pClassInfo;
    pEntity->GetSchemaClassInfo(&pClassInfo);
    if (pClassInfo == nullptr)
        return false;

    // Handle player chams
    if (CRT::StringCompare(pClassInfo->szName, CS_XOR("C_CSPlayerPawn")) == 0)
    {
        auto pPlayerPawn = I::GameResourceService->pGameEntitySystem->Get<C_CSPlayerPawn>(hOwner);
        if (pPlayerPawn == nullptr)
            return false;

        bool bIsLocalPlayer = (pPlayerPawn == SDK::LocalPawn);

        // Include local player in the chams rendering if the checkbox is checked
        if (!C_GET(bool, Vars.bRenderLocalPlayerChams) && bIsLocalPlayer)
            return false;

        // Include enemies in the chams rendering
        if (!bIsLocalPlayer && !pPlayerPawn->IsOtherEnemy(SDK::LocalPawn))
            return false;

        // Check if the entity is alive or if we should render chams on ragdolls
        if (pPlayerPawn->GetHealth() <= 0 && !C_GET(bool, Vars.bRenderChamsOnRagdolls))
            return false;

        return OverrideMaterial(pAnimatableSceneObjectDesc, pDx11, arrMeshDraw, nDataCount, pSceneView, pSceneLayer, pUnk, pUnk2);
    }

    // Handle weapon chams for local player
    if (C_GET(bool, Vars.bVisualChamsWeapons) && pEntity->IsWeapon())
    {
        auto pOwnerEntity = I::GameResourceService->pGameEntitySystem->Get<C_BaseEntity>(pEntity->GetOwnerHandle());
        if (pOwnerEntity && pOwnerEntity == SDK::LocalPawn)
        {
            return OverrideMaterial(pAnimatableSceneObjectDesc, pDx11, arrMeshDraw, nDataCount, pSceneView, pSceneLayer, pUnk, pUnk2);
        }
    }

    return false;
}


bool F::VISUALS::CHAMS::OverrideMaterial(void* pAnimatableSceneObjectDesc, void* pDx11, CMeshData* arrMeshDraw, int nDataCount, void* pSceneView, void* pSceneLayer, void* pUnk, void* pUnk2)
{
    const auto oDrawObject = H::hkDrawObject.GetOriginal();
    const CustomMaterial_t customMaterial = arrMaterials[C_GET(int, Vars.nVisualChamMaterial)];

    auto pEntity = I::GameResourceService->pGameEntitySystem->Get<C_BaseEntity>(arrMeshDraw->pSceneAnimatableObject->hOwner);
    if (pEntity == nullptr)
        return false;

    SchemaClassInfoData_t* pClassInfo;
    pEntity->GetSchemaClassInfo(&pClassInfo);
    if (pClassInfo == nullptr)
        return false;

    // Handle player chams
    if (CRT::StringCompare(pClassInfo->szName, CS_XOR("C_CSPlayerPawn")) == 0)
    {
        auto pPlayerPawn = I::GameResourceService->pGameEntitySystem->Get<C_CSPlayerPawn>(arrMeshDraw->pSceneAnimatableObject->hOwner);
        if (pPlayerPawn == nullptr)
            return false;

        bool bIsLocalPlayer = (pPlayerPawn == SDK::LocalPawn);

        // Apply IgnoreZ material and color
        if (C_GET(bool, Vars.bVisualChamsIgnoreZ))
        {
            arrMeshDraw->pMaterial = customMaterial.pMaterialInvisible;
            arrMeshDraw->colValue = bIsLocalPlayer ? C_GET(Color_t, Vars.colLocalChamsIgnoreZ) : C_GET(Color_t, Vars.colEnemyChamsIgnoreZ);
            oDrawObject(pAnimatableSceneObjectDesc, pDx11, arrMeshDraw, nDataCount, pSceneView, pSceneLayer, pUnk, pUnk2);
        }

        // Apply visible material and color
        arrMeshDraw->pMaterial = customMaterial.pMaterial;
        arrMeshDraw->colValue = bIsLocalPlayer ? C_GET(Color_t, Vars.colLocalChams) : C_GET(Color_t, Vars.colEnemyChams);
    }
    else if (C_GET(bool, Vars.bVisualChamsWeapons) && pEntity->IsWeapon())
    {
        auto pOwnerEntity = I::GameResourceService->pGameEntitySystem->Get<C_BaseEntity>(pEntity->GetOwnerHandle());
        if (pOwnerEntity && pOwnerEntity == SDK::LocalPawn)
        {
            // Apply weapon material and color for local player
            arrMeshDraw->pMaterial = customMaterial.pMaterial;
            arrMeshDraw->colValue = C_GET(Color_t, Vars.colWeaponChams);
        }
    }

    oDrawObject(pAnimatableSceneObjectDesc, pDx11, arrMeshDraw, nDataCount, pSceneView, pSceneLayer, pUnk, pUnk2);

    return true;
}
 
Начинающий
Статус
Оффлайн
Регистрация
26 Ноя 2020
Сообщения
62
Реакции[?]
10
Поинты[?]
2K
SceneAnimatableObject isnt what ur supposed to use
C_ViewmodelAttachmentModel is what you are looking for for arms
C_CSGOViewModel is for weapons

also, may i ask what kinda features you have on your asphyxia src?
 
Начинающий
Статус
Оффлайн
Регистрация
13 Авг 2022
Сообщения
132
Реакции[?]
12
Поинты[?]
5K
SceneAnimatableObject isnt what ur supposed to use
C_ViewmodelAttachmentModel is what you are looking for for arms
C_CSGOViewModel is for weapons

also, may i ask what kinda features you have on your asphyxia src?
Rage (WIP)
  • Silent Aim
  • Auto Scope
  • Weapon Customization (Global, Ak, etc..)

Visuals (WIP)
  • Bullet Tracers
  • World hit Markers
  • ViewModel Override
  • Bomb timer indicator
  • Hit logs
  • Nightmode, World/Sky/Cloud/light modulation, skybox (removed)

Movement (WIP)
  • Jump Bug
  • Bhop, Strafe (Legit, Aggressive (hvh))

Misc (WIP)
  • Purchase Logs (team, enemy, local)
  • Thirdperson (kinda buggy)
  • Skin Changer
 
Начинающий
Статус
Оффлайн
Регистрация
26 Ноя 2020
Сообщения
62
Реакции[?]
10
Поинты[?]
2K
Rage (WIP)
  • Silent Aim
  • Auto Scope
  • Weapon Customization (Global, Ak, etc..)

Visuals (WIP)
  • Bullet Tracers
  • World hit Markers
  • ViewModel Override
  • Bomb timer indicator
  • Hit logs
  • Nightmode, World/Sky/Cloud/light modulation, skybox (removed)

Movement (WIP)
  • Jump Bug
  • Bhop, Strafe (Legit, Aggressive (hvh))

Misc (WIP)
  • Purchase Logs (team, enemy, local)
  • Thirdperson (kinda buggy)
  • Skin Changer
whats wrong with the thirdperson, what does it do. if u need help lmk just slide me the src i can take a look at it bc ive been fixing a lot of shit with mine
 
Начинающий
Статус
Оффлайн
Регистрация
13 Авг 2022
Сообщения
132
Реакции[?]
12
Поинты[?]
5K
Последнее редактирование:
Начинающий
Статус
Оффлайн
Регистрация
29 Апр 2024
Сообщения
113
Реакции[?]
9
Поинты[?]
9K
Rage (WIP)
  • Silent Aim
  • Auto Scope
  • Weapon Customization (Global, Ak, etc..)

Visuals (WIP)
  • Bullet Tracers
  • World hit Markers
  • ViewModel Override
  • Bomb timer indicator
  • Hit logs
  • Nightmode, World/Sky/Cloud/light modulation, skybox (removed)

Movement (WIP)
  • Jump Bug
  • Bhop, Strafe (Legit, Aggressive (hvh))

Misc (WIP)
  • Purchase Logs (team, enemy, local)
  • Thirdperson (kinda buggy)
  • Skin Changer
dll please
 
Начинающий
Статус
Оффлайн
Регистрация
13 Авг 2022
Сообщения
132
Реакции[?]
12
Поинты[?]
5K
Начинающий
Статус
Оффлайн
Регистрация
26 Ноя 2020
Сообщения
62
Реакции[?]
10
Поинты[?]
2K
Сверху Снизу