yougame.biz
-
Автор темы
- #1
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Не ликнуты ресик(не мой)
Переписал по лв.
Переписал по лв.
C++:
#include "..\..\hooks\hooks.hpp"
#include "animation_system.h"
#include "..\ragebot\ragebot.h"
#include "..\autowall\autowall.h"
std::string ResolverMode[65];
int last_ticks[65];
int resolver::GetChokedPackets() {
auto ticks = player->m_flSimulationTime() - player->m_flOldSimulationTime();
if (ticks == 0 && last_ticks[player->EntIndex()] > 0) {
return last_ticks[player->EntIndex()] - 1;
}
else {
last_ticks[player->EntIndex()] = ticks;
return ticks;
}
}
float resolver::GetAngle(player_t* player) {
return math::normalize_yaw(player->m_angEyeAngles().y);
}
float resolver::GetForwardYaw(player_t* player) {
return math::normalize_yaw(GetBackwardYaw(player) - 180.f);
}
float resolver::GetBackwardYaw(player_t* player) {
return math::calculate_angle(player->GetAbsOrigin(), player->GetAbsOrigin()).y;
}
float resolver::GetLeftYaw(player_t* player) {
return math::normalize_yaw(math::calculate_angle(player->GetAbsOrigin(), player->GetAbsOrigin()).y - 90.f);
}
float resolver::GetRightYaw(player_t* player) {
return math::normalize_yaw(math::calculate_angle(player->GetAbsOrigin(), player->GetAbsOrigin()).y + 90.f);
}
bool resolver::TargetJitter(player_t* player, bool v2) {
float yaw = v2 ? GetRightYaw(player) : GetLeftYaw(player);
return fabsf(GetAngle(player) - math::normalize_yaw(yaw + 90.f))
>= fabsf(GetAngle(player) - math::normalize_yaw(yaw - 90.f));
}
bool resolver::TargetSide(player_t* player) {
float yaw = math::normalize_yaw(GetBackwardYaw(player));
float angle = GetAngle(player);
return fabsf(angle - math::normalize_yaw(yaw + 90.f))
>= fabsf(angle - math::normalize_yaw(yaw - 90.f));
}
void resolver::DetectSide(player_t* player, int *side)
{
Vector src3D, dst3D, forward, right, up, src, dst;
float back_two, right_two, left_two;
trace_t tr;
Ray_t ray, ray2, ray3, ray4, ray5;
CTraceFilter filter;
math::angle_vectors(Vector(0, GetBackwardYaw(player), 0), &forward, &right, &up);
filter.pSkip = player;
src3D = player->get_eye_pos();
dst3D = src3D + (forward * 384); //Might want to experiment with other numbers, incase you don't know what the number does, its how far the trace will go. Lower = shorter.
ray.Init(src3D, dst3D);
m_trace()->TraceRay(ray, MASK_SHOT, &filter, &tr);
back_two = (tr.endpos - tr.startpos).Length();
ray2.Init(src3D + right * 35, dst3D + right * 35);
m_trace()->TraceRay(ray2, MASK_SHOT, &filter, &tr);
right_two = (tr.endpos - tr.startpos).Length();
ray3.Init(src3D - right * 35, dst3D - right * 35);
m_trace()->TraceRay(ray3, MASK_SHOT, &filter, &tr);
left_two = (tr.endpos - tr.startpos).Length();
if (left_two > right_two) {
*side = -1;
//Body should be right
}
else if (right_two > left_two) {
*side = 1;
}
else
*side = 0;
}
bool resolver::DoesHaveJitter(player_t* player, int *new_side, adjust_data* record) {
static float LastAngle[64];
static int LastBrute[64];
static bool Switch[64];
static float LastUpdateTime[64];
int i = record->i;
float CurrentAngle = player->get_eye_pos().y;
if (CurrentAngle != 58.f) {
Switch[i] = !Switch[i];
LastAngle[i] = CurrentAngle;
*new_side = Switch[i] ? 1 : -1;
LastBrute[i] = *new_side;
LastUpdateTime[i] = m_globals()->m_curtime;
return true;
}
else {
if (fabsf(LastUpdateTime[i] - m_globals()->m_curtime >= TICKS_TO_TIME(17))
|| player->m_flSimulationTime() != player->m_flOldSimulationTime()) {
LastAngle[i] = CurrentAngle;
}
*new_side = LastBrute[i];
}
return false;
}
void resolver::StoreAntifreestand()
{
if (!g_ctx.local()->is_alive())
return;
if (!g_ctx.local()->m_bGunGameImmunity())
return;
for (int i = 1; i < m_globals()->m_maxclients; ++i)
{
auto player1 = g_ctx.local();
if (!player1 || !player1->is_alive() || player->IsDormant())
continue;
bool Autowalled = false, HitSide1 = false, HitSide2 = false;
auto idx = player->EntIndex();
float angToLocal = math::calculate_angle(player->GetAbsOrigin(), player->GetAbsOrigin()).y;
Vector ViewPoint = player->GetAbsOrigin() + Vector(0, 0, 90);
Vector2D Side1 = { (45 * sin(DEG2RAD(angToLocal))),(45 * cos(DEG2RAD(angToLocal))) };
Vector2D Side2 = { (45 * sin(DEG2RAD(angToLocal + 180))) ,(45 * cos(DEG2RAD(angToLocal + 180))) };
Vector2D Side3 = { (50 * sin(DEG2RAD(angToLocal))),(50 * cos(DEG2RAD(angToLocal))) };
Vector2D Side4 = { (50 * sin(DEG2RAD(angToLocal + 180))) ,(50 * cos(DEG2RAD(angToLocal + 180))) };
Vector Origin = player->GetAbsOrigin();
Vector2D OriginLeftRight[] = { Vector2D(Side1.x, Side1.y), Vector2D(Side2.x, Side2.y) };
Vector2D OriginLeftRightLocal[] = { Vector2D(Side3.x, Side3.y), Vector2D(Side4.x, Side4.y) };
for (int side = 0; side < 2; side++)
{
Vector OriginAutowall = { Origin.x + OriginLeftRight[side].x, Origin.y - OriginLeftRight[side].y , Origin.z + 90 };
Vector ViewPointAutowall = { ViewPoint.x + OriginLeftRightLocal[side].x, ViewPoint.y - OriginLeftRightLocal[side].y , ViewPoint.z };
for (int sidealternative = 0; sidealternative < 2; sidealternative++)
{
Vector ViewPointAutowallalternative = { Origin.x + OriginLeftRight[sidealternative].x, Origin.y - OriginLeftRight[sidealternative].y , Origin.z + 90 };
if (sidealternative == 0)
{
HitSide1 = true;
g_ctx.globals.missed_shots[idx] = -1;
//FreestandAngle[pPlayerEntity->EntIndex()] = 90;
}
else if (sidealternative == 1)
{
HitSide2 = true;
g_ctx.globals.missed_shots[idx] = 1;
//FreestandAngle[pPlayerEntity->EntIndex()] = -90;
}
Autowalled = true;
}
}
}
}
void resolver::Do(player_t* player) {
auto animstate = player->get_animation_state();
if (!animstate)
return;
animstate->m_flGoalFeetYaw = GetAngle(player);
if (!g_ctx.local()->is_alive())
return;
if (m_clientstate()->iChokedCommands <= 0)
return;
int idx = player->EntIndex();
if (!(g_ctx.local()->m_fFlags() & FL_ONGROUND))
return;
float angle = GetAngle(player);
int new_side = 0;
/*if (DoesHaveJitter(player, &new_side) && player->GetEyeAngles().x < 45) {
switch (csgo->missedshots[idx] % 2) {
case 0:
ResolverMode[idx] = "AB"();
animstate->m_flGoalFeetYaw = math::NormalizeYaw(angle + 90.f * new_side);
break;
case 1:
ResolverMode[idx] = "AC"();
animstate->m_flGoalFeetYaw = math::NormalizeYaw(angle - 90.f * new_side);
break;
}
}
else*/
{
bool forward = fabsf(math::normalize_yaw(GetAngle(player) - GetForwardYaw(player))) < 90.f;
if (g_ctx.globals.missed_shots[idx] == 0) {
/*ResolverMode[idx] = "C";
if (forward) {
FreestandSide[idx] *= -1;
ResolverMode[idx] += "B";
}
else
ResolverMode[idx] += "A";
animstate->m_flGoalFeetYaw = math::NormalizeYaw(angle - 90.f * FreestandSide[idx]);
}
else {*/
if (forward) {
switch (g_ctx.globals.missed_shots[idx] % 2) {
case 1:
ResolverMode[idx] = "DA";
if (g_ctx.globals.missed_shots[idx] == 1)
animstate->m_flGoalFeetYaw = math::normalize_yaw(angle - 58.f);
else
animstate->m_flGoalFeetYaw = math::normalize_yaw(angle + 58.f);
break;
case 0:
ResolverMode[idx] = "DB";
if (g_ctx.globals.missed_shots[idx] == 1)
animstate->m_flGoalFeetYaw = math::normalize_yaw(angle + 58.f);
else
animstate->m_flGoalFeetYaw = math::normalize_yaw(angle - 58.f);
break;
}
}
else {
switch (g_ctx.globals.missed_shots[idx] % 2) {
case 1:
ResolverMode[idx] = "DA";
if (g_ctx.globals.missed_shots[idx] == 1)
animstate->m_flGoalFeetYaw = math::normalize_yaw(angle + 70.f);
else
animstate->m_flGoalFeetYaw = math::normalize_yaw(angle - 70.f);
break;
case 0:
ResolverMode[idx] = "DB";
if (g_ctx.globals.missed_shots[idx] == 1)
animstate->m_flGoalFeetYaw = math::normalize_yaw(angle - 120.f);
else
animstate->m_flGoalFeetYaw = math::normalize_yaw(angle + 120.f);
break;
case 2:
ResolverMode[idx] = "DC";
if (g_ctx.globals.missed_shots[idx] == 1)
animstate->m_flGoalFeetYaw = math::normalize_yaw(angle - 180.f);
else
animstate->m_flGoalFeetYaw = math::normalize_yaw(angle + 180.f);
break;
}
}
}
}
animstate->m_flGoalFeetYaw = math::normalize_yaw(animstate->m_flGoalFeetYaw);
}