spinsquad

hitbox based triggerbot

Mar 22nd, 2015
696
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.51 KB | None | 0 0
  1. --[[
  2. theres no public one afaik
  3. was easy to make
  4. enjoy
  5. ]]
  6.  
  7. local util = util;
  8. local me = LocalPlayer();
  9. local hook = hook;
  10. local vgui = vgui;
  11. local concommand = concommand;
  12. local bit = bit;
  13.  
  14. local hitboxes = {
  15.     [HITGROUP_HEAD] = {false, "Head"},
  16.     [HITGROUP_CHEST] = {false, "Chest"},
  17.     [HITGROUP_STOMACH] = {false, "Stomach"},
  18.     [HITGROUP_LEFTARM] = {false, "Left Arm"},
  19.     [HITGROUP_RIGHTARM] = {false, "Right Arm"},
  20.     [HITGROUP_LEFTLEG] = {false, "Left Leg"},
  21.     [HITGROUP_RIGHTLEG] = {false, "Right Leg"},
  22.     [HITGROUP_GEAR] = {false, "Gear"},
  23. };
  24.  
  25. local function openmenu()
  26.     local frame = vgui.Create("DFrame");
  27.     frame:SetSize(150, 200);
  28.     frame:SetTitle("");
  29.     frame:Center();
  30.     frame:MakePopup();
  31.     local hh = 25;
  32.     local function createcheckbox(hitbox)
  33.         local checkbox = vgui.Create("DCheckBoxLabel", frame);
  34.         checkbox:SetPos(5, hh);
  35.         checkbox:SetText(hitboxes[hitbox][2]);
  36.         checkbox:SetChecked(hitboxes[hitbox][1]);
  37.         checkbox:SizeToContents();
  38.         function checkbox:OnChange(newbool)
  39.             hitboxes[hitbox][1] = newbool;
  40.         end
  41.         hh = hh + 20;
  42.     end
  43.     for k,v in next, hitboxes do
  44.         createcheckbox(k);
  45.     end
  46. end
  47.  
  48. concommand.Add("hitbox", openmenu);
  49.  
  50. hook.Add("CreateMove", "", function(ucmd)
  51.     local trace = me:GetEyeTrace();
  52.     local hitbox, entity = trace.HitGroup, trace.Entity;
  53.    
  54.     if (!entity:IsValid() || entity:IsDormant() || !entity:IsPlayer() || entity:Health() < 1) then return; end
  55.    
  56.     if (!hitboxes[hitbox][1]) then return; end
  57.    
  58.     ucmd:SetButtons(bit.bor(ucmd:GetButtons(), IN_ATTACK));
  59. end);
Advertisement
Add Comment
Please, Sign In to add comment