client.cpp
Add this above Code:
Cl_creatmove();
add this Code:
void FixupAngleDifference(usercmd_t *cmd);
usercmd_t g_Originalcmd;
void posthook_CL_CreateMove(usercmd_t *cmd)
{
// copy the original cmd structure for reference after it has been changed by the aimbot/other hacks
memcpy(&g_Originalcmd, cmd, sizeof(usercmd_t));
FixupAngleDifference(cmd);
}
void FixupAngleDifference(usercmd_t *cmd)
{
// thanks tetsuo for this copy/paste
cl_entity_t *pLocal;
Vector viewforward, viewright, viewup, aimforward, aimright, aimup, vTemp;
float newforward, newright, newup, newmagnitude, fTime;
float forward = g_Originalcmd.forwardmove;
float right = g_Originalcmd.sidemove;
float up = g_Originalcmd.upmove;
pLocal = gEngfuncs.GetLocalPlayer();
if(!pLocal)
return;
// this branch makes sure your horizontal velocity is not affected when fixing up the movement angles -- it isn't specific to spinning and you can use it with the source tetsuo posted in his forum too
if(pLocal->curstate.movetype == MOVETYPE_WALK)
{
gEngfuncs.pfnAngleVectors(Vector(0.0f, g_Originalcmd.viewangles.y, 0.0f), viewforward, viewright, viewup);
}
else
{
gEngfuncs.pfnAngleVectors(g_Originalcmd.viewangles, viewforward, viewright, viewup);
}
// SPIN!!!
int iHasShiftHeld = GetAsyncKeyState(VK_LSHIFT);
if(pLocal->curstate.movetype == MOVETYPE_WALK && !iHasShiftHeld && !(cmd->buttons & IN_ATTACK) && !(cmd->buttons & IN_USE) && (currentWeaponID!=WEAPON_HE && currentWeaponID!=WEAPON_FLASH && currentWeaponID!=WEAPON_SMOKE && currentWeaponID!=WEAPON_KNIFE))
{
cvar.nospread=2;
if(cvar.spin==1){
fTime = gEngfuncs.GetClientTime();
cmd->viewangles.y = fmod(fTime * cvar.spinrevs * 360.0f, 360.0f);}
if(cvar.spin==2){
fTime = gEngfuncs.GetClientTime();
#define M_PI 3.1415926
cmd->viewangles.x = cos(fTime * cvar.spinrevs * M_PI) * 90.0f;
cmd->viewangles.y = sin(fTime * cvar.spinrevs * 360.0f) * 360.0f;
}
}
else{
cvar.nospread = 1;
}
// this branch makes sure your horizontal velocity is not affected when fixing up the movement angles -- it isn't specific to spinning and you can use it with the source tetsuo posted in his forum too
if(pLocal->curstate.movetype == MOVETYPE_WALK)
{
gEngfuncs.pfnAngleVectors(Vector(0.0f, cmd->viewangles.y, 0.0f), aimforward, aimright, aimup);
}
else
{
gEngfuncs.pfnAngleVectors(cmd->viewangles, aimforward, aimright, aimup);
}
newforward = DotProduct(forward * viewforward.Normalize(), aimforward) + DotProduct(right * viewright.Normalize(), aimforward) + DotProduct(up * viewup.Normalize(), aimforward);
newright = DotProduct(forward * viewforward.Normalize(), aimright) + DotProduct(right * viewright.Normalize(), aimright) + DotProduct(up * viewup.Normalize(), aimright);
newup = DotProduct(forward * viewforward.Normalize(), aimup) + DotProduct(right * viewright.Normalize(), aimup) + DotProduct(up * viewup.Normalize(), aimup);
cmd->forwardmove = newforward;
cmd->sidemove = newright;
cmd->upmove = newup;
}
now in Code:
Cl_creatmove();
find this: Code:
if (gAimbot.target != -1 && me.iClip && me.pmMoveType != 5 && cvar.aim)
make it look like this: Code:
if (gAimbot.target != -1 && me.iClip && me.pmMoveType != 5 && cvar.aim)
{
if(cvar.spin == 1 || cvar.spin==2){
usercmd_t *cmd;
if((cmd->buttons & IN_ATTACK)){
VectorCopy ( gAimbot.aim_viewangles, usercmd->viewangles );
gEngfuncs.SetViewAngles ( gAimbot.aim_viewangles);
}
else {
}
}
else{
VectorCopy ( gAimbot.aim_viewangles, usercmd->viewangles );
gEngfuncs.SetViewAngles ( gAimbot.aim_viewangles);
}
}
cvar.cpp[code]
REGISTER_CVAR_FLOAT( spinrevs ,2.00)
REGISTER_CVAR_INT( spin, 0)[code]
cvar.h[code]
float spinrevs;
int spin;