2023-10-13 13:45:25 +03:00
|
|
|
return function()
|
|
|
|
local sneakTicks = 0
|
|
|
|
local windowEvents = {nil, nil, nil}
|
|
|
|
local windowDuration = 20
|
|
|
|
local clockCounter = 0
|
|
|
|
|
2023-10-13 15:50:18 +03:00
|
|
|
while _G.player == nil do
|
|
|
|
os.sleep(0.05)
|
|
|
|
end
|
|
|
|
|
2023-10-13 13:45:25 +03:00
|
|
|
parallel.waitForAny(
|
|
|
|
function() while _G._running do
|
2023-10-13 15:50:18 +03:00
|
|
|
if player and windowEvents[3] ~= nil and windowEvents[3] + windowDuration >= clockCounter then
|
|
|
|
local mainHand = player.heldItem and player.heldItem.getMetadata().name
|
|
|
|
local offHand = player.offhandItem and player.offhandItem.getMetadata().name
|
2023-10-13 13:45:25 +03:00
|
|
|
if mainHand == "openblocks:hang_glider" or offHand == "openblocks:hang_glider" then
|
2023-10-13 15:50:18 +03:00
|
|
|
NI.launch(player.yaw, player.pitch, 4)
|
2023-10-13 13:45:25 +03:00
|
|
|
end
|
|
|
|
end
|
|
|
|
os.sleep(0.05)
|
|
|
|
end end,
|
|
|
|
function() while _G._running do
|
|
|
|
clockCounter = clockCounter + 1
|
2023-10-13 15:50:18 +03:00
|
|
|
if player.isSneaking then
|
2023-10-13 13:45:25 +03:00
|
|
|
sneakTicks = sneakTicks + 1
|
|
|
|
elseif sneakTicks ~= 0 then
|
|
|
|
windowEvents = {clockCounter, windowEvents[1], windowEvents[2]}
|
|
|
|
sneakTicks = 0
|
|
|
|
end
|
|
|
|
os.sleep(0.05)
|
|
|
|
end end)
|
|
|
|
end
|