Advertisement
IdoX10

light police

Oct 28th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. local r = 255
  2. local b = 0
  3. light = false
  4.  
  5. hook.Add("Think", "HookKeyManagement", function()
  6. for i=1, 159 do
  7. if(!vgui.CursorVisible) then break; end;
  8.  
  9. if(input.WasKeyPressed(i)) then
  10. hook.Call("KeyPressed", nil, i);
  11. end;
  12.  
  13. if(input.WasKeyReleased(i)) then
  14. hook.Call("KeyReleased", nil, i);
  15. end;
  16. end;
  17. end);
  18.  
  19.  
  20. hook.Add("KeyReleased", "TestShiftBlablabla", function(Key, Released)
  21. if(Key == KEY_LSHIFT and Released) then
  22.  
  23. if light == false then
  24.  
  25. LightOn()
  26.  
  27. end
  28.  
  29. if light == true then
  30.  
  31. LightOff()
  32.  
  33. end
  34.  
  35. end
  36. end)
  37.  
  38. function LightOn()
  39.  
  40. light = true
  41. print("light on")
  42. local dlight = DynamicLight( LocalPlayer():GetVehicle():EntIndex() )
  43. dlight.pos = LocalPlayer():GetVehicle():GetPos()
  44. dlight.r = r
  45. dlight.g = 0
  46. dlight.b = b
  47. dlight.brightness = 2
  48. dlight.Decay = 1000
  49. dlight.Size = 256
  50. dlight.DieTime = CurTime() + 1
  51.  
  52. end
  53.  
  54. function LightOff()
  55.  
  56. light = false
  57. print("light off")
  58. r = 0
  59. b = 0
  60.  
  61. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement