Credits: Unknown, taken from R15's Omega Hook source, menu code from Harlequin by Stealth-X, tutorial written by me.
-client.cpp
Somewhere under your includes add:
CODE
void DrawAimVecMaker();
Somewhere add:
CODE
void gDrawFilledBoxAtLocation2( float* origin, int r, int g, int b, int a, int radius=1)
{
float vecScreen[2];
if( !CalcScreen(origin, vecScreen) ) { return; }
int radius2 = radius<<1;
gEngfuncs.pfnFillRGBA(vecScreen[0]-radius,vecScreen[1]-radius,radius2,radius2,r,g,b,a);
}
cl_entity_s vecDummy;
void DrawAimVecMaker()
{
vec3_t aim_location, target_origin;
vec3_t up, right, forward, playerAngles;
vector<aimvec>::iterator pos, end;
if(vecDummy.curstate.usehull == 1)
{
pos = gAimbot.AimVecsS.begin();
end = gAimbot.AimVecsS.end();
}
else if(vecDummy.curstate.usehull == 2)
{
pos = gAimbot.AimVecsD.begin();
end = gAimbot.AimVecsD.end();
}
else if(vecDummy.curstate.usehull == 6)
{
pos = gAimbot.AimVecsJ.begin();
end = gAimbot.AimVecsJ.end();
}
else
{
pos = gAimbot.AimVecsS.begin();
end = gAimbot.AimVecsS.end();
}
// calculate aiming vectors
playerAngles[0]=0;
playerAngles[1]=vecDummy.angles[1];
playerAngles[2]=0;
gEngfuncs.pfnAngleVectors (playerAngles, forward, right, up);
forward[2] = -forward[2];
register DWORD color = 0xFFFFFF;
float vecScreen[2];
int num = 0;
for (;pos!=end;++pos)
{
aim_location[0] = vecDummy.origin[0];
aim_location[1] = vecDummy.origin[1];
aim_location[2] = vecDummy.origin[2];
aim_location = aim_location + forward * pos[0].f;
aim_location = aim_location + up * pos[0].h;
aim_location = aim_location + right * pos[0].r;
gDrawFilledBoxAtLocation2(aim_location,192,255,255,255,1);
float r = ((color&0xFFFFFFFF)>>24)/255.0;
float g = ((color&0xFFFFFFFF)>>16)/255.0;
float b = ((color&0xFFFFFFFF)>>8 )/255.0;
gEngfuncs.pfnDrawSetTextColor(r,g,b);
if( CalcScreen(aim_location,vecScreen) )
{
char buf[3];
sprintf(buf,"Sequence: %d",vecDummy.curstate.usehull);
gEngfuncs.pfnDrawConsoleString(vecScreen[0],vecScreen[1]+3,buf );
}
color = 0xFFFFFFFF;
}
}
void func_vecdummysnap()
{
cvar.vecmaker_x = me.pmEyePos[0]-80;
cvar.vecmaker_y = me.pmEyePos[1];
cvar.vecmaker_z = me.pmEyePos[2];
}
In hud_redraw add:
CODE if (cvar.vecmaker)
{
DrawAimVecMaker ();
}
In hud_addentity, under if(bNewFrame), delete bNewFrame = false; and add:
CODE
{
bNewFrame = false;
if(cvar.vecmaker)
{
memcpy( &vecDummy,me.ent, sizeof(cl_entity_s) );
vecDummy.curstate.sequence = me.ent->curstate.sequence;
vecDummy.curstate.usehull = me.ent->curstate.gaitsequence;
switch(cvar.dummytype)
{
case 0:
vecDummy.origin[0] = cvar.vecmaker_x;
vecDummy.origin[1] = cvar.vecmaker_y;
vecDummy.origin[2] = cvar.vecmaker_z;break;
case 1:
vecDummy.origin[0] = me.ent->origin[0];
vecDummy.origin[1] = cvar.vecmaker_y;
vecDummy.origin[2] = cvar.vecmaker_z;break;
case 2:
vecDummy.origin[0] = cvar.vecmaker_x;
vecDummy.origin[1] = me.ent->origin[1];
vecDummy.origin[2] = cvar.vecmaker_z;break;
}
VectorCopy( vecDummy.origin, vecDummy.curstate.origin );
vecDummy.angles[0] = cvar.vecmaker_pitch;
vecDummy.angles[1] = cvar.vecmaker_yaw;
// vecDummy.angles[0] = me.ent->angles[0];
// vecDummy.angles[1] = me.ent->angles[1]-180;
vecDummy.curstate.frame = cvar.vecmaker_frame;
gEngfuncs.CL_CreateVisibleEntity(ET_NORMAL,&vecDummy);
}
}
cvar.cpp, cvar.h
Register your cvars:
CODE
REGISTER_CVAR_FLOAT( vecmaker_z, 0.00)
REGISTER_CVAR_FLOAT( vecmaker_y, 0.00)
REGISTER_CVAR_FLOAT( vecmaker_pitch, 0.00)
REGISTER_CVAR_FLOAT( vecmaker_yaw, 0.00)
REGISTER_CVAR_FLOAT( vecmaker_x, 0.00)
REGISTER_CVAR_INT( vecmaker, 0)
REGISTER_CVAR_INT( vecmaker_frame, 0)
REGISTER_CVAR_INT( dummytype, 0)
float vecmaker_pitch;
float vecmaker_yaw;
float vecmaker_x;
float vecmaker_y;
float vecmaker_z;
int dummytype;
int vecmaker;
int vecmaker_frame;
OGC Menu Code:
CODE
" " "[Built-In Modeler]"{ //Built in model for you to make vecs
" " "-Modeler on/off" "vecmaker change;vecdummysnap"//Toggle modeler on and off
" " "-Snap Modeler To You" "vecdummysnap"//Brings the model toward you
" " "-Dummytype Strafe " "vecdummysnap;dummytype 2"//Allows you to tweak rights
" " "-Dummytype Normal" "vecdummysnap;dummytype 0"//Keep the model still
" " "-Dummytype Down/Up " "vecdummysnap;dummytype 1"//Allows you to tweak forwards
}