Announcement
Collapse
No announcement yet.
s1mpleX problem
Collapse
X
-
Re: s1mpleX problem
Code:#include "Aimbot.h" #include "main.h" cCAimbot gAimbot; cCAimbot::cCAimbot( void ) { flBestDist = 99999.9f; m_nTarget = -1; } void __fastcall cCAimbot::DropTarget( void ) { flBestDist = 99999.9f; m_nTarget = -1; } int __fastcall cCAimbot::iGetTarget( void ) { return m_nTarget; } void __fastcall cCAimbot::MakeVector( QAngle angle, QAngle& vector ) { float pitch; float yaw; float tmp; pitch = (float)(angle[0] * PI/180); yaw = (float)(angle[1] * PI/180); tmp = (float) math.fastCos(pitch); vector[0] = (float) (-tmp * -math.fastCos(yaw)); vector[1] = (float) (math.fastSin(yaw)*tmp); vector[2] = (float) -math.fastSin(pitch); } void __fastcall cCAimbot::CalcAngle( Vector &src, Vector &dst, QAngle &angles ) { double delta[3] = { (src[0]-dst[0]), (src[1]-dst[1]), (src[2]-dst[2]) }; double hyp = math.fastSqrt(delta[0]*delta[0] + delta[1]*delta[1]); angles[0] = (float) (atan(delta[2]/hyp) * divPI); angles[1] = (float) (atan(delta[1]/delta[0]) * divPI); angles[2] = 0.0f; if(delta[0] >= 0.0) { angles[1] += 180.0f; } } float __fastcall cCAimbot::GetFov( QAngle angle, Vector src, Vector dst ) { QAngle ang,aim; float fov; CalcAngle(src, dst, ang); MakeVector(angle, aim); MakeVector(ang, ang); float mag_s = math.fastSqrt((aim[0]*aim[0]) + (aim[1]*aim[1]) + (aim[2]*aim[2])); float mag_d = math.fastSqrt((aim[0]*aim[0]) + (aim[1]*aim[1]) + (aim[2]*aim[2])); float u_dot_v = aim[0]*ang[0] + aim[1]*ang[1] + aim[2]*ang[2]; fov = math.fastAcos(u_dot_v / (mag_s*mag_d)) * (180.0 / M_PI); return fov; } bool __fastcall cCAimbot::GetVisible(Vector& vecAbsStart, Vector& vecAbsEnd, C_BaseEntity* pBaseEnt){ player_info_t pinfo; trace_t tr; Ray_t ray; ray.Init(vecAbsStart, vecAbsEnd); g_pEnginetrace->TraceRay(ray, MASK_NPCWORLDSTATIC|CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_MONSTER|CONTENTS_WINDOW|CONTENTS_DEBRIS|CONTENTS_HITBOX, NULL, &tr); if ( tr.fraction > 0.97f ) return true; if ( tr.m_pEnt && pBaseEnt ) { if ( tr.m_pEnt->index == 0 || tr.allsolid ) return false; if (( g_pEngine->GetPlayerInfo( tr.m_pEnt->index, &pinfo ) || pBaseEnt->index == tr.m_pEnt->index) && tr.fraction > 0.92) return true; } return false; } bool __fastcall GetBonePosition ( int iBone, Vector& vecOrigin, QAngle qAngles, int index ) { if( iBone < 0 || iBone >= 20 ) return false; matrix3x4_t pmatrix[MAXSTUDIOBONES]; IClientEntity* ClientEntity = g_pEntList->GetClientEntity( index ); if ( ClientEntity == NULL ) return false; if ( ClientEntity->IsDormant() ) return false; IClientRenderable* RenderEntity = ClientEntity->GetClientRenderable(); if( RenderEntity == NULL/* nothing */ ) return false; if( RenderEntity->SetupBones( pmatrix, 128, BONE_USED_BY_HITBOX, g_pGlobals->curtime ) == false ) return false; MatrixAngles( pmatrix[ iBone ], qAngles, vecOrigin ); return true; } bool __fastcall GetHitboxPosition ( int iHitBox, Vector& vecOrigin, QAngle qAngles, int index ) { if( iHitBox < 0 || iHitBox >= 20 ) return false; matrix3x4_t pmatrix[MAXSTUDIOBONES]; Vector vMin, vMax; IClientEntity* ClientEntity = g_pEntList->GetClientEntity( index ); if ( ClientEntity == NULL ) return false; if ( ClientEntity->IsDormant() ) return false; const model_t * model; model = ClientEntity->GetModel(); if( model ) { studiohdr_t *pStudioHdr = g_pModelinfo->GetStudiomodel( model); if ( !pStudioHdr ) return false; if( ClientEntity->SetupBones( pmatrix, 128, BONE_USED_BY_HITBOX, g_pGlobals->curtime) == false ) return false; mstudiohitboxset_t *set =pStudioHdr->pHitboxSet( 0 ); if ( !set ) return false; // pointer to the hitbox mstudiobbox_t* pbox = NULL; pbox = pStudioHdr->pHitbox(iHitBox, 0); //MatrixAngles( pmatrix[ pbox->bone ], qAngles, vecOrigin ); VectorTransform( pbox->bbmin, pmatrix[ pbox->bone ], vMin ); VectorTransform( pbox->bbmax, pmatrix[ pbox->bone ], vMax ); vecOrigin = ( vMin + vMax ) * 0.5f; return true; } return true; } void __fastcall cCAimbot::AimAtTarget( CUserCmd* c ) { if( g_pEngine->IsInGame() == false || g_pEngine->IsHLTV() == true || Me.BaseEnt() == NULL ) return; DropTarget(); //----------------------------------// player_info_t pinfo; QAngle qAim; //----------------------------------// //----------------------------------// for( int index = 1; index <= g_pEntList->NumberOfEntities( false ); ++index ) { if ( index == g_pEngine->GetLocalPlayer() ) continue; IClientEntity* ClientEntity = g_pEntList->GetClientEntity( index ); if ( ClientEntity == NULL || ClientEntity->IsDormant() ) continue; CBaseEntity* pBaseEntity = ClientEntity->GetBaseEntity(); //Get Life State int *lifestate = (int*) ( ( DWORD )pBaseEntity + ( DWORD )0x87 ); if( pBaseEntity == NULL || pBaseEntity->IsDormant() || !(*lifestate == LIFE_ALIVE) || g_pEngine->GetPlayerInfo( index, &pinfo ) == false || pBaseEntity->GetTeamNumber() == Me.BaseEnt()->GetTeamNumber() // || !GetBonePosition( 14/*Head*/, vPlayer, c->viewangles, index ) || !GetHitboxPosition( 12/*Head*/, vPlayer, c->viewangles, index ) || GetFov( Me.BaseEnt()->GetAbsAngles(), Me.BaseEnt()->EyePosition(), vPlayer ) > 360.f || !GetVisible( Me.BaseEnt()->EyePosition(), vPlayer, pBaseEntity ) || flBestDist < GetFov( Me.BaseEnt()->GetAbsAngles(), Me.BaseEnt()->EyePosition(), vPlayer )) continue; flBestDist = GetFov( Me.BaseEnt()->GetAbsAngles(), Me.BaseEnt()->EyePosition(), vPlayer ); m_nTarget = index; // Calculate the delta origin Vector vDeltaOrigin = vPlayer - vPlayer; // Calculate the Latency //float fLatency = g_pEngine->GetNetChannelInfo()->GetLatency( FLOW_OUTGOING ); // Compensate the latency //vDeltaOrigin[0] *= fLatency; //vDeltaOrigin[1] *= fLatency; // vDeltaOrigin[2] *= fLatency; //Apply the prediction PredictedTargetPosition = vPlayer /*+ vDeltaOrigin*/; } if( m_nTarget == -1 ) return; CalcAngle( Me.BaseEnt()->EyePosition(), PredictedTargetPosition, qAim ); //aim VectorCopy(qAim, c->viewangles); g_pEngine->SetViewAngles( qAim ); //shoot /*if(GetCvarValue("shoot")) { static bool bInAttack = false; if ( bInAttack ) c->buttons |= IN_ATTACK; else c->buttons &= ~IN_ATTACK; bInAttack = !bInAttack; } */ DropTarget(); }
and this goes in client
Code:_asm { PUSH active PUSH input_sample_frametime PUSH sequence_number CALL g_dwOrgCreateMove } if ( g_pInput ) { CUserCmd* cmd = g_pInput->GetUserCmd( sequence_number ); QAngle punchAngle = *(QAngle*)((DWORD)Me.BaseEnt() + 0xBB0); QAngle pPunchAngle = *(QAngle*)((DWORD)Me.BaseEnt() + 0xBB0); if ( g_pEngine->IsInGame()) { gAimbot.AimAtTarget(cmd); } } }
Comment
-
Re: s1mpleX problem
Logger showd me errors in AimAtTarget and GetHitboxPosition...
hmm it might be coz i didnt hook the g_pGlobals correctly or something? it in those places where g_pGlobals is used , in GetHitboxPosition and AimAtTarget , guessing coz there i used g_pGlobals , could anyone help me hooking it? did it like this in main.cppCode:CGlobalVarsBase* g_pGlobals = NULL;
Code:extern CGlobalVarsBase* g_pGlobals
Comment
-
Re: s1mpleX problem
you set it up in Init(..)?
else this pointer is NULL and of course it wont work then:
via sig:
Code:m_pGlobals = (CGlobalVarsBase*)*(DWORD*)(m_pMemTools->findPattern((DWORD)GetModuleHandle("engine.dll"),0x2df000,(PBYTE)"\x68\x00\x00\x00\x00\x50\x50\xFF\x12\x85\xC0\x75\x0D\x68\x00\x00\x00\x00\xE8\x00\x00\x00\x00","x????xxxxxxxxx????x????")+0x1);
Code:// Called once when the client DLL is loaded virtual int Init( CreateInterfaceFn appSystemFactory, CreateInterfaceFn physicsFactory, CGlobalVarsBase *pGlobals ) = 0;
Comment
-
Re: s1mpleX problem
actually not filling/filling the globals pointer with shitty memory was a copy pasta protection in my s1mpleX base whne i released it so yes, it is the globals pointer that makes ur hook fail hard.
but hey, since you dont know what ur doing, globals->curtime or whatever is used as reference for the setupbones function so that it knows when to update the bones...so it can also be just a time reference as GetTickCount....I 0x90 you!
Comment
Comment