waggfagg

Untitled

Jul 28th, 2016
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.91 KB | None | 0 0
  1. local fa;
  2. local aa;
  3. local aimtarget;
  4. local dists = {};
  5. local aimignore;
  6. local aimPos;
  7. local cones = {};
  8. local nullevec = Vector() * -1;
  9. local servertime = 0;
  10. local IsFirstTimePredicted = IsFirstTimePredicted;
  11. local reg = debug.getregistry();
  12. local originalFire = reg.Entity.FireBullets;
  13.  
  14.  
  15. local function fixmovement(userCmd, aaa)
  16. local side = Vector(userCmd:GetForwardMove(), userCmd:GetSideMove(), userCmd:GetUpMove());
  17. side = ((side:GetNormal()):Angle() + (userCmd:GetViewAngles() - fa)):Forward() * side:Length();
  18. userCmd:SetForwardMove(side.x);
  19. userCmd:SetSideMove(side.y);
  20. end
  21.  
  22. local function getangle(angle)
  23. if(!settings["Misc"]["No Recoil"]) then return angle + ply.GetPunchAngle(me); end
  24. return angle;
  25. end
  26.  
  27. local function predict(v, pos, fake)
  28. local myFrames = engine.TickInterval();
  29. local theirFrames = RealFrameTime() / 25;
  30. local myVelocity = ent.GetVelocity(me);
  31. local theirVelocity = ent.GetVelocity(v);
  32. local final = pos + (theirVelocity * theirFrames) - (myVelocity * myFrames);
  33. if(!fake) then return final; end
  34. return final + fake;
  35. end
  36.  
  37. local function IsVis(v,pos)
  38. local traceData = {}
  39. traceData.start = predict(me,ent.EyePos(me));
  40. traceData.endpos = predict(me,pos);
  41. traceData.mask = MASK_SHOT;
  42. traceData.filter = function(entity) return !entity:IsPlayer() end
  43. local trace = util.TraceLine(traceData)
  44. return !trace.Hit
  45. end
  46.  
  47. local function normalize(angle)
  48. angle.x = math.NormalizeAngle(angle.x);
  49. angle.p = math.Clamp(angle.p, -89, 89);
  50. end
  51.  
  52. local hitBoxes = {
  53. ["Head"] = 0,
  54. ["L Upperarm"] = 1,
  55. ["L Forearm"] = 2,
  56. ["L Hand"] = 3,
  57. ["R Upperarm"] = 4,
  58. ["R Forearm"] = 5,
  59. ["R Hand"] = 6,
  60. ["L Thigh"] = 7,
  61. ["L Calf"] = 8,
  62. ["F Foot"] = 9,
  63. ["L Toe"] = 10,
  64. ["R Thigh"] = 11,
  65. ["R Calf"] = 12,
  66. ["R Foot"] = 13,
  67. ["R Toe"] = 14,
  68. ["Pelvis"] = 15,
  69. ["Spine"] = 16,
  70. };
  71.  
  72. local hitscans = {0,16,4,1,5,2,6,3,15,11,7,12,8,13,9};
  73.  
  74. /*if(settings["Aimbot"]["Hitbox"]) then
  75. if(settings["Aimbot"]["Hitscan"]) then settings["Aimbot"]["Hitscan"] = false; end
  76.  
  77. local hBox = ent.GetHitBoxBone(v,0,0)
  78. if(!hBox) then return ent.OBBCenter(v); end
  79. local min,max = ent.GetHitBoxBounds(v,0,0);
  80. local hBoxPos = ent.GetBonePosition(v,hBox);
  81. if(!hBoxPos) then return ent.OBBCenter(v); end
  82. return (hBoxPos + (min + max) / 2);
  83.  
  84. end*/
  85.  
  86.  
  87. local function getposition(v)
  88. if(settings["Aimbot"]["Body Aim"]) then
  89. local pos = ent.OBBCenter(v);
  90. if(!pos) then return; end
  91. return pos;
  92. end
  93.  
  94. local pos, ang = ent.GetBonePosition(v,ent.GetHitBoxBone(v,0,0));
  95. finalpos = pos + ang:Forward() * 2;
  96. return finalpos;
  97.  
  98. /*if(settings["Aimbot"]["Hitbox"]) then
  99. local bone = ent.GetBonePosition(v,0,0);
  100. local min,max = ent.GetHitBoxBounds(v,0,0);
  101. local aids;
  102. if(bone) then aids = bone + ((min + max) / 2); end
  103. if(IsVis(v,aids)) then return aids; end
  104. end
  105. if(!settings["Aimbot"]["Hitbox"] && !settings["Aimbot"]["Hitscan"]) then
  106. if(ent.LookupAttachment(v,"eyes") != 0) then
  107. local bone = ent.GetAttachment(v,ent.LookupAttachment(v,"eyes")).Pos;
  108. if(IsVis(v,bone)) then return bone; else return; end
  109. elseif (ent.LookupAttachment(ent,"forward") != 0) then
  110. local bone = ent.GetAttachment(v,ent.LookupAttachment(v,"forward")).Pos;
  111. if(IsVis(v,bone)) then return bone; else return; end
  112. else
  113. local pos = ent.OBBCenter(v);
  114. if(IsVis(v,pos)) then return pos; else return; end
  115. end
  116. end
  117.  
  118. if(settings["Aimbot"]["Hitscan"]) then
  119. if(settings["Aimbot"]["Hitbox"]) then settings["Aimbot"]["Hitbox"] = false; end
  120. for k,_ in next, hitscans do
  121. local hScan = ent.GetHitBoxBone(v,hitscans[k],0);
  122. if(!hScan) then return ent.OBBCenter(v); end
  123. local hScanPos = ent.GetBonePosition(v,hScan);
  124. if(!hScanPos) then return ent.OBBCenter(v); end
  125. local min,max = ent.GetHitBoxBounds(v,hitscans[k], 0);
  126. if (IsVis(v, hScanPos + (min + max) / 2)) then
  127. return (hScanPos + (min + max) / 2);
  128. else
  129. return ent.OBBCenter(v);
  130. end
  131. end
  132. end*/
  133. end
  134.  
  135.  
  136.  
  137. local bucket = {};
  138.  
  139. local nullVel = Vector();
  140.  
  141. local function getLagPred(v)
  142. if(!bucket[v]) then
  143. bucket[v] = {ent.GetVelocity(v), ent.GetPos(v), ent.GetVelocity(v), 0};
  144. return nullvec;
  145. end
  146. local oldVel = bucket[v][1];
  147. local oldPos = bucket[v][2];
  148.  
  149. local newVel = ent.GetVelocity(v);
  150. local newPos = ent.GetPos(v);
  151. if(newVel != nullVel && newVel == oldVel && oldPos == newPos) then
  152. bucket[v][4] = bucket[v][4] + 1;
  153. local predVel = oldVel + oldVel * (bucket[v][4] * engine.TickInterval());
  154. predVel.z = 0;
  155. return predVel;
  156. else
  157. bucket[v] = {newVel, newPos, newVel, 0};
  158. return nullvec
  159. end
  160. end
  161.  
  162. local function valid(v)
  163. if(!v || v == nil || !v:Alive() || !ent.IsValid(v) || v == me || ent.Health(v) < 1 || ply.Team(v) == 1002 || !IsVis(v,v:GetPos())) then return false; end
  164. if(settings["Aimbot"]["Ignore Spawn Protection"] && v:GetColor().a != 255) then return false; end
  165. if(settings["Aimbot"]["Ignore Bots"] && ply.IsBot(v)) then return false; end
  166. if(settings["Aimbot"]["Ignore Team"] && ply.Team(v) == ply.Team(me)) then return false; end
  167. if(settings["Aimbot"]["Ignore Friends"] && ply.GetFriendStatus(v) == "friend") then return false; end
  168.  
  169. return true;
  170. end
  171.  
  172. local function nextshot()
  173. aimtarget = nil;
  174. local allplys = player.GetAll();
  175. local avaib = {};
  176. for k,v in next,allplys do
  177. avaib[math.random(100)] = v;
  178. end
  179.  
  180. for k,v in next, avaib do
  181. if(valid(v)) then
  182. aimtarget = v;
  183. end
  184. end
  185. end
  186.  
  187. local function gettarget()
  188. for i = 1, #player.GetAll() do
  189. local v = player.GetAll()[i];
  190. if(!valid(v)) then aimtarget = v;
  191. break;
  192. end
  193. return aimtarget;
  194. end
  195. end
  196.  
  197. hook.Add("Move","",function() if(!IsFirstTimePredicted()) then return; end servertime = CurTime(); end);
  198.  
  199. function reg.Entity.FireBullets(p, data)
  200. local spread = data.Spread * -1;
  201. local class = p:GetActiveWeapon():GetClass();
  202. if(spread != cones[class] && spread != nullvec) then
  203. cones[class] = spread;
  204. end
  205.  
  206. return(originalFire(p,data));
  207. end
  208.  
  209. local function pSpread(userCmd, angle)
  210. local w = ply.GetActiveWeapon(me);
  211. if(!w || !ent.IsValid(w) || !cones[ent.GetClass(w)] || !settings["Misc"]["No Spread"]) then return angl.Forward(angle); end
  212.  
  213. return(dickwrap.Predict(userCmd,angl.Forward(angle), cones[ent.GetClass(w)]));
  214. end
  215.  
  216. local function canfire()
  217. local w = ply.GetActiveWeapon(me);
  218. if(!w || !em.IsValid(w)) then return true; end
  219.  
  220. return(servertime >= wep.GetNextPrimaryFire(w));
  221. end
  222.  
  223. local function shootable()
  224. local badweps = {"knife", "grenade", "ied", "bomb", "slam", "climb", "sword", "hand", "fist"};
  225. local w = ply.GetActiveWeapon(me);
  226. if(ent.IsValid(w)) then
  227. local n = string.lower(w:GetPrintName())
  228. if(w:Clip1() <= 0) then
  229. return false;
  230. end
  231. for k,v in next, badweps do
  232. if(string.find(n,k)) then return false;
  233. end
  234. return true;
  235. end
  236. end
  237. end
Add Comment
Please, Sign In to add comment