Using FAKEMETA, we create the FM_CmdStart forward to capture the forwardmove and sidemove variables.
Then using the walkspeed which is MAXSPEED * 0.52, we check if forward/side moves are lower than that amount. 0.52 was retrieved from the client cvar "cl_movespeedkey" which is changeable, so this will break if the client changes it. It's their own fault for trying to cheat/mess around.
Heres the full code. Enjoy.
Code: Select all
plugin_init()
register_forward( FM_CmdStart, "FMCmdStart" );
public FMCmdStart( id, uc_handle, randseed )
{
new Float:fmove, Float:smove;
get_uc(uc_handle, UC_ForwardMove, fmove);
get_uc(uc_handle, UC_SideMove, smove );
new Float:maxspeed;
pev(id, pev_maxspeed, maxspeed);
new Float:walkspeed = (maxspeed * 0.52);
fmove = floatabs( fmove );
smove = floatabs( smove );
if(fmove <= walkspeed && smove <= walkspeed && !(fmove == 0.0 && smove == 0.0))
{
client_print( id, print_center, "WALKING" );
}
else
{
client_print( id, print_center, "RUNNING" );
}
}