float radius = (cone * height) / 1.5f;
Interfaces.Surface->DrawFilledCircle(width / 2, height / 2, radius, 255, 0, 0, 50);
wtf
how about d e b u g g i n g it, maybe your getinaccuracy returns 0
read titleCode:void DrawSpread() { CBaseEntity* localplayer = (CBaseEntity*)Interfaces.EntityList->GetClientEntity(Interfaces.pEngine->GetLocalPlayer()); if (!localplayer) return; CBaseCombatWeapon* activeWeapon = (CBaseCombatWeapon*)Interfaces.EntityList->GetClientEntityFromHandle(localplayer->GetActiveBaseCombatWeapon()); if (!activeWeapon) return; int width, height; Interfaces.Engine->GetScreenSize(width, height); if (Settings.GetMenuSetting(Tab_Visuals,Visuals_Spread)) { float cone = activeWeapon->GetInaccuracy(); if (cone > 0.0f) { float radius = (cone * height) / 1.5f; Interfaces.Surface->DrawFilledCircle(width / 2, height / 2, radius, 255, 0, 0, 50); } } }
Azuki (07-11-2017)
That's a ghetto method of doing it anyway. Someone posted on another forum the maths behind the correct way.
IDA
Code:Code:// inside C_WeaponCSBase::DrawCrosshair // this is GetFOV probably (*(void (**)(void))(*(_DWORD *)v113 + 0x500))(); v11 = result * 0.017453292 * 0.5; v154 = v11; (*(void (__thiscall **)(int))(*(_DWORD *)v2 + 1936))(v2); v131 = v11; (*(void (__thiscall **)(int))(*(_DWORD *)v2 + 1940))(v2); v133 = v11; __libm_sse2_tanf((__m128d)LODWORD(v154)); // float spread_distance = ( (weapon->GetInaccuracy() + weapon->GetCone()) * 320.f ) / std::tan( Math::deg_to_rad(local_player->GetFOV()) * 0.5f ) v117 = (float)((float)(v133 + v131) * 320.0) / v154; v137 = (float)((float)(v133 + v131) * 320.0) / v154;
Code:float spread_distance = ((localplayer->get_weapon()->get_accuracy() + localplayer->get_weapon()->get_cone()) * 320.f) / std::tan(DEG2RAD(player_fov) * 0.5f); float radius = spread_distance * (y / 480.f);
inb4 this
Code:void DrawSpread() { if (Settings.GetMenuSetting(Tab_Visuals,Visuals_Spread)) { float cone = activeWeapon->GetInaccuracy(); if (cone > 0.0f) { (*(void (**)(void))(*(_DWORD *)v113 + 0x500))(); v11 = result * 0.017453292 * 0.5; v154 = v11; (*(void (__thiscall **)(int))(*(_DWORD *)v2 + 1936))(v2); v131 = v11; (*(void (__thiscall **)(int))(*(_DWORD *)v2 + 1940))(v2); v133 = v11; __libm_sse2_tanf((__m128d)LODWORD(v154)); // float spread_distance = ( (weapon->GetInaccuracy() + weapon->GetCone()) * 320.f ) / std::tan( Math::deg_to_rad(local_player->GetFOV()) * 0.5f ) v117 = (float)((float)(v133 + v131) * 320.0) / v154; v137 = (float)((float)(v133 + v131) * 320.0) / v154; } } }