Advertisement
Guest User

sHop

a guest
Jan 27th, 2015
575
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.81 KB | None | 0 0
  1. timer.Simple(1, function()
  2.  
  3. surface.CreateFont( "sHop", { font = "Arial", size = 15, weight = 750, antialias = false, outline = true } )
  4.  
  5. local Version = "1337"
  6. local Enabled = true
  7. local curSpeed = 0
  8. local maxSpeed = 0
  9. local sHop = {}
  10.  
  11. /*
  12.  
  13. Helper functions
  14.  
  15. */
  16.  
  17. function sHop.AddHook( Type, Function )
  18. Name = "[sHop] - " .. math.random( 1, 10000 )
  19. hook.Add( Type, Name, Function )
  20. end
  21.  
  22. function sHop.AddCommand( Name, Function )
  23. concommand.Add( Name, Function )
  24. end
  25.  
  26. /*
  27.  
  28. Core functions
  29.  
  30. */
  31.  
  32.  
  33. function sHop.HUD()
  34. curSpeed = math.Round( LocalPlayer():GetVelocity():Length() )
  35. if ( curSpeed > maxSpeed && LocalPlayer():Alive() ) then
  36. maxSpeed = curSpeed
  37. end
  38. if Enabled then
  39. draw.RoundedBox( 4, 10, 10, 150, 70, Color( 0, 0, 0, 150 ) )
  40. draw.SimpleText( "sHop " .. Version, "sHop", 50, 15, Color( 50, 200, 50, 255 ) )
  41. draw.SimpleText( "Speed: " .. curSpeed, "sHop", 20, 30, Color( 255, 255, 255, 255 ) )
  42. draw.SimpleText( "Max Speed: " .. maxSpeed, "sHop", 20, 45, Color( 255, 255, 255, 255 ) )
  43. draw.SimpleText( "Coded by Snip", "sHop", 30, 60, Color( 200, 40, 60 ) )
  44. end
  45. end
  46.  
  47. local bhop = { };
  48. bhop.MetaPlayer = FindMetaTable( "Player")
  49. bhop.oldKeyDown = bhop.MetaPlayer['KeyDown']
  50. local bhopOn = true;
  51. local bhopSOn = true;
  52. local bhopHooks = { hook = { }, name = { } };
  53. bhop.left = false
  54. bhop.right = false
  55. bhop.jump = false
  56. bhop.what = true
  57. function bhop.AddHook(hookname, name, func)
  58. table.insert( bhopHooks.hook, hookname );
  59. table.insert( bhopHooks.name, name );
  60. hook.Add( hookname, name, func );
  61. end
  62. bhop.MetaPlayer['KeyDown'] = function( self, key )
  63. if self != LocalPlayer() then return end
  64. if (key == IN_MOVELEFT) and bhop.left then
  65. return true
  66. elseif (key == IN_MOVERIGHT) and bhop.right then
  67. return true
  68. elseif (key == IN_JUMP) and bhop.jump then
  69. return true
  70. else
  71. return bhop.oldKeyDown( self, key )
  72. end
  73. end
  74.  
  75. function bhop.spamjump()
  76. bhop.what = false
  77. bhop.jump = true
  78. timer.Simple(.05, function()
  79. bhop.jump = false
  80. timer.Simple( .25, function()
  81. bhop.what = true
  82. end)
  83. end)
  84. end
  85.  
  86.  
  87. local oldEyePos = LocalPlayer():EyeAngles()--This is to see where player is looking
  88. function bhop.CreateMove( cmd )
  89. local JumpReleased = false;
  90. if (cmd:KeyDown( IN_JUMP )) then
  91.  
  92. if (!JumpReleased) then
  93. if (bhopOn && !LocalPlayer():OnGround()) then --Bhop here
  94. cmd:RemoveKey( IN_JUMP );
  95. if bhop.what then
  96. bhop.spamjump()
  97. end
  98. end
  99. else
  100. JumpReleased = false
  101. end
  102.  
  103. if(bhopSOn ) then--auto strafer
  104. local traceRes = LocalPlayer():EyeAngles()
  105.  
  106. if( traceRes.y > oldEyePos.y ) then --If you move your mouse left, walk left, if you're jumping
  107. oldEyePos = traceRes;
  108. cmd:SetSideMove( -1000000 )
  109. bhop.left = true
  110. timer.Simple(1, function() bhop.left = false end)
  111. end
  112.  
  113. if( oldEyePos.y > traceRes.y ) then --If you move your mouse right, move right, while jumping
  114. oldEyePos = traceRes;
  115. cmd:SetSideMove( 1000000 )
  116. bhop.right = true
  117. timer.Simple(1, function() bhop.right = false end)
  118. end
  119. end
  120. elseif (!JumpReleased) then
  121. JumpReleased = true;
  122. end
  123.  
  124. end
  125.  
  126. bhop.AddHook( "CreateMove", tostring(math.random(0, 133712837)), bhop.CreateMove )--add the hook
  127. concommand.Add( "sHop", function () --Toggler
  128. if bhopOn then
  129. print("sHop off")
  130. bhopOn = false;
  131. else
  132. print("sHop on")
  133. bhopOn = true;
  134. end
  135. end )
  136. concommand.Add( "sHop_strafe", function ()
  137. if bhopSOn then
  138. print("Strafe off")
  139. bhopSOn = false;
  140. else
  141. print("Strafe on")
  142. bhopSOn = true;
  143. end
  144. end)
  145. concommand.Add("sHop_unload", function()
  146. for i = 1, #bhopHooks.hook do
  147. hook.Remove( bhopHooks.hook[i], bhopHooks.name[i] );
  148. print( "Unhooked "..bhopHooks.hook[i].." using name "..bhopHooks.name[i] );
  149. end
  150. concommand.Remove("sHop_strafe")
  151. concommand.Remove("bhop")
  152. bhopOn = false;
  153. bhopSOn = false;
  154. print("sHop unloaded")
  155. table.Empty( bhopHooks )
  156. concommand.Remove( "sHop_unload" )
  157. end)
  158. /*
  159.  
  160. Hooks and command adding.
  161.  
  162. */
  163.  
  164. sHop.AddHook( "HUDPaint", sHop.HUD )
  165. chat.AddText( Color( 255, 255, 50 ), "[sHop " .. Version .. "] ", Color( 255, 255, 255 ), "Loaded sHop!" )
  166.  
  167. end )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement