Advertisement
stabulous

c_hitreg.lua

Apr 23rd, 2014
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.29 KB | None | 0 0
  1. cooldownTable = {[13] = 1000, [4] = 2000, [2] = 400, [11] = 100}
  2. continuousFireTable = {[11] = true}
  3.  
  4. myTimer = Timer()
  5. animTimer = Timer()
  6. hitMarkTimer = Timer()
  7.  
  8. function Fire()
  9. myWeapon = LocalPlayer:GetEquippedWeapon()
  10. cooldownTime = cooldownTable[myWeapon.id]
  11. if cooldownTime == nil then
  12. print("nil value")
  13. cooldownTime = 1000
  14. end
  15. local results = LocalPlayer:GetAimTarget()
  16. if myTimer:GetMilliseconds() > cooldownTime then
  17. animTimer:Restart()
  18. myTimer:Restart()
  19. if results.entity then
  20. local entityType = results.entity.__type
  21. if entityType == "Vehicle" or entityType == "Player" then
  22. if myWeapon.ammo_clip > 0 and myWeapon.ammo_clip < 20 then
  23. hitMarkTimer:Restart()
  24. local args = {}
  25. args.weapon = myWeapon.id
  26. args.target = results.entity
  27. Network:Send("Shoot", args)
  28. end
  29. end
  30. end
  31. end
  32.  
  33. end
  34.  
  35. playFireAnimation = function(args)
  36. if animTimer:GetMilliseconds() < 100 and Game:GetState() == 4 then
  37. Input:SetValue(Action.FireRight, 1.0, false)
  38. end
  39. end
  40.  
  41. blockdamage = function(args)
  42. return false
  43. end
  44.  
  45. MouseDown = function(args)
  46. if args.button == 1 then
  47. if continuousFireTable[LocalPlayer:GetEquippedWeapon().id] == true then
  48. firing = true
  49. else
  50. Fire()
  51. end
  52. end
  53. end
  54.  
  55. MouseUp = function(args)
  56. if args.button == 1 then
  57. if continuousFireTable[LocalPlayer:GetEquippedWeapon().id] == true then
  58. firing = false
  59. end
  60. end
  61. end
  62.  
  63. function Tick()
  64. if hitMarkTimer:GetMilliseconds() < 100 then Render:DrawCircle(Render.Size/2, 10, Color(255, 0, 0)) end
  65. if firing == true then Fire() end
  66. end
  67.  
  68. blacklist = {
  69. Action.FireGrapple,
  70. Action.ParachuteOpenClose,
  71. Action.FireRight
  72. }
  73. function blockFire(args)
  74. for index, action in ipairs(blacklist) do
  75. if action == args.input then
  76. return false
  77. end
  78. end
  79. end
  80.  
  81. Events:Subscribe("LocalPlayerInput", blockFire)
  82. Events:Subscribe("LocalPlayerBulletHit", blockdamage)
  83. Events:Subscribe("MouseDown", MouseDown)
  84. Events:Subscribe("MouseUp", MouseUp)
  85. Events:Subscribe("Render", Tick)
  86. Events:Subscribe("InputPoll", playFireAnimation)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement