Code:
VOID CorrectSpread( )
{
if(cg->snap)
{
input_t* input = (input_t*)0xcc4ff8;
usercmd_t * cmd = input->GetUserCmd( input->currentCmdNum - 1);
cmd->servertime = *(int*)0x794464 + 1;
FirstBulletFix();//from king-orgy can be found on UC at cod4 section
Vector3 ForwardVec, RightVec, UpVec, CalculatedSpreadView, SpreadView, DestinationVec;
int seed = *(int*)0x794474;
Vector3 vWeaponAngles;
GetWeaponView( vWeaponAngles );
CMath.NSAngleVectors( vWeaponAngles, ForwardVec, RightVec, UpVec );
float flSpread;
weapon_t * pWeapon = GetPlayerWeapon( cg_entities2[cg->clientNum].nWeaponID );
GetWeaponSpread( pWeapon, &flSpread );
flSpread *= 0.01745329238474369f;
flSpread = tan(flSpread) * 8192.0f;
float flSpreadRight, flSpreadUp;
Vector3 myViewpoint = {0, 0, 0 };
GetViewPoint ( myViewpoint );
GetRandomFloats( seed, &flSpreadRight, &flSpreadUp );
flSpreadRight *= flSpread;
flSpreadUp *= flSpread;
SpreadView[ 0 ] = myViewpoint[ 0 ] + ForwardVec[ 0 ] * 8192 + RightVec[ 0 ] * flSpreadRight + UpVec[ 0 ] * flSpreadUp;
SpreadView[ 1 ] = myViewpoint[ 1 ] + ForwardVec[ 1 ] * 8192 + RightVec[ 1 ] * flSpreadRight + UpVec[ 1 ] * flSpreadUp;
SpreadView[ 2 ] = myViewpoint[ 2 ] + ForwardVec[ 2 ] * 8192 + RightVec[ 2 ] * flSpreadRight + UpVec[ 2 ] * flSpreadUp;
CalculatedSpreadView[ 0 ] = SpreadView[ 0 ] - myViewpoint[ 0 ];
CalculatedSpreadView[ 1 ] = SpreadView[ 1 ] - myViewpoint[ 1 ];
CalculatedSpreadView[ 2 ] = SpreadView[ 2 ] - myViewpoint[ 2 ];
CMath.NSVectorAngles( CalculatedSpreadView, DestinationVec );
Vector3 FinalVecAngles;
DestinationVec[ 0 ] *= -1;
FinalVecAngles[ 0 ] = viewMatrix->viewAngles[ 0 ] - DestinationVec[ 0 ];
FinalVecAngles[ 1 ] = viewMatrix->viewAngles[ 1 ] - DestinationVec[ 1 ];
FinalVecAngles[ 2 ] = 0;
if ( !clientInfo[cg->clientNum].zoomed )// WE NEED DO IT ONLY WHEN NOT ZOOMED
{
cmd->viewangles[ 0 ] += ANGLE2SHORT( FinalVecAngles[ 0 ] );
cmd->viewangles[ 1 ] += ANGLE2SHORT( FinalVecAngles[ 1 ] );
cmd->viewangles[ 2 ] += ANGLE2SHORT( FinalVecAngles[ 2 ] );
}
//viewangles->ViewAngle[ 0 ] -= vFinalSpreadAngles[ 0 ];
//viewangles->ViewAngle[ 1 ] -= vFinalSpreadAngles[ 1 ];
}
}
Code:
CMath.GetAngleToOrigin( vOrg, ViewAngle[ 0 ], ViewAngle[ 1 ] );
if ( cvar.silentaim )
{
stealthAimAngles[ 0 ] = ViewAngle[ 1 ];
stealthAimAngles[ 1 ] = ViewAngle[ 0 ];
stealthAimAngles[ 2 ] = 0;
}
else
{
/*D3DXVECTOR3 CalculatedPos;
CalculatedPos = *(D3DXVECTOR3*)&vOrg - *(D3DXVECTOR3*)&camera->Location;
D3DXVec3Normalize( &CalculatedPos, &CalculatedPos );
viewangles->ViewAngle[ 1 ] += D3***oDegree( asin( D3DXVec3Dot((D3DXVECTOR3*)&camera->ViewMatrix[ 1 ], &CalculatedPos )));
viewangles->ViewAngle[ 0 ] -= D3***oDegree( asin( D3DXVec3Dot((D3DXVECTOR3*)&camera->ViewMatrix[ 2 ], &CalculatedPos )));*/
viewangles->ViewAngle[ 1 ] += ViewAngle[ 0 ];
viewangles->ViewAngle[ 0 ] += ViewAngle[ 1 ];
}
cba to copy the rest
for the full code: google "NoSpread (!copy & paste!)" and click on the first link