LunaScripts

gmod memeware

Mar 9th, 2016
434
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local type = type;
  2. local next = next;
  3.  
  4. local function Copy(tt, lt)
  5. local copy = {}
  6. if lt then
  7. if type(tt) == "table" then
  8. for k,v in next, tt do
  9. copy[k] = Copy(k, v)
  10. end
  11. else
  12. copy = lt
  13. end
  14. return copy
  15. end
  16. if type(tt) != "table" then
  17. copy = tt
  18. else
  19. for k,v in next, tt do
  20. copy[k] = Copy(k, v)
  21. end
  22. end
  23. return copy
  24. end
  25.  
  26. local surface = Copy(surface);
  27. local vgui = Copy(vgui);
  28. local input = Copy(input);
  29. local Color = Color;
  30. local ScrW, ScrH = ScrW, ScrH;
  31. local gui = Copy(gui);
  32. local math = Copy(math);
  33. local file = Copy(file);
  34. local util = Copy(util);
  35.  
  36. surface.CreateFont("memeyou", {
  37. font = "Console",
  38. size = 13,
  39. weight = 900,
  40. shadow = true,
  41. antialias = false,
  42. });
  43.  
  44. surface.CreateFont("memeyou2", {
  45. font = "Console",
  46. size = 13,
  47. weight = 900,
  48. shadow = false,
  49. antialias = false,
  50. });
  51.  
  52. local options = {
  53. ["Ragebot"] = {
  54. {
  55. {"Aimbot", 20, 20, 350, 240, 120},
  56. {"Enabled", "Checkbox", false, 0},
  57. {"Silent", "Checkbox", false, 0},
  58. {"Autofire", "Checkbox", false, 0},
  59. {"Autosnap", "Checkbox", false, 0},
  60. {"Auto Pistol", "Checkbox", false, 0},
  61. {"Non-Sticky", "Checkbox", false, 0},
  62. {"Bullettime", "Checkbox", false, 0},
  63. },
  64. {
  65. {"Target", 20, 280, 350, 180, 120},
  66. {"Selection", "Selection", "Distance", {"Distance", "Health", "Nextshot"}, 150 },
  67. {"Bodyaim", "Checkbox", false, 0},
  68. {"Ignore Bots", "Checkbox", false, 0},
  69. {"Ignore Team", "Checkbox", false, 0},
  70. {"Ignore Friends", "Checkbox", false, 0},
  71. {"Snapline", "Checkbox", false, 0},
  72. },
  73. {
  74. {"Accuracy", 380, 20, 350, 190, 120},
  75. {"Anti Spread", "Checkbox", false, 0},
  76. {"Anti Recoil", "Checkbox", false, 0},
  77. },
  78. {
  79. {"Anti-Aim", 380, 230, 350, 230, 140},
  80. {"Enabled", "Checkbox", false, 0},
  81. {"X", "Selection", "Emotion", {"Up", "Down", "Jitter", "Emotion"}, 150},
  82. {"Y", "Selection", "Emotion", {"Forward", "Backwards", "Jitter", "TJitter", "Sideways", "Emotion", "Static", "Towards Players"}, 150},
  83. {"Max Y", "Slider", 50, 360, 150},
  84. {"Min Y", "Slider", 0, 360, 150},
  85. {"Emotion Randomcoin X", "Slider", 50, 100, 150},
  86. {"Emotion Randomcoin Y", "Slider", 20, 100, 150},
  87. },
  88. },
  89. ["Visuals"] = {
  90. {
  91. {"ESP", 20, 20, 350, 240, 220},
  92. {"Enabled", "Checkbox", false, 54},
  93. {"Box", "Checkbox", false, 54},
  94. {"Box Type", "Selection", "2D Box", {"2D Box", "3D Box"}, 68},
  95. {"Name", "Checkbox", false, 54},
  96. {"Health", "Checkbox", false, 54},
  97. {"Weapon", "Checkbox", false, 54},
  98. {"XQZ", "Checkbox", false, 54},
  99. {"Chams", "Checkbox", false, 54},
  100. {"Skeleton", "Checkbox", false, 54},
  101. },
  102. {
  103. {"Filter", 20, 280, 350, 180, 220},
  104. {"Enemies only", "Checkbox", false, 54},
  105. {"Distance", "Checkbox", false, 54},
  106. {"Max Distance", "Slider", 0, 10000, 68},
  107. },
  108. {
  109. {"Misc", 380, 20, 350, 190, 220},
  110. {"Thirdperson", "Checkbox", false, 54},
  111. },
  112. },
  113. ["Colors"] = {
  114. {
  115. {"Box - Team", 20, 20, 250, 175, 130},
  116. {"R", "Slider", 255, 255, 88},
  117. {"G", "Slider", 255, 255, 88},
  118. {"B", "Slider", 0, 255, 88},
  119. },
  120. {
  121. {"Box - Enemy", 20, 205, 250, 175, 130},
  122. {"R", "Slider", 180, 255, 88},
  123. {"G", "Slider", 120, 255, 88},
  124. {"B", "Slider", 0, 255, 88},
  125. },
  126. {
  127. {"Chams - Team", 290, 20, 250, 175, 130},
  128. {"Visible R", "Slider", 0, 255, 88},
  129. {"Visible G", "Slider", 255, 255, 88},
  130. {"Visible B", "Slider", 0, 255, 88},
  131. {"Not Visible R", "Slider", 0, 255, 88},
  132. {"Not Visible G", "Slider", 0, 255, 88},
  133. {"Not Visible B", "Slider", 255, 255, 88},
  134. },
  135.  
  136. {
  137. {"Chams - Enemy", 290, 205, 250, 175, 130},
  138. {"Visible R", "Slider", 255, 255, 88},
  139. {"Visible G", "Slider", 0, 255, 88},
  140. {"Visible B", "Slider", 0, 255, 88},
  141. {"Not Visible R", "Slider", 180, 255, 88},
  142. {"Not Visible G", "Slider", 120, 255, 88},
  143. {"Not Visible B", "Slider", 0, 255, 88},
  144. },
  145. },
  146. };
  147.  
  148. local order = {
  149. "Ragebot",
  150. "Visuals",
  151. "Colors",
  152. };
  153.  
  154. local function updatevar( men, sub, lookup, new )
  155. for aa,aaa in next, options[men] do
  156. for key, val in next, aaa do
  157. if(aaa[1][1] != sub) then continue; end
  158. if(val[1] == lookup) then
  159. val[3] = new;
  160. end
  161. end
  162. end
  163. end
  164.  
  165. local function loadconfig()
  166. if(!file.Exists("memeware.txt", "DATA")) then return; end
  167. local tab = util.JSONToTable( file.Read("memeware.txt", "DATA") );
  168. local cursub;
  169. for k,v in next, tab do
  170. if(!options[k]) then continue; end
  171. for men, subtab in next, v do
  172. for key, val in next, subtab do
  173. if(key == 1) then cursub = val[1]; continue; end
  174. updatevar(k, cursub, val[1], val[3]);
  175. end
  176. end
  177. end
  178. end
  179.  
  180. local function gBool(men, sub, lookup)
  181. if(!options[men]) then return; end
  182. for aa,aaa in next, options[men] do
  183. for key, val in next, aaa do
  184. if(aaa[1][1] != sub) then continue; end
  185. if(val[1] == lookup) then
  186. return val[3];
  187. end
  188. end
  189. end
  190. end
  191.  
  192. local function gOption(men, sub, lookup)
  193. if(!options[men]) then return ""; end
  194. for aa,aaa in next, options[men] do
  195. for key, val in next, aaa do
  196. if(aaa[1][1] != sub) then continue; end
  197. if(val[1] == lookup) then
  198. return val[3];
  199. end
  200. end
  201. end
  202. return "";
  203. end
  204.  
  205. local function gInt(men, sub, lookup)
  206. if(!options[men]) then return 0; end
  207. for aa,aaa in next, options[men] do
  208. for key, val in next, aaa do
  209. if(aaa[1][1] != sub) then continue; end
  210. if(val[1] == lookup) then
  211. return val[3];
  212. end
  213. end
  214. end
  215. return 0;
  216. end
  217.  
  218. local function saveconfig()
  219. file.Write("memeware.txt", util.TableToJSON(options));
  220. end
  221.  
  222. local mousedown;
  223. local candoslider;
  224. local drawlast;
  225.  
  226. local visible = {};
  227.  
  228. for k,v in next, order do
  229. visible[v] = false;
  230. end
  231.  
  232. local function DrawBackground(w, h)
  233. surface.SetDrawColor(255, 255, 255);
  234. surface.DrawRect(0, 0, w, h);
  235.  
  236. local curcol = Color(182, 0, 0);
  237.  
  238. for i = 0, 30 do
  239. surface.SetDrawColor(curcol);
  240. curcol.r = curcol.r - 1;
  241. surface.DrawLine(0, i, w, i);
  242. end
  243.  
  244. surface.SetDrawColor(curcol);
  245.  
  246. surface.SetFont("memeyou");
  247.  
  248. local tw, th = surface.GetTextSize("MEMEWare for Garry's Mod");
  249.  
  250. surface.SetTextPos(5, 15 - th / 2);
  251.  
  252. surface.SetTextColor(255, 255, 255);
  253.  
  254. surface.DrawText("MEMEWare for Garry's Mod");
  255.  
  256. surface.DrawRect(0, 31, 5, h - 31);
  257. surface.DrawRect(0, h - 5, w, h);
  258. surface.DrawRect(w - 5, 31, 5, h);
  259. end
  260.  
  261. local function MouseInArea(minx, miny, maxx, maxy)
  262. local mousex, mousey = gui.MousePos();
  263. return(mousex < maxx && mousex > minx && mousey < maxy && mousey > miny);
  264. end
  265.  
  266. local function DrawOptions(self, w, h)
  267. local mx, my = self:GetPos();
  268.  
  269. local sizeper = (w - 10) / #order;
  270.  
  271. local maxx = 0;
  272.  
  273. for k,v in next, order do
  274. local bMouse = MouseInArea(mx + 5 + maxx, my + 31, mx + 5 + maxx + sizeper, my + 31 + 30);
  275. if(visible[v]) then
  276. local curcol = Color(0, 0, 0);
  277. for i = 0, 30 do
  278. surface.SetDrawColor(curcol);
  279. curcol.r, curcol.g, curcol.b = curcol.r + 3, curcol.g + 3, curcol.b + 3;
  280. surface.DrawLine( 5 + maxx, 31 + i, 5 + maxx + sizeper, 31 + i);
  281. end
  282. elseif(bMouse) then
  283. local curcol = Color(124, 124, 124);
  284. for i = 0, 30 do
  285. surface.SetDrawColor(curcol);
  286. curcol.r, curcol.g, curcol.b = curcol.r - 1.7, curcol.g - 1.7, curcol.b - 1.7;
  287. surface.DrawLine( 5 + maxx, 31 + i, 5 + maxx + sizeper, 31 + i);
  288. end
  289. else
  290. local curcol = Color(51, 51, 51);
  291. for i = 0, 30 do
  292. surface.SetDrawColor(curcol);
  293. curcol.r, curcol.g, curcol.b = curcol.r - 1.7, curcol.g - 1.7, curcol.b - 1.7;
  294. surface.DrawLine( 5 + maxx, 31 + i, 5 + maxx + sizeper, 31 + i);
  295. end
  296. end
  297. if(bMouse && input.IsMouseDown(MOUSE_LEFT) && !mousedown && !visible[v]) then
  298. local nb = visible[v];
  299. for key,val in next, visible do
  300. visible[key] = false;
  301. end
  302. visible[v] = !nb;
  303. end
  304. surface.SetFont("memeyou2");
  305. surface.SetTextColor(255, 255, 255);
  306. local tw, th = surface.GetTextSize(v);
  307. surface.SetTextPos( 5 + maxx + sizeper / 2 - tw / 2, 31 + 15 - th / 2 );
  308. surface.DrawText(v);
  309. maxx = maxx + sizeper;
  310. end
  311. end
  312.  
  313. local function DrawCheckbox(self, w, h, var, maxy, posx, posy, dist)
  314. surface.SetFont("memeyou2");
  315. surface.SetTextColor(0, 0, 0);
  316. surface.SetTextPos( 5 + posx + 15 + 5, 61 + posy + maxy );
  317. local tw, th = surface.GetTextSize(var[1]);
  318. surface.DrawText(var[1]);
  319.  
  320. surface.SetDrawColor(163, 163, 163);
  321.  
  322. surface.DrawOutlinedRect( 5 + posx + 15 + 5 + dist + var[4], 61 + posy + maxy + 2, 14, 14);
  323.  
  324. local mx, my = self:GetPos();
  325.  
  326. local bMouse = MouseInArea(mx + 5 + posx + 15 + 5, my + 61 + posy + maxy, mx + 5 + posx + 15 + 5 + dist + 14 + var[4], my + 61 + posy + maxy + 16);
  327.  
  328. if(bMouse) then
  329. surface.DrawRect( 5 + posx + 15 + 5 + dist + 2 + var[4], 61 + posy + maxy + 4, 10, 10);
  330. end
  331.  
  332. if(var[3]) then
  333. surface.SetDrawColor(184, 0, 0);
  334. surface.DrawRect( 5 + posx + 15 + 5 + dist + 2 + var[4], 61 + posy + maxy + 4, 10, 10);
  335. surface.SetDrawColor(93, 0, 0);
  336. surface.DrawOutlinedRect( 5 + posx + 15 + 5 + dist + 2 + var[4], 61 + posy + maxy + 4, 10, 10);
  337. end
  338.  
  339. if(bMouse && input.IsMouseDown(MOUSE_LEFT) && !mousedown && !drawlast) then
  340. var[3] = !var[3];
  341. end
  342. end
  343.  
  344. local function DrawSlider(self, w, h, var, maxy, posx, posy, dist)
  345. local curnum = var[3];
  346. local max = var[4];
  347. local size = var[5];
  348. surface.SetFont("memeyou2");
  349. surface.SetTextColor(0, 0, 0);
  350. surface.SetTextPos( 5 + posx + 15 + 5, 61 + posy + maxy );
  351. surface.DrawText(var[1]);
  352.  
  353. local tw, th = surface.GetTextSize(var[1]);
  354.  
  355. surface.SetDrawColor(163, 163, 163);
  356.  
  357. surface.DrawRect( 5 + posx + 15 + 5 + dist, 61 + posy + maxy + 9, size, 2);
  358.  
  359. local ww = math.ceil(curnum * size / max);
  360.  
  361. surface.SetDrawColor(184, 0, 0);
  362.  
  363. surface.DrawRect( 3 + posx + 15 + 5 + dist + ww, 61 + posy + maxy + 9 - 5, 4, 12);
  364.  
  365. surface.SetDrawColor(93, 0, 0);
  366.  
  367. local tw, th = surface.GetTextSize(curnum..".00");
  368.  
  369. surface.DrawOutlinedRect( 3 + posx + 15 + 5 + dist + ww, 61 + posy + maxy + 4, 4, 12);
  370.  
  371. surface.SetTextPos( 5 + posx + 15 + 5 + dist + (size / 2) - tw / 2, 61 + posy + maxy + 16);
  372.  
  373. surface.DrawText(curnum..".00");
  374.  
  375. local mx, my = self:GetPos();
  376.  
  377. local bMouse = MouseInArea(5 + posx + 15 + 5 + dist + mx, 61 + posy + maxy + 9 - 5 + my, 5 + posx + 15 + 5 + dist + mx + size, 61 + posy + maxy + 9 - 5 + my + 12);
  378.  
  379. if(bMouse && input.IsMouseDown(MOUSE_LEFT) && !drawlast && !candoslider) then
  380. local mw, mh = gui.MousePos();
  381.  
  382. local new = math.ceil( ((mw - (mx + posx + 25 + dist - size)) - (size + 1)) / (size - 2) * max);
  383. var[3] = new;
  384. end
  385. end
  386.  
  387. local notyetselected;
  388.  
  389. local function DrawSelect(self, w, h, var, maxy, posx, posy, dist)
  390.  
  391. local size = var[5];
  392. local curopt = var[3];
  393.  
  394. surface.SetFont("memeyou2");
  395. surface.SetTextColor(0, 0, 0);
  396. surface.SetTextPos( 5 + posx + 15 + 5, 61 + posy + maxy );
  397. local tw, th = surface.GetTextSize(var[1]);
  398. surface.DrawText(var[1]);
  399.  
  400. surface.SetDrawColor(163, 163, 163);
  401.  
  402. surface.DrawOutlinedRect( 25 + posx + dist, 61 + posy + maxy, size, 16);
  403.  
  404. local mx, my = self:GetPos();
  405.  
  406. local bMouse = MouseInArea( mx + 25 + posx + dist, my + 61 + posy + maxy, mx + 25 + posx + dist + size, my + 61 + posy + maxy + 16)
  407.  
  408. local check = dist..posy..posx..w..h..maxy;
  409.  
  410. if(bMouse || notyetselected == check) then
  411.  
  412. surface.DrawRect(25 + posx + dist + 2, 61 + posy + maxy + 2, size - 4, 12);
  413.  
  414. end
  415.  
  416. local tw, th = surface.GetTextSize(curopt);
  417.  
  418. surface.SetTextPos( 25 + posx + dist + 5, 61 + posy + maxy + 6 - th / 2 + 2);
  419.  
  420. surface.DrawText(curopt);
  421.  
  422. if(bMouse && input.IsMouseDown(MOUSE_LEFT) && !drawlast && !mousedown || notyetselected == check) then
  423. notyetselected = check;
  424. drawlast = function()
  425. local maxy2 = 16;
  426. for k,v in next, var[4] do
  427. surface.SetDrawColor(163, 163, 163);
  428. surface.DrawRect( 25 + posx + dist, 61 + posy + maxy + maxy2, size, 16);
  429. local bMouse2 = MouseInArea( mx + 25 + posx + dist, my + 61 + posy + maxy + maxy2, mx + 25 + posx + dist + size, my + 61 + posy + maxy + 16 + maxy2)
  430. if(bMouse2) then
  431. surface.SetDrawColor(200, 200, 200);
  432. surface.DrawRect( 25 + posx + dist, 61 + posy + maxy + maxy2, size, 16);
  433. end
  434. local tw, th = surface.GetTextSize(v);
  435. surface.SetTextPos( 25 + posx + dist + 5, 61 + posy + maxy + 6 - th / 2 + 2 + maxy2);
  436. surface.DrawText(v);
  437. maxy2 = maxy2 + 16;
  438. if(bMouse2 && input.IsMouseDown(MOUSE_LEFT) && !mousedown) then
  439. var[3] = v;
  440. notyetselected = nil;
  441. drawlast = nil;
  442. return;
  443. end
  444. end
  445. local bbMouse = MouseInArea( mx + 25 + posx + dist, my + 61 + posy + maxy, mx + 25 + posx + dist + size, my + 61 + posy + maxy + maxy2);
  446. if(!bbMouse && input.IsMouseDown(MOUSE_LEFT) && !mousedown) then
  447. notyetselected = nil;
  448. drawlast = nil;
  449. return;
  450. end
  451. end
  452. end
  453.  
  454.  
  455. end
  456.  
  457. local function DrawSubSub(self, w, h, k, var)
  458. local opt, posx, posy, sizex, sizey, dist = var[1][1], var[1][2], var[1][3], var[1][4], var[1][5], var[1][6];
  459.  
  460. surface.SetDrawColor(163, 163, 163);
  461.  
  462. local startpos = 61 + posy;
  463.  
  464. surface.SetTextColor(0, 0, 0);
  465.  
  466. surface.SetFont("memeyou2");
  467.  
  468. local tw, th = surface.GetTextSize(opt);
  469.  
  470. surface.DrawLine( 5 + posx, startpos, 5 + posx + 15, startpos);
  471.  
  472. surface.SetTextPos( 5 + posx + 15 + 5, startpos - th / 2 );
  473.  
  474. surface.DrawLine( 5 + posx + 15 + 5 + tw + 5, startpos, 5 + posx + sizex, startpos);
  475.  
  476. surface.DrawLine( 5 + posx, startpos, 5 + posx, startpos + sizey);
  477.  
  478. surface.DrawLine(5 + posx, startpos + sizey, 5 + posx + sizex, startpos + sizey );
  479.  
  480. surface.DrawLine( 5 + posx + sizex, startpos, 5 + posx + sizex, startpos + sizey);
  481.  
  482. surface.DrawText(opt);
  483.  
  484. local maxy = 15;
  485.  
  486. for k,v in next, var do
  487. if(k == 1) then continue; end
  488. if(v[2] == "Checkbox") then
  489. DrawCheckbox(self, w, h, v, maxy, posx, posy, dist);
  490. elseif(v[2] == "Slider") then
  491. DrawSlider(self, w, h, v, maxy, posx, posy, dist);
  492. elseif(v[2] == "Selection") then
  493. DrawSelect(self, w, h, v, maxy, posx, posy, dist);
  494. end
  495. maxy = maxy + 25;
  496. end
  497. end
  498.  
  499. local function DrawSub(self, w, h)
  500. for k, v in next, visible do
  501. if(!v) then continue; end
  502. for _, var in next, options[k] do
  503. DrawSubSub(self, w, h, k, var);
  504. end
  505. end
  506. end
  507.  
  508. local function DrawSaveButton(self, w, h)
  509. local curcol = Color(235, 235, 235);
  510. local mx, my = self:GetPos();
  511. local bMouse = MouseInArea(mx + 30, my + h - 50, mx + 30 + 200, my + h - 50 + 30);
  512. if(bMouse) then
  513. curcol = Color(200, 200, 200);
  514. end
  515. for i = 0, 30 do
  516. surface.SetDrawColor(curcol);
  517. surface.DrawLine( 30, h - 50 + i, 30 + 200, h - 50 + i );
  518. for k,v in next, curcol do
  519. curcol[k] = curcol[k] - 2;
  520. end
  521. end
  522. surface.SetFont("memeyou2");
  523. surface.SetTextColor(0, 0, 0);
  524. local tw, th = surface.GetTextSize("Save Configuration");
  525. surface.SetTextPos( 30 + 100 - tw / 2, h - 50 + 15 - th / 2 );
  526. surface.DrawText("Save Configuration");
  527. if(bMouse && input.IsMouseDown(MOUSE_LEFT)) then
  528. saveconfig();
  529. end
  530. end
  531.  
  532. local function DrawLoadButton(self, w, h)
  533. local curcol = Color(235, 235, 235);
  534. local mx, my = self:GetPos();
  535. local bMouse = MouseInArea(mx + 250, my + h - 50, mx + 250 + 200, my + h - 50 + 30);
  536. if(bMouse) then
  537. curcol = Color(200, 200, 200);
  538. end
  539. for i = 0, 30 do
  540. surface.SetDrawColor(curcol);
  541. surface.DrawLine( 250, h - 50 + i, 250 + 200, h - 50 + i );
  542. for k,v in next, curcol do
  543. curcol[k] = curcol[k] - 2;
  544. end
  545. end
  546. surface.SetFont("memeyou2");
  547. surface.SetTextColor(0, 0, 0);
  548. local tw, th = surface.GetTextSize("Load Configuration");
  549. surface.SetTextPos( 250 + 100 - tw / 2, h - 50 + 15 - th / 2 );
  550. surface.DrawText("Load Configuration");
  551. if(bMouse && input.IsMouseDown(MOUSE_LEFT)) then
  552. loadconfig();
  553. end
  554. end
  555.  
  556. loadconfig();
  557.  
  558. local insertdown2, insertdown, menuopen;
  559.  
  560. local function menu()
  561. local frame = vgui.Create("DFrame");
  562. frame:SetSize(800, 600);
  563. frame:Center();
  564. frame:SetTitle("");
  565. frame:MakePopup();
  566. frame:ShowCloseButton(false);
  567.  
  568. frame.Paint = function(self, w, h)
  569. if(candoslider && !mousedown && !drawlast && !input.IsMouseDown(MOUSE_LEFT)) then
  570. candoslider = false;
  571. end
  572. DrawBackground(w, h);
  573. DrawOptions(self, w, h);
  574. DrawSub(self, w, h);
  575. DrawSaveButton(self, w, h);
  576. DrawLoadButton(self, w, h);
  577. if(drawlast) then
  578. drawlast();
  579. candoslider = true;
  580. end
  581. mousedown = input.IsMouseDown(MOUSE_LEFT);
  582. end
  583.  
  584. frame.Think = function()
  585. if (input.IsKeyDown(KEY_INSERT) && !insertdown2) then
  586. frame:Remove();
  587. menuopen = false;
  588. candoslider = false;
  589. drawlast = nil;
  590. end
  591. end
  592. end
  593.  
  594. local function Think()
  595. if (input.IsKeyDown(KEY_INSERT) && !menuopen && !insertdown) then
  596. menuopen = true;
  597. insertdown = true;
  598. menu();
  599. elseif (!input.IsKeyDown(KEY_INSERT) && !menuopen) then
  600. insertdown = false;
  601. end
  602. if (input.IsKeyDown(KEY_INSERT) && insertdown && menuopen) then
  603. insertdown2 = true;
  604. else
  605. insertdown2 = false;
  606. end
  607. end
  608.  
  609. hook.Add("Think", "", Think);
  610.  
  611. --[[
  612. Actual codens
  613. ]]
  614.  
  615. local FindMetaTable = FindMetaTable;
  616.  
  617. local em = FindMetaTable"Entity";
  618. local pm = FindMetaTable"Player";
  619. local cm = FindMetaTable"CUserCmd";
  620. local wm = FindMetaTable"Weapon";
  621. local am = FindMetaTable"Angle";
  622. local vm = FindMetaTable"Vector";
  623.  
  624. local Vector = Vector;
  625. local player = Copy(player);
  626. local Angle = Angle;
  627. local me = LocalPlayer();
  628. local render = Copy(render);
  629. local cma = Copy(cam);
  630. local Material = Material;
  631. local CreateMaterial = CreateMaterial;
  632.  
  633. --[[
  634. esp
  635. ]]
  636.  
  637. local function Filter(v)
  638. local enemy = gBool("Visuals", "Filter", "Enemies only");
  639. local dist = gBool("Visuals", "Filter", "Distance")
  640. if(enemy) then
  641. if(pm.Team(v) == pm.Team(me)) then return false; end
  642. end
  643. if(dist) then
  644. local maxdist = gBool("Visuals", "Filter", "Max Distance");
  645. if( vm.Distance( em.GetPos(v), em.GetPos(me) ) > (maxdist * 5) ) then return false; end
  646. end
  647. return true;
  648. end
  649.  
  650.  
  651. local chamsmat = CreateMaterial("a", "VertexLitGeneric", {
  652. ["$ignorez"] = 1,
  653. ["$model"] = 1,
  654. ["$basetexture"] = "models/debug/debugwhite",
  655. });
  656.  
  657. local chamsmat2 = CreateMaterial("@", "vertexlitgeneric", {
  658. ["$ignorez"] = 0,
  659. ["$model"] = 1,
  660. ["$basetexture"] = "models/debug/debugwhite",
  661. });
  662.  
  663. local function GetChamsColor(v, vis)
  664. local pre = "Chams - Enemy";
  665. if(pm.Team(v) == pm.Team(me)) then
  666. pre = "Chams - Team";
  667. end
  668. if(vis) then
  669. local r = gInt("Colors", pre, "Visible R") / 255;
  670. local g = gInt("Colors", pre, "Visible G") / 255;
  671. local b = gInt("Colors", pre, "Visible B") / 255;
  672. return r,g,b;
  673. end
  674. local r = gInt("Colors", pre, "Not Visible R") / 255;
  675. local g = gInt("Colors", pre, "Not Visible G") / 255;
  676. local b = gInt("Colors", pre, "Not Visible B") / 255;
  677. return r,g,b;
  678. end
  679.  
  680. local function Chams(v)
  681. if(gBool("Visuals", "ESP", "XQZ")) then
  682. cam.Start3D();
  683. cam.IgnoreZ(true);
  684. em.DrawModel(v);
  685. cam.IgnoreZ(false);
  686. cam.End3D();
  687. end
  688. if(gBool("Visuals", "ESP", "Chams")) then
  689. cam.Start3D();
  690.  
  691. render.MaterialOverride(chamsmat);
  692. render.SetColorModulation(GetChamsColor(v));
  693.  
  694. em.DrawModel(v);
  695.  
  696. render.SetColorModulation(GetChamsColor(v, true));
  697. render.MaterialOverride(chamsmat2);
  698.  
  699. em.DrawModel(v);
  700.  
  701. cam.End3D();
  702. end
  703. end
  704.  
  705. local function GetColor(v)
  706. if(pm.Team(v) == pm.Team(me)) then
  707. local r = gInt("Colors", "Box - Team", "R");
  708. local g = gInt("Colors", "Box - Team", "G");
  709. local b = gInt("Colors", "Box - Team", "B");
  710. return(Color(r, g, b, 220));
  711. end
  712. local r = gInt("Colors", "Box - Enemy", "R");
  713. local g = gInt("Colors", "Box - Enemy", "G");
  714. local b = gInt("Colors", "Box - Enemy", "B");
  715. return(Color(r, g, b, 220));
  716. end
  717.  
  718. local function ESP(v)
  719. local pos = em.GetPos(v);
  720. local pos, pos2 = vm.ToScreen(pos - Vector(0, 0, 5)), vm.ToScreen( pos + Vector(0, 0, 70 ) );
  721. local h = pos.y - pos2.y;
  722. local w = h / 2.2;
  723. if(gBool("Visuals", "ESP", "Box") && gOption("Visuals", "ESP", "Box Type") == "2D Box") then
  724.  
  725. surface.SetDrawColor(GetColor(v));
  726. surface.DrawOutlinedRect( pos.x - w / 2, pos.y - h, w, h);
  727. surface.SetDrawColor(0, 0, 0, 220);
  728. surface.DrawOutlinedRect( pos.x - w / 2 - 1, pos.y - h - 1, w + 2, h + 2);
  729. surface.DrawOutlinedRect( pos.x - w / 2 + 1, pos.y - h + 1, w - 2, h - 2);
  730.  
  731. end
  732.  
  733. if(gBool("Visuals", "ESP", "Health")) then
  734. local hp = em.Health(v) * h / 100;
  735. if(hp > h) then hp = h; end
  736. local diff = h - hp;
  737. surface.SetDrawColor(0, 0, 0, 255);
  738. surface.DrawRect(pos.x - w / 2 - 5, pos.y - h - 1, 3, h + 2);
  739. surface.SetDrawColor( ( 100 - em.Health(v) ) * 2.55, em.Health(v) * 2.55, 0, 255);
  740. surface.DrawRect(pos.x - w / 2 - 4, pos.y - h + diff, 1, hp);
  741. end
  742.  
  743.  
  744. surface.SetFont("BudgetLabel");
  745.  
  746. surface.SetTextColor(255, 255, 255);
  747.  
  748. if(gBool("Visuals", "ESP", "Name")) then
  749.  
  750. local tw, th = surface.GetTextSize(pm.Name(v));
  751.  
  752. surface.SetTextPos( pos.x - tw / 2, pos.y - h + 2 - th );
  753.  
  754. surface.DrawText(pm.Name(v));
  755.  
  756. end
  757.  
  758. if(gBool("Visuals", "ESP", "Weapon")) then
  759.  
  760. local w = pm.GetActiveWeapon(v);
  761. if(w && em.IsValid(w)) then
  762. local tw, th = surface.GetTextSize(em.GetClass(w));
  763. surface.SetTextPos( pos.x - tw / 2, pos.y - th / 2 + 5 );
  764. surface.DrawText(em.GetClass(w));
  765. end
  766.  
  767. end
  768.  
  769. if(gBool("Visuals", "ESP", "Skeleton")) then
  770. local origin = em.GetPos(v);
  771. for i = 1, em.GetBoneCount(v) do
  772. local parent = em.GetBoneParent(v, i);
  773. if(!parent) then continue; end
  774. local bonepos, parentpos = em.GetBonePosition(v, i), em.GetBonePosition(v, parent);
  775. if(!bonepos || !parentpos || bonepos == origin) then continue; end
  776. local bs, ps = vm.ToScreen(bonepos), vm.ToScreen(parentpos);
  777. surface.SetDrawColor(255, 255, 255);
  778. surface.DrawLine(bs.x, bs.y, ps.x, ps.y);
  779. end
  780. end
  781.  
  782. end
  783.  
  784. local aimtarget;
  785.  
  786.  
  787. hook.Add("HUDPaint", "", function()
  788. if(aimtarget && gBool("Ragebot", "Target", "Snapline")) then
  789. local pos = vm.ToScreen(em.LocalToWorld(aimtarget, em.OBBCenter(aimtarget)));
  790. surface.SetDrawColor(255, 255, 255);
  791. surface.DrawLine(ScrW() / 2, ScrH() / 2, pos.x, pos.y);
  792. end
  793. if(!gBool("Visuals", "ESP", "Enabled")) then return; end
  794. for k,v in next, player.GetAll() do
  795. if(!em.IsValid(v) || em.Health(v) < 1 || v == me || em.IsDormant(v)) then continue; end
  796. if(!Filter(v)) then continue; end
  797. ESP(v);
  798. end
  799. end);
  800.  
  801. hook.Add("RenderScreenspaceEffects", "", function()
  802. if(!gBool("Visuals", "ESP", "Enabled")) then return; end
  803. for k,v in next, player.GetAll() do
  804. if(!em.IsValid(v) || em.Health(v) < 1 || v == me || em.IsDormant(v)) then continue; end
  805. if(!Filter(v)) then continue; end
  806. Chams(v);
  807. end
  808. end);
  809.  
  810. saveconfig();
  811.  
  812. --[[
  813. memes
  814. ]]
  815.  
  816. local fa;
  817. local aa;
  818.  
  819. local function FixMovement(ucmd, aaaaa)
  820. --local move = Vector(cm.GetForwardMove(ucmd), cm.GetSideMove(ucmd), 0);
  821. --local move = am.Forward( vm.Angle(move) + ( cm.GetViewAngles(ucmd) - fa ) ) * vm.Length(move);
  822. local move = Vector(cm.GetForwardMove(ucmd), cm.GetSideMove(ucmd), cm.GetUpMove(ucmd));
  823. local speed = math.sqrt(move.x * move.x + move.y * move.y);
  824. local ang = vm.Angle(move);
  825. local yaw = math.rad(cm.GetViewAngles(ucmd).y - fa.y + ang.y);
  826. cm.SetForwardMove(ucmd, (math.cos(yaw) * speed) * ( aaaaa && -1 || 1 ));
  827. cm.SetSideMove(ucmd, math.sin(yaw) * speed);
  828. --cm.SetForwardMove(ucmd, move.x);
  829. --cm.SetSideMove(ucmd, (aaaaa && move.y * -1 || move.y));
  830. end
  831.  
  832. local function Clamp(val, min, max)
  833. if(val < min) then
  834. return min;
  835. elseif(val > max) then
  836. return max;
  837. end
  838. return val;
  839. end
  840.  
  841. local function NormalizeAngle(ang)
  842. ang.x = math.NormalizeAngle(ang.x);
  843. ang.p = math.Clamp(ang.p, -89, 89);
  844. end
  845.  
  846. --[[
  847. aimer
  848. ]]
  849.  
  850. local table = Copy(table);
  851. local dists = {};
  852.  
  853. local function GetPos(v)
  854.  
  855. if(gBool("Ragebot", "Target", "Bodyaim")) then return( em.LocalToWorld(v, em.OBBCenter(v)) ); end
  856.  
  857. local eyes = em.LookupAttachment(v, "eyes");
  858.  
  859. if(!eyes) then return( em.LocalToWorld(v, em.OBBCenter(v)) ); end
  860.  
  861. local pos = em.GetAttachment(v, eyes);
  862.  
  863. if(!pos) then return( em.LocalToWorld(v, em.OBBCenter(v)) ); end
  864.  
  865. return(pos.Pos);
  866. end
  867.  
  868. local aimignore;
  869.  
  870. local function Valid(v)
  871. if(!v || !em.IsValid(v) || v == me || em.Health(v) < 1 || em.IsDormant(v) || pm.Team(v) == 1002 || (v == aimignore && gOption("Ragebot", "Target", "Selection") == "Nextshot")) then return false; end
  872. if(gBool("Ragebot", "Target", "Ignore Bots")) then
  873. if(pm.IsBot(v)) then return false; end
  874. end
  875. if(gBool("Ragebot", "Target", "Ignore Team")) then
  876. if(pm.Team(v) == pm.Team(me)) then return false; end
  877. end
  878. if(gBool("Ragebot", "Target", "Ignore Friends")) then
  879. if(pm.GetFriendStatus(v) == "friend") then return false; end
  880. end
  881. local tr = {
  882. start = em.EyePos(me),
  883. endpos = GetPos(v),
  884. mask = MASK_SHOT,
  885. filter = {me, v},
  886. };
  887. return(util.TraceLine(tr).Fraction == 1);
  888. end
  889.  
  890. local function gettarget()
  891.  
  892. local opt = gOption("Ragebot", "Target", "Selection");
  893.  
  894. local sticky = gOption("Ragebot", "Aimbot", "Non-Sticky");
  895.  
  896. if(opt == "Distance") then
  897.  
  898. if( !sticky && Valid(aimtarget) ) then return; end
  899.  
  900. dists = {};
  901.  
  902. for k,v in next, player.GetAll() do
  903. if(!Valid(v)) then continue; end
  904. dists[#dists + 1] = { vm.Distance( em.GetPos(v), em.GetPos(me) ), v };
  905. end
  906.  
  907. table.sort(dists, function(a, b)
  908. return(a[1] < b[1]);
  909. end);
  910.  
  911. aimtarget = dists[1] && dists[1][2] || nil;
  912.  
  913. elseif(opt == "Health") then
  914.  
  915. if( !sticky && Valid(aimtarget) ) then return; end
  916.  
  917. dists = {};
  918.  
  919. for k,v in next, player.GetAll() do
  920. if(!Valid(v)) then continue; end
  921. dists[#dists + 1] = { em.Health(v), v };
  922. end
  923.  
  924. table.sort(dists, function(a, b)
  925. return(a[1] < b[1]);
  926. end);
  927.  
  928. aimtarget = dists[1] && dists[1][2] || nil;
  929.  
  930. elseif(opt == "Nextshot") then
  931. if( !sticky && Valid(aimtarget) ) then return; end
  932. aimtarget = nil;
  933. local allplys = player.GetAll();
  934. local avaib = {};
  935. for k,v in next,allplys do
  936. avaib[math.random(100)] = v;
  937. end
  938.  
  939. for k,v in next, avaib do
  940. if(Valid(v)) then
  941. aimtarget = v;
  942. end
  943. end
  944. end
  945.  
  946. end
  947.  
  948.  
  949. local cones = {};
  950.  
  951. local pcall = pcall;
  952. local require = require;
  953.  
  954. local nullvec = Vector() * -1;
  955.  
  956. local IsFirstTimePredicted = IsFirstTimePredicted;
  957. local CurTime = CurTime;
  958. local servertime=0;
  959. local bit = Copy(bit);
  960. pcall(require, "dickwrap");
  961.  
  962. hook.Add("Move", "", function()
  963. if(!IsFirstTimePredicted()) then return; end
  964. servertime = CurTime();
  965. end);
  966.  
  967.  
  968. GAMEMODE["EntityFireBullets"] = function(self, p, data)
  969. aimignore = aimtarget;
  970. local w = pm.GetActiveWeapon(me);
  971. local Spread = data.Spread * -1;
  972. if(!w || !em.IsValid(w) || cones[em.GetClass(w)] == Spread || Spread == nullvec) then return; end
  973. cones[em.GetClass(w)] = Spread;
  974. end
  975.  
  976. local function PredictSpread(ucmd, ang)
  977. local w = pm.GetActiveWeapon(me);
  978. if(!w || !em.IsValid(w) || !cones[em.GetClass(w)] || !gBool("Ragebot", "Accuracy", "Anti Spread")) then return am.Forward(ang); end
  979. return(dickwrap.Predict(ucmd, am.Forward(ang), cones[em.GetClass(w)]));
  980. end
  981.  
  982. local function Autofire(ucmd)
  983. if(pm.KeyDown(me, 1) && gBool("Ragebot", "Aimbot", "Auto Pistol")) then
  984. cm.SetButtons(ucmd, bit.band( cm.GetButtons(ucmd), bit.bnot( 1 ) ) );
  985. else
  986. cm.SetButtons(ucmd, bit.bor( cm.GetButtons(ucmd), 1 ) );
  987. end
  988. end
  989.  
  990. local function WeaponCanFire()
  991. local w = pm.GetActiveWeapon(me);
  992. if(!w || !em.IsValid(w) || !gBool("Ragebot", "Aimbot", "Bullettime")) then return true; end
  993. return( servertime >= wm.GetNextPrimaryFire(w) );
  994. end
  995.  
  996. local function WeaponShootable()
  997. local wep = pm.GetActiveWeapon(me);
  998. if( em.IsValid(wep) ) then // I would never get lazy..
  999. local n = string.lower(wep:GetPrintName())
  1000. if( wep:Clip1() <= 0 ) then
  1001. return false;
  1002. end
  1003.  
  1004.  
  1005.  
  1006. if( string.find(n,"knife") or string.find(n,"grenade") or string.find(n,"sword") or string.find(n,"bomb") or string.find(n,"ied") or string.find(n,"c4") or string.find(n,"slam") or string.find(n,"climb") or string.find(n,"hand") or string.find(n,"fist") ) then
  1007. return false;
  1008. end
  1009.  
  1010.  
  1011. return true;
  1012. end
  1013. end
  1014.  
  1015. local function PredictPos(pos)
  1016. local myvel = LocalPlayer():GetVelocity()
  1017. local pos = pos - (myvel * engine.TickInterval());
  1018. return pos;
  1019. end
  1020.  
  1021.  
  1022. local function aimer(ucmd)
  1023. if(cm.CommandNumber(ucmd) == 0 || !gBool("Ragebot", "Aimbot", "Enabled")) then return; end
  1024. gettarget();
  1025. aa = false;
  1026. if(aimtarget && (input.IsKeyDown(KEY_LALT) || gBool("Ragebot", "Aimbot", "Autosnap")) && WeaponCanFire() && WeaponShootable() ) then
  1027. aa = true;
  1028. local pos = GetPos(aimtarget) - em.EyePos(me);
  1029. PredictPos(pos);
  1030. local ang = vm.Angle( PredictSpread(ucmd, vm.Angle(pos)));
  1031. NormalizeAngle(ang);
  1032. cm.SetViewAngles(ucmd, ang);
  1033. if(gBool("Ragebot", "Aimbot", "Autofire")) then
  1034. Autofire(ucmd);
  1035. end
  1036. if(gBool("Ragebot", "Aimbot", "Silent")) then
  1037. FixMovement(ucmd);
  1038. else
  1039. fa = ang;
  1040. end
  1041. end
  1042. end
  1043.  
  1044. --[[
  1045. antiaimer
  1046. ]]
  1047.  
  1048.  
  1049.  
  1050. local ox=-181;
  1051. local oy=0;
  1052.  
  1053. local function RandCoin()
  1054. local randcoin = math.random(0,1);
  1055. if(randcoin == 1) then return 1; else return -1; end
  1056. end
  1057.  
  1058. local function GetX()
  1059. local opt = gOption("Ragebot", "Anti-Aim", "X");
  1060. if(opt == "Emotion") then
  1061. local randcoin = gInt("Ragebot", "Anti-Aim", "Emotion Randomcoin X");
  1062. if( math.random(100) < randcoin ) then
  1063. ox = RandCoin() * 181;
  1064. end
  1065. elseif( opt == "Up" ) then
  1066. ox = -181;
  1067. elseif( opt == "Down" ) then
  1068. ox = 181;
  1069. elseif(opt == "Jitter") then
  1070. ox = ox * -1;
  1071. end
  1072. end
  1073.  
  1074. local function GetClosest()
  1075. local ddists = {};
  1076.  
  1077. local closest;
  1078.  
  1079. for k,v in next, player.GetAll() do
  1080. if(!Valid(v)) then continue; end
  1081. ddists[#ddists + 1] = { vm.Distance( em.GetPos(v), em.GetPos(me) ), v };
  1082. end
  1083.  
  1084. table.sort(ddists, function(a, b)
  1085. return(a[1] < b[1]);
  1086. end);
  1087.  
  1088. closest = ddists[1] && ddists[1][2] || nil;
  1089.  
  1090. if(!closest) then return fa.y; end
  1091.  
  1092. local pos = em.GetPos(closest);
  1093.  
  1094. local pos = vm.Angle(pos - em.EyePos(me));
  1095.  
  1096. return( pos.y );
  1097. end
  1098.  
  1099. local function GetY()
  1100. local opt = gOption("Ragebot", "Anti-Aim", "Y");
  1101. if(opt == "Emotion") then
  1102. local randcoin = gInt("Ragebot", "Anti-Aim", "Emotion Randomcoin Y");
  1103. if( math.random(100) < randcoin ) then
  1104. oy = fa.y + math.random(-180, 180);
  1105. end
  1106. elseif( opt == "Eye Angles" ) then
  1107. oy = fa.y;
  1108. elseif( opt == "Sideways" ) then
  1109. oy = fa.y - 90;
  1110. elseif(opt == "Jitter") then
  1111. oy = fa.y + math.random(-90, 90);
  1112. elseif(opt == "TJitter") then
  1113. oy = fa.y - 180 + math.random(-90, 90);
  1114. elseif(opt == "Static") then
  1115. oy = 0;
  1116. elseif(opt == "Forward") then
  1117. oy = fa.y;
  1118. elseif(opt == "Backwards") then
  1119. oy = fa.y - 180;
  1120. elseif(opt == "Towards Players") then
  1121. oy = GetClosest();
  1122. end
  1123. end
  1124.  
  1125. local function walldetect()
  1126. local eye = em.EyePos(me);
  1127. local tr = util.TraceLine({
  1128. start = eye,
  1129. endpos = (eye + (am.Forward(fa) * 10)),
  1130. mask = MASK_ALL,
  1131. });
  1132. if(tr.Hit) then
  1133. ox = -181;
  1134. oy = -90;
  1135. end
  1136. end
  1137.  
  1138. local function antiaimer(ucmd)
  1139. if( (cm.CommandNumber(ucmd) == 0 && !gBool("Visuals", "Misc", "Thirdperson")) || cm.KeyDown(ucmd, 1) || cm.KeyDown(ucmd, 32) || aa || !gBool("Ragebot", "Anti-Aim", "Enabled")) then return; end
  1140. GetX();
  1141. GetY();
  1142. walldetect();
  1143. local aaang = Angle(ox, oy, 0);
  1144. cm.SetViewAngles(ucmd, aaang);
  1145. FixMovement(ucmd, true);
  1146. end
  1147.  
  1148. local function GetAngle(ang)
  1149. if(!gBool("Ragebot", "Accuracy", "Anti Recoil")) then return ang + pm.GetPunchAngle(me); end
  1150. return ang;
  1151. end
  1152.  
  1153. local function rapidfire(ucmd)
  1154. if(pm.KeyDown(me, 1) && gBool("Ragebot", "Aimbot", "Auto Pistol")) then
  1155. cm.SetButtons(ucmd, bit.band( cm.GetButtons(ucmd), bit.bnot( 1 ) ) );
  1156. end
  1157. end
  1158.  
  1159. local function meme(ucmd)
  1160. if(!fa) then fa = cm.GetViewAngles(ucmd); end
  1161. fa = fa + Angle(cm.GetMouseY(ucmd) * .023, cm.GetMouseX(ucmd) * -.023, 0);
  1162. NormalizeAngle(fa);
  1163. if(cm.CommandNumber(ucmd) == 0) then
  1164. cm.SetViewAngles(ucmd, GetAngle(fa));
  1165. return;
  1166. end
  1167. if(cm.KeyDown(ucmd, 1)) then
  1168. local ang = GetAngle(vm.Angle( PredictSpread(ucmd, fa ) ) );
  1169. NormalizeAngle(ang);
  1170. cm.SetViewAngles(ucmd, ang);
  1171. end
  1172. if(cm.KeyDown(ucmd, 2) && !em.IsOnGround(me)) then
  1173. cm.SetButtons(ucmd, bit.band( cm.GetButtons(ucmd), bit.bnot( 2 ) ) );
  1174. end
  1175. end
  1176.  
  1177.  
  1178. hook.Add("CreateMove", "", function(ucmd)
  1179. meme(ucmd);
  1180. aimer(ucmd);
  1181. antiaimer(ucmd);
  1182. end);
  1183.  
  1184. hook.Add("CalcView", "", function(p, o, a, f)
  1185. return({
  1186. angles = GetAngle(fa),
  1187. origin = (gBool("Visuals", "Misc", "Thirdperson") && o + am.Forward(fa) * -150 || o),
  1188. fov = f,
  1189. });
  1190. end);
  1191.  
  1192. hook.Add("ShouldDrawLocalPlayer", "", function()
  1193. return(gBool("Visuals", "Misc", "Thirdperson"));
  1194. end);
RAW Paste Data