How often do you want to check for distance moved? Just create a constantly looping set_task or thinking entity, create a static variable that holds the origin from last call, global variable that holds the total walk distance and use get_distance_f. Something like this:
PHP Code:
// should limit the distance somehow in case the player gets teleported back to spawn
#define DISTANCE_MAX 100.0
#define LOOP_TIMER 1.0
new Float: g_fTotalDistanceWalked[ 33 ]
set_task( LOOP_TIMER, "_tCycle", .flags = "b" )
public _tCycle( )
{
new aPlayers[ 32 ], iNum, id
static Float: s_fLastOrigin[ 33 ][ 3 ]
new Float: fCurrentOrigin[ 3 ]
new Float: fDistance
get_players( aPlayers, iNum, "a" )
for( new i; i < iNum; i ++ )
{
id = aPlayers[ i ]
entity_get_vector( id, EV_VEC_origin, fCurrentOrigin )
if( s_fLastOrigin[ id ] != 0.0 )
{
fDistance = get_distance_f( s_fLastOrigin[ id ], fCurrentOrigin )
if( fDistance < DISTANCE_MAX )
{
g_fTotalDistanceWalked[ 33 ] += fDistance
}
}
xs_vec_copy( fCurrentOrigin, s_fLastOrigin[ id ] )
}
}
Thinking entity would probably be better but I don't feel like writing it.