Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void LeftClick ( )
- {
- INPUT Input = { 0 };
- // left down
- Input.type = INPUT_MOUSE;
- Input.mi.dwFlags = MOUSEEVENTF_LEFTDOWN;
- ::SendInput ( 1, &Input, sizeof ( INPUT ) );
- // left up
- ::ZeroMemory ( &Input, sizeof ( INPUT ) );
- Input.type = INPUT_MOUSE;
- Input.mi.dwFlags = MOUSEEVENTF_LEFTUP;
- ::SendInput ( 1, &Input, sizeof ( INPUT ) );
- }
- bool triggerBot ( )
- {
- player_info_t pInfo;
- trace_t tr;
- Ray_t ray;
- CTraceFilter filter;
- Vector vecDir, playerAngles;
- C_BaseEntity* pLocalPlayer = ( C_BaseEntity* )entitylist->GetClientEntity ( engine->GetLocalPlayer ( ) );
- if ( !pLocalPlayer )
- return false;
- filter.pSkip = pLocalPlayer;
- QAngle localAngles;
- engine->GetViewAngles ( localAngles );
- AngleVectors ( localAngles /*+ pLocalPlayer->GetPunchAngle ( ) *2.0f*/, &vecDir );
- vecDir = vecDir * 8192 + pLocalPlayer->GetEyePos ( );
- ray.Init ( pLocalPlayer->GetEyePos ( ), vecDir );
- //ray, 0x4600400B, &filter, &tr
- enginetrace->TraceRay ( ray, 0x4600400B, &filter, &tr );
- //g_pEngineTrace->TraceRay ( ray, ( CONTENTS_SOLID | CONTENTS_MOVEABLE | CONTENTS_MONSTER | CONTENTS_DEBRIS | CONTENTS_HITBOX ), /*&filter*/0, &tr );
- if ( tr.allsolid || tr.m_pEnt == entitylist->GetClientEntity ( 0 ) )
- return 0;
- if ( tr.m_pEnt && engine->GetPlayerInfo ( tr.m_pEnt->index, &pInfo ) && pLocalPlayer->team ( ) != tr.m_pEnt->team ( ) )
- {
- if ( tr.m_pEnt->index )
- {
- return true;
- }
- }
- return false;
- }
- void normalizeAngle ( QAngle& input )
- {
- if ( input.x < -89.0f )
- input.x = -89.0f;
- if ( input.x > 89.0f )
- input.x = 89.0f;
- while ( input.y > 180.0f )
- input.y -= 360.0f;
- while ( input.y < -180.0f )
- input.y += 360.0f;
- input.z = 0.0f;
- }
- DWORD spotOffset = 0x00000935, shotsFiredOffset = 0x00001D6C;
- QAngle angle;
- QAngle m_ViewAngle;
- QAngle OldAngle;
- void __fastcall hkPaintTraverse ( void* ecx, void* edx, unsigned int vguiPanel, bool forceRepaint, bool allowForce )
- {
- oPaintTraverse ( ecx, vguiPanel, forceRepaint, allowForce );
- static DWORD lastShoot = 0;
- if ( engine->IsInGame ( ) && engine->IsConnected ( ) && !engine->IsTakingScreenshot ( ) )
- {
- if ( GetAsyncKeyState ( 6 ) )
- {
- if ( triggerBot ( ) )
- {
- DWORD currentCount = GetTickCount ( );
- if ( currentCount - lastShoot > 20 )
- {
- LeftClick ( );
- lastShoot = currentCount;
- }
- }
- }
- C_BaseEntity *pLocalEntity = ( C_BaseEntity* )entitylist->GetClientEntity ( engine->GetLocalPlayer ( ) );
- if ( !pLocalEntity )
- return;
- for ( int i = 0; i < entitylist->GetHighestEntityIndex ( ); i++ ) //spotter
- {
- C_BaseEntity* pBaseEntity = ( C_BaseEntity* )entitylist->GetClientEntity ( i );
- if ( !pBaseEntity )
- continue;
- if ( pBaseEntity->health ( ) < 1 )
- continue;
- if ( pBaseEntity == pLocalEntity )
- continue;
- if ( pLocalEntity->team ( ) == pBaseEntity->team ( ) )
- continue;
- *( BYTE* )( ( DWORD )pBaseEntity + spotOffset ) = 1;
- }
- if ( GetAsyncKeyState ( VK_LBUTTON ) )
- {
- if ( *( DWORD* )( ( DWORD )pLocalEntity + shotsFiredOffset ) > 1 )
- {
- engine->GetViewAngles ( m_ViewAngle );
- QAngle* m_PunchAngle = pLocalEntity->GetAimPunchPtr ( );
- if ( !m_PunchAngle )
- return;
- //g_pCVar->ConsolePrintf ( "PunchAngles: %f %f\n", m_PunchAngle->x, m_PunchAngle->y );
- m_ViewAngle.x = m_ViewAngle.x + OldAngle.x;
- m_ViewAngle.y = m_ViewAngle.y + OldAngle.y;
- // Add the old "viewpunch" so we get the "center" of the screen again
- angle.x = m_ViewAngle.x - m_PunchAngle->x * 2.0f;
- angle.y = m_ViewAngle.y - m_PunchAngle->y * 2.0f;
- // remove the new "viewpunch" from the viewangles
- normalizeAngle ( angle );
- //g_pCVar->ConsolePrintf ( "OriginalAngles: %f %f\nSetting angles to %f %f\n", m_ViewAngle.x, m_ViewAngle.y, angle.x, angle.y );
- engine->SetViewAngles ( angle );
- OldAngle.x = m_PunchAngle->x * 2;
- OldAngle.y = m_PunchAngle->y * 2;
- // save the old "viewpunch"
- } else
- {
- OldAngle.x = 0;
- OldAngle.y = 0;
- }
- } else
- {
- OldAngle.x = 0;
- OldAngle.y = 0;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement