fr1kin

Garry's Mod Hitbox ESP

Jun 21st, 2013
1,826
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.19 KB | None | 0 0
  1. local IGNOREZ = true;
  2.  
  3. local color = Color( 255, 255, 0, 50 );
  4.  
  5. local that_other_color = Color( color.r, color.g, color.b, 255 );
  6.  
  7. local function DrawHitbox()
  8.     cam.Start3D( EyePos(), EyeAngles() );
  9.         for i, ent in pairs( ents.GetAll() ) do
  10.             if( !ent ) then continue; end
  11.             if( !IsValid( ent ) ) then continue; end
  12.             if( ent == LocalPlayer() ) then continue; end
  13.             if( !ent:IsPlayer() && !ent:IsNPC() ) then continue; end
  14.             if( ( ent:IsPlayer() && !ent:Alive() ) || ( ent:IsNPC() && ent:GetMoveType() == 0 ) ) then continue; end
  15.             for hitbox = 0, ent:GetHitBoxCount(0) do
  16.                 local bone = ent:GetHitBoxBone( hitbox, 0 );
  17.                 local bpos, bang = ent:GetBonePosition( bone );
  18.                 local min, max = ent:GetHitBoxBounds( hitbox, 0 );
  19.                 if( min == nil || max == nil ) then
  20.                     continue;
  21.                 end
  22.                 if( !IGNOREZ ) then
  23.                     render.SetColorMaterial();
  24.                 else
  25.                     render.SetColorMaterialIgnoreZ();
  26.                 end
  27.                 render.SetBlend( color.a / 255 );
  28.                 render.DrawBox( bpos, bang, min, max, color, !IGNOREZ );
  29.                 render.DrawWireframeBox( bpos, bang, min, max, that_other_color, !IGNOREZ );
  30.             end
  31.         end
  32.     cam.End3D();
  33. end
  34.  
  35. hook.Add( "RenderScreenspaceEffects", "Render", DrawHitbox );
Advertisement
Add Comment
Please, Sign In to add comment