Credits: By RiPiel
Code:
//In your hooking functions...
pEngfuncs->pfnPlaybackEvent = PlaybackEvent;
//And then...
void PlaybackEvent ( int flags, const edict_t *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 )
{
if ( cvar.aimbot_recoil == 3 )
{
float ViewAngles[3], NewPunchangle[3];
static float PrevPunchangle[3];
static int LastWeapon;
if ( ( Weapon.m_iId == WEAPONLIST_FAMAS ) || ( Weapon.m_iId == WEAPONLIST_GALIL ) )
{
NewPunchangle[0] = ( (float) iparam1 / 10000000 ) * 2.0f;
NewPunchangle[1] = ( (float) iparam2 / 10000000 ) * 2.0f;
}
else
{
NewPunchangle[0] = ( (float) iparam1 / 100 ) * 2.0f;
NewPunchangle[1] = ( (float) iparam2 / 100 ) * 2.0f;
}
if ( ( ( NewPunchangle[0] == 0.0f ) && ( NewPunchangle[1] == 0.0f ) ) || ( LastWeapon != Weapon.m_iId ) )
{
VectorClear ( PrevPunchangle );
LastWeapon = Weapon.m_iId;
}
pEngfuncs->GetViewAngles ( ViewAngles );
ViewAngles[0] -= NewPunchangle[0] - PrevPunchangle[0];
ViewAngles[1] -= NewPunchangle[1] - PrevPunchangle[1];
pEngfuncs->SetViewAngles ( ViewAngles );
PrevPunchangle[0] = NewPunchangle[0];
PrevPunchangle[1] = NewPunchangle[1];
}
gEngfuncs.pfnPlaybackEvent ( flags, pInvoker, eventindex, delay, origin, angles, fparam1, fparam2, iparam1, iparam2, bparam1, bparam2 );
}
Notes:
Do NOT use No-Spread because is detectable to spectators...
Weapon.m_iId is the ID of your current weapon...
WEAPONLIST_FAMAS is 15, and WEAPONLIST_GALIL is 14...