Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sourcemod>
- #include <sdktools>
- int g_HaloSprite;
- int g_LaserBeam;
- public void OnPluginStart()
- {
- RegConsoleCmd( "sm_hitboxtest", Command_HitboxTest );
- RegConsoleCmd( "sm_bboxtest", Command_BBoxTest );
- }
- public void OnMapStart()
- {
- g_HaloSprite = PrecacheModel( "materials/sprites/glow01.vmt" );
- g_BlueLightning = PrecacheModel( "materials/sprites/laserbeam.vmt" );
- }
- public Action Command_HitboxTest( int client, int args )
- {
- float startpos[3];
- GetClientEyePosition( client, startpos );
- float angles[3];
- GetClientEyeAngles( client, angles );
- TR_EnumerateEntities( startpos, angles, false, RayType_Infinite, HitPlayerHBox, client );
- }
- public Action Command_BBoxTest( int client, int args )
- {
- float startpos[3];
- GetClientEyePosition( client, startpos );
- float angles[3];
- GetClientEyeAngles( client, angles );
- TR_EnumerateEntities( startpos, angles, false, RayType_Infinite, HitPlayerBBox, client );
- }
- public bool HitPlayerBBox( int entity, int client )
- {
- if( 0 < entity <= MaxClients && entity != client )
- {
- TR_ClipRayToEntity( MASK_PLAYERSOLID, entity );
- float pos[3];
- TR_GetEndPosition( pos );
- PrintToChatAll( "Hit %N (%i)! Collided at (%.2f, %.2f, %.2f) | Fraction: %.2f", entity, entity, pos[0], pos[1], pos[2], TR_GetFraction() );
- float startpos[3];
- GetClientEyePosition( client, startpos );
- TE_SetupBeamPoints( startpos, pos, g_BlueLightning, g_HaloSprite, 0, 0, 20.0, 1.0, 1.0, 0, 0.0, { 0, 255, 0, 255 }, 0 );
- TE_SendToAll( 0.0 );
- return false;
- }
- return true;
- }
- public bool HitPlayerHBox( int entity, int client )
- {
- if( 0 < entity <= MaxClients && entity != client )
- {
- TR_ClipRayToEntity( MASK_ALL, entity );
- float pos[3];
- TR_GetEndPosition( pos );
- PrintToChatAll( "Hit %N (%i)! Collided at (%.2f, %.2f, %.2f) | Fraction: %.2f", entity, entity, pos[0], pos[1], pos[2], TR_GetFraction() );
- float startpos[3];
- GetClientEyePosition( client, startpos );
- TE_SetupBeamPoints( startpos, pos, g_BlueLightning, g_HaloSprite, 0, 0, 20.0, 1.0, 1.0, 0, 0.0, { 255, 0, 0, 255 }, 0 );
- TE_SendToAll( 0.0 );
- return false;
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement