Advertisement
Wolfrost

Misc CSGO shit

Oct 14th, 2016
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #pragma once
  2. #include "common.h"
  3. #include "interfaces.h"
  4. #include "usercmd.h"
  5. #include "baseentity.h"
  6. #include "definitions.h"
  7. #include "draw.h"
  8. #include "viewsetup.h"
  9. #include "maths.h"
  10. #include "material.h"
  11. #include <algorithm>
  12. #include <unordered_map>
  13. #include <sys\stat.h>
  14. #include <fstream>
  15. #include "glowobject.h"
  16. #include "utils.h"
  17. #include "menu.h"
  18. #include "raytracing.h"
  19.  
  20. #pragma comment(lib, "Winmm.lib")
  21.  
  22. #define HITGROUP_GENERIC    0
  23. #define HITGROUP_HEAD       1
  24. #define HITGROUP_CHEST      2
  25. #define HITGROUP_STOMACH    3
  26. #define HITGROUP_LEFTARM    4  
  27. #define HITGROUP_RIGHTARM   5
  28. #define HITGROUP_LEFTLEG    6
  29. #define HITGROUP_RIGHTLEG   7
  30. #define HITGROUP_GEAR       10          // alerts NPC, but doesn't do damage or bleed (1/100th damage)
  31.  
  32. #define BONE_USED_MASK              0x0007FF00
  33. #define BONE_USED_BY_ANYTHING       0x0007FF00
  34. #define BONE_USED_BY_HITBOX         0x00000100  // bone (or child) is used by a hit box
  35. #define BONE_USED_BY_ATTACHMENT     0x00000200  // bone (or child) is used by an attachment point
  36. #define BONE_USED_BY_VERTEX_MASK    0x0003FC00
  37. #define BONE_USED_BY_VERTEX_LOD0    0x00000400  // bone (or child) is used by the toplevel model via skinned vertex
  38. #define BONE_USED_BY_VERTEX_LOD1    0x00000800 
  39. #define BONE_USED_BY_VERTEX_LOD2    0x00001000  
  40. #define BONE_USED_BY_VERTEX_LOD3    0x00002000
  41. #define BONE_USED_BY_VERTEX_LOD4    0x00004000
  42. #define BONE_USED_BY_VERTEX_LOD5    0x00008000
  43. #define BONE_USED_BY_VERTEX_LOD6    0x00010000
  44. #define BONE_USED_BY_VERTEX_LOD7    0x00020000
  45. #define BONE_USED_BY_BONE_MERGE     0x00040000  // bone is available for bone merge to occur against it
  46.  
  47. enum ClientFrameStage_t
  48. {
  49.     FRAME_UNDEFINED = -1,
  50.     FRAME_START,
  51.     FRAME_NET_UPDATE_START,
  52.     FRAME_NET_UPDATE_POSTDATAUPDATE_START,
  53.     FRAME_NET_UPDATE_POSTDATAUPDATE_END,
  54.     FRAME_NET_UPDATE_END,
  55.     FRAME_RENDER_START,
  56.     FRAME_RENDER_END
  57. };
  58. enum ClassIDs
  59. {
  60.     CAI_BaseNPC = 0,
  61.     CAK47,
  62.     CBaseAnimating,
  63.     CBaseAnimatingOverlay ,
  64.     CBaseAttributableItem_,
  65.     CBaseButton,
  66.     CBaseCSGrenade,
  67.     CBaseCSGrenadeProjectile,
  68.     CBaseDoor,
  69.     CBaseFlex,
  70.     CBaseGrenade,
  71.     CBaseParticleEntity,
  72.     CBasePlayer,
  73.     CBasePropDoor,
  74.     CBaseTeamObjectiveResource,
  75.     CBaseTempEntity,
  76.     CBaseToggle,
  77.     CBaseTrigger,
  78.     CBaseViewModel,
  79.     CBaseVPhysicsTrigger,
  80.     CBaseWeaponWorldModel,
  81.     CBeam,
  82.     CBeamSpotlight,
  83.     CBoneFollower,
  84.     CBreakableProp,
  85.     CBreakableSurface,
  86.     CC4,
  87.     CCascadeLight,
  88.     CChicken,
  89.     CColorCorrection,
  90.     CColorCorrectionVolume,
  91.     CCSGameRulesProxy,
  92.     CCSPlayer,
  93.     CCSPlayerResource,
  94.     CCSRagdoll,
  95.     CCSTeam,
  96.     CDEagle,
  97.     CDecoyGrenade,
  98.     CDecoyProjectile,
  99.     CDynamicLight,
  100.     CDynamicProp,
  101.     CEconEntity,
  102.     CEmbers,
  103.     CEntityDissolve,
  104.     CEntityFlame,
  105.     CEntityFreezing,
  106.     CEntityParticleTrail,
  107.     CEnvAmbientLight,
  108.     CEnvDetailController,
  109.     CEnvDOFController,
  110.     CEnvParticleScript,
  111.     CEnvProjectedTexture,
  112.     CEnvQuadraticBeam,
  113.     CEnvScreenEffect,
  114.     CEnvScreenOverlay,
  115.     CEnvTonemapController,
  116.     CEnvWind,
  117.     CFireCrackerBlast,
  118.     CFireSmoke,
  119.     CFireTrail,
  120.     CFish,
  121.     CFlashbang,
  122.     CFogController,
  123.     CFootstepControl,
  124.     CFunc_Dust,
  125.     CFunc_LOD,
  126.     CFuncAreaPortalWindow,
  127.     CFuncBrush,
  128.     CFuncConveyor,
  129.     CFuncLadder,
  130.     CFuncMonitor,
  131.     CFuncMoveLinear,
  132.     CFuncOccluder,
  133.     CFuncReflectiveGlass,
  134.     CFuncRotating,
  135.     CFuncSmokeVolume,
  136.     CFuncTrackTrain,
  137.     CGameRulesProxy,
  138.     CHandleTest,
  139.     CHEGrenade,
  140.     CHostage,
  141.     CHostageCarriableProp,
  142.     CIncendiaryGrenade,
  143.     CInferno,
  144.     CInfoLadderDismount,
  145.     CInfoOverlayAccessor,
  146.     CItem_Healthshot,
  147.     CKnife,
  148.     CKnifeGG,
  149.     CLightGlow,
  150.     CMaterialModifyControl,
  151.     CMolotovGrenade,
  152.     CMolotovProjectile,
  153.     CMovieDisplay,
  154.     CParticleFire,
  155.     CParticlePerformanceMonitor,
  156.     CParticleSystem,
  157.     CPhysBox,
  158.     CPhysBoxMultiplayer,
  159.     CPhysicsProp,
  160.     CPhysicsPropMultiplayer,
  161.     CPhysMagnet,
  162.     CPlantedC4,
  163.     CPlasma,
  164.     CPlayerResource,
  165.     CPointCamera,
  166.     CPointCommentaryNode,
  167.     CPoseController,
  168.     CPostProcessController,
  169.     CPrecipitation,
  170.     CPrecipitationBlocker,
  171.     CPredictedViewModel,
  172.     CProp_Hallucination,
  173.     CPropDoorRotating,
  174.     CPropJeep,
  175.     CPropVehicleDriveable,
  176.     CRagdollManager,
  177.     CRagdollProp,
  178.     CRagdollPropAttached,
  179.     CRopeKeyframe,
  180.     CSCAR17,
  181.     CSceneEntity,
  182.     CSensorGrenade,
  183.     CSensorGrenadeProjectile,
  184.     CShadowControl,
  185.     CSlideshowDisplay,
  186.     CSmokeGrenade,
  187.     CSmokeGrenadeProjectile,
  188.     CSmokeStack,
  189.     CSpatialEntity,
  190.     CSpotlightEnd,
  191.     CSprite,
  192.     CSpriteOriented,
  193.     CSpriteTrail,
  194.     CStatueProp,
  195.     CSteamJet,
  196.     CSun,
  197.     CSunlightShadowControl,
  198.     CTeam,
  199.     CTeamplayRoundBasedRulesProxy,
  200.     CTEArmorRicochet,
  201.     CTEBaseBeam,
  202.     CTEBeamEntPoint,
  203.     CTEBeamEnts,
  204.     CTEBeamFollow,
  205.     CTEBeamLaser,
  206.     CTEBeamPoints,
  207.     CTEBeamRing,
  208.     CTEBeamRingPoint,
  209.     CTEBeamSpline,
  210.     CTEBloodSprite,
  211.     CTEBloodStream,
  212.     CTEBreakModel1,
  213.     CTEBSPDecal,
  214.     CTEBubbles,
  215.     CTEBubbleTrail,
  216.     CTEClientProjectile,
  217.     CTEDecal,
  218.     CTEDust,
  219.     CTEDynamicLight,
  220.     CTEEffectDispatch,
  221.     CTEEnergySplash,
  222.     CTEExplosion,
  223.     CTEFireBullets,
  224.     CTEFizz,
  225.     CTEFootprintDecal,
  226.     CTEFoundryHelpers,
  227.     CTEGaussExplosion,
  228.     CTEGlowSprite,
  229.     CTEImpact,
  230.     CTEKillPlayerAttachments,
  231.     CTELargeFunnel,
  232.     CTEMetalSparks,
  233.     CTEMuzzleFlash,
  234.     CTEParticleSystem,
  235.     CTEPhysicsProp,
  236.     CTEPlantBomb,
  237.     CTEPlayerAnimEvent,
  238.     CTEPlayerDecal,
  239.     CTEProjectedDecal,
  240.     CTERadioIcon,
  241.     CTEShatterSurface,
  242.     CTEShowLine,
  243.     CTesla,
  244.     CTESmoke,
  245.     CTESparks,
  246.     CTESprite,
  247.     CTESpriteSpray,
  248.     CTest_ProxyToggle_Networkable,
  249.     CTestTraceline,
  250.     CTEWorldDecal,
  251.     CTriggerPlayerMovement,
  252.     CTriggerSoundOperator,
  253.     CVGuiScreen,
  254.     CVoteController,
  255.     CWaterBullet,
  256.     CWaterLODControl,
  257.     CWeaponAug,
  258.     CWeaponAWP,
  259.     CWeaponBaseItem,
  260.     CWeaponBizon,
  261.     CWeaponCSBase,
  262.     CWeaponCSBaseGun,
  263.     CWeaponCycler,
  264.     CWeaponElite,
  265.     CWeaponFamas,
  266.     CWeaponFiveSeven,
  267.     CWeaponG3SG1,
  268.     CWeaponGalil,
  269.     CWeaponGalilAR,
  270.     CWeaponGlock,
  271.     CWeaponHKP2000,
  272.     CWeaponM249,
  273.     CWeaponM3,
  274.     CWeaponM4A1,
  275.     CWeaponMAC10,
  276.     CWeaponMag7,
  277.     CWeaponMP5Navy,
  278.     CWeaponMP7,
  279.     CWeaponMP9,
  280.     CWeaponNegev,
  281.     CWeaponNOVA,
  282.     CWeaponP228,
  283.     CWeaponP250,
  284.     CWeaponP90,
  285.     CWeaponSawedoff,
  286.     CWeaponSCAR20,
  287.     CWeaponScout,
  288.     CWeaponSG550,
  289.     CWeaponSG552,
  290.     CWeaponSG556,
  291.     CWeaponSSG08,
  292.     CWeaponTaser,
  293.     CWeaponTec9,
  294.     CWeaponTMP,
  295.     CWeaponUMP45,
  296.     CWeaponUSP,
  297.     CWeaponXM1014,
  298.     CWorld,
  299.     DustTrail,
  300.     MovieExplosion,
  301.     ParticleSmokeGrenade,
  302.     RocketTrail,
  303.     SmokeTrail,
  304.     SporeExplosion,
  305.     SporeTrail
  306. };
  307.  
  308. void TraceLine( Vector& vecAbsStart, Vector& vecAbsEnd, unsigned int mask, CBaseEntity* ignore, trace_t* ptr )
  309. {
  310.     Ray_t ray;
  311.     ray.Init( vecAbsStart, vecAbsEnd );
  312.     CTraceFilter filter;
  313.     filter.pSkip = ignore;
  314.  
  315.     I::EngineTrace->TraceRay( ray, mask, &filter, ptr );
  316. }
  317.  
  318. unsigned int drawPanel;
  319. int ScreenWidth, ScreenHeight;
  320. IMaterial* ChamsMat, *ChamsMat_IgnoreZ, *ChamsMat_Flat, *ChamsMat_Flat_IgnoreZ;
  321. bool bDrawHitmarker;
  322. int iHitmarkerTime;
  323. int iTotalHits;
  324. bool bInAntiAim;
  325. Vector LastViewAngles;
  326. CBaseEntity* pLocal;
  327. bool bSendPacket;
  328. std::vector<char*> Spectators;
  329. DWORD ServerRankRevealAllOff;
  330.  
  331. class CFixMove
  332. {
  333. public:
  334.     void Start(CUserCmd* pCmd)
  335.     {
  336.         m_oldangle      = pCmd->viewangles;
  337.         m_oldforward    = pCmd->forwardmove;
  338.         m_oldsidemove   = pCmd->sidemove;
  339.     }
  340.     void End(CUserCmd* pCmd)
  341.     {
  342.         float yaw_delta = pCmd->viewangles.y - m_oldangle.y;
  343.         float f1;
  344.         float f2;
  345.  
  346.         if( m_oldangle.y < 0.f )
  347.             f1 = 360.0f + m_oldangle.y;
  348.         else
  349.             f1 = m_oldangle.y;
  350.  
  351.         if( pCmd->viewangles.y < 0.0f )
  352.             f2 = 360.0f + pCmd->viewangles.y;
  353.         else
  354.             f2 = pCmd->viewangles.y;
  355.  
  356.         if( f2 < f1 )
  357.             yaw_delta = abs( f2 - f1 );
  358.         else
  359.             yaw_delta = 360.0f - abs( f1 - f2 );
  360.         yaw_delta = 360.0f - yaw_delta;
  361.  
  362.         pCmd->forwardmove = cos( DEG2RAD( yaw_delta ) ) * m_oldforward + cos( DEG2RAD( yaw_delta + 90.f ) ) * m_oldsidemove;
  363.         pCmd->sidemove = sin( DEG2RAD( yaw_delta ) ) * m_oldforward + sin( DEG2RAD( yaw_delta + 90.f ) ) * m_oldsidemove;
  364.     }
  365. private:
  366.     float m_oldforward, m_oldsidemove;
  367.     Vector m_oldangle;
  368. };
  369. class CCorrection
  370. {
  371. public:
  372.     int index;
  373.     Vector RealAngles;
  374.     CCorrection(int index, Vector RealAngles) { this->index = index; this->RealAngles = RealAngles; }
  375. };
  376.  
  377. CBaseCombatWeapon* GetWeapon(CBaseEntity* pEntity, int Index)
  378. {
  379.     //return (CBaseCombatWeapon*)I::ClientEntList->GetClientEntityFromHandle(GetFieldValue<CHandle<CBaseCombatWeapon>>(0x2DE8 + ((Index - 1) * 0x4)));
  380.     //inline T GetFieldValue(int Offset) { return *(T*)((DWORD)this + Offset); }
  381.     return (CBaseCombatWeapon*)I::ClientEntList->GetClientEntityFromHandle( *(CHandle<CBaseCombatWeapon>*)((DWORD)pEntity + 0x2DE8 + ((Index - 1) * 0x4)) );
  382. }
  383. CBaseCombatWeapon* GetActiveWeapon(CBaseEntity* pEntity)
  384. {
  385.     return (CBaseCombatWeapon*)I::ClientEntList->GetClientEntityFromHandle( *(CHandle<CBaseCombatWeapon>*)((DWORD)pEntity + 0x2EE8) );
  386. }
  387.  
  388. typedef bool(__cdecl *ServerRankRevealAllFn)(float*);
  389. ServerRankRevealAllFn ServerRankRevealAllEx;
  390. void ServerRankRevealAll()
  391. {
  392.     static float fArray[ 3 ] = { 0.f, 0.f, 0.f };
  393.     ServerRankRevealAllOff = Utils::FindPattern("client.dll", "55 8B EC 8B 0D ? ? ? ? 68 ? ? ? ?");
  394.     if (!ServerRankRevealAllOff) return;
  395.     ServerRankRevealAllEx = ( ServerRankRevealAllFn )( ServerRankRevealAllOff );
  396.     if (!ServerRankRevealAllEx) return;
  397.     ServerRankRevealAllEx( fArray );
  398. }
  399.  
  400. enum Hitboxes
  401. {
  402.     HITBOX_HEAD,
  403.     HITBOX_NECK,
  404.     HITBOX_LOWER_NECK,
  405.     HITBOX_PELVIS,
  406.     HITBOX_BODY,
  407.     HITBOX_THORAX,
  408.     HITBOX_CHEST,
  409.     HITBOX_UPPER_CHEST,
  410.     HITBOX_RIGHT_THIGH,
  411.     HITBOX_LEFT_THIGH,
  412.     HITBOX_RIGHT_CALF,
  413.     HITBOX_LEFT_CALF,
  414.     HITBOX_RIGHT_FOOT,
  415.     HITBOX_LEFT_FOOT,
  416.     HITBOX_RIGHT_HAND,
  417.     HITBOX_LEFT_HAND,
  418.     HITBOX_RIGHT_UPPER_ARM,
  419.     HITBOX_RIGHT_FOREARM,
  420.     HITBOX_LEFT_UPPER_ARM,
  421.     HITBOX_LEFT_FOREARM,
  422.     HITBOX_MAX
  423. };
  424.  
  425. struct TargetList_t
  426. {
  427.     float distance;
  428.     float fClose;
  429.     Vector AimbotAngle;
  430.     float AimAngleDiff;
  431.     TargetList_t(){}
  432.     TargetList_t(Vector aimAngle, Vector myCoords, Vector enCoords)
  433.     {
  434.         //Calculate crosshair distance
  435.         Vector PlayerAngles;
  436.         I::Engine->GetViewAngles(PlayerAngles);
  437.         fClose = Math.GetFov( PlayerAngles, myCoords, enCoords );
  438.         AimbotAngle = aimAngle;
  439.     }
  440. };
  441. struct CompareTargetByCrosshairDistance
  442. {
  443.     bool operator() (TargetList_t & lhs, TargetList_t & rhs)
  444.     {
  445.         return lhs.fClose < rhs.fClose;
  446.     }
  447. };
  448. void PlayerBox( float x, float y, float w, float h, Color clr )
  449. {
  450.     int r = 255, g = 255, b = 255, a = 255;
  451.     clr.GetColor(r,g,b,a);
  452.     I::Surface->DrawSetColor( r, g, b, a );
  453.     I::Surface->DrawOutlinedRect( x - w, y, x + w, y + h );
  454.     I::Surface->DrawSetColor( 0, 0, 0, 255 );
  455.     I::Surface->DrawOutlinedRect( x - w - 1, y - 1, x + w + 1, y + h + 1 );
  456.     I::Surface->DrawOutlinedRect( x - w + 1, y + 1, x + w - 1, y + h - 1 );
  457. }
  458. void HealthBar( Vector bot, Vector top, float health )
  459. {
  460.     float h = ( bot.y - top.y );
  461.     float offset = ( h / 4.f ) + 5;
  462.     float w = h / 64.f;
  463.  
  464.     UINT hp = h - ( UINT )( ( h * health ) / 100 ); // Percentage
  465.  
  466.     Draw::DrawOutlinedRect( ( top.x - offset ) - 1, top.y - 1, 3, h + 2, Color::Black() );
  467.  
  468.     Draw::DrawLine( ( top.x - offset ), top.y + hp, ( top.x - offset ), top.y + h, Color::Green() );
  469. }
  470. void ArmorBar( Vector bot, Vector top, float armor )
  471. {
  472.     float h = ( bot.y - top.y );
  473.     float offset = ( h / 4.f ) + 10;
  474.     float w = h / 64.f;
  475.  
  476.     UINT arm = h - (UINT)( ( h * armor ) / 100 );
  477.     Draw::DrawOutlinedRect( ( top.x - offset ) - 1, top.y - 1, 3, h + 2, Color::Black() );
  478.  
  479.     Draw::DrawLine( ( top.x - offset ), top.y + arm, ( top.x - offset ), top.y + h, Color::Lightblue() );
  480. }
  481. player_info_t GetInfo(int Index)
  482. {
  483.     player_info_t temp;
  484.     I::Engine->GetPlayerInfo(Index, &temp);
  485.     return temp;
  486. }
  487. CBaseCombatWeapon* GetWeapon(CBaseEntity* curent)
  488. {
  489.     CBaseCombatWeapon* temp = (CBaseCombatWeapon*)I::ClientEntList->GetClientEntityFromHandle(curent->GetWeaponHandle());
  490.     if (!temp) return nullptr;
  491.     return temp;
  492. }
  493. CBaseEntity* GetObserverTarget(CBaseEntity* curent)
  494. {
  495.     CBaseEntity* temp = (CBaseEntity*)I::ClientEntList->GetClientEntityFromHandle(curent->GetObserverTarget());
  496.     if (!temp) return nullptr;
  497.     return temp;
  498. }
  499. float GetBombTimer(CBaseEntity* curent)
  500. {
  501.     float returnValue = curent->GetBombTimer() - I::Globals->curtime;
  502.     return ( returnValue < 0 ) ? 0.f : returnValue;
  503. }
  504. bool IsFileExists(const std::string& name)
  505. {
  506.     struct stat buffer;
  507.     return (stat(name.c_str(), &buffer) == 0);
  508. }
  509. std::string GetWorkingPath()
  510. {
  511.     char szPath[MAX_PATH];
  512.  
  513.     GetModuleFileNameA(0, szPath, MAX_PATH);
  514.  
  515.     std::string path(szPath);
  516.  
  517.     return path.substr(0, path.find_last_of("\\") + 1);
  518. }
  519. void ForceMaterial( IMaterial* material, Color color )
  520. {
  521.     if( material != NULL )
  522.     {
  523.         I::RenderView->SetColorModulation( color.Base() );
  524.         I::ModelRenderer->ForcedMaterialOverride( material );
  525.     }
  526. }
  527. void PlayerBox3D( CBaseEntity* pEntity, CBaseEntity* pLocal )
  528. {
  529.     ICollideable* coll = pEntity->GetCollideable();
  530.     if (!coll) return;
  531.  
  532.     Vector min = coll->OBBMins();
  533.     Vector max = coll->OBBMaxs();
  534.  
  535.     Vector corners[8] =
  536.     {
  537.         Vector(min.x,min.y,min.z),
  538.         Vector(min.x,max.y,min.z),
  539.         Vector(max.x,max.y,min.z),
  540.         Vector(max.x,min.y,min.z),
  541.         Vector(min.x,min.y,max.z),
  542.         Vector(min.x,max.y,max.z),
  543.         Vector(max.x,max.y,max.z),
  544.         Vector(max.x,min.y,max.z)
  545.     };
  546.  
  547.     float ang = pEntity->GetEyeAngles().y;
  548.  
  549.     for (int i=0; i<=7; i++)
  550.         corners[i].Rotate2D(ang);
  551.  
  552.     Vector _corners[8];
  553.  
  554.     for (int i=0; i<=7; i++)
  555.     {
  556.         if (!Draw::WorldToScreen(pEntity->GetAbsOrigin() + corners[i], _corners[i]))
  557.             continue;
  558.     }
  559.  
  560.     int x1 = ScreenWidth * 2, y1 = ScreenHeight * 2, x2 = -ScreenWidth, y2 = -ScreenHeight;
  561.  
  562.     for (int i = 0; i <= 7; i++)
  563.     {
  564.         x1 = (int)(min(x1, _corners[i].x));
  565.         y1 = (int)(min(y1, _corners[i].y));
  566.         x2 = (int)(max(x2, _corners[i].x));
  567.         y2 = (int)(max(y2, _corners[i].y));
  568.     }
  569.  
  570.     int diff = x2 - x1;
  571.     int diff2 = y2 - y1;
  572.  
  573.     static Color col;
  574.  
  575.     if (pEntity->GetTeamNum() == pLocal->GetTeamNum())
  576.         col = Color::Lime();
  577.     else
  578.         col = Color::Red();
  579.  
  580.    
  581.     for (int i = 1; i <= 4; i++)
  582.     {
  583.         Draw::DrawLine((int)(_corners[i - 1].x), (int)(_corners[i - 1].y), (int)(_corners[i % 4].x), (int)(_corners[i % 4].y), col);
  584.         Draw::DrawLine((int)(_corners[i - 1].x), (int)(_corners[i - 1].y), (int)(_corners[i + 3].x), (int)(_corners[i + 3].y), col);
  585.         Draw::DrawLine((int)(_corners[i + 3].x), (int)(_corners[i + 3].y), (int)(_corners[i % 4 + 4].x), (int)(_corners[i % 4 + 4].y), col);
  586.     }
  587. }
  588.  
  589. typedef bool(__stdcall* CreateMoveFn)(float, CUserCmd*);
  590. CreateMoveFn oCreateMove;
  591. typedef void(__thiscall* PaintTraverseFn)(void*, unsigned int, bool, bool);
  592. PaintTraverseFn oPaintTraverse;
  593. typedef void(__stdcall* OverrideViewFn)(CViewSetup*);
  594. OverrideViewFn oOverrideView;
  595. typedef void(__thiscall* FrameStageNotifyFn)(void*, ClientFrameStage_t);
  596. FrameStageNotifyFn oFrameStageNotify;
  597. typedef void*(__thiscall* DrawModelExecuteFn)(void*, void*, void*, const ModelRenderInfo_t&, matrix3x4_t*);
  598. DrawModelExecuteFn oDrawModelExecute;
  599. typedef bool(__thiscall *FireEventClientSideFn)(void*, CGameEvent*);
  600. FireEventClientSideFn oFireEventClientSide;
  601.  
  602. bool __stdcall hkCreateMove(float SampleTime, CUserCmd* cmd);
  603. void __fastcall hkPaintTraverse(void* _this, void*, unsigned int panel, bool forceRepaint, bool allowForce);
  604. void __stdcall hkOverrideView(CViewSetup* pViewSetup);
  605. void __fastcall hkFrameStageNotify(void* ecx, void* edx, ClientFrameStage_t Stage);
  606. void __fastcall hkDrawModelExecute(void* _this, void*, void* context, void* state, const ModelRenderInfo_t& pInfo, matrix3x4_t* pCustomBoneToWorld);
  607. bool __fastcall hkFireEventClientSide(void* ecx, void* edx, CGameEvent* pEvent);
  608.  
  609. RecvVarProxyFn oModelIndex, oItemDefinitionIndex, oSmokeEffectTickBegin;
  610.  
  611. void hkModelIndex(const CRecvProxyData* pData, void* pStruct, void* pOut);
  612. void hkItemDefinitionIndex(const CRecvProxyData* pData, void* pStruct, void* pOut);
  613. void hkSmokeEffectTickBegin(const CRecvProxyData* pData, void* pStruct, void* pOut);
  614.  
  615. namespace Hooks
  616. {
  617.     CVMTHookManager* ClientHook;
  618.     CVMTHookManager* ClientModeHook;
  619.     CVMTHookManager* PanelHook;
  620.     CVMTHookManager* ModelRendererHook;
  621.     CVMTHookManager* EventManagerHook;
  622.  
  623.     void Hook()
  624.     {
  625.         bDrawHitmarker = false;
  626.         bInAntiAim = false;
  627.         iTotalHits = 0;
  628.         bSendPacket = true;
  629.  
  630.         ClientHook = new CVMTHookManager(I::Client);
  631.         ClientModeHook = new CVMTHookManager(I::ClientMode);
  632.         PanelHook = new CVMTHookManager(I::Panel);
  633.         ModelRendererHook = new CVMTHookManager(I::ModelRenderer);
  634.         EventManagerHook = new CVMTHookManager(I::GameEventManager);
  635.  
  636.         oCreateMove = (CreateMoveFn)ClientModeHook->HookFunction(24, hkCreateMove);
  637.         oOverrideView = (OverrideViewFn)ClientModeHook->HookFunction(18, hkOverrideView);
  638.         oPaintTraverse = (PaintTraverseFn)PanelHook->HookFunction(41, hkPaintTraverse);
  639.         oFrameStageNotify = (FrameStageNotifyFn)ClientHook->HookFunction(36, hkFrameStageNotify);
  640.         oDrawModelExecute = (DrawModelExecuteFn)ModelRendererHook->HookFunction(21, hkDrawModelExecute);
  641.         oFireEventClientSide = (FireEventClientSideFn)EventManagerHook->HookFunction(9 , hkFireEventClientSide);
  642.  
  643.         oModelIndex = Netvars->GetProxyFunction("DT_BaseViewModel", "m_nModelIndex");
  644.         oItemDefinitionIndex = Netvars->GetProxyFunction("DT_BaseAttributableItem", "m_iItemDefinitionIndex");
  645.         oSmokeEffectTickBegin = Netvars->GetProxyFunction("DT_SmokeGrenadeProjectile", "m_nSmokeEffectTickBegin");
  646.  
  647.         Netvars->HookProp("DT_BaseViewModel", "m_nModelIndex", hkModelIndex);
  648.         Netvars->HookProp("DT_BaseAttributableItem", "m_iItemDefinitionIndex", hkItemDefinitionIndex);
  649.         Netvars->HookProp("DT_SmokeGrenadeProjectile", "m_nSmokeEffectTickBegin", hkSmokeEffectTickBegin);
  650.  
  651.         ClientHook->HookTable(true);
  652.         ClientModeHook->HookTable(true);
  653.         PanelHook->HookTable(true);
  654.         ModelRendererHook->HookTable(true);
  655.         EventManagerHook->HookTable(true);
  656.     }
  657.  
  658.     void Unhook()
  659.     {
  660.         delete ClientHook;
  661.         delete ClientModeHook;
  662.         delete PanelHook;
  663.         delete ModelRendererHook;
  664.         delete EventManagerHook;
  665.  
  666.         Netvars->HookProp("DT_BaseViewModel", "m_nModelIndex", oModelIndex);
  667.         Netvars->HookProp("DT_BaseAttributableItem", "m_iItemDefinitionIndex", oItemDefinitionIndex);
  668.         Netvars->HookProp("DT_SmokeGrenadeProjectile", "m_nSmokeEffectTickBegin", oSmokeEffectTickBegin);
  669.     }
  670. }
  671.  
  672. bool __stdcall hkCreateMove(float SampleTime, CUserCmd* cmd)
  673. {
  674.     // Work here on CreateMove
  675.     if (!cmd) return false;
  676.     if (!cmd->command_number) return false;
  677.    
  678.     // Grab the local player
  679.     CBaseEntity* me = (CBaseEntity*)I::ClientEntList->GetClientEntity(I::Engine->GetLocalPlayerIndex());
  680.     if (!me) return false;
  681.  
  682.     pLocal = me;
  683.  
  684.     // Grab bSendPacket
  685.     PDWORD pFramePointer;
  686.     __asm mov pFramePointer, ebp;
  687.     *(bool*)(*pFramePointer - 0x1C) = bSendPacket;
  688.  
  689.     if (cmd->buttons & IN_JUMP && !(me->GetFlags() & FL_ONGROUND))
  690.     {
  691.         cmd->buttons &= ~IN_JUMP;
  692.         bool backwards = cmd->forwardmove < 0;
  693.         if(cmd->mousedx < 0) cmd->sidemove = backwards ? 650.f : -650.f;
  694.         if(cmd->mousedx > 0) cmd->sidemove = backwards ? -650.f : 650.f;
  695.     }
  696.  
  697.     if (GetAsyncKeyState(VK_F1) && me->GetMoveType() != MOVETYPE_LADDER && me->GetMoveType() != MOVETYPE_NOCLIP)
  698.         cmd->tick_count = INT_MAX;
  699.  
  700.     if (cmd->buttons & IN_SCORE)
  701.         ServerRankRevealAll();
  702.  
  703.     if (me->isAlive())
  704.     {
  705.  
  706.     // RAGEBOT
  707.  
  708.     TargetList_t* TargetList = new TargetList_t[64];
  709.     int targetLoop = 0;
  710.     Vector AimbotAngle;
  711.  
  712.     // ANTIAIM
  713.     CFixMove FixMove;
  714.     FixMove.Start(cmd);
  715.     Vector temp;
  716.  
  717.     if (me->GetMoveType() != MOVETYPE_LADDER && me->GetMoveType() != MOVETYPE_NOCLIP)
  718.     {
  719.         if (!(cmd->buttons & IN_ATTACK) && !pLocal->IsDefusing())
  720.         {
  721.             cmd->viewangles.x = 180.f;
  722.             cmd->viewangles.y -= 180.f;
  723.  
  724.             Math.NormalizeVector(cmd->viewangles);
  725.         }
  726.     }
  727.  
  728.     FixMove.End(cmd);
  729.  
  730.     Vector bone;
  731.     for (int i=1; i<=I::Globals->maxClients; i++)
  732.     {
  733.         CBaseEntity* enemy = (CBaseEntity*)I::ClientEntList->GetClientEntity(i);
  734.         if (!enemy) continue;
  735.        
  736.         if (enemy->IsDormant()) continue;
  737.         if (!enemy->isAlive()) continue;
  738.         if (enemy->GetTeamNum() == me->GetTeamNum()) continue;
  739.         if (enemy->IsImmune()) continue;
  740.  
  741.         bone = enemy->GetBonePos(6);
  742.  
  743.         AimbotAngle = Math.CalcAngle(me->GetEyePosition(), bone);
  744.         Math.NormalizeVector(AimbotAngle);
  745.  
  746.         AimbotAngle -= me->GetPunchAngle() * 2.f;
  747.         Math.NormalizeVector(AimbotAngle);
  748.  
  749.         TargetList[targetLoop] = TargetList_t(AimbotAngle, me->GetEyePosition(), bone);
  750.         targetLoop++;
  751.     }
  752.  
  753.     if (targetLoop > 0)
  754.     {
  755.         std::sort(TargetList, TargetList + targetLoop, CompareTargetByCrosshairDistance());
  756.         if (cmd->buttons & IN_ATTACK)
  757.         {
  758.             //cmd->buttons |= IN_DUCK;
  759.             cmd->sidemove = 0.f;
  760.             cmd->forwardmove = 0.f;
  761.             cmd->viewangles = (TargetList[0].AimbotAngle);
  762.         }
  763.         delete [] TargetList;
  764.     }
  765.  
  766.     }
  767.  
  768.     LastViewAngles = cmd->viewangles;
  769.  
  770.     if (cmd->viewangles.x > 89.f || cmd->viewangles.x < -89.f )
  771.         printf("Gotcha your X got out of bounds! X = %f\n", cmd->viewangles.x);
  772.     if (cmd->viewangles.y > 180.f || cmd->viewangles.y < -180.f)
  773.         printf("Gotcha your Y got out of bounds! Y = %f\n", cmd->viewangles.y);
  774.  
  775.     return false;
  776. }
  777. void __fastcall hkPaintTraverse(void* _this, void*, unsigned int panel, bool forceRepaint, bool allowForce)
  778. {
  779.     oPaintTraverse(_this,panel,forceRepaint,allowForce);
  780.     static float flRainbow = 0.f;
  781.     static Vector CenterScreen;
  782.     static int observer_count = 0;
  783.  
  784.     if (!drawPanel||drawPanel==NULL)
  785.     {
  786.         if (strstr(I::Panel->GetName(panel), "FocusOverlayPanel"))
  787.         {
  788.             drawPanel = panel;
  789.             Draw::Arial = I::Surface->SCreateFont();
  790.             Draw::Tahoma = I::Surface->SCreateFont();
  791.             I::Surface->SetFontGlyphSet(Draw::Arial, "Arial", 20, 20, 0, 0, FONTFLAG_NONE);
  792.             I::Surface->SetFontGlyphSet(Draw::Tahoma, "Tahoma", 12, FW_SEMIBOLD, 0, 0, FONTFLAG_OUTLINE);
  793.             I::Engine->GetScreenSize(ScreenWidth, ScreenHeight);
  794.             CenterScreen = Vector(0,0,0);
  795.             CenterScreen.x = (float)(ScreenWidth/2);
  796.             CenterScreen.y = (float)(ScreenHeight/2);
  797.         }
  798.     }
  799.  
  800.     if (panel != drawPanel) return;
  801.  
  802.     CBaseEntity* me = (CBaseEntity*)I::ClientEntList->GetClientEntity(I::Engine->GetLocalPlayerIndex());
  803.     if (!me) return;
  804.  
  805.     static float text_rainbow;
  806.     text_rainbow += 0.0005f;
  807.     if ( text_rainbow > 1.f ) text_rainbow = 0.f;
  808.  
  809.     Draw::DrawString(Draw::Tahoma, 5, 430, Color::FromHSB(text_rainbow,1.f,1.f), false, "COLUMBINEHOOK INSIDE (C)");
  810.     Draw::DrawRectRainbow(5, 440, 215, 3, 0.008f, flRainbow);
  811.     Draw::DrawString(Draw::Tahoma, 5, 455, Color::FromHSB(text_rainbow,1.f,1.f), false, "MADE WITH LOVE BY DOUBLE V");
  812.  
  813.     Draw::DrawString(Draw::Tahoma, 200, 20, Color::FromHSB(text_rainbow,1.f,1.f), false, "WELCOME, %s!", GetInfo(I::Engine->GetLocalPlayerIndex()).szName);
  814.  
  815.     if (bDrawHitmarker)
  816.     {
  817.         // Draw hitmarker
  818.         const int disoff = 5;
  819.         const int length = 10;
  820.         Draw::DrawLine(CenterScreen.x-disoff,CenterScreen.y+disoff, CenterScreen.x-disoff-length,CenterScreen.y+disoff+length, Color::White());
  821.         Draw::DrawLine(CenterScreen.x+disoff,CenterScreen.y-disoff, CenterScreen.x+disoff+length,CenterScreen.y-disoff-length, Color::White());
  822.         Draw::DrawLine(CenterScreen.x-disoff,CenterScreen.y-disoff, CenterScreen.x-disoff-length,CenterScreen.y-disoff-length, Color::White());
  823.         Draw::DrawLine(CenterScreen.x+disoff,CenterScreen.y+disoff, CenterScreen.x+disoff+length,CenterScreen.y+disoff+length, Color::White());
  824.         if (iHitmarkerTime >= 0) iHitmarkerTime--;
  825.         if (iHitmarkerTime < 0) bDrawHitmarker = false;
  826.     }
  827.  
  828.     for (int i=1; i<=I::ClientEntList->GetHighestEntityIndex(); i++)
  829.     {
  830.         if (i<=I::Globals->maxClients)
  831.         {
  832.             // PLAYER ESP
  833.             CBaseEntity* enemy = (CBaseEntity*)I::ClientEntList->GetClientEntity(i);
  834.             if (!enemy) continue;
  835.             if (enemy == me) continue;
  836.  
  837.             if (enemy->IsDormant()) continue;
  838.             if (!enemy->isAlive()) continue;
  839.  
  840.             Vector enemy_head3d = enemy->GetBonePos(6); enemy_head3d.z += 10.f;
  841.             Vector enemy_head2d;
  842.  
  843.             Vector enemy_origin3d = enemy->GetAbsOrigin();
  844.             Vector enemy_origin2d;
  845.  
  846.             if (!Draw::WorldToScreen(enemy_head3d, enemy_head2d) || !Draw::WorldToScreen(enemy_origin3d, enemy_origin2d))
  847.                 continue;
  848.  
  849.             float height = enemy_origin2d.y - enemy_head2d.y;
  850.             float width = height / 4.f;
  851.             int bottom = 0;
  852.  
  853.             PlayerBox3D(enemy, me);
  854.             Draw::DrawString( Draw::Tahoma, enemy_head2d.x, enemy_head2d.y - 8, (me->GetTeamNum() != enemy->GetTeamNum()) ? Color::Orange() : Color::Aqua(), true, "%s - %d | %d", GetInfo(i).szName, enemy->Health(), enemy->Armor());
  855.             Draw::DrawString( Draw::Tahoma, enemy_origin2d.x, enemy_origin2d.y, Color::White(), true, "%s | $%d", GetActiveWeapon(enemy) != nullptr ? GetActiveWeapon(enemy)->GetWeaponName().c_str() : "Unknown", enemy->GetMoney());
  856.             if (me->GetTeamNum() != enemy->GetTeamNum())
  857.             {
  858.                 Draw::DrawLine(ScreenWidth/2-1, ScreenHeight-1, enemy_origin2d.x-1, enemy_origin2d.y-1, Color::Black());
  859.                 Draw::DrawLine(ScreenWidth/2, ScreenHeight, enemy_origin2d.x, enemy_origin2d.y, Color::Orange());
  860.                 Draw::DrawLine(ScreenWidth/2+1, ScreenHeight+1, enemy_origin2d.x+1, enemy_origin2d.y+1, Color::Black());
  861.             }
  862.  
  863.             static float rainbow;
  864.             rainbow += 0.0005f;
  865.             if ( rainbow > 1.f ) rainbow = 0.f;
  866.  
  867.             dlight_t* lpELight = I::Effects->CL_AllocDlight(enemy->Index());
  868.             lpELight->color = MakeColorExp(Color::FromHSB(rainbow,1.f,1.f), 6);
  869.             lpELight->radius = 75.f;
  870.             lpELight->decay = lpELight->radius / 5.0f;
  871.             lpELight->key = enemy->Index();
  872.             lpELight->m_Direction = enemy->GetAbsOrigin();
  873.             lpELight->origin = enemy->GetAbsOrigin();
  874.             lpELight->die = I::Globals->curtime + 0.05f;
  875.         }
  876.         else
  877.         {
  878.             // WORLD ESP
  879.             CBaseEntity* entity = (CBaseEntity*)I::ClientEntList->GetClientEntity(i);
  880.             if (!entity) continue;
  881.            
  882.             Vector pos, pos3d;
  883.             pos3d = entity->GetAbsOrigin();
  884.            
  885.             if (!Draw::WorldToScreen(pos3d, pos))
  886.                 continue;
  887.  
  888.             int owner = entity->GetOwner();
  889.  
  890.             if (owner == -1)
  891.             {
  892.                 if (strstr(entity->GetClientClass()->m_pNetworkName, "CWeapon"))
  893.                     Draw::DrawString(Draw::Tahoma, pos.x, pos.y, Color::White(), true, "%s", std::string(entity->GetClientClass()->m_pNetworkName).substr(7).c_str());
  894.                 if (entity->GetClientClass()->m_ClassID == ClassIDs::CAK47)
  895.                     Draw::DrawString(Draw::Tahoma, pos.x, pos.y, Color::White(), true, "AK-47");
  896.             }
  897.  
  898.             if (strstr(entity->GetClientClass()->m_pNetworkName, "CPlantedC4"))
  899.                 Draw::DrawString(Draw::Tahoma, pos.x, pos.y, Color::White(), true, "Planted C4 - %.1f", GetBombTimer(entity));
  900.             if (strstr(entity->GetClientClass()->m_pNetworkName, "CSmokeGrenadeProjectile"))
  901.                 Draw::DrawString(Draw::Tahoma, pos.x, pos.y, Color::White(), true, "Smoke");
  902.             if (strstr(entity->GetClientClass()->m_pNetworkName, "CMolotovProjectile"))
  903.                 Draw::DrawString(Draw::Tahoma, pos.x, pos.y, Color::White(), true, "Molotov");
  904.             if (strstr(entity->GetClientClass()->m_pNetworkName, "CDecoyProjectile"))
  905.                 Draw::DrawString(Draw::Tahoma, pos.x, pos.y, Color::White(), true, "Decoy");
  906.             if (strstr(entity->GetClientClass()->m_pNetworkName, "CBaseCSGrenadeProjectile"))
  907.                 Draw::DrawString(Draw::Tahoma, pos.x, pos.y, Color::White(), true, "HE Grenade");
  908.             if (entity->GetClientClass()->m_ClassID == ClassIDs::CC4)
  909.                     Draw::DrawString(Draw::Tahoma, pos.x, pos.y, Color::White(), true, "C4");
  910.         }
  911.     }
  912.  
  913.     observer_count = 0;
  914.  
  915.     //Menu->Paint();
  916.  
  917. }
  918. void __stdcall hkOverrideView(CViewSetup* pViewSetup)
  919. {
  920.     if (pViewSetup->fov == 90.f)
  921.         pViewSetup->fov = 125.f;
  922.     oOverrideView(pViewSetup);
  923. }
  924. void __fastcall hkFrameStageNotify(void* ecx, void* edx, ClientFrameStage_t Stage)
  925. {
  926.     std::vector<CCorrection> Corrections;
  927.     Vector vecAimPunch;
  928.     Vector vecViewPunch;
  929.  
  930.     Vector* pAimPunch = nullptr;
  931.     Vector* pViewPunch = nullptr;
  932.     CBaseEntity* me;
  933.     me = (CBaseEntity*)I::ClientEntList->GetClientEntity(I::Engine->GetLocalPlayerIndex());
  934.  
  935.     if (Stage == FRAME_RENDER_START)
  936.     {
  937.         if (me && me->isAlive())
  938.         {
  939.             pAimPunch = me->pGetPunchAngle();
  940.             pViewPunch = me->pGetViewPunchAngle();
  941.  
  942.             vecAimPunch = *pAimPunch;
  943.             Math.NormalizeVector(vecAimPunch);
  944.             vecViewPunch = *pViewPunch;
  945.             Math.NormalizeVector(vecViewPunch);
  946.  
  947.             *pAimPunch = Vector(0, 0, 0);
  948.             *pViewPunch = Vector(0, 0, 0);
  949.         }
  950.     }
  951.  
  952.     if (Stage == FRAME_NET_UPDATE_POSTDATAUPDATE_START)
  953.     {
  954.         for (int i=0; i < I::Globals->maxClients; i++)
  955.         {
  956.             CBaseEntity* pEntity = (CBaseEntity*)I::ClientEntList->GetClientEntity(i);
  957.             if (!pEntity)
  958.                 continue;
  959.             if (pEntity ==  me)
  960.                 continue;
  961.             if (!pEntity->isAlive())
  962.                 continue;
  963.  
  964.             Vector* pAngle = pEntity->GetEyeAnglesPtr();
  965.             if (!pAngle)
  966.                 continue;
  967.  
  968.             Corrections.push_back(CCorrection(i, *pAngle));
  969.         }
  970.     }
  971.  
  972.     // Run the original frame stage notify function.
  973.     oFrameStageNotify(ecx, Stage);
  974.  
  975.     for (CCorrection c : Corrections)
  976.     {
  977.         CBaseEntity* pEntity = (CBaseEntity*)I::ClientEntList->GetClientEntity(c.index);
  978.         if (!pEntity)
  979.             continue;
  980.         if (pEntity == me)
  981.             continue;
  982.         if (!pEntity->isAlive())
  983.             continue;
  984.         *pEntity->GetEyeAnglesPtr() = c.RealAngles;
  985.     }
  986.    
  987.     // Restore the original aim and view punches.
  988.     if (pAimPunch && pViewPunch)
  989.     {
  990.         *pAimPunch = vecAimPunch;
  991.         *pViewPunch = vecViewPunch;
  992.     }
  993. }
  994. void __fastcall hkDrawModelExecute(void* _this, void*, void* context, void* state, const ModelRenderInfo_t& pInfo, matrix3x4_t* pCustomBoneToWorld)
  995. {
  996.     Hooks::ModelRendererHook->HookTable(false);
  997.  
  998.     if (I::Engine->InGame())
  999.     {
  1000.         CBaseEntity* pLocal = (CBaseEntity*)I::ClientEntList->GetClientEntity(I::Engine->GetLocalPlayerIndex());
  1001.         if (pLocal)
  1002.         {
  1003.             if (pInfo.pModel)
  1004.             {
  1005.                 std::string ModelName = I::ModelInfo->GetModelName(pInfo.pModel);
  1006.  
  1007.                 if (ModelName.find("models/player") != std::string::npos)
  1008.                 {
  1009.                     CBaseEntity* pModelEntity = (CBaseEntity*)I::ClientEntList->GetClientEntity(pInfo.entity_index);
  1010.                     if (pModelEntity && pModelEntity->isAlive() && !pModelEntity->IsDormant())
  1011.                     {
  1012.                         Color render_color_hidden = pModelEntity->GetTeamNum() == pLocal->GetTeamNum() ? Color(72, 219, 75) : Color(232, 209, 32);
  1013.                         Color render_color_visible = pModelEntity->GetTeamNum() == pLocal->GetTeamNum() ? Color(84, 167, 255) : Color::Yellow();
  1014.  
  1015.                         IMaterial* GlowMeme = I::MatSystem->FindMaterial("dev\\glow_rim3d", TEXTURE_GROUP_OTHER);
  1016.                         if (GlowMeme)
  1017.                         {
  1018.                             ForceMaterial( GlowMeme, render_color_hidden );
  1019.                             I::ModelRenderer->DrawModelExecute( context, state, pInfo, pCustomBoneToWorld );
  1020.                             GlowMeme->SetMaterialVarFlag( MATERIAL_VAR_IGNOREZ, true );
  1021.                         }
  1022.  
  1023.                         visible_tex->SetMaterialVarFlag( MATERIAL_VAR_IGNOREZ, false );
  1024.                         ForceMaterial( visible_tex, render_color_visible );
  1025.                         I::ModelRenderer->DrawModelExecute( context, state, pInfo, pCustomBoneToWorld );
  1026.                     }
  1027.                 }
  1028.                 else if( ModelName.find( "arms" ) != std::string::npos )
  1029.                 {
  1030.                     static float rainbow;
  1031.                     rainbow += 0.001f;
  1032.                     if ( rainbow > 1.f ) rainbow = 0.f;
  1033.  
  1034.                     visible_tex->SetMaterialVarFlag( MATERIAL_VAR_IGNOREZ, false );
  1035.                     ForceMaterial( visible_tex, Color::FromHSB( rainbow, 1.f, 1.f ) );
  1036.  
  1037.                     I::ModelRenderer->DrawModelExecute( context, state, pInfo, pCustomBoneToWorld );
  1038.                 }
  1039.                 else if( ModelName.find( "weapon" ) != std::string::npos )
  1040.                 {
  1041.                     visible_tex->SetMaterialVarFlag( MATERIAL_VAR_IGNOREZ, false );
  1042.                     ForceMaterial( visible_tex, Color::White() );
  1043.                 }
  1044.                 else if( ModelName.find( "flash" ) != std::string::npos )
  1045.                 {
  1046.                     IMaterial* Flash = I::MatSystem->FindMaterial("effects\\flashbang", TEXTURE_GROUP_CLIENT_EFFECTS);
  1047.                     IMaterial* FlashWhite = I::MatSystem->FindMaterial("effects\\flashbang_white", TEXTURE_GROUP_CLIENT_EFFECTS);
  1048.  
  1049.                     if (Flash && FlashWhite)
  1050.                     {
  1051.                         Flash->SetMaterialVarFlag(MATERIAL_VAR_NO_DRAW, true);
  1052.                         FlashWhite->SetMaterialVarFlag(MATERIAL_VAR_NO_DRAW, true);
  1053.                     }
  1054.  
  1055.                     I::ModelRenderer->ForcedMaterialOverride(Flash);
  1056.                     I::ModelRenderer->ForcedMaterialOverride(FlashWhite);
  1057.  
  1058.                     I::ModelRenderer->ForcedMaterialOverride(NULL);
  1059.                 }
  1060.                 else if( ModelName.find( "smoke" ) != std::string::npos )
  1061.                 {
  1062.                     IMaterial* vistasmokev1 = I::MatSystem->FindMaterial("particle\\vistasmokev1\\vistasmokev1", TEXTURE_GROUP_PARTICLE);
  1063.                     IMaterial* vistasmokev1_emods = I::MatSystem->FindMaterial("particle\\vistasmokev1\\vistasmokev1_emods", TEXTURE_GROUP_PARTICLE);
  1064.                     IMaterial* vistasmokev1_emods_impactdust = I::MatSystem->FindMaterial("particle\\vistasmokev1\\vistasmokev1_emods_impactdust", TEXTURE_GROUP_PARTICLE);
  1065.                     IMaterial* vistasmokev1_fire = I::MatSystem->FindMaterial("particle\\vistasmokev1\\vistasmokev1_fire", TEXTURE_GROUP_PARTICLE);
  1066.                     IMaterial* vistasmokev1_fire2 = I::MatSystem->FindMaterial("particle\\vistasmokev1\\vistasmokev1_fire2", TEXTURE_GROUP_PARTICLE);
  1067.                     IMaterial* vistasmokev1_fire2_fogged = I::MatSystem->FindMaterial("particle\\vistasmokev1\\vistasmokev1_fire2_fogged", TEXTURE_GROUP_PARTICLE);
  1068.                     IMaterial* vistasmokev1_min_depth_nearcull = I::MatSystem->FindMaterial("particle\\vistasmokev1\\vistasmokev1_min_depth_nearcull", TEXTURE_GROUP_PARTICLE);
  1069.                     IMaterial* vistasmokev1_nearcull = I::MatSystem->FindMaterial("particle\\vistasmokev1\\vistasmokev1_nearcull", TEXTURE_GROUP_PARTICLE);
  1070.                     IMaterial* vistasmokev1_nearcull_fog = I::MatSystem->FindMaterial("particle\\vistasmokev1\\vistasmokev1_nearcull_fog", TEXTURE_GROUP_PARTICLE);
  1071.                     IMaterial* vistasmokev1_nearcull_nodepth = I::MatSystem->FindMaterial("particle\\vistasmokev1\\vistasmokev1_nearcull_nodepth", TEXTURE_GROUP_PARTICLE);
  1072.                     IMaterial* vistasmokev1_no_rgb = I::MatSystem->FindMaterial("particle\\vistasmokev1\\vistasmokev1_no_rgb", TEXTURE_GROUP_PARTICLE);
  1073.                     IMaterial* vistasmokev1_smokegrenade = I::MatSystem->FindMaterial("particle\\vistasmokev1\\vistasmokev1_smokegrenade", TEXTURE_GROUP_PARTICLE);
  1074.                     IMaterial* vistasmokev4_addself_nearcull = I::MatSystem->FindMaterial("particle\\vistasmokev1\\vistasmokev4_addself_nearcull", TEXTURE_GROUP_PARTICLE);
  1075.                     IMaterial* vistasmokev4_emods_nocul = I::MatSystem->FindMaterial("particle\\vistasmokev1\\vistasmokev4_emods_nocul", TEXTURE_GROUP_PARTICLE);
  1076.                     IMaterial* vistasmokev4_nearcull = I::MatSystem->FindMaterial("particle\\vistasmokev1\\vistasmokev4_nearcull", TEXTURE_GROUP_PARTICLE);
  1077.                     IMaterial* vistasmokev4_nocull = I::MatSystem->FindMaterial("particle\\vistasmokev1\\vistasmokev4_nocull", TEXTURE_GROUP_PARTICLE);
  1078.  
  1079.                     vistasmokev1->SetMaterialVarFlag(MATERIAL_VAR_NO_DRAW, true);
  1080.                     vistasmokev1_emods->SetMaterialVarFlag(MATERIAL_VAR_NO_DRAW, true);
  1081.                     vistasmokev1_emods_impactdust->SetMaterialVarFlag(MATERIAL_VAR_NO_DRAW, true);
  1082.                     vistasmokev1_fire->SetMaterialVarFlag(MATERIAL_VAR_NO_DRAW, true);
  1083.                     vistasmokev1_fire2->SetMaterialVarFlag(MATERIAL_VAR_NO_DRAW, true);
  1084.                     vistasmokev1_fire2_fogged->SetMaterialVarFlag(MATERIAL_VAR_NO_DRAW, true);
  1085.                     vistasmokev1_min_depth_nearcull->SetMaterialVarFlag(MATERIAL_VAR_NO_DRAW, true);
  1086.                     vistasmokev1_nearcull->SetMaterialVarFlag(MATERIAL_VAR_NO_DRAW, true);
  1087.                     vistasmokev1_nearcull_fog->SetMaterialVarFlag(MATERIAL_VAR_NO_DRAW, true);
  1088.                     vistasmokev1_nearcull_nodepth->SetMaterialVarFlag(MATERIAL_VAR_NO_DRAW, true);
  1089.                     vistasmokev1_no_rgb->SetMaterialVarFlag(MATERIAL_VAR_NO_DRAW, true);
  1090.                     vistasmokev1_smokegrenade->SetMaterialVarFlag(MATERIAL_VAR_NO_DRAW, true);
  1091.                     vistasmokev4_addself_nearcull->SetMaterialVarFlag(MATERIAL_VAR_NO_DRAW, true);
  1092.                     vistasmokev4_emods_nocul->SetMaterialVarFlag(MATERIAL_VAR_NO_DRAW, true);
  1093.                     vistasmokev4_nearcull->SetMaterialVarFlag(MATERIAL_VAR_NO_DRAW, true);
  1094.                     vistasmokev4_nocull->SetMaterialVarFlag(MATERIAL_VAR_NO_DRAW, true);
  1095.  
  1096.                     I::ModelRenderer->ForcedMaterialOverride(vistasmokev1);
  1097.                     I::ModelRenderer->ForcedMaterialOverride(vistasmokev1_emods);
  1098.                     I::ModelRenderer->ForcedMaterialOverride(vistasmokev1_emods_impactdust);
  1099.                     I::ModelRenderer->ForcedMaterialOverride(vistasmokev1_fire);
  1100.                     I::ModelRenderer->ForcedMaterialOverride(vistasmokev1_fire2);
  1101.                     I::ModelRenderer->ForcedMaterialOverride(vistasmokev1_fire2_fogged);
  1102.                     I::ModelRenderer->ForcedMaterialOverride(vistasmokev1_min_depth_nearcull);
  1103.                     I::ModelRenderer->ForcedMaterialOverride(vistasmokev1_nearcull);
  1104.                     I::ModelRenderer->ForcedMaterialOverride(vistasmokev1_nearcull_fog);
  1105.                     I::ModelRenderer->ForcedMaterialOverride(vistasmokev1_nearcull_nodepth);
  1106.                     I::ModelRenderer->ForcedMaterialOverride(vistasmokev1_no_rgb);
  1107.                     I::ModelRenderer->ForcedMaterialOverride(vistasmokev1_smokegrenade);
  1108.                     I::ModelRenderer->ForcedMaterialOverride(vistasmokev4_addself_nearcull);
  1109.                     I::ModelRenderer->ForcedMaterialOverride(vistasmokev4_emods_nocul);
  1110.                     I::ModelRenderer->ForcedMaterialOverride(vistasmokev4_nearcull);
  1111.                     I::ModelRenderer->ForcedMaterialOverride(vistasmokev4_nocull);
  1112.  
  1113.                     I::ModelRenderer->ForcedMaterialOverride(NULL);
  1114.                 }
  1115.             }
  1116.         }
  1117.     }
  1118.  
  1119.     I::ModelRenderer->DrawModelExecute( context, state, pInfo, pCustomBoneToWorld );
  1120.     I::ModelRenderer->ForcedMaterialOverride( NULL );
  1121.     Hooks::ModelRendererHook->HookTable(true);
  1122. }
  1123. bool __fastcall hkFireEventClientSide(void* ecx, void* edx, CGameEvent* pEvent)
  1124. {
  1125.     if (!pEvent)
  1126.         return oFireEventClientSide(ecx, pEvent);
  1127.  
  1128.     if (!strcmp(pEvent->GetName(), "player_death"))
  1129.     {
  1130.         // The game launched a player_death event.
  1131.         int nUserID = pEvent->GetInt("attacker");
  1132.         int nDead = pEvent->GetInt("userid");
  1133.         if (!nUserID || !nDead)
  1134.             return false;
  1135.  
  1136.         // If I'm the one who dies...
  1137.         if (I::Engine->GetPlayerForUserID(nDead) == I::Engine->GetLocalPlayerIndex())
  1138.         {
  1139.             I::Engine->ClientCmd("say Wait...you actually killed me? How dare...");
  1140.         }
  1141.  
  1142.         // Continue only if I'm the one who killed
  1143.         if (I::Engine->GetPlayerForUserID(nUserID) == I::Engine->GetLocalPlayerIndex())
  1144.         {
  1145.             if (strstr(pEvent->GetString("weapon"), "knife"))
  1146.                 pEvent->SetString("weapon", "knife_m9_bayonet");
  1147.             player_info_t killed_info = GetInfo(I::Engine->GetPlayerForUserID(nDead));
  1148.             std::stringstream ss;
  1149.             ss << "say " << killed_info.szName << ", you got rekt by the ColumbineHook, an exclusive internal meme, using a weapon named " << pEvent->GetString("weapon") << ".";
  1150.             I::Engine->ClientCmd(ss.str().c_str());
  1151.         }
  1152.     }
  1153.    
  1154.     if (!strcmp(pEvent->GetName(), "bomb_planted"))
  1155.     {
  1156.         // The game launched the bomb_beginplant event
  1157.         int nPlanter = pEvent->GetInt("userid");
  1158.         if (!nPlanter)
  1159.             return false;
  1160.  
  1161.         player_info_t planter_info = GetInfo(I::Engine->GetPlayerForUserID(nPlanter));
  1162.  
  1163.         std::stringstream ss;
  1164.         ss << "say Wow, " << planter_info.szName << ", you planted the bomb like a real muslim!";
  1165.  
  1166.         I::Engine->ClientCmd(ss.str().c_str());
  1167.    
  1168.     }
  1169.  
  1170.     if (!strcmp(pEvent->GetName(), "bomb_exploded"))
  1171.     {
  1172.         // The game launched the bomb_exploded event
  1173.         I::Engine->ClientCmd("say ALLAHU AKBAR!!!");
  1174.     }
  1175.  
  1176.     if (!strcmp(pEvent->GetName(), "bomb_dropped"))
  1177.     {
  1178.         int nDropper = pEvent->GetInt("userid");
  1179.         if (!nDropper)
  1180.             return false;
  1181.  
  1182.         player_info_t info = GetInfo(I::Engine->GetPlayerForUserID(nDropper));
  1183.  
  1184.         std::stringstream ss;
  1185.         ss << "say Oh no! " << info.szName << " dropped the fuckin bomb!";
  1186.  
  1187.         I::Engine->ClientCmd(ss.str().c_str());
  1188.     }
  1189.  
  1190.     if (!strcmp(pEvent->GetName(), "bomb_defused"))
  1191.     {
  1192.         int nDefuser = pEvent->GetInt("userid");
  1193.         if (!nDefuser)
  1194.             return false;
  1195.  
  1196.         player_info_t info = GetInfo(I::Engine->GetPlayerForUserID(nDefuser));
  1197.  
  1198.         std::stringstream ss;
  1199.        
  1200.         ss << "say " << info.szName << " defused the bomb with SWAT style! Bin Laden really sad atm...";
  1201.  
  1202.         I::Engine->ClientCmd(ss.str().c_str());
  1203.     }
  1204.  
  1205.     if (!strcmp(pEvent->GetName(), "bomb_begindefuse"))
  1206.     {
  1207.         int nDefuser = pEvent->GetInt("userid");
  1208.         if (!nDefuser)
  1209.             return false;
  1210.  
  1211.         player_info_t info = GetInfo(I::Engine->GetPlayerForUserID(nDefuser));
  1212.  
  1213.         std::stringstream ss;
  1214.        
  1215.         ss << "say " << info.szName << " started defusing the mothafucking bomb!";
  1216.         if (pEvent->GetInt("haskit"))
  1217.             ss << " And he has got a l33t defuser!!!";
  1218.  
  1219.         I::Engine->ClientCmd(ss.str().c_str());
  1220.     }
  1221.  
  1222.     if (!strcmp(pEvent->GetName(), "bomb_abortdefuse"))
  1223.     {
  1224.         int nAborter = pEvent->GetInt("userid");
  1225.         if (!nAborter)
  1226.             return false;
  1227.  
  1228.         player_info_t info = GetInfo(I::Engine->GetPlayerForUserID(nAborter));
  1229.  
  1230.         // Continue only if I'm not the aborter
  1231.         if (I::Engine->GetPlayerForUserID(nAborter) != I::Engine->GetLocalPlayerIndex())
  1232.         {
  1233.             std::stringstream ss;
  1234.             ss << "say " << info.szName << " aborted the bomb defusal like a fucking pussy!!! MAYBE HE NEEDS SOME COLUMBINEHOOK ;)";
  1235.             I::Engine->ClientCmd(ss.str().c_str());
  1236.         }
  1237.     }
  1238.  
  1239.     if (!strcmp(pEvent->GetName(), "round_freeze_end"))
  1240.     {
  1241.         I::Engine->ClientCmd("say Wow another round full of pure skills starts!");
  1242.     }
  1243.  
  1244.     if (!strcmp(pEvent->GetName(), "weapon_fire"))
  1245.     {
  1246.         int nFirer = pEvent->GetInt("userid");
  1247.         if (!nFirer) return false;
  1248.  
  1249.         if (I::Engine->GetPlayerForUserID(nFirer) == I::Engine->GetLocalPlayerIndex())
  1250.         {
  1251.             CBaseEntity* me = (CBaseEntity*)I::ClientEntList->GetClientEntity(I::Engine->GetLocalPlayerIndex());
  1252.             if (!me) return false;
  1253.  
  1254.             if (me->GetTotalHitsOnServer() > iTotalHits)
  1255.             {
  1256.                 bDrawHitmarker = true;
  1257.                 iHitmarkerTime = 25;
  1258.                 PlaySound("C:\\Users\\UTENTE\\Documents\\Visual Studio 2012\\Projects\\Internal Fantabosco\\hitmarker.wav", NULL, SND_FILENAME | SND_ASYNC);
  1259.             }
  1260.  
  1261.             iTotalHits = me->GetTotalHitsOnServer();
  1262.         }
  1263.     }
  1264.  
  1265.     return oFireEventClientSide(ecx, pEvent);
  1266. }
  1267.  
  1268. void hkModelIndex(const CRecvProxyData* pData, void* pStruct, void* pOut)
  1269. {
  1270.     if (I::Engine->InGame())
  1271.     {
  1272.         int* hz = reinterpret_cast<int*>(reinterpret_cast<DWORD>(pData) + 0x8);
  1273.         if (!hz)
  1274.         {
  1275.             oModelIndex(pData, pStruct, pOut);
  1276.             return;
  1277.         }
  1278.  
  1279.         if(*hz == I::ModelInfo->GetModelIndex("models/weapons/v_knife_default_t.mdl") || *hz == I::ModelInfo->GetModelIndex("models/weapons/v_knife_default_ct.mdl"))
  1280.             *hz = I::ModelInfo->GetModelIndex("models/weapons/v_knife_m9_bay.mdl");
  1281.     }
  1282.     oModelIndex(pData, pStruct, pOut);
  1283. }
  1284. void hkItemDefinitionIndex(const CRecvProxyData* pData, void* pStruct, void* pOut)
  1285. {
  1286.     if (I::Engine->InGame())
  1287.     {
  1288.         int* hz = reinterpret_cast<int*>(reinterpret_cast<DWORD>(pData) + 0x8);
  1289.         if (!hz)
  1290.         {
  1291.             oItemDefinitionIndex(pData, pStruct, pOut);
  1292.             return;
  1293.         }
  1294.  
  1295.         if(*hz == WEAPON_KNIFE_T || *hz == WEAPON_KNIFE)
  1296.             *hz = WEAPON_KNIFE_M9_BAYONET;
  1297.     }
  1298.     oItemDefinitionIndex(pData, pStruct, pOut);
  1299. }
  1300. void hkSmokeEffectTickBegin(const CRecvProxyData* pData, void* pStruct, void* pOut)
  1301. {
  1302.     oSmokeEffectTickBegin(pData, pStruct, pOut);
  1303. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement