Advertisement
Guest User

Untitled

a guest
May 26th, 2019
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.18 KB | None | 0 0
  1. local client_latency, client_log, client_draw_rectangle, client_draw_circle_outline, client_userid_to_entindex, client_draw_gradient, client_set_event_callback, client_screen_size, client_eye_position, client_color_log = client.latency, client.log, client.draw_rectangle, client.draw_circle_outline, client.userid_to_entindex, client.draw_gradient, client.set_event_callback, client.screen_size, client.eye_position, client.color_log
  2. local client_draw_circle, client_draw_text, client_visible, client_exec, client_delay_call, client_trace_line, client_world_to_screen, client_draw_hitboxes = client.draw_circle, client.draw_text, client.visible, client.exec, client.delay_call, client.trace_line, client.world_to_screen, client.draw_hitboxes
  3. local client_get_cvar, client_draw_line, client_camera_angles, client_draw_debug_text, client_random_int, client_random_float = client.get_cvar, client.draw_line, client.camera_angles, client.draw_debug_text, client.random_int, client.random_float
  4. local entity_get_local_player, entity_is_enemy, entity_get_player_name, entity_get_all, entity_set_prop, entity_get_player_weapon, entity_hitbox_position, entity_get_prop, entity_get_players, entity_get_classname = entity.get_local_player, entity.is_enemy, entity.get_player_name, entity.get_all, entity.set_prop, entity.get_player_weapon, entity.hitbox_position, entity.get_prop, entity.get_players, entity.get_classname
  5. local globals_mapname, globals_tickcount, globals_realtime, globals_absoluteframetime, globals_tickinterval, globals_curtime, globals_frametime, globals_maxplayers = globals.mapname, globals.tickcount, globals.realtime, globals.absoluteframetime, globals.tickinterval, globals.curtime, globals.frametime, globals.maxplayers 
  6. local ui_new_slider, ui_new_combobox, ui_reference, ui_set_visible, ui_new_color_picker, ui_set_callback, ui_set, ui_new_checkbox, ui_new_hotkey, ui_new_button, ui_new_multiselect, ui_get = ui.new_slider, ui.new_combobox, ui.reference, ui.set_visible, ui.new_color_picker, ui.set_callback, ui.set, ui.new_checkbox, ui.new_hotkey, ui.new_button, ui.new_multiselect, ui.get
  7. local math_ceil, math_tan, math_correctRadians, math_fact, math_log10, math_randomseed, math_cos, math_sinh, math_random, math_huge, math_pi, math_max, math_atan2, math_ldexp, math_floor, math_sqrt, math_deg, math_atan = math.ceil, math.tan, math.correctRadians, math.fact, math.log10, math.randomseed, math.cos, math.sinh, math.random, math.huge, math.pi, math.max, math.atan2, math.ldexp, math.floor, math.sqrt, math.deg, math.atan
  8. local math_fmod, math_acos, math_pow, math_abs, math_min, math_sin, math_frexp, math_log, math_tanh, math_exp, math_modf, math_cosh, math_asin, math_rad = math.fmod, math.acos, math.pow, math.abs, math.min, math.sin, math.frexp, math.log, math.tanh, math.exp, math.modf, math.cosh, math.asin, math.rad
  9. local table_maxn, table_foreach, table_sort, table_remove, table_foreachi, table_move, table_getn, table_concat, table_insert = table.maxn, table.foreach, table.sort, table.remove, table.foreachi, table.move, table.getn, table.concat, table.insert
  10. local string_find, string_format, string_rep, string_gsub, string_len, string_gmatch, string_dump, string_match, string_reverse, string_byte, string_char, string_upper, string_lower, string_sub = string.find, string.format, string.rep, string.gsub, string.len, string.gmatch, string.dump, string.match, string.reverse, string.byte, string.char, string.upper, string.lower, string.sub
  11. --end of local variables 
  12.  
  13. local function distance(x1, y1, x2, y2)
  14. return math_sqrt((x2-x1)^2 + (y2-y1)^2)
  15. end
  16.  
  17. local function hsv_to_rgb(h, s, v, a)
  18. local r, g, b
  19.  
  20. local i = math_floor(h * 6);
  21. local f = h * 6 - i;
  22. local p = v * (1 - s);
  23. local q = v * (1 - f * s);
  24. local t = v * (1 - (1 - f) * s);
  25.  
  26. i = i % 6
  27.  
  28. if i == 0 then r, g, b = v, t, p
  29. elseif i == 1 then r, g, b = q, v, p
  30. elseif i == 2 then r, g, b = p, v, t
  31. elseif i == 3 then r, g, b = p, q, v
  32. elseif i == 4 then r, g, b = t, p, v
  33. elseif i == 5 then r, g, b = v, p, q
  34. end
  35.  
  36. return r * 255, g * 255, b * 255, a * 255
  37. end
  38.  
  39. local function contains(table, val)
  40. for i=1,#table do
  41. if table[i] == val then
  42. return true
  43. end
  44. end
  45. return false
  46. end
  47. 
  48. local menu_hotkey_reference = ui.reference("MISC", "Settings", "Menu key")
  49. local menu_color_reference = ui.reference("MISC", "Settings", "Menu color")
  50.  
  51. local effects_reference = ui.new_multiselect("MISC", "Settings", "Menu effects", {"Lines", "Gradient", "Dots", "Text"})
  52.  
  53. local lines_distance_reference = ui.new_slider("MISC", "Settings", "Line distance", 4, 100, 15, true, "px")
  54. local lines_color_reference = ui.new_color_picker("MISC", "Settings", "Line color", 100, 100, 100, 20)
  55. local lines_speed_reference = ui.new_slider("MISC", "Settings", "Line speed", 1, 30, 5)
  56.  
  57. local gradient_distance_reference = ui.new_slider("MISC", "Settings", "Gradient distance", 1, 2048, 1700, true, "px")
  58. local gradient_color_reference = ui.new_color_picker("MISC", "Settings", "Gradient color", 16, 16, 16, 210)
  59.  
  60. local dots_speed_reference = ui.new_slider("MISC", "Settings", "Dots speed", 1, 100, 20, true, "%")
  61. local dots_color_reference = ui.new_color_picker("MISC", "Settings", "Dots color", 255, 255, 255, 150)
  62. local dots_amount_reference = ui.new_slider("MISC", "Settings", "Dots amount", 1, 300, 80)
  63. local dots_connet_distance_reference = ui.new_slider("MISC", "Settings", "Dots connect distance", 1, 500, 180, true, "px")
  64. local dots_connect_color_reference = ui.new_color_picker("MISC", "Settings", "Dots connect color", 255, 255, 255, 50)
  65. 
  66. local function on_effects_change()
  67. local effects = ui_get(effects_reference)
  68. ui_set_visible(lines_distance_reference, contains(effects, "Lines"))
  69. ui_set_visible(lines_color_reference, contains(effects, "Lines"))
  70. ui_set_visible(lines_speed_reference, contains(effects, "Lines"))
  71.  
  72. ui_set_visible(gradient_distance_reference, contains(effects, "Gradient"))
  73. ui_set_visible(gradient_color_reference, contains(effects, "Gradient"))
  74.  
  75. ui_set_visible(dots_speed_reference, contains(effects, "Dots"))
  76. ui_set_visible(dots_color_reference, contains(effects, "Dots"))
  77. ui_set_visible(dots_amount_reference, contains(effects, "Dots"))
  78. ui_set_visible(dots_connet_distance_reference, contains(effects, "Dots"))
  79. ui_set_visible(dots_connect_color_reference, contains(effects, "Dots"))
  80. end
  81. ui_set_callback(effects_reference, on_effects_change)
  82.  
  83. local key_pressed_prev = false
  84. local menu_open = true
  85. local ingame = false
  86. local last_change = globals_realtime()-1
  87. 
  88. local last_change = globals_realtime()
  89. local x_dir, y_dir = "+", "+"
  90. local x, y = 0, 0
  91. local flags = "b"
  92. local additional = 2
  93. local tr, tg, tb = 149, 213, 72
  94.  
  95. local rainbow_progress = 0
  96.  
  97. local lines_progress = 0
  98.  
  99. local dots = {}
  100. local dot_size = 3
  101.  
  102. client_delay_call(1,
  103. pcall,
  104. function()
  105. if not ingame then
  106. menu_open = false
  107. end
  108. end
  109. )
  110.  
  111. local function on_paint(ctx)
  112. ingame = true
  113. local key_pressed = ui_get(menu_hotkey_reference)
  114. if key_pressed and not key_pressed_prev then
  115. menu_open = not menu_open
  116. last_change = globals_realtime()
  117. end
  118. key_pressed_prev = key_pressed
  119.  
  120. local opacity_multiplier = 0
  121. if menu_open then
  122. opacity_multiplier = 1
  123. end
  124. if globals_realtime() - last_change < 0.15 then
  125. opacity_multiplier = (globals_realtime() - last_change) / 0.15
  126. if not menu_open then
  127. opacity_multiplier = 1 - opacity_multiplier
  128. end
  129. end
  130.  
  131. --draw effects
  132. if opacity_multiplier > 0 then
  133. local effects = ui_get(effects_reference)
  134. if #effects > 0 then
  135. local screen_width, screen_height = client_screen_size()
  136.  
  137. --draw gradient
  138. if contains(effects, "Gradient") then
  139. local gradient_r, gradient_g, gradient_b, gradient_a = ui_get(gradient_color_reference)
  140. local gradient_thickness = ui_get(gradient_distance_reference)
  141. gradient_a = gradient_a * opacity_multiplier
  142. client_draw_gradient(ctx, 0, screen_height - gradient_thickness, screen_width, gradient_thickness, 0, 0, 0, 0, gradient_r, gradient_g, gradient_b, gradient_a, false) -- bottom gradient
  143. client_draw_gradient(ctx, screen_width - gradient_thickness, 0, gradient_thickness, screen_height, 0, 0, 0, 0, gradient_r, gradient_g, gradient_b, gradient_a, true) -- right gradient
  144. client_draw_gradient(ctx, 0, 0, screen_width, gradient_thickness, gradient_r, gradient_g, gradient_b, gradient_a, 0, 0, 0, 0, false) -- top gradient
  145. client_draw_gradient(ctx, 0, 0, gradient_thickness, screen_height, gradient_r, gradient_g, gradient_b, gradient_a, 0, 0, 0, 0, true)
  146. end
  147.  
  148. --draw lines
  149. if contains(effects, "Lines") then
  150. local r, g, b, a = ui_get(lines_color_reference)
  151. a = a * opacity_multiplier
  152. for i=1, screen_width*1.6, ui_get(lines_distance_reference) do
  153. local i = i + lines_progress*ui_get(lines_distance_reference)
  154. client_draw_line(ctx, i, 0, i-screen_height, screen_height, r, g, b, a)
  155. end
  156. lines_progress = lines_progress + 0.1*ui_get(lines_speed_reference)/80
  157. if lines_progress > 1 then
  158. lines_progress = 0
  159. end
  160. end
  161.  
  162. --draw retarded text effect
  163. if contains(effects, "Text") then
  164. local x_max, y_max = screen_width-80, screen_height-20
  165.  
  166. local change_dir = false
  167.  
  168. if x_dir == "+" and x >= x_max then
  169. x_dir = "-"
  170. change_dir = true
  171. elseif x_dir == "-" and 0 >= x then
  172. x_dir = "+"
  173.  change_dir = true
  174. end
  175. 
  176. if y_dir == "+" and y >= y_max then
  177. y_dir = "-"
  178. change_dir = true
  179. elseif y_dir == "-" and 0 >= y then
  180. y_dir = "+"
  181. change_dir = true
  182. end
  183.  
  184. if x_dir == "+" then
  185. x = x + additional
  186. else
  187. x = x - additional
  188. end
  189.  
  190. if y_dir == "+" then
  191. y = y + additional
  192. else
  193. y = y - additional
  194. end
  195.  
  196. if change_dir then
  197. rainbow_progress = rainbow_progress + 0.2
  198. if rainbow_progress == 1.2 then
  199. rainbow_progress = 0
  200. end
  201.  tr, tg, tb = hsv_to_rgb(rainbow_progress, 1, 1, 255)
  202. end
  203.  
  204. client_draw_text(ctx, x+1, y, 0, 0, 0, 100 * opacity_multiplier, flags, 0, "gamesense.pub")
  205. client_draw_text(ctx, x-1, y, 0, 0, 0, 100 * opacity_multiplier, flags, 0, "gamesense.pub")
  206. client_draw_text(ctx, x, y+1, 0, 0, 0, 100 * opacity_multiplier, flags, 0, "gamesense.pub")
  207. client_draw_text(ctx, x, y-1, 0, 0, 0, 100 * opacity_multiplier, flags, 0, "gamesense.pub")
  208.  
  209. client_draw_text(ctx, x, y, tr, tg, tb, 255 * opacity_multiplier, flags, 0, "gamesense.pub")
  210.  
  211. local x_additional = 0
  212. local w = 75
  213. for i=1, w do
  214. local r, g, b = hsv_to_rgb(i/w - (x/x_max)*5, 1, 1, 255)
  215. client_draw_rectangle(ctx, x+i, y+14, 1, 2, r, g, b, 255 * opacity_multiplier)
  216.  end
  217. end
  218.  
  219. --draw dots
  220. if contains(effects, "Dots") then
  221. local r, g, b, a = ui_get(dots_color_reference)
  222. a = a * opacity_multiplier
  223. local r_connect, g_connect, b_connect, a_connect = ui_get(dots_connect_color_reference)
  224. a_connect = a_connect * opacity_multiplier * 0.5
  225. local speed_multiplier = ui_get(dots_speed_reference) / 100
  226. local dots_amount = ui_get(dots_amount_reference)
  227. local dots_connect_distance = ui_get(dots_connet_distance_reference)
  228. local line_a = a/4
  229. while #dots > dots_amount do
  230. table_remove(dots, #dots)
  231. end
  232. while #dots < dots_amount do
  233. local x, y = client_random_int(-dots_connect_distance, screen_width+dots_connect_distance), client_random_int(-dots_connect_distance, screen_height+dots_connect_distance)
  234. local max = 12
  235. local min = 4
  236.  
  237. local velocity_x
  238. if client_random_int(0, 1) == 1 then
  239. velocity_x = client_random_float(-max, -min)
  240.  else
  241. velocity_x = client_random_float(min, max)
  242. end
  243.  
  244. local velocity_y
  245. if client_random_int(0, 1) == 1 then
  246. velocity_y = client_random_float(-max, -min)
  247. else
  248. velocity_y = client_random_float(min, max)
  249. end
  250.  
  251. local size = client_random_float(dot_size-1, dot_size+1)
  252. table_insert(dots, {x, y, velocity_x, velocity_y, size})
  253. end
  254.  
  255. local dots_new = {}
  256. for i=1, #dots do
  257. local dot = dots[i]
  258. local x, y, velocity_x, velocity_y, size = dot[1], dot[2], dot[3], dot[4], dot[5]
  259. x = x + velocity_x*speed_multiplier*0.2
  260. y = y + velocity_y*speed_multiplier*0.2
  261. if x > -dots_connect_distance and x < screen_width+dots_connect_distance and y > -dots_connect_distance and y < screen_height+dots_connect_distance then
  262. table_insert(dots_new, {x, y, velocity_x, velocity_y, size})
  263. end
  264. end
  265. dots = dots_new
  266.  
  267. for i=1, #dots do
  268. local dot = dots[i]
  269. local x, y, velocity_x, velocity_y, size = dot[1], dot[2], dot[3], dot[4], dot[5]
  270. for i2=1, #dots do
  271.  local dot2 = dots[i2]
  272. local x2, y2 = dot2[1], dot2[2]
  273. if distance(x, y, x2, y2) <= dots_connect_distance then
  274. client_draw_line(ctx, x, y, x2, y2, r_connect, g_connect, b_connect, a_connect)
  275. end
  276. end
  277. end
  278.  
  279.  for i=1, #dots do
  280. local dot = dots[i]
  281. local x, y, velocity_x, velocity_y, size = dot[1], dot[2], dot[3], dot[4], dot[5]
  282. client_draw_circle(ctx, x, y, r, g, b, a, size, 0, 1, 1)
  283. end
  284. end
  285.  
  286. end
  287. end
  288. end
  289.  
  290. client_set_event_callback("paint", on_paint)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement