_plane = _this select 0
_player = player
_pos = GetPos _plane;
_x = _pos select 0;
_y = _pos select 1;
_z = _pos select 2;
?(speed _plane <=40 and _z<=10): goto "OpenCanopy"

#MainLoop
?(not alive _plane): goto "Exit"
?(speed _plane >45): goto "CloseCanopy"
goto "MainLoop"

#Mainloop2 
?(not alive _plane): goto "Exit"
?(speed _plane <45): goto "Mainloop"
~5
goto "Mainloop2"

#CloseCanopy
_Plane vehicleRadio "CANOPY"
_plane animate ["canopy",0]
_plane animate ["handle",0]
goto "MainLoop2"

#OpenCanopy
_Plane vehicleRadio "CANOPY"
_plane animate ["canopy",1]
_plane animate ["handle",1]
goto "MainLoop"


#Exit
exit

