View Single Post
hmmmmm
Great Tester of Whatever
Join Date: Mar 2017
Location: ...
Old 01-25-2018 , 06:36   Re: VScript Functions
Reply With Quote #4

PHP Code:
#include <sourcemod>
#include <sdktools>
#include <vscriptfun>

public void OnMapStart()
{
    
CreateTimer0.1Timer_DebugDraw_TIMER_REPEAT TIMER_FLAG_NO_MAPCHANGE );
}

public 
Action Timer_DebugDrawHandle timer )
{
    for( 
int i 1<= MaxClientsi++ )
    {
        if( 
IsClientInGame) && !IsFakeClient) )
        {
            
PrintToServer"Drawing axis" );
            
float pos[3];
            
GetClientEyePositionipos );
            
float angles[3];
            
GetClientEyeAnglesiangles );
            
            
TR_TraceRayposanglesMASK_ALLRayType_Infinite );
            if( 
TR_DidHit() )
            {
                
TR_GetEndPositionpos );
                
DrawAxispos );
            }
        }
    }
}

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.DebugDrawLinepos1pos225500true0.1 );
    
    
pos1 pos;
    
pos2 pos;
    
pos1[1] -= s;
    
pos2[1] += s;
    
VSF.DebugDrawLinepos1pos202550false0.1 );
    
    
pos1 pos;
    
pos2 pos;
    
pos1[2] -= s;
    
pos2[2] += s;
    
VSF.DebugDrawLinepos1pos200255false0.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.

Last edited by hmmmmm; 01-25-2018 at 06:54.
hmmmmm is offline