PHP Code:
#include <sourcemod>
#include <sdktools>
#include <vscriptfun>
public void OnMapStart()
{
CreateTimer( 0.1, Timer_DebugDraw, _, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE );
}
public Action Timer_DebugDraw( Handle timer )
{
for( int i = 1; i <= MaxClients; i++ )
{
if( IsClientInGame( i ) && !IsFakeClient( i ) )
{
PrintToServer( "Drawing axis" );
float pos[3];
GetClientEyePosition( i, pos );
float angles[3];
GetClientEyeAngles( i, angles );
TR_TraceRay( pos, angles, MASK_ALL, RayType_Infinite );
if( TR_DidHit() )
{
TR_GetEndPosition( pos );
DrawAxis( pos );
}
}
}
}
void DrawAxis( const float pos[3], float s = 5.0 )
{
float pos1[3], pos2[3];
pos1 = pos;
pos2 = pos;
pos1[0] -= s;
pos2[0] += s;
VSF.DebugDrawLine( pos1, pos2, 255, 0, 0, true, 0.1 );
pos1 = pos;
pos2 = pos;
pos1[1] -= s;
pos2[1] += s;
VSF.DebugDrawLine( pos1, pos2, 0, 255, 0, false, 0.1 );
pos1 = pos;
pos2 = pos;
pos1[2] -= s;
pos2[2] += s;
VSF.DebugDrawLine( pos1, pos2, 0, 0, 255, false, 0.1 );
}
Also I wanted to mention that in the include file, the extension filename is specified as vsfun.ext but it builds to vscriptfun.ext, which is a bit confusing.