Advertisement
Guest User

Untitled

a guest
Nov 19th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.26 KB | None | 0 0
  1. local material = Material( "icon16/stop.png" );
  2. hook.Add( "HUDPaint", "TB::DrawPoliceStop", function()
  3. if( #ents.FindByClass( "tb_cracker" ) < 1 || !table.HasValue( TB.Settings.PoliceJobs, RPExtraTeams[ LocalPlayer():Team() ].name ) ) then
  4. return;
  5. end
  6.  
  7. local _e = ents.FindByClass( "tb_cracker" )[ 1 ];
  8. local pos = _e:GetPos():ToScreen();
  9. local dist = _e:GetPos():Distance( LocalPlayer():GetPos() );
  10. dist = math.Round( ( dist / 17.3 ) - 3, 0 );
  11. if( dist < 10 ) then
  12. return;
  13. end
  14.  
  15. surface.SetDrawColor( color_white );
  16. surface.SetMaterial( material );
  17. surface.DrawTexturedRect( pos.x, pos.y, 16, 16 );
  18.  
  19. draw.SimpleText( "Bank is being robbed! Distance: " .. dist .. "m", "Trebuchet18", pos.x + 18, pos.y - 2, color_white );
  20.  
  21. end );
  22. TB.Door = Entity( 611 );
  23. net.Receive( "TB::WriteDoor", function( _ )
  24. TB.Door = Entity( net.ReadFloat() );
  25. timer.Simple( 20, function()
  26. if( !IsValid( TB.Door ) ) then
  27. TB.Door = Entity( 611 );
  28. end
  29. end );
  30.  
  31. end );
  32. hook.Add( "PostDrawOpaqueRenderables", "TB::DrawDoorHUD", function()
  33.  
  34. if( IsValid( TB.Door ) && LocalPlayer():GetPos():Distance( TB.Door:GetPos() ) < 500 ) then
  35. local text = TB.Door:GetNWFloat( "cooldown", 0 );
  36. local clr = Color( 0, 255, 0 );
  37. if( text == 0 ) then
  38. text = "Ready";
  39. else
  40. text = text - CurTime();
  41. text = string.FormattedTime( text );
  42. if( string.len( text.m ) < 2 ) then
  43. text.m = 0 .. text.m;
  44. end
  45.  
  46. if( string.len( text.s ) < 2 ) then
  47. text.s = 0 .. text.s;
  48. end
  49.  
  50. text = text.m .. ":" .. text.s;
  51. clr = Color( 255, 0, 0 );
  52. end
  53.  
  54.  
  55.  
  56. local font = "TB::Vault";
  57. local pos = TB.Door:GetPos();
  58. local ang = TB.Door:GetAngles();
  59. local w, h = surface.GetTextSize( text );
  60.  
  61. pos = pos + TB.Door:GetRight() * -1;
  62. pos = pos + TB.Door:GetUp() * 4;
  63. pos = pos + TB.Door:GetForward() * -3;
  64. ang:RotateAroundAxis( ang:Forward(), 90 );
  65. ang:RotateAroundAxis( ang:Right(), 90 );
  66.  
  67. surface.SetFont( font );
  68. local w, h = surface.GetTextSize( text );
  69.  
  70. cam.Start3D2D( pos, ang, 0.1 );
  71.  
  72. draw.SimpleText( text, font, 9, 9, Color( 0, 0, 0 ), TEXT_ALIGN_CENTER );
  73. draw.SimpleText( text, font, 10, 10, clr, TEXT_ALIGN_CENTER );
  74.  
  75. cam.End3D2D();
  76. end
  77.  
  78. end );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement