Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void aimbot(){
- for (;;){
- if (AimBot) {
- int PlayerNumber = Other.ClosestEntity();
- if (PlayerNumber > 0 && PlayerNumber <= 64 && !Entity.IsDead(PlayerNumber ) && !Entity.IsDormant(PlayerNumber ) && Local.GetTeam() != Entity.GetTeam(PlayerNumber )) {
- AimAngle = CalculateAngle(PlayerNumber, 6);
- AimAngle = Local.NormalizeAngle(AimAngle);
- CurrentAngle = Local.ViewAngle();
- CurrentAngle = Local.NormalizeAngle(CurrentAngle);
- if (Local.Fov(Entity.Position(PlayerNumber), AimAngle, CurrentAngle) <= aimbot_pistol_fov_int) {
- SetAngle(AimAngle, CurrentAngle, Smoothness);
- }
- }
- }
- Sleep(1);
- }
- }
- struct{
- Vector NormalizeAngle(Vector angle){
- if (!std::isfinite(angle.x))
- {
- angle.x = 0;
- }
- if (!std::isfinite(angle.y))
- {
- angle.y = 0;
- }
- while (angle.y < -180.0f) angle.y += 360.0f;
- while (angle.y > 180.0f) angle.y -= 360.0f;
- if (angle.x > 89.0f) angle.x = 89.0f;
- if (angle.x < -89.0f) angle.x = -89.0f;
- angle.z = 0;
- return angle;
- }
- Vector SmoothAngle(Vector SrcAngles, Vector DestAngles, int SmoothAmount) {
- Vector SmoothedAngles;
- SmoothedAngles.x = SrcAngles.x + (DestAngles.x - SrcAngles.x) * SmoothAmount;
- SmoothedAngles.y = SrcAngles.y + (DestAngles.y - SrcAngles.y) * SmoothAmount;
- SmoothedAngles.z = SrcAngles.z + (DestAngles.z - SrcAngles.z) * SmoothAmount;
- return NormalizeAngle(SmoothedAngles);
- }
- bool fovCheck(DWORD EntityBase, Vector CurrentAngles, Vector AimAngles, float MaximumFov){
- Vector MyPosition = Player.GetPosition();
- Vector EntityPosition = Entity.GetPosition(EntityBase);
- float distance = Server.GetDistance(MyPosition, EntityPosition);
- float pitch = sin(DEG2RAD(CurrentAngles.x - AimAngles.x)) * distance;
- float yaw = sin(DEG2RAD(CurrentAngles.y - AimAngles.y)) * distance;
- float fov = sqrt(powf(pitch, 2.0) + powf(yaw, 2.0));
- if (fov <= MaximumFov)
- return true;
- else
- return false;
- }
- Vector compensateVelocity(DWORD EntityBase, Vector EnemyPos, float smoothAmount){
- Vector EntityVelocity = Entity.GetVelocity(EntityBase);
- Vector MyVelocity = Player.GetVelocity();
- EnemyPos.x = EnemyPos.x + (EntityVelocity.x / 100.f) * (40.f / smoothAmount);
- EnemyPos.y = EnemyPos.y + (EntityVelocity.y / 100.f) * (40.f / smoothAmount);
- EnemyPos.z = EnemyPos.z + (EntityVelocity.z / 100.f) * (40.f / smoothAmount);
- EnemyPos.x = EnemyPos.x - (MyVelocity.x / 100.f) * (40.f / smoothAmount);
- EnemyPos.y = EnemyPos.y - (MyVelocity.y / 100.f) * (40.f / smoothAmount);
- EnemyPos.z = EnemyPos.z - (MyVelocity.z / 100.f) * (40.f / smoothAmount);
- return EnemyPos;
- }
- Vector getAimAngles(DWORD EntityBase, int TargetBone){
- Vector AimAngles;
- Vector myPosition = Player.GetPosition();
- Vector entityPosition = Entity.GetBonePosition(EntityBase, TargetBone);
- entityPosition = compensateVelocity(EntityBase, entityPosition, 40);
- Vector Punch = Player.GetPunch();
- Vector ViewOrigin = Player.GetViewOrigin();
- float pitchreduction = Server.GetRandomFloat(2.f, 2.f);
- float yawreduction = Server.GetRandomFloat(2.f, 2.f);
- float delta[3] = { (myPosition.x - entityPosition.x), (myPosition.y - entityPosition.y), ((myPosition.z + ViewOrigin.z) - entityPosition.z) };
- float hyp = sqrt(delta[0] * delta[0] + delta[1] * delta[1]);
- //AimAngles.x = atanf(delta[2] / hyp)* (180/M_PI) - Punch.x *pitchreduction;
- //AimAngles.y = atanf(delta[1] / delta[0]) *(180/M_PI) - Punch.y *yawreduction;
- AimAngles.x = atanf(delta[2] / hyp)* (180 / M_PI) - Punch.x *pitchreduction;
- AimAngles.y = atanf(delta[1] / delta[0]) *(180 / M_PI) - Punch.y *yawreduction;
- AimAngles.z = 0.0f;
- if (delta[0] >= 0.0){
- AimAngles.y += 180.0f;
- }
- return AimAngles;
- }
- double DEG2RAD(double d){
- return (d*M_PI / 180);
- }
- int ClosestEntity()
- {
- float CurrentDistance = 0xFFFFFF;
- int ClosestTarget = -1;
- for (int i = 0; i <= 64; i++)
- {
- if (i > 0 && i <= 64 && !Entity.IsDead(i) && !Entity.IsDormant(i) && Local.GetTeam() != Entity.GetTeam(i))
- {
- Vector AimAngles = CalculateAngle(i, 6);
- float Distance = Local.Distance(Local.ViewAngle(), AimAngles);
- if (Distance < CurrentDistance)
- {
- CurrentDistance = Distance;
- ClosestTarget = i;
- }
- }
- }
- if (ClosestTarget != 0)
- return ClosestTarget;
- }
- void SetAngle(Vector dest, Vector orig, float Smooth)
- {
- Vector SmoothAngles;
- SmoothAngles.x = dest.x - orig.x;
- SmoothAngles.y = dest.y - orig.y;
- SmoothAngles.z = 0.0f;
- SmoothAngles = Local.NormalizeAngle(SmoothAngles);
- SmoothAngles.x = orig.x + SmoothAngles.x / 100.0f * (Smooth / 10);
- SmoothAngles.y = orig.y + SmoothAngles.y / 100.0f * (Smooth / 10);
- SmoothAngles.z = 0.0f;
- SmoothAngles = Local.NormalizeAngle(SmoothAngles);
- Engine->Write<Vector>(Local.EngineBase() + Utils->GetOffset("m_dwViewAngles"), SmoothAngles);
- }
- }Other;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement