Advertisement
Mister_Stefan

Watermark LWv4

Apr 10th, 2021
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.72 KB | None | 0 0
  1. menu.add_check_box("Watermark enable")
  2. menu.add_color_picker("Watermark color")
  3.  
  4. local fontnew = render.create_font("Segoe UI", 14, 400, true, false, false)
  5.  
  6. local function on_paint()
  7.     if menu.get_bool("Watermark enable") then
  8.         local screen_width = engine.get_screen_width()
  9.         local fps = tostring(globals.get_framecount())
  10.         local ping = tostring(globals.get_ping())
  11.         local nickname = globals.get_username()
  12.         local curtime = globals.get_time()
  13.         local color_main = menu.get_color("Watermark color");
  14.         local color_gradient = menu.get_color("Watermark color");
  15.         local color_gradient2 = menu.get_color("Watermark color");
  16.        
  17.         local text
  18.         if ping ~= "0" then
  19.            text = tostring("ChaiSense | " .. nickname .. " | " .. "delay: " .. ping .. " | " .. curtime)
  20.         else
  21.             text = tostring("ChaiSense | " .. nickname .. " | " .. curtime)
  22.         end
  23.         local width = render.get_text_width(fontnew, text)
  24.        
  25.         local bg_color = color.new(0, 0, 0, 120)
  26.        
  27.         local x = screen_width - 10 - width - 4
  28.         local y = 10
  29.         local w = width + 5
  30.         render.draw_rect_filled_gradient(x, y, w, 16, color.new(0, 0, 0, 255), color.new(0, 0, 0, 0), 1)
  31.         render.draw_rect_filled_gradient(x, y, math.floor((w / 2) + 0.5), 2, color.new(0, 0, 0, 0), color_gradient2, 0)
  32.         render.draw_rect_filled_gradient(math.floor((x + w / 2) + 0.5), y, math.floor((w / 2) + 0.5), 2, color_gradient2, color.new(0, 0, 0, 0), 0)
  33.         render.draw_rect_filled(x, y + 2, w, 16, bg_color)
  34.         render.draw_text(fontnew, x + 2, y + 3, color.new(255, 255, 255), text)
  35.     end
  36. end
  37.  
  38. client.add_callback("on_paint", on_paint)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement