Advertisement
LordNoobIV

cEMP

Apr 9th, 2014
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.66 KB | None | 0 0
  1. moveTimer = Timer()
  2. PulseTimer = Timer()
  3. eTable = {}
  4. on = false
  5. cPlayer = LocalPlayer
  6.  
  7. function fireEffect(eid)
  8.     effect1 = ClientEffect.Create(AssetLocation.Game, {
  9.         effect_id = eid,
  10.  
  11.         position = cPlayer:GetPosition(),
  12.         angle = Angle()
  13.     })
  14.     print(eid)
  15.     print(effect1)
  16.     print(effect1:GetEffectId())
  17. end
  18.  
  19. EMP = function(args)
  20.     if args.key == string.byte("M") then
  21.         print("lol")
  22.         Game:FireEvent("gui.mercenarymode.show")
  23.  
  24.     elseif args.key == string.byte("Z") and on == false then
  25.         print(on)
  26.         if effect1 ~= ClientEffect or effect1 == nil then
  27.             fireEffect(287)
  28.         end
  29.         if PulseTimer:GetSeconds() > 1 then
  30.             Network:Send("Activated", args)
  31.             print("Valid time. Sending to network.")
  32.             print(tostring(LocalPlayer), "activated EMP. Sending to network.")
  33.         end
  34.     elseif args.key == string.byte("X") and effect1:IsValid() == true then
  35.         effect1:Remove()
  36.         Network:Send("Deactictivated", args)
  37.     end
  38.  
  39. end
  40.  
  41. Pulse = function(args)
  42.     if PulseTimer:GetSeconds() > 3 then
  43.         fireEffect(137)
  44.         PulseTimer:Restart()
  45.     end
  46. end
  47.  
  48. EMPHit = function(args)
  49.     Chat:Print("You were hit by an EMP!", Color(255, 0, 0))
  50. end
  51.  
  52. MoveTo = function(args)
  53.     PlayerPosition = LocalPlayer:GetPosition()
  54.     PlayerAngle = LocalPlayer:GetAngle()
  55.     Position = PlayerPosition + (PlayerAngle * Vector3(0, 0, 0))
  56.     if effect1 then
  57.         effect1:SetPosition(Position)
  58.     end
  59. end
  60.  
  61.  
  62. Cleanup = function(args)
  63.     if effect1 ~= nil then
  64.         effect1:Remove()
  65.         print("Removing stray effects")
  66.     end
  67. end
  68.  
  69. Events:Subscribe("ModulesLoad", Cleanup)
  70. Events:Subscribe("KeyDown", EMP)
  71. Events:Subscribe("PreTick", MoveTo)
  72.  
  73. Network:Subscribe("Found", Pulse)
  74. Network:Subscribe("Hit", EMPHit)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement