Advertisement
NSKuber

For Marko

Nov 9th, 2020
966
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.89 KB | None | 0 0
  1. local fMaxTimeBetweenPresses = 0.5
  2. local bIsOtherButtonPressed = false
  3. local bIsDoorOpen = true
  4.  
  5. Buttons:EnableUsage()
  6.  
  7. RunHandled(WaitForever,
  8.  
  9. OnEvery(Event(Button01.Used)),function()
  10.   if not bIsOtherButtonPressed then
  11.     bIsOtherButtonPressed = true
  12.     Wait(Delay(fMaxTimeBetweenPresses))
  13.     bIsOtherButtonPressed = false
  14.   else
  15.     bIsDoorOpen = true
  16.     worldInfo:ShowMessageToAll("DOOR OPENED")
  17.     --CODE TO OPEN THE DOOR
  18.     Wait(Delay(fMaxTimeBetweenPresses))
  19.   end
  20.   Button01:EnableUsage()
  21.  
  22. end,
  23.  
  24. OnEvery(Event(Button02.Used)),function()
  25.   if not bIsOtherButtonPressed then
  26.     bIsOtherButtonPressed = true
  27.     Wait(Delay(fMaxTimeBetweenPresses))
  28.     bIsOtherButtonPressed = false
  29.   else
  30.     bIsDoorOpen = true
  31.     worldInfo:ShowMessageToAll("DOOR OPENED")
  32.     --CODE TO OPEN THE DOOR
  33.     Wait(Delay(fMaxTimeBetweenPresses))
  34.   end
  35.  
  36.   Button02:EnableUsage()
  37. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement