Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2019
1,253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.83 KB | None | 0 0
  1. function wm()
  2.  
  3.     drawline();
  4.     drawrect();
  5.     drawtext();
  6.  
  7. end
  8.  
  9. local frame_rate = 0.0
  10.     local get_abs_fps = function()
  11.         frame_rate = 0.9 * frame_rate + (1.0 - 0.9) * globals.AbsoluteFrameTime()
  12.         return math.floor((1.0 / frame_rate) + 0.5)
  13. end
  14.  
  15. function drawrect()
  16.  
  17.     local sw, sh = draw.GetScreenSize();
  18.     --aw
  19.  
  20.     draw.Color(44, 42, 99, 200); --thicc outline color
  21.     draw.FilledRect(sw/1.186, sh/90, sw/1.139, sh/18.946); --outline rect
  22.     draw.Color(34, 29, 70, 220); --inside rect color
  23.     draw.FilledRect(sw/1.181, sh/63.529, sw/1.144, sh/20.769); --inside rect
  24.     draw.Color(18, 12, 38, 255); --inside rect outline color
  25.     draw.OutlinedRect(sw/1.182, sh/67.5, sw/1.143, sh/20.377); --inside rect outline
  26.     draw.OutlinedRect(sw/1.186, sh/98.181, sw/1.139, sh/18.620); --outside rect outline
  27.  
  28.     --info
  29.  
  30.     draw.Color(44, 42, 99, 200); --thicc outline color
  31.     draw.FilledRect(sw/1.138, sh/90, sw/1.053, sh/18.946); --outline rect
  32.     draw.Color(34, 29, 70, 220); --inside rect color
  33.     draw.FilledRect(sw/1.134, sh/63.529, sw/1.0565, sh/20.769); --inside rect
  34.     draw.Color(18, 12, 38, 255); --inside rect outline color
  35.     draw.OutlinedRect(sw/1.134, sh/67.5, sw/1.0565, sh/20.377); --inside rect outline
  36.     draw.OutlinedRect(sw/1.138, sh/98.181, sw/1.053, sh/18.620); --outside rect outline
  37.  
  38.     --time
  39.  
  40.     draw.Color(44, 42, 99, 200); --thicc outline color
  41.     draw.FilledRect(sw/1.052, sh/90, sw/1.0045, sh/18.946); --outline rect
  42.     draw.Color(34, 29, 70, 220); --inside rect color
  43.     draw.FilledRect(sw/1.048, sh/63.529, sw/1.008, sh/20.769); --inside rect
  44.     draw.Color(18, 12, 38, 255); --inside rect outline color
  45.     draw.OutlinedRect(sw/1.0485, sh/67.5, sw/1.0075, sh/20.377); --inside rect outline
  46.     draw.OutlinedRect(sw/1.052, sh/98.181, sw/1.0047, sh/18.620); --outside rect outline
  47.  
  48. end
  49.  
  50. function drawtext()
  51.  
  52.     local sw, sh = draw.GetScreenSize();
  53.     local f = draw.CreateFont("Arial", 30, 1200);
  54.     local i = draw.CreateFont("Arial", 14, 500);
  55.     local val = draw.CreateFont("Arial", 17, 600);
  56.     local t = draw.CreateFont("Arial", 17, 600);
  57.     local rw,rh;
  58.     local date = os.date("*t")
  59.  
  60.     local speed = 0;
  61.     local latency= 0;
  62.      if entities.FindByClass( "CBasePlayer" )[1] ~= nil then
  63.         latency=entities.GetPlayerResources():GetPropInt( "m_iPing", client.GetLocalPlayerIndex() )
  64.      end
  65.  
  66.     --name
  67.  
  68.     draw.SetFont(f);
  69.     draw.Color(255, 255, 255, 255);
  70.     draw.TextShadow(sw/1.177, sh/54, "A");
  71.     draw.Color(201, 47, 96, 255);
  72.     draw.TextShadow(sw/1.163, sh/54, "W");
  73.  
  74.     --info
  75.  
  76.     --fps
  77.     draw.SetFont(i);
  78.     draw.Color(255, 255, 255, 255);
  79.     draw.Text(sw/1.128, sh/29.189, "FPS");
  80.     draw.SetFont(val);
  81.     if (get_abs_fps() < 30) then
  82.         draw.Color(255, 0, 0);
  83.     else
  84.         draw.Color(126, 183, 50);
  85.     end
  86.     rw,rh = draw.GetTextSize(get_abs_fps());
  87.     draw.TextShadow(sw/1.121 - (rw/2), sh/49.09, get_abs_fps());
  88.  
  89.     --ping
  90.     draw.SetFont(i);
  91.     draw.Color(255, 255, 255, 255);
  92.     draw.Text(sw/1.104, sh/29.189, "PING");
  93.     draw.SetFont(val);
  94.     draw.Color(126, 183, 50);
  95.     rw,rh = draw.GetTextSize(latency);
  96.     draw.TextShadow(sw/1.096 - (rw/2), sh/49.09, latency);
  97.  
  98.     --speed
  99.     draw.SetFont(i);
  100.     draw.Color(255, 255, 255, 255);
  101.     draw.Text(sw/1.082, sh/29.189, "SPEED");
  102.     draw.SetFont(val);
  103.     if entities.GetLocalPlayer() ~= nil then
  104.  
  105.         local Entity = entities.GetLocalPlayer();
  106.         local Alive = Entity:IsAlive();
  107.         local velocityX = Entity:GetPropFloat( "localdata", "m_vecVelocity[0]" );
  108.         local velocityY = Entity:GetPropFloat( "localdata", "m_vecVelocity[1]" );
  109.         local velocity = math.sqrt( velocityX^2 + velocityY^2 );
  110.         local FinalVelocity = math.min( 9999, velocity ) + 0.2;
  111.         if ( Alive == true ) then
  112.           speed= math.floor(FinalVelocity) ;
  113.         else
  114.           speed=0;
  115.         end
  116.     end
  117.     rw,rh = draw.GetTextSize(speed)
  118.     draw.Color(126, 183, 50);
  119.     draw.TextShadow(sw/1.070 - (rw/2), sh/49.09, speed);
  120.  
  121.     --time
  122.     draw.SetFont(i);
  123.     draw.Color(255, 255, 255, 255);
  124.     draw.Text(sw/1.036, sh/29.189, "TIME");
  125.     draw.SetFont(t);
  126.     draw.Color(0, 170, 255, 255);
  127.     draw.TextShadow(sw/1.046, sh/49.09, string.format("%02d:%02d:%02d", date.hour, date.min, date.sec));
  128.  
  129. end
  130.  
  131. function drawline()
  132.  
  133.     local screenSize = draw.GetScreenSize();
  134.     local r = math.floor(math.sin(globals.RealTime() * 1) * 127 + 128);
  135.     local g = math.floor(math.sin(globals.RealTime() * 1 + 2) * 127 + 128);
  136.     local b = math.floor(math.sin(globals.RealTime() * 1 + 4) * 127 + 128);
  137.  
  138.     draw.Color(r, g, b, 255);
  139.     draw.FilledRect(0, 0, screenSize, 5);
  140. end
  141.  
  142. callbacks.Register('Draw', 'wm', wm);
  143. client.AllowListener( "client_disconnect" );
  144. client.AllowListener( "begin_new_match" );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement