Advertisement
captmicro

PredictSpread

Aug 5th, 2010
290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.13 KB | None | 0 0
  1. ubot.aimbot.PredictSpread = function(ang)
  2.     local wep = ubot.lp:GetActiveWeapon()
  3.     if (wep.Base ~= "weapon_cs_base") then return ang end
  4.    
  5.     local seed = forceofnature.randseedget()
  6.     local vecSpread = ubot.num2vec(ubot.aimbot.GetCone(wep) * -1)
  7.     local vecRight = Vector(0,-1,0)
  8.     local vecUp = Vector(-(ang:Forward()), 0, 0)
  9.    
  10.     local x, y, z = 0, 0, 0
  11.     local bias = forceofnature.cvarget("ai_shot_bias", CVAR_FLOAT)
  12.     local biasMin = forceofnature.cvarget("ai_shot_bias_min", CVAR_FLOAT)
  13.     local biasMax = forceofnature.cvarget("ai_shot_bias_max", CVAR_FLOAT)
  14.    
  15.     local shotbias = ((biasMax - biasMin) * bias) + biasMin
  16.     local flatness = (math.abs(shotbias) * 0.5)
  17.    
  18.     while (z > 1) do
  19.         x = (forceofnature.randfloat(-1,1) * flatness) + (forceofnature.randfloat(-1,1) * (1 - flatness))
  20.         y = (forceofnature.randfloat(-1,1) * flatness) + (forceofnature.randfloat(-1,1) * (1 - flatness))
  21.         if (shotbias < 0) then
  22.             x = (x >= 0) and (1.0 - x) or (-1.0 - x)
  23.             y = (y >= 0) and (1.0 - y) or (-1.0 - y)
  24.         end
  25.         z = (x*x)+(y*y)
  26.     end
  27.    
  28.     local spread = ang:Forward() + (x * vecSpread.x * vecRight) + (y * vecSpread.y * vecUp)
  29.     return spread
  30. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement