Advertisement
julioCCs

[GTA-IV] Air Combat IV.vb

Mar 23rd, 2013
502
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 254.56 KB | None | 0 0
  1. 'http://gtaxscripting.blogspot.com/
  2. 'http://www.facebook.com/GtaIVScripting
  3. 'https://www.youtube.com/user/GTAScripting
  4.  
  5. 'Air Combat IV script by JulioNIB
  6.  
  7. 'with colaboration (testing/jet models/tips/code tips) of:
  8.  
  9. 'core.max2010 - https://www.youtube.com/user/coremax2010
  10. 'metalwars - https://www.youtube.com/user/Metalwarz
  11. 'SkylineGTRFreak - https://www.youtube.com/user/SkylineGTRR34Freak
  12. 'zzcool (taltigolt) - https://www.youtube.com/user/taltigolt
  13. 'Hardsty1e - http://www.gtagaming.com/forums/member.php?u=107738
  14. 'Fredwalktrought - https://www.youtube.com/user/fredwalkthrough
  15.  
  16. Imports System
  17. Imports GTA
  18. Imports System.Windows.Forms
  19. Imports System.Drawing
  20. Imports System.Collections.Generic
  21. Imports System.IO
  22. Imports System.Text
  23.  
  24. Public Class AirCombat_IV
  25.     Inherits Script
  26.  
  27.     Private timeWaitLoadsettings As Double = 500
  28.     Private iniFile As String = ""
  29.     Private soundAuxIdle As gta.object
  30.     Private soundAuxAceel As gta.object
  31.     Private soundAuxAceel2 As gta.object
  32.     Private soundOffset As Double = 0
  33.     Private soundOffsetAux As Double = 0
  34.     Private ptfxEject As int32
  35.     Private multi As Double = 1
  36.     Private multiAux As Double = 0
  37.     Private lastJetHealth As Double = 1000
  38.     Private myJet As vehicle = Nothing
  39.     Private myFakeJet As vehicle = Nothing
  40.     Private actual20mm As int16 = 0
  41.     Private dot20mmPTFX As int32 = 0
  42.     Private dot20mmPTFXTrace As int32 = 0
  43.     'private planeDirAuxFront as gta.object = nothing
  44.     'private planeDirAuxCenter as gta.object = nothing
  45.     'private planeDirAuxUp as gta.object = nothing
  46.     Private currWeapon As int16 = 0
  47.     Private timeShoot20mm As int16 = 0
  48.     Private trainList As New list(Of trains)
  49.     Private trainListAux As New list(Of trains)
  50.     Private trainItem As trains
  51.     Private bResetPL As Boolean = False
  52.     Private timeWaitSoundRocket As Double = 0
  53.     Private original_model As model = Nothing
  54.     Private PTFXMyJetSmoke As int32 = 0
  55.     Private PTFXMyJetFire As int32 = 0
  56.     'private timeReloadSettings as double = 0
  57.     Private rpmAnim As Double = 0
  58.     Private width_Coef, height_Coef As Double
  59.     Private myWidth, myHeight, myGameWidth, myGameHeight As Int16
  60.     Private useResolutionFix As Boolean = False
  61.     Private groundDist As Double
  62.     Private PTFXMyExp As Int32
  63.     Private bExplodeMyJet As Boolean = True
  64.     Private PTFXWater As Int32 = 0
  65.     Private timeWaterEffect As Double = 0
  66.     Private timeKeepWaterEffect As Double = 0
  67.     Private actualJetSpeed As Double = 40
  68.     Private bWaterImpact As Boolean = False
  69.     Private timeWaitCloseGears As Double = 0
  70.     Private timeWaitOpenGears As Double = 0
  71.     Private timeSearchIdleJets As Double = 5000
  72.     Private bWarnEnemyMissileLock As Boolean = False
  73.     Private bWarnMyMissileLock As Boolean = False
  74.     Private bPlayerWasAlive As Boolean = True
  75.     Private st_height_teleport, st_height_teleport_back, st_time_check, st_time_check_aux As Double
  76.     Private st_teleport_pos, st_teleport_pos_back As Vector3
  77.     Private st_in_earth As Boolean = True
  78.     Private camPilotOffset As Vector3
  79.     Private camPilotDir As Vector3
  80.     Private camPilotOriginalDir As Vector3
  81.     Private camPilotOriginalPlaneDir As Vector3
  82.     Private camPilotHidePlayer As Boolean = False
  83.     Private camPilotFixedRotation As Boolean = False
  84.     Private timeResetPlayerInv As Double = 0
  85.     Private moveForceMultAux As Double = 0.1
  86.     Private bSpawnMenuON As Boolean = False
  87.     Private bFixedCockpitCam As Boolean = True
  88.     Private camObjectAux As GTA.Object = Nothing
  89.     Private bMustStop As Boolean = False
  90.     Private bResetFaceDraw As Boolean = False
  91.     Private search_for_helicopter As Boolean = True
  92.  
  93.     Private variation_0 As Int16 = 0
  94.     Private variation_1 As Int16 = 0
  95.     Private variation_2 As Int16 = 0
  96.     Private variation_4 As Int16 = 0
  97.     Private variation_5 As Int16 = 0
  98.     Private variation_7 As Int16 = 0
  99.     Private variation_9 As Int16 = 0
  100.  
  101.     'xbox controller
  102.     Private controllerState As Microsoft.Xna.Framework.Input.GamePadState
  103.     Private lastXBoxPacket As Double = 0
  104.     Private lastXBoxInput As Double = 0
  105.     Private timeWaitShootRocket As Double = 0
  106.     Private timeWaitShootBomb As Double = 0
  107.     Private timeWaitSelectSMItem As Double = 0
  108.     Private timeXControlSpawnMenuDown As Double = 0
  109.  
  110.     ' dificult level
  111.     Private timeWaitMissileLock As Double = 300 ' this will decrease when you kill enemies
  112.     Private AimEase As Double = 1 ' greater = easier
  113.  
  114.     ' setup mode
  115.     Private SM_Current_index As Int16 = 0
  116.     Private SM_Obj_aux As GTA.Object = Nothing
  117.     Private SM_actual_rocket As Int16 = 0
  118.     Private SM_actual_cannon As Int16 = 0
  119.     Private SM_actual_engine As Int16 = 0
  120.     Private SM_type As Int16 = 0
  121.     Private SM_TimeWaitPTFX As Double = 50
  122.  
  123.     ' hotkeys
  124.     Private hkShootRocket, hkShootCannon, hkDropBomb, hkSwitchGun, hkSpawnEnemy, hkSpawnFugitive, hkJetMoveDown, hkJetMoveUp, _
  125.         hkEject, hkEnterJet, hkSwitchCam, hkFlare, hkTurnLeft, hkTurnRight, hkRollLeft, hkRollRight, hkUp, hkDown, hkSpawnMenu, _
  126.         hkNextMenuItem, hkPrevMenuItem As Keys
  127.  
  128.     Private bFlapsHelpMode As Boolean = False
  129.     Private bShowPosition As Boolean = False
  130.     Private bSetupHelpMode As Boolean = False
  131.  
  132.     ' sounds
  133.     Private sndRocket As New System.Media.SoundPlayer()
  134.     Private sndEject As New System.Media.SoundPlayer()
  135.     Private sndAlarm As New System.Media.SoundPlayer()
  136.     Private sndMissileLock As New System.Media.SoundPlayer()
  137.     Private sndRocket2 As New System.Media.SoundPlayer()
  138.     Private sndAlarm2 As New System.Media.SoundPlayer()
  139.     Private sndMissileLock2 As New System.Media.SoundPlayer()
  140.     ' native sonds section
  141.     Private IDsndCannon As Int32 = 0
  142.     Private IDSndJetIdle As Int32 = 0
  143.     Private IDSndJetAccel As Int32 = 0
  144.     Private IDSndJetAccel2 As Int32 = 0
  145.     Private IDSndBombRelease As Int32 = 0
  146.     Private IDsndRocketMove As Int32 = 0
  147.     Private IDsndRocketMoveEnemy As Int32 = 0
  148.     Private timeWaitIDSndJetAccel As Double = 0
  149.  
  150.     ' extra cams
  151.     Private camDeath As Camera
  152.     Private camGun As Camera
  153.     Private camMode As Int16 = 0
  154.     Private bRocketCamON As Boolean = False
  155.  
  156.     ' rocket   
  157.     Private Class MR
  158.         Public enabled As Boolean = False
  159.         Public rocket As GTA.Object
  160.         Public model_name As String = "cj_rpg_rocket"
  161.         Public dir As Vector3
  162.         Public final_dir As Vector3 = Vector3.Zero
  163.         Public launched As Boolean = False
  164.         Public attached As Boolean = False
  165.         Public timeOut As Double = 0
  166.         Public ptfxID As Int32 = 0
  167.         Public ptfxExpID As Int32 = 0
  168.         Public ROff As Int32 = 0
  169.         Public xAttach, yAttach, zAttach, xRotAttach, yRotAttach, zRotAttach As Double
  170.         Public isBomb As Boolean = False
  171.         Public visible_fired As Boolean = True
  172.         Public visible_idle As Boolean = True
  173.         Public speed_multiplier As Double = 1.0
  174.         Public explosion_size As Double = 1.0
  175.         Public explosion_force As Double = 1.0
  176.         Public propulsor_effect_size As Double = 1.0
  177.         Public timeResetPTFX As Double = 0
  178.         Public damage_against_jets As Double
  179.         Public fixRotation As Vector3
  180.         Public TRocketsJetLocked As TJet = Nothing
  181.         Public THeliLocked As Vehicle = Nothing
  182.         Public bReseting As Boolean = False
  183.  
  184.         Public Sub Hide(ByVal rocket As GTA.Object)
  185.             rocket.detach()
  186.             rocket.visible = False
  187.             rocket.freezeposition = True
  188.             native.function.call("SET_OBJECT_COLLISION", rocket, False)
  189.         End Sub
  190.  
  191.         Public Sub attach(ByVal jet As Vehicle)
  192.             Native.Function.Call("SET_OBJECT_COLLISION", rocket, False)
  193.             Native.Function.Call("SET_OBJECT_RECORDS_COLLISIONS", rocket, 0)
  194.             Native.Function.Call("stop_ptfx", ptfxID)
  195.             rocket.FreezePosition = False
  196.             Native.Function.Call("ATTACH_OBJECT_TO_CAR", rocket, jet, 0, xAttach, yAttach, zAttach, 0, 0, 0)
  197.             rocket.Visible = visible_idle
  198.             Native.Function.Call("SET_OBJECT_DYNAMIC", rocket, 1)
  199.             final_dir = Vector3.Zero
  200.             launched = False
  201.             attached = True
  202.             TRocketsJetLocked = Nothing
  203.             bReseting = False
  204.         End Sub
  205.  
  206.         Public Function launch(ByVal pDir As Vector3, ByVal bJetLocked As Boolean)
  207.             If launched Then Return False
  208.  
  209.             native.function.call("SET_OBJECT_COLLISION", rocket, True)
  210.  
  211.             rocket.freezeposition = False
  212.             launched = True
  213.             attached = False
  214.             timeOut = 1000
  215.  
  216.             dir = pDir
  217.  
  218.             If bJetLocked Then
  219.                 final_dir = pDir
  220.             Else
  221.                 final_dir = vector3.zero
  222.             End If
  223.  
  224.             If propulsor_effect_size > 0 Then
  225.                 Native.Function.Call("stop_ptfx", ptfxID)
  226.  
  227.                 ptfxID = Native.Function.Call(Of Int32)("START_PTFX_ON_OBJ", "weap_rocket_player", rocket, 0, 0, 0, 0, 0, 0, propulsor_effect_size)
  228.             End If
  229.  
  230.             fixRotation = rocket.rotation
  231.  
  232.             rocket.detach()
  233.  
  234.             native.function.call("SET_OBJECT_RECORDS_COLLISIONS", rocket, 1)
  235.  
  236.             rocket.visible = visible_fired
  237.  
  238.             Return True
  239.         End Function
  240.     End Class
  241.  
  242.     Private tmpRocket As MR
  243.     Private TJetLocked As TJet = Nothing
  244.     Private jetEnemyAttacking As Vehicle = Nothing
  245.     Private myRockets As New List(Of GTA.Object)
  246.  
  247.     ' cannon
  248.     Private Class cannon
  249.         Public enabled As Boolean = False
  250.         Public size As Double = 1.0
  251.         Public trace_size As Double = 1.0
  252.         Public damage As Integer = 10
  253.         'public x, y, z as double
  254.         Public range As Double = 300
  255.         Public shootTime As Int16 = 1
  256.         Public ptfx As Int32 = 0
  257.         Public ptfxTrace As Int32 = 0
  258.         'public attachPoint as gta.object = nothing
  259.         Public offPosition As Vector3
  260.     End Class
  261.  
  262.     Private tmpCannon As cannon
  263.     'private cannList as new list(of cannon)
  264.     'private actualCannon as int16 = 0
  265.     'private cannonCount as int16 = 0
  266.  
  267.     ' textures/sprites
  268.     Private texMissile As Texture
  269.     Private texBomb As Texture
  270.     Private texJet As Texture
  271.     Private texRpm As Texture
  272.     Private texMissileAlarm As Texture
  273.     Private texMissileLocked As Texture
  274.     Private texBackg As Texture
  275.     Private texLineAux As Texture
  276.     Private texBotton As Texture
  277.     Private texFlares As Texture
  278.  
  279.     ' engine
  280.     Private Class engine
  281.         Public enabled As Boolean = False
  282.         Public ptfx As Int32 = 0
  283.         Public engLight As Light = New Light
  284.         Public offPosition As Vector3
  285.     End Class
  286.  
  287.     Private tmpEngine As engine
  288.  
  289.     ' enemy cfg
  290.     Private enemyJet_shoot_cannon, enemyJet_shoot_rocket As Boolean
  291.     Private enemyJet_cannon_dmg, enemyJet_rocket_damage, enemyJet_rocket_timewait, maxRoundForEvade, maxRoundForFugitiveEvade As Int32
  292.     Private maxAutoSpawnEnemies As Int16 = 2
  293.     Private timeLastAutoSpawnEnemies As Double = 0
  294.     Private drawEnemyRectDist As Double = 350
  295.  
  296.     ' jets
  297.     Private Class TJet
  298.         Public jet As Vehicle = Nothing
  299.         Public p As Ped = Nothing
  300.         Public lastHealth As Double = 1000
  301.         Public timeWait As Int16 = 1000
  302.         Public rockets As New List(Of MR)
  303.         Private timeShoot20mm As Int16 = 0
  304.         Private dot20mmPTFX As Int32 = 0
  305.         Private dot20mmPTFXTrace As Int32 = 0
  306.         Private actual20mm As Int16 = 0
  307.         'public dirObj as gta.object = nothing
  308.         'public dirObjCenter as gta.object = nothing
  309.         Public PTFXFire As Int32 = 0
  310.         Public PTFXSmoke As Int32 = 0
  311.         Public PTFXExp As Int32 = 0
  312.         Public timeRemove As Int16 = -1000
  313.         Public jetblip As Blip = Nothing
  314.         Public timeWaitLaunch As Double = 0
  315.         Public timeMissileAlarm As Double = 0
  316.         Public timeMissileAlarmValue As Double = 300
  317.         Public timeMissileLock As Double = 0
  318.         Public timeMissileLockValue As Double = 300
  319.         Public is_hunter As Boolean = False
  320.         Public is_fugitive As Boolean = False
  321.         Public isMP As Boolean = False
  322.         Public bAutoSpawn As Boolean = False
  323.         Public engines As New List(Of engine)
  324.         Public bExplodeJet As Boolean = True
  325.         Public lockedOnTarget As Boolean = False
  326.         Public timeOutFlare As Double = 0
  327.         Public flareReleased As Boolean = False
  328.         Public timeResetRot As Double = 100
  329.         Public resetRot As Vector3 = Vector3.Zero
  330.         Public resetHeading As Double = 0
  331.         Public resetSpeed As Double = 0
  332.         Public actualSpeed As Double
  333.         Public checkPAux As Checkpoint = New Checkpoint
  334.         Public DamagedByPlayer As Boolean = False
  335.  
  336.         Public back_gear_l As Int16
  337.         Public back_gear_r As Int16
  338.         Public front_gear_l As Int16
  339.         Public front_gear_r As Int16
  340.         Public flaps_r As Int16
  341.         Public flaps_l As Int16
  342.         Public flap_idle_angle As Double
  343.         Public gears_closed_angle As Double
  344.  
  345.         Public Sub start()
  346.             jet.enginerunning = True
  347.             p.becomemissioncharacter()
  348.             jet.applyforce(vector3.worldup * 5)
  349.             jet.speed = 50.0
  350.             jetblip = jet.attachblip
  351.  
  352.             If is_hunter Then
  353.                 jetBlip.color = blipcolor.red
  354.             Else
  355.                 jetBlip.color = blipcolor.yellow
  356.             End If
  357.  
  358.             resetRot = vector3.zero
  359.             resetHeading = 0
  360.             resetSpeed = 0
  361.             timeResetRot = 100
  362.  
  363.             actualSpeed = 100
  364.         End Sub
  365.  
  366.         Public Sub shoot20mm(ByVal vecPosFin As Vector3, ByVal dmg As Int32)
  367.             If Me.timeShoot20mm <= 0 Then
  368.                 Me.timeShoot20mm = 10
  369.  
  370.                 Native.Function.Call("stop_ptfx", Me.dot20mmPTFX)
  371.                 Native.Function.Call("stop_ptfx", Me.dot20mmPTFXTrace)
  372.  
  373.                 If Me.actual20mm = 1 Then
  374.                     Me.dot20mmPTFX = Native.Function.Call(Of Int32)("START_PTFX_ON_VEH", "muz_machine", _
  375.                         jet, 0.85, 2.0, -0.3, 0, 0, 90.0, 2.0)
  376.                     Me.dot20mmPTFXTrace = Native.Function.Call(Of Int32)("START_PTFX_ON_VEH", "wpn_bullet_trace", _
  377.                         jet, 0.85, 2.0, -0.3, -90.0, 0, 0, 3.0)
  378.                 Else
  379.                     Me.dot20mmPTFX = Native.Function.Call(Of Int32)("START_PTFX_ON_VEH", "muz_machine", _
  380.                         jet, -0.85, 2.0, -0.3, 0, 0, 90.0, 2.0)
  381.                     Me.dot20mmPTFXTrace = Native.Function.Call(Of Int32)("START_PTFX_ON_VEH", "wpn_bullet_trace", _
  382.                         jet, -0.85, 2.0, -0.3, -90.0, 0, 0, 3.0)
  383.                 End If
  384.  
  385.                 Dim vecPos As Vector3 = Me.jet.Position + Me.jet.Direction * 5
  386.  
  387.                 Native.Function.Call("FIRE_SINGLE_BULLET", vecPos.X, vecPos.Y, vecPos.Z, vecPosFin.X, vecPosFin.Y, vecPosFin.Z, dmg)
  388.  
  389.                 Me.actual20mm += 1
  390.  
  391.                 If Me.actual20mm > 1 Then Me.actual20mm = 0
  392.             Else
  393.                 Me.timeShoot20mm -= 10 * (25 / Game.FPS)
  394.             End If
  395.         End Sub
  396.     End Class
  397.  
  398.     ' custom jet config
  399.     Private Class TCustomJetCFG
  400.         Public jetModel As Model
  401.  
  402.         Public fileName As String
  403.  
  404.         Public display_name As String
  405.         'public hotKeySpawn as keys
  406.         Public console_cmd_spawn As String
  407.  
  408.         Public pilot_model As Model
  409.         Public enemy_model As Model
  410.         Public sEnemy_model As String
  411.         Public maxJetSpeed As Double
  412.         Public use_fake_jet As Boolean
  413.  
  414.         Public engineList As New List(Of engine)
  415.         Public engineMinFxSize, engineIdleFxSize, engineMaxFxSize
  416.  
  417.         Public cannList As New List(Of cannon)
  418.         Public actualCannon As Int16 = 0
  419.         Public cannonCount As Int16 = 0
  420.  
  421.         Public MRL As New List(Of MR)
  422.         Public MRLReset As New List(Of MR)
  423.  
  424.         Public cam1_ahead_Offset, cam1_up_offset, _
  425.             cam2_ahead_Offset, cam2_up_offset, _
  426.             cam3_ahead_Offset, cam3_up_offset As Double
  427.  
  428.         Public soundCannon, soundJetIdle, soundJetAccel, soundJetAccel2, soundBombRelease, soundRocketMove As String
  429.  
  430.         Public wingsAngle As Double = 20
  431.         Public maxWingAngle As Double = 0
  432.         Public idleFlapsAngle, minFlapsAngle, maxFlapsAngle, rudder_idle_angle, rudder_min_angle, rudder_max_angle, gears_closed_angle, gears_open_angle, elevator_idle_angle, elevator_min_angle, elevator_max_angle As Double
  433.         Public cockpit_id, left_wing_id, right_wing_id, left_flap_id, right_flap_id, back_gears_r_id, back_gears_l_id, front_gears_r_id, front_gears_l_id, rudder_1_id, rudder_2_id, elevator_1_id, elevator_2_id As Int16
  434.  
  435.         Public moveLeftForce, moveRightForce, rollLeftForce, rollRightForce, moveUpForce, moveDownForce As Double
  436.  
  437.         Public texPreview As Texture = Nothing
  438.  
  439.         ' extras
  440.         Public extraList As New List(Of jetExtras)
  441.  
  442.         ' skins
  443.         Public skin_count As Int16 = 0
  444.         Public skin As Int16 = 0
  445.     End Class
  446.  
  447.     Private tmpTCustomJetCFG As TCustomJetCFG
  448.     Private TCustomJetCFGList As New List(Of TCustomJetCFG)
  449.     Private myActualJet As TCustomJetCFG = Nothing
  450.     Private actualSkin As Int16 = 1
  451.  
  452.     ' extras
  453.     Private Class jetExtras
  454.         Public extraID As Int16
  455.         Public initiallyEnabled As Boolean
  456.         Public activateWhenFireCannon As Boolean
  457.         Public activateWhenFireRocket As Boolean
  458.         Public activateWhenFireBomb As Boolean
  459.         Public activateWhenReleaseFlares As Boolean
  460.         Public hotkey As Keys
  461.         Public autoOffTime As Double
  462.         Public timeOutToggle As Double = 0
  463.         Public bShowing As Boolean
  464.     End Class
  465.  
  466.     Private tmpExtra As jetExtras = Nothing
  467.  
  468.     ' enemy models
  469.     Private Class EnemyModel
  470.         Public model As String
  471.         Public jet_model As Int16
  472.         Public back_gear_l As Int16
  473.         Public back_gear_r As Int16
  474.         Public front_gear_l As Int16
  475.         Public front_gear_r As Int16
  476.         Public flaps_r As Int16
  477.         Public flaps_l As Int16
  478.         Public flap_idle_angle As Double
  479.         Public gears_closed_angle As Double
  480.     End Class
  481.  
  482.     Private tmpEnemyModel As EnemyModel
  483.     'Private enemyModels As New list(Of EnemyModel)
  484.  
  485.     ' my flare
  486.     'private myFlareObj as gta.object = nothing
  487.     'private PTFXMyFlare as int32
  488.     Private timeOutMyFlare As Double = 0
  489.     Private myFlareReleased As Boolean = False
  490.     Private timeHKFlareDown As Double = 0
  491.     Private timeWaitNextRelFlare As Double = 0
  492.     Private timeShowFlareAux As Double = 0
  493.  
  494.     ' flares aux
  495.     Private Class Flare
  496.         Public flareObj As GTA.Object = Nothing
  497.         Public PTFXFlare As Int32 = 0
  498.     End Class
  499.  
  500.     Private tmpFlare As Flare
  501.     Private myFlares As New List(Of Flare)
  502.     Private myFlaresResetList As New List(Of Flare)
  503.     Private enemyFlares As New List(Of Flare)
  504.     Private timeWaitResetFlarePTFX As Double = 0
  505.  
  506.     Private tmpJet As TJet
  507.     Private jetList As New List(Of TJet)
  508.     'private wreckedJetList as new list(of TJet)
  509.  
  510.     ' fake trains
  511.     Private Class trains
  512.         Public pos, rot, vel As Vector3
  513.         Public m As Model
  514.         Public train As GTA.Object
  515.         Public bCreate As Boolean = True
  516.         Public speed As Double
  517.  
  518.         Public Sub New(ByVal v As GTA.Vehicle)
  519.             pos = v.Position
  520.             rot = v.Rotation
  521.             speed = v.Speed
  522.             m = v.Model
  523.             train = Nothing
  524.         End Sub
  525.     End Class
  526.  
  527.     ' helicopters  
  528.     Private Class THeli
  529.         Public heli As Vehicle = Nothing
  530.         Public heliBlip As Blip = Nothing
  531.         Public timeMissileLockValue As Double = 0
  532.         Public timeMissileLock As Double = 0
  533.         'Public checkPAux As checkpoint = New checkpoint
  534.         Public isMP As Boolean = False
  535.  
  536.         Public Sub New(ByVal v As Vehicle)
  537.             heli = v
  538.             heliBlip = v.AttachBlip
  539.             heliBlip.Color = BlipColor.Orange
  540.         End Sub
  541.     End Class
  542.  
  543.     Private tmpHeli As THeli = Nothing
  544.     Private heliList As New List(Of THeli)
  545.     Private heliLocked As Vehicle = Nothing
  546.     Private timeCheckHeli As Double = 0
  547.  
  548.     ' jet aquirement point
  549.     Private Class TJetAP
  550.         Public diameter, heading As Double
  551.         Public checkPos, jetPos As Vector3
  552.         Public cp As Checkpoint = New Checkpoint
  553.         Public cpAlpha, cpRcolor, cpGcolor, cpBcolor As Int16
  554.         Public autoCreateJet As Boolean = False
  555.         Public createdJet As Vehicle = Nothing
  556.         Public jetModel As Model = Nothing
  557.         Public resetPosition As Boolean = True
  558.         Public checkPVisible As Boolean = True
  559.         Public showOnMap As Boolean = True
  560.         Public tblip As Blip = Nothing
  561.         Public display_name As String = ""
  562.         Public skin As Int16 = 0
  563.     End Class
  564.  
  565.     Private tmpTJetAP As TJetAP = Nothing
  566.     Private TJetAPList As New List(Of TJetAP)
  567.     Private timeSetAP As Double = 1000
  568.  
  569.     Public Sub New()
  570.         Me.Interval = 10
  571.  
  572.         original_model = Player.Model
  573.  
  574.         Game.Console.Print("Air Combat IV script by JulioNIB v1.5.1, loading files...")
  575.     End Sub
  576.  
  577.     Private Sub loadSettingsAux()
  578.         soundAuxIdle = World.CreateObject("cj_proc_brick", Player.Character.Position.Around(23) + Vector3.WorldUp * 7)
  579.         soundAuxIdle.Visible = False
  580.         Native.Function.Call("set_object_collision", soundAuxIdle, False)
  581.         soundAuxAceel = World.CreateObject("cj_proc_brick", Player.Character.Position.Around(3) + Vector3.WorldUp * 5)
  582.         soundAuxAceel.Visible = False
  583.         Native.Function.Call("set_object_collision", soundAuxAceel, False)
  584.         soundAuxAceel2 = World.CreateObject("cj_proc_brick", Player.Character.Position.Around(4) + Vector3.WorldUp * 7)
  585.         soundAuxAceel2.Visible = False
  586.         Native.Function.Call("set_object_collision", soundAuxAceel2, False)
  587.  
  588.         SM_Obj_aux = World.CreateObject("cj_proc_brick", Player.Character.Position.Around(5) + Vector3.WorldUp * 7)
  589.         SM_Obj_aux.Visible = False
  590.         Native.Function.Call("set_object_collision", SM_Obj_aux, False)
  591.  
  592.         camObjectAux = World.CreateObject("cj_proc_brick", Player.Character.Position.Around(6) + Vector3.WorldUp * 7)
  593.         camObjectAux.Visible = False
  594.         Native.Function.Call("set_object_collision", camObjectAux, False)
  595.  
  596.         texMissile = New Texture(File.ReadAllBytes(".\Scripts\JetFiles\missile.png"))
  597.         texBomb = New Texture(File.ReadAllBytes(".\Scripts\JetFiles\bomb.png"))
  598.         texJet = New Texture(File.ReadAllBytes(".\Scripts\JetFiles\jet.png"))
  599.         texRpm = New Texture(File.ReadAllBytes(".\Scripts\JetFiles\speed.png"))
  600.         texMissileAlarm = New Texture(File.ReadAllBytes(".\Scripts\JetFiles\missile_alarm.png"))
  601.         texMissileLocked = New Texture(File.ReadAllBytes(".\Scripts\JetFiles\missileLocked.png"))
  602.         texBackg = New Texture(File.ReadAllBytes(".\Scripts\JetFiles\Back.png"))
  603.         texLineAux = New Texture(File.ReadAllBytes(".\Scripts\JetFiles\Line.png"))
  604.         texBotton = New Texture(File.ReadAllBytes(".\Scripts\JetFiles\Botton.png"))
  605.         texFlares = New Texture(File.ReadAllBytes(".\Scripts\JetFiles\Flare.png"))
  606.  
  607.         sndRocket.SoundLocation = ".\Scripts\JetFiles\rocketLaunch.wav"
  608.         sndRocket.Load()
  609.         sndEject.SoundLocation = ".\Scripts\JetFiles\eject.wav"
  610.         sndEject.Load()
  611.         sndAlarm.SoundLocation = ".\Scripts\JetFiles\alarm.wav"
  612.         sndAlarm.Load()
  613.         sndMissileLock.SoundLocation = ".\Scripts\JetFiles\missileLock.wav"
  614.         sndMissileLock.Load()
  615.  
  616.         sndRocket2.SoundLocation = ".\Scripts\JetFiles\rocketLaunch2.wav"
  617.         sndRocket2.Load()
  618.         sndAlarm2.SoundLocation = ".\Scripts\JetFiles\alarm2.wav"
  619.         sndAlarm2.Load()
  620.         sndMissileLock2.SoundLocation = ".\Scripts\JetFiles\missileLock2.wav"
  621.         sndMissileLock2.Load()
  622.  
  623.         IDSndJetIdle = Native.Function.Call(Of Int32)("get_sound_id")
  624.         IDSndJetAccel = Native.Function.Call(Of Int32)("get_sound_id")
  625.         IDSndJetAccel2 = Native.Function.Call(Of Int32)("get_sound_id")
  626.         IDsndCannon = Native.Function.Call(Of Int32)("get_sound_id")
  627.         IDSndBombRelease = Native.Function.Call(Of Int32)("get_sound_id")
  628.         IDsndRocketMove = Native.Function.Call(Of Int32)("get_sound_id")
  629.         IDsndRocketMoveEnemy = Native.Function.Call(Of Int32)("get_sound_id")
  630.  
  631.         myWidth = 1680
  632.         myHeight = 1050
  633.  
  634.         ' load settings
  635.         loadConfig()
  636.  
  637.         ' load custom jet settings
  638.         loadJetConfig()
  639.  
  640.         ' load custom aquirement points
  641.         loadJetAquirementPos()
  642.  
  643.         camDeath = New Camera
  644.         camGun = New Camera
  645.  
  646.         Game.Console.Print("Air Combat IV, load complete...")
  647.     End Sub
  648.  
  649.     Private Sub msg(ByVal sMsg As String, ByVal time As Int32)
  650.         Native.Function.Call("PRINT_STRING_WITH_LITERAL_STRING_NOW", "STRING", sMsg, time, 1)
  651.     End Sub
  652.  
  653.     Private Sub keyDown(ByVal sender As Object, ByVal e As GTA.KeyEventArgs) Handles MyBase.KeyDown
  654.         If bSetupHelpMode Then
  655.             setupModeKeypress(e)
  656.  
  657.             Exit Sub
  658.         End If
  659.  
  660.         If isInJet() AndAlso (e.Key = Keys.Subtract) Then
  661.             If myActualJet.skin_count > 0 Then
  662.                 actualSkin += 1
  663.  
  664.                 If actualSkin > myActualJet.skin_count - 1 Then actualSkin = 0
  665.  
  666.                 Native.Function.Call("SET_CAR_LIVERY", myJet, actualSkin)
  667.  
  668.                 msg("Skin: " & (actualSkin + 1).ToString, 2000)
  669.             End If
  670.         End If
  671.  
  672.         If isInJet() AndAlso (e.Key = hkFlare) AndAlso (timeOutMyFlare <= 0) Then
  673.             timeHKFlareDown = 0
  674.             timeWaitNextRelFlare = 0
  675.         End If
  676.  
  677.         If isInJet() AndAlso ((e.Key = hkSpawnEnemy) OrElse (e.Key = hkSpawnFugitive)) Then
  678.             For c As Int16 = 1 To 3
  679.                 If spawnEnemyJet(e.Key) Then
  680.                     Exit For
  681.                 Else
  682.                     Wait(50)
  683.                 End If
  684.             Next
  685.         End If
  686.  
  687.         If isInJet() AndAlso (e.Key = hkSwitchCam) Then
  688.             If Exists(camGun) Then
  689.                 camMode += 1
  690.  
  691.                 ' rocket 1, 2, 3, ..., Bomb, cannon and normal cam
  692.                 If camMode > 5 Then camMode = 0
  693.  
  694.                 If camMode = 4 Then
  695.                     Player.Character.Visible = Not camPilotHidePlayer
  696.  
  697.                     Dim TmpSpeed As Double = myJet.Speed
  698.                     myJet.FreezePosition = True
  699.                     Wait(10)
  700.                     camPilotOffset = myJet.GetOffset(Player.Character.GetOffsetPosition(Vector3.WorldUp * 0.7 + Player.Character.Direction * 0.06))
  701.                     camPilotDir = myJet.Rotation
  702.                     camPilotOriginalDir = myJet.Rotation
  703.                     camPilotOriginalPlaneDir = myJet.Rotation
  704.                     myJet.FreezePosition = False
  705.                     Native.Function.Call("SET_CAR_FORWARD_SPEED", myJet, TmpSpeed)
  706.  
  707.                     bFixedCockpitCam = True
  708.                 Else
  709.                     Player.Character.Visible = True
  710.                 End If
  711.  
  712.                 If camMode > 0 Then
  713.                     camGun.Activate()
  714.                 Else
  715.                     camGun.Deactivate()
  716.                 End If
  717.             Else
  718.                 msg("Error creating extra camera...", 3000)
  719.             End If
  720.         End If
  721.  
  722.         If isInJet() AndAlso (e.Key = hkSwitchGun) AndAlso isJetOk() Then
  723.             currWeapon += 1
  724.  
  725.             If currWeapon > 2 Then currWeapon = 0
  726.  
  727.             If currWeapon = 0 Then
  728.                 msg("Rocket", 1000)
  729.             ElseIf currWeapon = 1 Then
  730.                 msg("Cannon", 1000)
  731.             ElseIf currWeapon = 2 Then
  732.                 msg("Bomb", 1000)
  733.             End If
  734.         End If
  735.  
  736.         If ((e.Key = hkShootRocket) OrElse ((currWeapon = 0) AndAlso (e.Key = Keys.LButton))) AndAlso isInJet() AndAlso isJetOk() Then
  737.             For Each r As MR In myActualJet.MRL
  738.                 If r.enabled AndAlso Not r.isBomb AndAlso Not r.launched Then
  739.                     If r.launch(planeDir() * 2.5, Exists(TJetLocked)) Then
  740.                         timeWaitSoundRocket = 150
  741.  
  742.                         If camMode <> 4 Then sndRocket.Play() Else sndRocket2.Play()
  743.  
  744.                         Native.Function.Call("stop_sound", IDsndRocketMove)
  745.                         Native.Function.Call("PLAY_SOUND_FROM_object", IDsndRocketMove, myActualJet.soundRocketMove, r.rocket)
  746.                         timeWaitSoundRocket = 150
  747.                         r.timeOut = 3000
  748.                         r.TRocketsJetLocked = TJetLocked
  749.                         r.THeliLocked = heliLocked
  750.                         Native.Function.Call("stop_ptfx", r.ptfxExpID)
  751.  
  752.                         Exit Sub
  753.                     End If
  754.                 End If
  755.             Next
  756.         End If
  757.  
  758.         If (groundDist > 8) AndAlso ((e.Key = hkDropBomb) OrElse ((currWeapon = 2) AndAlso (e.Key = Keys.LButton))) AndAlso isInJet() AndAlso isJetOk() Then
  759.             For Each r As MR In myActualJet.MRL
  760.                 If r.enabled AndAlso r.isBomb AndAlso Not r.launched Then
  761.                     r.launch((planeDir() / 1.5) * myJetSpeedAux() + Vector3.WorldDown * 50, False)
  762.  
  763.                     r.timeOut = 3000
  764.  
  765.                     Native.Function.Call("stop_sound", IDSndBombRelease)
  766.                     Native.Function.Call("PLAY_SOUND_FROM_vehicle", IDSndBombRelease, myActualJet.soundBombRelease, myJet)
  767.  
  768.                     Exit Sub
  769.                 End If
  770.             Next
  771.         End If
  772.  
  773.         'if exists(camGun) andalso camGun.isactive then
  774.         '   camGun.deactivate
  775.         '   camMode = 0
  776.         'end if
  777.  
  778.         If (e.Key = hkEject) Then ejectPilot()
  779.     End Sub
  780.     Private Sub keyUp(ByVal sender As Object, ByVal e As GTA.KeyEventArgs) Handles MyBase.KeyUp
  781.         If bSetupHelpMode Then
  782.             If (e.Key = Keys.Up) OrElse (e.Key = Keys.Down) OrElse (e.Key = Keys.Left) OrElse (e.Key = Keys.Right) _
  783.                 OrElse (e.Key = Keys.NumPad6) OrElse (e.Key = Keys.NumPad4) OrElse (e.Key = Keys.NumPad8) OrElse (e.Key = Keys.NumPad2) OrElse (e.Key = Keys.Subtract) OrElse (e.Key = Keys.Add) Then
  784.                 For Each m As MR In myActualJet.MRL
  785.                     m.rocket.Visible = False
  786.                     Native.Function.Call("stop_ptfx", m.ptfxID)
  787.  
  788.                     If myActualJet.MRL.IndexOf(m) = SM_actual_rocket Then
  789.                         m.attach(myJet)
  790.                         m.ptfxID = Native.Function.Call(Of Int32)("START_PTFX_ON_OBJ", "weap_rocket_player", m.rocket, 0, 0, 0, 0, 0, 0, 2.0)
  791.                         m.rocket.Visible = True
  792.                     End If
  793.                 Next
  794.             End If
  795.  
  796.             Exit Sub
  797.         End If
  798.  
  799.         If isInJet() AndAlso (e.Key = hkFlare) AndAlso (timeOutMyFlare <= 0) Then
  800.             If timeHKFlareDown < 100 Then
  801.                 Native.Function.Call("stop_sound", IDSndBombRelease)
  802.                 Native.Function.Call("PLAY_SOUND_FROM_vehicle", IDSndBombRelease, myActualJet.soundBombRelease, myJet)
  803.  
  804.                 timeOutMyFlare = 3000
  805.                 timeWaitResetFlarePTFX = 200
  806.  
  807.                 Dim off As Int16 = -5
  808.  
  809.                 For Each f As Flare In myFlares
  810.                     f.flareObj.Detach()
  811.                     f.flareObj.ApplyForce(rotateVec(planeDir, off) * myJet.Speed * 2 + Vector3.WorldDown * 30)
  812.                     f.PTFXFlare = Native.Function.Call(Of Int32)("START_PTFX_ON_OBJ", "weap_rocket_player", f.flareObj, 0, 0, 0, 0, 0, 0, 0.5)
  813.  
  814.                     off += 5
  815.                 Next
  816.  
  817.                 myFlareReleased = True
  818.             End If
  819.         End If
  820.  
  821.         If (e.Key = Keys.RButton) AndAlso bRocketCamON AndAlso camGun.isActive Then
  822.             bRocketCamON = False
  823.  
  824.             camGun.Deactivate()
  825.         End If
  826.  
  827.         If e.Key = hkSpawnMenu Then
  828.             If TCustomJetCFGList.Count = 0 Then
  829.                 msg("There is no jets installed...", 6000)
  830.                 bSpawnMenuON = False
  831.             Else
  832.                 bSpawnMenuON = Not bSpawnMenuON
  833.             End If
  834.         End If
  835.  
  836.         If bSpawnMenuON Then
  837.             If (e.Key = Keys.Enter) Then
  838.                 For c As Int16 = 0 To TCustomJetCFGList.Count - 1
  839.                     If c = SM_Current_index Then
  840.                         bSpawnMenuON = False
  841.                         spawnMyJet(TCustomJetCFGList(c))
  842.                         Exit Sub
  843.                     End If
  844.                 Next
  845.  
  846.                 msg("Error detecting the jet :(", 6000)
  847.             ElseIf ((e.Key = hkNextMenuItem) OrElse (e.Key = hkPrevMenuItem)) Then
  848.                 If (e.Key = hkNextMenuItem) Then SM_Current_index += 1
  849.                 If (e.Key = hkPrevMenuItem) Then SM_Current_index -= 1
  850.  
  851.                 If SM_Current_index < 0 Then SM_Current_index = TCustomJetCFGList.Count - 1
  852.                 If SM_Current_index > TCustomJetCFGList.Count - 1 Then SM_Current_index = 0
  853.             End If
  854.         End If
  855.     End Sub
  856.  
  857.     Private Sub ejectPilot()
  858.         Dim bEjected As Boolean = False
  859.  
  860.         If Player.Character.isAlive Then
  861.             If isInJet() AndAlso (myJet.Speed > 5) Then
  862.                 bEjected = True
  863.  
  864.                 TJetLocked = Nothing
  865.  
  866.                 If Exists(camGun) Then camGun.Deactivate()
  867.                 camMode = 0
  868.                 Player.Character.Visible = True
  869.  
  870.                 If ptfxEject <> 0 Then Native.Function.Call("stop_ptfx", ptfxEject)
  871.  
  872.                 ptfxEject = Native.Function.Call(Of Int32)("START_PTFX_ON_VEH", "shot_directed_steam", _
  873.                     myJet, 0, 2.5, 0, 0, 0, 0, 1.5)
  874.  
  875.                 If myActualJet.cockpit_id > -1 Then Native.Function.Call("break_car_door", myJet, myActualJet.cockpit_id, False)
  876.  
  877.                 sndEject.Play()
  878.  
  879.                 Dim tmpVecPos As Vector3 = myJet.GetOffsetPosition(Vector3.WorldUp * myActualJet.jetModel.GetDimensions.Z)
  880.  
  881.                 Player.Character.Invincible = True
  882.                 'player.character.task.clearallimmediately     
  883.                 'player.character.detach
  884.                 Native.Function.Call("ON_FIRE_SCREAM", Player.Character)
  885.                 Native.Function.Call("WARP_CHAR_FROM_CAR_TO_COORD", Player.Character, tmpVecPos.X, tmpVecPos.Y, tmpVecPos.Z)
  886.                 bWaterImpact = True
  887.                 'wait(250)
  888.                 'player.character.isragdoll = true         
  889.                 Player.Character.Velocity = planeDirUp() * 15 + planeDir() * (myJet.Speed)
  890.                 Player.Character.Health -= (myJet.Speed / 8)
  891.  
  892.                 For Each j As TJet In jetList
  893.                     'j.checkPAux.visible = False
  894.  
  895.                     If Not j.isMP AndAlso Exists(j.jet) AndAlso Exists(j.p) Then
  896.                         j.p.Task.DriveTo((j.jet.Position + j.jet.Direction * 1000).Around(100), 80.0, False) ' fly away
  897.                     End If
  898.                 Next
  899.  
  900.                 timeResetPlayerInv = 250
  901.  
  902.                 clearHeliList()
  903.  
  904.                 Player.IgnoredByEveryone = False
  905.             End If
  906.  
  907.             If Not bEjected Then
  908.                 If isInJet() Then
  909.                     TJetLocked = Nothing
  910.  
  911.                     If Exists(camGun) Then camGun.Deactivate()
  912.                     camMode = 0
  913.                     Player.Character.Visible = True
  914.  
  915.                     If (myJet.Speed < 2) Then
  916.                         Dim vecPos As Vector3 = (myJet.Position + myJet.Direction * ((myJet.Model.GetDimensions.Y / 2) + 2)).ToGround
  917.  
  918.                         If myActualJet.cockpit_id <> -1 Then
  919.                             If Exists(myFakeJet) AndAlso myActualJet.use_fake_jet Then Native.Function.Call("CONTROL_CAR_DOOR", myFakeJet, myActualJet.cockpit_id, True, 40 * (3.14 / 180))
  920.  
  921.                             Native.Function.Call("CONTROL_CAR_DOOR", myJet, myActualJet.cockpit_id, True, 40 * (3.14 / 180))
  922.  
  923.                             Wait(1000)
  924.                         End If
  925.  
  926.                         Game.FadeScreenOut(250, True)
  927.                         Wait(500)
  928.  
  929.                         Try
  930.                             Player.Character.Task.ClearAll()
  931.                             Native.Function.Call("WARP_CHAR_FROM_CAR_TO_COORD", Player.Character, vecPos.X, vecPos.Y, vecPos.Z)
  932.                         Catch
  933.                             msg("Error trying to exit the jet...", 5000)
  934.                         End Try
  935.  
  936.                         Game.FadeScreenIn(250, False)
  937.  
  938.                         If myActualJet.cockpit_id <> -1 Then
  939.                             Wait(300)
  940.                             If Exists(myFakeJet) AndAlso myActualJet.use_fake_jet Then Native.Function.Call("CONTROL_CAR_DOOR", myFakeJet, myActualJet.cockpit_id, True, 0)
  941.  
  942.                             Native.Function.Call("CONTROL_CAR_DOOR", myJet, myActualJet.cockpit_id, True, 0)
  943.                         End If
  944.  
  945.                         If bMustStop Then Native.Function.Call("SET_CAR_FORWARD_SPEED", myJet, 0)
  946.                     End If
  947.  
  948.                     For Each j As TJet In jetList
  949.                         'j.checkPAux.visible = False
  950.  
  951.                         If Not j.isMP AndAlso Exists(j.jet) AndAlso Exists(j.p) Then
  952.                             j.p.Task.DriveTo((j.jet.Position + j.jet.Direction * 1000).Around(100), 80.0, False) ' fly away
  953.                         End If
  954.                     Next
  955.  
  956.                     clearHeliList()
  957.  
  958.                     Player.IgnoredByEveryone = False
  959.                 Else
  960.                     Dim tmpVeh As Vehicle = Nothing
  961.  
  962.                     For Each j As TCustomJetCFG In TCustomJetCFGList
  963.                         If Exists(Player.Character.CurrentVehicle) AndAlso (Player.Character.CurrentVehicle.Model = j.jetModel) Then tmpVeh = Player.Character.CurrentVehicle
  964.  
  965.                         If Not Exists(tmpVeh) Then tmpVeh = World.GetClosestVehicle(Player.Character.Position + Player.Character.Direction, 7.0, j.jetModel)
  966.  
  967.                         If Exists(tmpVeh) Then
  968.                             myActualJet = j
  969.                             Exit For
  970.                         End If
  971.                     Next
  972.  
  973.                     If Exists(tmpVeh) Then
  974.                         If Exists(camGun) Then camGun.Deactivate()
  975.                         camMode = 0
  976.                         Player.Character.Visible = True
  977.  
  978.                         Player.Character.Task.ClearAllImmediately()
  979.                         Player.Character.Task.GoTo(tmpVeh.Position + tmpVeh.Direction)
  980.  
  981.                         If (myActualJet.cockpit_id <> -1) Then
  982.                             If Exists(myFakeJet) AndAlso myActualJet.use_fake_jet Then Native.Function.Call("CONTROL_CAR_DOOR", myFakeJet, myActualJet.cockpit_id, True, 40 * (3.14 / 180))
  983.  
  984.                             Native.Function.Call("CONTROL_CAR_DOOR", tmpVeh, myActualJet.cockpit_id, True, 40 * (3.14 / 180))
  985.  
  986.                             Wait(1000)
  987.                         End If
  988.  
  989.                         Game.FadeScreenOut(250, True)
  990.                         Wait(500)
  991.  
  992.                         Try
  993.                             variation_0 = Native.Function.Call(Of Int32)("GET_CHAR_DRAWABLE_VARIATION", Player.Character, 0)
  994.                             variation_1 = Native.Function.Call(Of Int32)("GET_CHAR_DRAWABLE_VARIATION", Player.Character, 1)
  995.                             variation_2 = Native.Function.Call(Of Int32)("GET_CHAR_DRAWABLE_VARIATION", Player.Character, 2)
  996.                             variation_4 = Native.Function.Call(Of Int32)("GET_CHAR_DRAWABLE_VARIATION", Player.Character, 4)
  997.                             variation_5 = Native.Function.Call(Of Int32)("GET_CHAR_DRAWABLE_VARIATION", Player.Character, 5)
  998.                             variation_7 = Native.Function.Call(Of Int32)("GET_CHAR_DRAWABLE_VARIATION", Player.Character, 7)
  999.                             variation_9 = Native.Function.Call(Of Int32)("GET_CHAR_DRAWABLE_VARIATION", Player.Character, 9)
  1000.  
  1001.                             Player.Model = myActualJet.pilot_model
  1002.                             Player.Character.Task.WarpIntoVehicle(tmpVeh, VehicleSeat.Driver)
  1003.                         Catch
  1004.                             msg("Error trying to enter the jet...", 5000)
  1005.                         End Try
  1006.  
  1007.                         Game.FadeScreenIn(250, False)
  1008.  
  1009.                         If myActualJet.cockpit_id <> -1 Then
  1010.                             Wait(300)
  1011.                             If Exists(myFakeJet) AndAlso myActualJet.use_fake_jet Then Native.Function.Call("CONTROL_CAR_DOOR", myFakeJet, myActualJet.cockpit_id, True, 0)
  1012.  
  1013.                             Native.Function.Call("CONTROL_CAR_DOOR", tmpVeh, myActualJet.cockpit_id, True, 0)
  1014.                         End If
  1015.                     End If
  1016.                 End If
  1017.             End If
  1018.         End If
  1019.     End Sub
  1020.  
  1021.     Private Sub spawnMyJet(ByVal j As TCustomJetCFG)
  1022.         Dim vecPos As Vector3
  1023.         Dim bShiftDown As Boolean = Game.isKeyPressed(Keys.ShiftKey) OrElse _
  1024.            (controllerState.IsConnected AndAlso controllerState.IsButtonDown(Microsoft.Xna.Framework.Input.Buttons.A))
  1025.  
  1026.         camMode = 0
  1027.         If camGun.isActive Then camGun.Deactivate()
  1028.  
  1029.         msg("Creating jet: " & j.display_name, 3000)
  1030.  
  1031.         Game.FadeScreenOut(500, True)
  1032.  
  1033.         Try
  1034.             Player.Model = j.pilot_model
  1035.  
  1036.             If bShiftDown Then
  1037.                 vecPos = Player.Character.Position + Vector3.WorldUp * 50
  1038.             Else
  1039.                 vecPos = Player.Character.Position + Game.CurrentCamera.Direction * 15
  1040.                 vecPos.Z = Player.Character.Position.Z + 0.5
  1041.             End If
  1042.  
  1043.             Dim car As Vehicle = World.CreateVehicle(j.jetModel, vecPos)
  1044.  
  1045.             Wait(50)
  1046.  
  1047.             If Not Exists(car) Then car = World.CreateVehicle(j.jetModel, vecPos)
  1048.  
  1049.             If Not Exists(car) Then
  1050.                 Game.FadeScreenIn(250, False)
  1051.                 Wait(300)
  1052.                 msg("error creating jet", 2000)
  1053.                 Exit Sub
  1054.             End If
  1055.  
  1056.             car.Heading = Player.Character.Heading
  1057.  
  1058.             If j.skin_count > 0 Then
  1059.                 Native.Function.Call("SET_CAR_LIVERY", car, j.skin)
  1060.  
  1061.                 actualSkin = j.skin
  1062.             End If
  1063.  
  1064.             Player.Character.WarpIntoVehicle(car, VehicleSeat.Driver)
  1065.  
  1066.             If bShiftDown Then
  1067.                 car.Speed = 100
  1068.             End If
  1069.         Catch
  1070.         End Try
  1071.  
  1072.         Game.FadeScreenIn(250, False)
  1073.     End Sub
  1074.  
  1075.     Private Sub setupModeKeypress(ByVal e As GTA.KeyEventArgs)
  1076.         If (e.Key = Keys.C) Then
  1077.             If Not camDeath.isActive Then
  1078.                 camDeath.Position = Game.CurrentCamera.Position
  1079.                 camDeath.Direction = Game.CurrentCamera.Direction
  1080.                 camDeath.FOV = Game.CurrentCamera.FOV
  1081.                 camDeath.Activate()
  1082.             Else
  1083.                 camDeath.Deactivate()
  1084.             End If
  1085.         End If
  1086.  
  1087.         If e.Key = Keys.B Then myActualJet.MRL(SM_actual_rocket).isBomb = Not myActualJet.MRL(SM_actual_rocket).isBomb
  1088.  
  1089.         If e.Key = Keys.Down Then
  1090.             SM_type += 1
  1091.  
  1092.             SM_actual_rocket = 0
  1093.             SM_actual_cannon = 0
  1094.             SM_actual_engine = 0
  1095.         End If
  1096.  
  1097.         If SM_type < 0 Then SM_type = 2
  1098.         If SM_type > 2 Then SM_type = 0
  1099.  
  1100.         If e.Key = Keys.Left Then
  1101.             If SM_type = 0 Then SM_actual_rocket -= 1
  1102.             If SM_type = 1 Then SM_actual_cannon -= 1
  1103.             If SM_type = 2 Then SM_actual_engine -= 1
  1104.         End If
  1105.         If e.Key = Keys.Right Then
  1106.             If SM_type = 0 Then SM_actual_rocket += 1
  1107.             If SM_type = 1 Then SM_actual_cannon += 1
  1108.             If SM_type = 2 Then SM_actual_engine += 1
  1109.         End If
  1110.  
  1111.         checkSM_Index()
  1112.  
  1113.         If e.Key = Keys.G Then
  1114.             Dim nextPosAux As Int16 = 0
  1115.  
  1116.             If SM_type = 0 Then
  1117.                 If SM_actual_rocket = myActualJet.MRL.Count - 1 Then nextPosAux = 0 Else nextPosAux = SM_actual_rocket + 1
  1118.  
  1119.                 myActualJet.MRL(nextPosAux).xAttach = myActualJet.MRL(SM_actual_rocket).xAttach * -1
  1120.                 myActualJet.MRL(nextPosAux).yAttach = myActualJet.MRL(SM_actual_rocket).yAttach
  1121.                 myActualJet.MRL(nextPosAux).zAttach = myActualJet.MRL(SM_actual_rocket).zAttach
  1122.                 myActualJet.MRL(nextPosAux).enabled = True
  1123.  
  1124.                 SM_actual_rocket += 1
  1125.  
  1126.                 msg("Oposite rocket generated!", 2000)
  1127.             ElseIf SM_type = 1 Then
  1128.                 If SM_actual_cannon = myActualJet.cannList.Count - 1 Then nextPosAux = 0 Else nextPosAux = SM_actual_cannon + 1
  1129.  
  1130.                 myActualJet.cannList(nextPosAux).offPosition.X = myActualJet.cannList(SM_actual_cannon).offPosition.X * -1
  1131.                 myActualJet.cannList(nextPosAux).offPosition.Y = myActualJet.cannList(SM_actual_cannon).offPosition.Y
  1132.                 myActualJet.cannList(nextPosAux).offPosition.Z = myActualJet.cannList(SM_actual_cannon).offPosition.Z
  1133.                 myActualJet.cannList(nextPosAux).enabled = True
  1134.  
  1135.                 SM_actual_cannon += 1
  1136.  
  1137.                 msg("Oposite cannon generated!", 2000)
  1138.             ElseIf SM_type = 2 Then
  1139.                 If SM_actual_engine = myActualJet.engineList.Count - 1 Then nextPosAux = 0 Else nextPosAux = SM_actual_engine + 1
  1140.  
  1141.                 myActualJet.engineList(nextPosAux).offPosition.X = myActualJet.engineList(SM_actual_engine).offPosition.X * -1
  1142.                 myActualJet.engineList(nextPosAux).offPosition.Y = myActualJet.engineList(SM_actual_engine).offPosition.Y
  1143.                 myActualJet.engineList(nextPosAux).offPosition.Z = myActualJet.engineList(SM_actual_engine).offPosition.Z
  1144.                 myActualJet.engineList(nextPosAux).enabled = True
  1145.  
  1146.                 SM_actual_engine += 1
  1147.  
  1148.                 msg("Oposite engine generated!", 2000)
  1149.             End If
  1150.  
  1151.             Wait(500)
  1152.  
  1153.             checkSM_Index()
  1154.         End If
  1155.  
  1156.         If e.Key = Keys.Enter Then
  1157.             If SM_type = 0 Then
  1158.                 myActualJet.MRL(SM_actual_rocket).enabled = Not myActualJet.MRL(SM_actual_rocket).enabled
  1159.             ElseIf SM_type = 1 Then
  1160.                 myActualJet.cannList(SM_actual_cannon).enabled = Not myActualJet.cannList(SM_actual_cannon).enabled
  1161.             ElseIf SM_type = 2 Then
  1162.                 myActualJet.engineList(SM_actual_engine).enabled = Not myActualJet.engineList(SM_actual_engine).enabled
  1163.             End If
  1164.         End If
  1165.  
  1166.         If e.Key = Keys.NumPad0 Then saveNewSetup()
  1167.     End Sub
  1168.  
  1169.     Private Sub checkSM_Index()
  1170.         If SM_actual_rocket > myActualJet.MRL.Count - 1 Then SM_actual_rocket = 0
  1171.         If SM_actual_cannon > myActualJet.cannList.Count - 1 Then SM_actual_cannon = 0
  1172.         If SM_actual_engine > myActualJet.engineList.Count - 1 Then SM_actual_engine = 0
  1173.  
  1174.         If SM_actual_rocket < 0 Then SM_actual_rocket = myActualJet.MRL.Count - 1
  1175.         If SM_actual_cannon < 0 Then SM_actual_cannon = myActualJet.cannList.Count - 1
  1176.         If SM_actual_engine < 0 Then SM_actual_engine = myActualJet.engineList.Count - 1
  1177.     End Sub
  1178.  
  1179.     Private Function returnJetOffPos(ByVal j As TJet)
  1180.         Return j.jet.GetOffsetPosition(Vector3.RelativeRight * ((jetList.IndexOf(j) - Math.Round(jetList.Count / 2)) * 25)) - j.jet.Position
  1181.     End Function
  1182.  
  1183.     Private Sub releaseEnemyFlare(ByVal j As TJet)
  1184.         If Not j.flareReleased AndAlso (j.timeOutFlare <= 0) Then
  1185.             j.timeOutFlare = 5000
  1186.  
  1187.             'native.function.call("stop_ptfx", j.ptfxFlare)        
  1188.             'j.flareObj.detach         
  1189.             'j.flareObj.applyforce(enemyDir(j) * j.jet.speed + vector3.worlddown * 30)         
  1190.             'j.ptfxFlare = native.function.call(of int32)("START_PTFX_ON_OBJ", "weap_rocket_player", j.flareObj, 0, 0, 0, 0, 0, 0, 1.5)
  1191.             Dim off As Int16 = -5
  1192.  
  1193.             For Each f As Flare In enemyFlares
  1194.                 Native.Function.Call("stop_ptfx", f.PTFXFlare)
  1195.                 f.flareObj.Detach()
  1196.                 f.flareObj.ApplyForce(rotateVec(enemyDir(j), off) * j.jet.Speed * 2 + Vector3.WorldDown * 30)
  1197.                 f.PTFXFlare = Native.Function.Call(Of Int32)("START_PTFX_ON_OBJ", "weap_rocket_player", f.flareObj, 0, 0, 0, 0, 0, 0, 1.5)
  1198.  
  1199.                 off += 5
  1200.             Next
  1201.  
  1202.             j.flareReleased = True
  1203.         End If
  1204.     End Sub
  1205.  
  1206.     Private Sub resetEnemyFlare(ByVal j As TJet)
  1207.         If enemyFlares.Count = 0 Then
  1208.             For c As Int16 = 1 To 5
  1209.                 tmpFlare = New Flare
  1210.                 enemyFlares.Add(tmpFlare)
  1211.             Next
  1212.         End If
  1213.  
  1214.         For Each f As Flare In enemyFlares
  1215.             If Not Exists(f.flareObj) Then
  1216.                 f.flareObj = World.CreateObject("cj_proc_brick", Player.Character.Position.Around(5) + Vector3.WorldUp * 50)
  1217.                 'f.flareObj.attachblip
  1218.                 j.flareReleased = True
  1219.             End If
  1220.  
  1221.             Native.Function.Call("stop_ptfx", f.PTFXFlare)
  1222.             f.flareObj.AttachToVehicle(j.jet, Vector3.WorldDown, Vector3.Zero)
  1223.             f.flareObj.Visible = False
  1224.         Next
  1225.  
  1226.         j.flareReleased = False
  1227.     End Sub
  1228.  
  1229.     Private Function spawnEnemyJet(ByVal key As Keys, Optional ByVal bAutoSpawn As Boolean = False)
  1230.         'if wreckedJetList.count = 0 then
  1231.             Dim tmpCustomJet As TCustomJetCFG = Nothing
  1232.  
  1233.             tmpJet = New TJet
  1234.             tmpJet.is_hunter = (key = hkSpawnEnemy)
  1235.             tmpJet.is_fugitive = (key = hkSpawnFugitive)
  1236.             tmpJet.bAutoSpawn = bAutoSpawn
  1237.  
  1238.             If TCustomJetCFGList.Count > 0 Then
  1239.                 Dim tmpIndex As Int16 = Math.Round(random(-2, TCustomJetCFGList.Count + 2))
  1240.  
  1241.                 If tmpIndex < 0 Then
  1242.                     tmpIndex = 0
  1243.                 ElseIf tmpIndex > TCustomJetCFGList.Count - 1 Then
  1244.                     tmpIndex = TCustomJetCFGList.Count - 1
  1245.                 End If
  1246.  
  1247.                 tmpCustomJet = TCustomJetCFGList(tmpIndex)
  1248.  
  1249.                 tmpJet.jet = World.CreateVehicle(tmpCustomJet.jetModel, Player.Character.Position + Vector3.WorldUp * (200 - groundDist))
  1250.  
  1251.                 tmpJet.back_gear_l = tmpCustomJet.back_gears_l_id
  1252.                 tmpJet.back_gear_r = tmpCustomJet.back_gears_r_id
  1253.                 tmpJet.front_gear_l = tmpCustomJet.front_gears_l_id
  1254.                 tmpJet.front_gear_r = tmpCustomJet.front_gears_r_id
  1255.                 tmpJet.flaps_r = tmpCustomJet.right_flap_id
  1256.                 tmpJet.flaps_l = tmpCustomJet.left_flap_id
  1257.                 tmpJet.flap_idle_angle = tmpCustomJet.idleFlapsAngle
  1258.                 tmpJet.gears_closed_angle = tmpCustomJet.gears_closed_angle
  1259.             Else
  1260.                 If TCustomJetCFGList.Count = 0 Then
  1261.                     msg("No enemy model was specified in the main INI file", 10000)
  1262.                     Return False
  1263.                 End If
  1264.  
  1265.                 tmpCustomJet = TCustomJetCFGList(0)
  1266.  
  1267.                 tmpJet.jet = World.CreateVehicle(tmpCustomJet.jetModel, Player.Character.Position + Vector3.WorldUp * (200 - groundDist))
  1268.  
  1269.                 tmpJet.back_gear_l = -1
  1270.                 tmpJet.back_gear_r = -1
  1271.                 tmpJet.front_gear_l = -1
  1272.                 tmpJet.front_gear_r = -1
  1273.                 tmpJet.flaps_r = -1
  1274.                 tmpJet.flaps_l = -1
  1275.                 tmpJet.flap_idle_angle = -1
  1276.                 tmpJet.gears_closed_angle = -100
  1277.             End If
  1278.  
  1279.             If Exists(tmpJet.jet) Then
  1280.                 tmpJet.jet.Visible = False
  1281.                 'tmpJet.p = tmpJet.jet.CreatePedOnSeat(vehicleseat.driver, "m_y_cop_traffic", RelationshipGroup.cop)
  1282.                 'tmpJet.p = world.createped("m_y_cop_traffic", player.character.position + vector3.worldup * 20)
  1283.                 If myActualJet.sEnemy_model <> "" Then
  1284.                     tmpJet.p = World.CreatePed(myActualJet.enemy_model, Player.Character.Position + Vector3.WorldUp * 20)
  1285.                 Else
  1286.                     tmpJet.p = World.CreatePed("m_m_fbi", Player.Character.Position + Vector3.WorldUp * 20)
  1287.                 End If
  1288.  
  1289.                 If Exists(tmpJet.p) Then
  1290.                     'tmpJet.dirObj = world.createobject("cj_rpg_rocket", tmpJet.jet.position.around(5) + vector3.worldup * 100)
  1291.                     'tmpJet.dirObjCenter = world.createobject("cj_rpg_rocket", tmpJet.jet.position.around(5) + vector3.worldup * 100)
  1292.  
  1293.                     'if exists(tmpJet.dirObj) andalso exists(tmpJet.dirObjCenter) then
  1294.                         tmpJet.p.CancelAmbientSpeech()
  1295.                         tmpJet.p.Task.ClearAll()
  1296.                         tmpJet.p.Task.WarpIntoVehicle(tmpJet.jet, VehicleSeat.Driver)
  1297.  
  1298.                         'native.function.call("ATTACH_OBJECT_TO_CAR", tmpJet.dirObj, tmpJet.jet, 0, 0, 1.0, 0, 0, 0, 0)
  1299.                         'native.function.call("ATTACH_OBJECT_TO_CAR", tmpJet.dirObjCenter, tmpJet.jet, 0, 0, 0, 0, 0, 0, 0)
  1300.  
  1301.                         tmpRocket = New MR
  1302.                         tmpRocket.rocket = World.CreateObject("cj_rpg_rocket", Player.Character.Position.Around(5) + Vector3.WorldUp * 100)
  1303.                         tmpRocket.Hide(tmpRocket.rocket)
  1304.                         tmpRocket.xAttach = -2.5
  1305.                         tmpRocket.yAttach = -3.0
  1306.                         tmpRocket.zAttach = -0.3
  1307.                         tmpRocket.attach(tmpJet.jet)
  1308.                         tmpJet.rockets.Add(tmpRocket)
  1309.  
  1310.                         tmpRocket = New MR
  1311.                         tmpRocket.rocket = World.CreateObject("cj_rpg_rocket", Player.Character.Position.Around(5) + Vector3.WorldUp * 100)
  1312.                         tmpRocket.Hide(tmpRocket.rocket)
  1313.                         tmpRocket.xAttach = 2.5
  1314.                         tmpRocket.yAttach = -3.0
  1315.                         tmpRocket.zAttach = -0.3
  1316.                         tmpRocket.attach(tmpJet.jet)
  1317.                         tmpJet.rockets.Add(tmpRocket)
  1318.  
  1319.                         resetEnemyFlare(tmpJet)
  1320.  
  1321.                         For Each e As engine In tmpCustomJet.engineList
  1322.                             If Not e.enabled Then Continue For
  1323.  
  1324.                             tmpEngine = New engine
  1325.                             'tmpEngine.x = e.x
  1326.                             'tmpEngine.y = e.y
  1327.                             'tmpEngine.z = e.z
  1328.                             tmpEngine.offPosition.X = e.offPosition.X
  1329.                             tmpEngine.offPosition.Y = e.offPosition.Y
  1330.                             tmpEngine.offPosition.Z = e.offPosition.Z
  1331.                             'tmpEngine.attachPoint = world.createobject("cj_rpg_rocket", player.character.position.around(5) + vector3.worldup * 100)
  1332.                             'native.function.call("ATTACH_OBJECT_TO_CAR", tmpEngine.attachPoint, tmpJet.jet, 0, e.x, e.y, e.z, 0, 0, 0)
  1333.                             'tmpEngine.attachPoint.visible = false
  1334.                             tmpEngine.engLight.Intensity = 300
  1335.                             tmpEngine.engLight.Enabled = True
  1336.                             tmpEngine.engLight.Color = Color.Goldenrod
  1337.                             tmpJet.engines.Add(tmpEngine)
  1338.                         Next
  1339.  
  1340.                         tmpJet.jet.Position = (Player.Character.Position + Vector3.WorldUp * 50).Around(300)
  1341.                         tmpJet.jet.Speed = 50.0
  1342.                         tmpJet.jet.Visible = True
  1343.                         tmpJet.jet.Metadata.isAnJet = True
  1344.                         tmpJet.p.Metadata.IsJetPilot = True
  1345.  
  1346.                         jetList.Add(tmpJet)
  1347.  
  1348.                         'If tmpJet.is_hunter Then
  1349.                             'tmpJet.checkPAux.Color = Color.FromArgb(100, 255, 0, 0)
  1350.                         'Else
  1351.                             'tmpJet.checkPAux.Color = Color.FromArgb(100, 200, 200, 0)
  1352.                         'End If
  1353.  
  1354.                         'tmpJet.checkPAux.Visible = True
  1355.                         'tmpJet.checkPAux.Diameter = 10
  1356.  
  1357.                         If tmpCustomJet.skin_count > 0 Then Native.Function.Call("SET_CAR_LIVERY", tmpJet.jet, tmpCustomJet.skin)
  1358.  
  1359.                         tmpJet.start()
  1360.  
  1361.                         Return True
  1362.                     'end if
  1363.                 End If
  1364.             End If
  1365.  
  1366.             Return False
  1367.         'else
  1368.         '   dim tmpPed as ped = nothing
  1369.         '  
  1370.         '   tmpPed = world.createped("m_y_cop_traffic", player.character.position + vector3.worldup * 20)
  1371.         '  
  1372.         '   if exists(tmpPed) then
  1373.         '       tmpPed.CancelAmbientSpeech
  1374.         '       wreckedJetList.item(0).p = tmpPed
  1375.         '       wreckedJetList.item(0).p.visible = false
  1376.         '       wreckedJetList.item(0).p.task.clearall
  1377.         '      
  1378.         '       wreckedJetList.item(0).jet.visible = false
  1379.         '       wreckedJetList.item(0).jet.position = player.character.position + vector3.worldup * 20
  1380.         '      
  1381.         '       wreckedJetList.item(0).jet.repair
  1382.         '       wreckedJetList.item(0).jet.health = 1000
  1383.         '       wreckedJetList.item(0).jet.enginehealth = 1000
  1384.         '       wreckedJetList.item(0).jet.petroltankhealth = 1000
  1385.         '       wreckedJetList.item(0).jet.EngineRunning = true                
  1386.         '       wreckedJetList.item(0).jet.speed = 50  
  1387.         '       wreckedJetList.item(0).p.task.clearallimmediately
  1388.         '       wreckedJetList.item(0).p.task.WarpIntoVehicle(wreckedJetList.item(0).jet, vehicleseat.driver)
  1389.         '      
  1390.         '       resetEnemyFlare(wreckedJetList.item(0))
  1391.         '
  1392.         '       wreckedJetList.item(0).jet.position = (player.character.position + vector3.worldup * 50).around(300)
  1393.         '       wreckedJetList.item(0).p.visible = true
  1394.         '       wreckedJetList.item(0).jet.speed = 50.0
  1395.         '       wreckedJetList.item(0).jet.visible = true
  1396.         '      
  1397.         '       for each r as MR in wreckedJetList.item(0).rockets
  1398.         '           if r.launched then r.attach(wreckedJetList.item(0).jet)
  1399.         '       next
  1400.         '      
  1401.         '       jetList.add(wreckedJetList.item(0))
  1402.         '      
  1403.         '       wreckedJetList.item(0).start
  1404.         '      
  1405.         '       wreckedJetList.removeat(0)
  1406.         '   end if
  1407.         'end if
  1408.     End Function
  1409.  
  1410.     Private Sub general_tick(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Tick
  1411.         Try
  1412.         If timeWaitLoadsettings > 0 Then
  1413.             timeWaitLoadsettings -= Me.Interval
  1414.  
  1415.             If timeWaitLoadsettings <= 0 Then loadSettingsAux()
  1416.  
  1417.             Exit Sub
  1418.         End If
  1419.  
  1420.         controllerState = Microsoft.Xna.Framework.Input.GamePad.GetState(Microsoft.Xna.Framework.PlayerIndex.One)
  1421.  
  1422.         If controllerState.IsConnected Then
  1423.             If lastXBoxPacket = 0 Then
  1424.                 lastXBoxPacket = controllerState.PacketNumber
  1425.             ElseIf lastXBoxPacket <> controllerState.PacketNumber Then
  1426.                 lastXBoxPacket = controllerState.PacketNumber
  1427.  
  1428.                 lastXBoxInput = 500
  1429.  
  1430.                 If bSpawnMenuON AndAlso (timeWaitSelectSMItem <= 0) Then
  1431.                     If (controllerState.IsButtonDown(Microsoft.Xna.Framework.Input.Buttons.DPadLeft) OrElse controllerState.IsButtonDown(Microsoft.Xna.Framework.Input.Buttons.DPadRight)) Then
  1432.                         timeWaitSelectSMItem = 100
  1433.  
  1434.                         If controllerState.IsButtonDown(Microsoft.Xna.Framework.Input.Buttons.DPadRight) Then SM_Current_index += 1
  1435.                         If controllerState.IsButtonDown(Microsoft.Xna.Framework.Input.Buttons.DPadLeft) Then SM_Current_index -= 1
  1436.  
  1437.                         If SM_Current_index < 0 Then SM_Current_index = TCustomJetCFGList.Count - 1
  1438.                         If SM_Current_index > TCustomJetCFGList.Count - 1 Then SM_Current_index = 0
  1439.                     End If
  1440.  
  1441.                     If controllerState.IsButtonDown(Microsoft.Xna.Framework.Input.Buttons.A) OrElse controllerState.IsButtonDown(Microsoft.Xna.Framework.Input.Buttons.X) Then
  1442.                         timeWaitSelectSMItem = 100
  1443.  
  1444.                         For c As Int16 = 0 To TCustomJetCFGList.Count - 1
  1445.                             If c = SM_Current_index Then
  1446.                                 bSpawnMenuON = False
  1447.                                 spawnMyJet(TCustomJetCFGList(c))
  1448.                                 Exit For
  1449.                             End If
  1450.                         Next
  1451.  
  1452.                         bSpawnMenuON = False
  1453.  
  1454.                         Exit Sub
  1455.                     End If
  1456.                 End If
  1457.  
  1458.                 If controllerState.IsButtonDown(Microsoft.Xna.Framework.Input.Buttons.B) Then
  1459.                     ejectPilot()
  1460.  
  1461.                     Wait(500)
  1462.                 End If
  1463.             End If
  1464.  
  1465.             If controllerState.IsButtonDown(Microsoft.Xna.Framework.Input.Buttons.LeftShoulder) AndAlso _
  1466.                 controllerState.IsButtonDown(Microsoft.Xna.Framework.Input.Buttons.RightShoulder) Then
  1467.                 timeXControlSpawnMenuDown += Interval
  1468.  
  1469.                 If timeXControlSpawnMenuDown > 200 Then
  1470.                     timeXControlSpawnMenuDown = 0
  1471.  
  1472.                     bSpawnMenuON = Not bSpawnMenuON
  1473.                 End If
  1474.  
  1475.                 Player.Character.Task.ClearAll()
  1476.             Else
  1477.                 If timeXControlSpawnMenuDown > 0 Then timeXControlSpawnMenuDown -= Interval
  1478.             End If
  1479.         End If
  1480.  
  1481.         If Not isInJet() AndAlso bResetFaceDraw Then
  1482.             Native.Function.Call("SET_DRAW_PLAYER_COMPONENT", 7, True)
  1483.             Native.Function.Call("SET_DRAW_PLAYER_COMPONENT", 0, True)
  1484.             Native.Function.Call("SET_DRAW_PLAYER_COMPONENT", 9, True)
  1485.  
  1486.             bResetFaceDraw = False
  1487.         End If
  1488.  
  1489.         If timeWaitSelectSMItem > 0 Then timeWaitSelectSMItem -= Interval
  1490.  
  1491.         If lastXBoxInput > 0 Then lastXBoxInput -= Interval
  1492.  
  1493.         If bSetupHelpMode Then
  1494.             Dim moveMulti As Double = 1
  1495.  
  1496.             If Game.isKeyPressed(Keys.ControlKey) Then moveMulti = 10
  1497.  
  1498.             If Game.isKeyPressed(Keys.Subtract) Then ' move up
  1499.                 If SM_type = 0 Then myActualJet.MRL(SM_actual_rocket).zAttach -= 0.01 * moveMulti
  1500.                 If SM_type = 1 Then myActualJet.cannList(SM_actual_cannon).offPosition.Z -= 0.02 * moveMulti
  1501.                 If SM_type = 2 Then myActualJet.engineList(SM_actual_engine).offPosition.Z -= 0.02 * moveMulti
  1502.             End If
  1503.             If Game.isKeyPressed(Keys.Add) Then ' move down
  1504.                 If SM_type = 0 Then myActualJet.MRL(SM_actual_rocket).zAttach += 0.01 * moveMulti
  1505.                 If SM_type = 1 Then myActualJet.cannList(SM_actual_cannon).offPosition.Z += 0.02 * moveMulti
  1506.                 If SM_type = 2 Then myActualJet.engineList(SM_actual_engine).offPosition.Z += 0.02 * moveMulti
  1507.             End If
  1508.             If Game.isKeyPressed(Keys.NumPad2) Then ' move backward
  1509.                 If SM_type = 0 Then myActualJet.MRL(SM_actual_rocket).yAttach -= 0.01 * moveMulti
  1510.                 If SM_type = 1 Then myActualJet.cannList(SM_actual_cannon).offPosition.Y -= 0.02 * moveMulti
  1511.                 If SM_type = 2 Then myActualJet.engineList(SM_actual_engine).offPosition.Y -= 0.02 * moveMulti
  1512.             End If
  1513.             If Game.isKeyPressed(Keys.NumPad8) Then ' move forward
  1514.                 If SM_type = 0 Then myActualJet.MRL(SM_actual_rocket).yAttach += 0.01 * moveMulti
  1515.                 If SM_type = 1 Then myActualJet.cannList(SM_actual_cannon).offPosition.Y += 0.02 * moveMulti
  1516.                 If SM_type = 2 Then myActualJet.engineList(SM_actual_engine).offPosition.Y += 0.02 * moveMulti
  1517.             End If
  1518.             If Game.isKeyPressed(Keys.NumPad6) Then ' move left
  1519.                 If SM_type = 0 Then myActualJet.MRL(SM_actual_rocket).xAttach -= 0.01 * moveMulti
  1520.                 If SM_type = 1 Then myActualJet.cannList(SM_actual_cannon).offPosition.X -= 0.02 * moveMulti
  1521.                 If SM_type = 2 Then myActualJet.engineList(SM_actual_engine).offPosition.X -= 0.02 * moveMulti
  1522.             End If
  1523.             If Game.isKeyPressed(Keys.NumPad4) Then ' move left
  1524.                 If SM_type = 0 Then myActualJet.MRL(SM_actual_rocket).xAttach += 0.01 * moveMulti
  1525.                 If SM_type = 1 Then myActualJet.cannList(SM_actual_cannon).offPosition.X += 0.02 * moveMulti
  1526.                 If SM_type = 2 Then myActualJet.engineList(SM_actual_engine).offPosition.X += 0.02 * moveMulti
  1527.             End If
  1528.  
  1529.             If SM_TimeWaitPTFX <= 0 Then
  1530.                 SM_TimeWaitPTFX = 20
  1531.  
  1532.                 If SM_type = 1 Then
  1533.                     If myActualJet.cannList(SM_actual_cannon).enabled Then
  1534.                         Native.Function.Call("stop_ptfx", myActualJet.cannList(SM_actual_cannon).ptfx)
  1535.                         myActualJet.cannList(SM_actual_cannon).ptfx = Native.Function.Call(Of Int32)("START_PTFX_ON_VEH", "muz_machine", _
  1536.                             myJet, myActualJet.cannList(SM_actual_cannon).offPosition.X, myActualJet.cannList(SM_actual_cannon).offPosition.Y, _
  1537.                             myActualJet.cannList(SM_actual_cannon).offPosition.Z, 0, 0, 90.0, 1.0)
  1538.                     End If
  1539.                 ElseIf SM_type = 2 Then
  1540.                     If myActualJet.engineList(SM_actual_engine).enabled Then
  1541.                         Native.Function.Call("stop_ptfx", myActualJet.engineList(SM_actual_engine).ptfx)
  1542.                         myActualJet.engineList(SM_actual_engine).ptfx = Native.Function.Call(Of Int32)("START_PTFX_ON_VEH", "muz_pistol_large", _
  1543.                             myJet, myActualJet.engineList(SM_actual_engine).offPosition.X, myActualJet.engineList(SM_actual_engine).offPosition.Y, _
  1544.                             myActualJet.engineList(SM_actual_engine).offPosition.Z, 0, 0, -90.0, 1.0)
  1545.                     End If
  1546.                 End If
  1547.             Else
  1548.                 SM_TimeWaitPTFX -= Me.Interval
  1549.             End If
  1550.  
  1551.             If camDeath.isActive AndAlso Exists(Game.DefaultCamera) Then
  1552.                 Dim tmpVec As Vector3 = camDeath.Position
  1553.                 Dim tmpZ As Double = tmpVec.Z
  1554.  
  1555.                 SM_Obj_aux.Position = camDeath.Position
  1556.                 SM_Obj_aux.Rotation = camDeath.Rotation
  1557.  
  1558.                 If Game.isGameKeyPressed(GameKey.MoveForward) Then
  1559.                     tmpVec += camDeath.Direction / 2
  1560.                 ElseIf Game.isGameKeyPressed(GameKey.MoveBackward) Then
  1561.                     tmpVec -= camDeath.Direction / 2
  1562.                 ElseIf Game.isGameKeyPressed(GameKey.MoveLeft) Then
  1563.                     tmpVec = SM_Obj_aux.GetOffsetPosition(Vector3.RelativeLeft / 4)
  1564.                 ElseIf Game.isGameKeyPressed(GameKey.MoveRight) Then
  1565.                     tmpVec = SM_Obj_aux.GetOffsetPosition(Vector3.RelativeRight / 4)
  1566.                 End If
  1567.  
  1568.                 camDeath.Position = tmpVec
  1569.  
  1570.                 tmpVec = rotateVec(camDeath.Direction, (Game.Mouse.Movement.X * 5) * -20)
  1571.                 tmpVec.Z -= Game.Mouse.Movement.Y * 2
  1572.                 camDeath.Direction = tmpVec
  1573.             End If
  1574.  
  1575.             Exit Sub
  1576.         End If
  1577.  
  1578.         If bShowPosition Then
  1579.             Dim charPos As Vector3 = Player.Character.Position
  1580.             charPos.Z = Player.Character.Position.ToGround.Z
  1581.  
  1582.             msg("Position: " & charPos.ToString & "    heading: " & Player.Character.Heading, 100)
  1583.         End If
  1584.  
  1585.         If Game.isKeyPressed(hkFlare) OrElse (controllerState.IsConnected AndAlso controllerState.IsButtonDown(Microsoft.Xna.Framework.Input.Buttons.Y)) Then
  1586.             If (timeHKFlareDown < 100) Then timeHKFlareDown += Me.Interval
  1587.         Else
  1588.             timeHKFlareDown = 0
  1589.         End If
  1590.  
  1591.  
  1592.         If timeCheckHeli <= 0 Then
  1593.             timeCheckHeli = 500
  1594.  
  1595.             checkHeli()
  1596.         Else
  1597.             timeCheckHeli -= Me.Interval
  1598.         End If
  1599.  
  1600.         If timeResetPlayerInv > 0 Then
  1601.             timeResetPlayerInv -= Me.Interval
  1602.  
  1603.             If timeResetPlayerInv <= 0 Then Player.Character.Invincible = False
  1604.         End If
  1605.  
  1606.         If (Not Player.Character.isAlive) AndAlso bPlayerWasAlive Then
  1607.             bPlayerWasAlive = False
  1608.  
  1609.             bResetPL = True
  1610.         End If
  1611.  
  1612.         bPlayerWasAlive = Player.Character.isAlive
  1613.  
  1614.         checkSpaceTrip()
  1615.  
  1616.         If timeSearchIdleJets <= 0 Then
  1617.             timeSearchIdleJets = 1000
  1618.  
  1619.             searchForOtherJets()
  1620.         Else
  1621.             timeSearchIdleJets -= Me.Interval
  1622.         End If
  1623.  
  1624.         If bWaterImpact AndAlso Player.Character.isAlive AndAlso Player.Character.isInWater Then
  1625.             If Player.Character.Velocity.Z <= -31 Then
  1626.                 Player.Character.Die()
  1627.             Else
  1628.                 Player.Character.Health += (Player.Character.Velocity.Z * 2)
  1629.  
  1630.                 Player.Character.ForceRagdoll(6000, False)
  1631.             End If
  1632.  
  1633.             bWaterImpact = False
  1634.         End If
  1635.  
  1636.         ' jet aquirement tick
  1637.         checkJetAP()
  1638.  
  1639.         ' flare tick
  1640.         If timeOutMyFlare > 0 Then timeOutMyFlare -= Me.Interval
  1641.  
  1642.         If myFlareReleased AndAlso (Not Exists(myJet) OrElse (myFlares(0).flareObj.Position.DistanceTo(myJet.Position) > 400)) Then
  1643.             'native.function.call("stop_ptfx", PTFXMyFlare)
  1644.             For Each f As Flare In myFlares
  1645.                 Native.Function.Call("stop_ptfx", f.PTFXFlare)
  1646.  
  1647.                 myFlaresResetList.Add(f)
  1648.             Next
  1649.  
  1650.             myFlareReleased = False
  1651.         End If
  1652.  
  1653.         Try
  1654.             If myFlaresResetList.Count > 0 Then
  1655.                 If timeWaitResetFlarePTFX > 0 Then
  1656.                     timeWaitResetFlarePTFX -= Me.Interval
  1657.                 Else
  1658.                     For Each f As Flare In myFlaresResetList
  1659.                         f.flareObj.AttachToVehicle(myJet, Vector3.WorldDown, Vector3.Zero)
  1660.                     Next
  1661.  
  1662.                     myFlaresResetList.Clear()
  1663.                 End If
  1664.             End If
  1665.         Catch
  1666.         End Try
  1667.  
  1668.         If bResetPL AndAlso (Player.Character.Health > 0) Then
  1669.             bResetPL = False
  1670.  
  1671.             Player.Character.Visible = True
  1672.             Player.Character.FreezePosition = False
  1673.             Game.TimeScale = 1.0
  1674.             Player.IgnoredByEveryone = False
  1675.  
  1676.             If Player.Model <> original_model Then
  1677.                 Game.FadeScreenOut(200, True)
  1678.  
  1679.                 Try
  1680.                     Wait(500)
  1681.                     Player.Model = original_model
  1682.  
  1683.                     Native.Function.Call("SET_CHAR_COMPONENT_VARIATION", Player.Character, 0, variation_0, 0)
  1684.                     Native.Function.Call("SET_CHAR_COMPONENT_VARIATION", Player.Character, 1, variation_1, 0)
  1685.                     Native.Function.Call("SET_CHAR_COMPONENT_VARIATION", Player.Character, 2, variation_2, 0)
  1686.                     Native.Function.Call("SET_CHAR_COMPONENT_VARIATION", Player.Character, 4, variation_4, 0)
  1687.                     Native.Function.Call("SET_CHAR_COMPONENT_VARIATION", Player.Character, 5, variation_5, 0)
  1688.                     Native.Function.Call("SET_CHAR_COMPONENT_VARIATION", Player.Character, 7, variation_7, 0)
  1689.                     Native.Function.Call("SET_CHAR_COMPONENT_VARIATION", Player.Character, 9, variation_9, 0)
  1690.  
  1691.                     camDeath.Deactivate()
  1692.                     camDeath.Position = Player.Character.Position
  1693.                     camDeath.Activate()
  1694.                     Wait(100)
  1695.                     camDeath.Deactivate()
  1696.                     Wait(200)
  1697.                 Catch
  1698.                 End Try
  1699.  
  1700.                 Game.FadeScreenIn(500, True)
  1701.             End If
  1702.  
  1703.             bWaterImpact = False
  1704.  
  1705.             For c As Int16 = jetList.Count - 1 To 0 Step -1
  1706.                 removeJet(c)
  1707.             Next
  1708.  
  1709.             timeLastAutoSpawnEnemies = 0
  1710.  
  1711.             For Each ap As TJetAP In TJetAPList
  1712.                 ap.resetPosition = True
  1713.  
  1714.                 If Exists(ap.createdJet) Then ap.createdJet.Delete()
  1715.  
  1716.                 resetAPJet(ap)
  1717.             Next
  1718.         End If
  1719.  
  1720.         setJet()
  1721.  
  1722.         If timeLastAutoSpawnEnemies > 0 Then timeLastAutoSpawnEnemies -= Me.Interval
  1723.  
  1724.         If Exists(myJet) AndAlso Exists(myActualJet) Then
  1725.             If timeWaitShootRocket > 0 Then timeWaitShootRocket -= Interval
  1726.             If timeWaitShootBomb > 0 Then timeWaitShootBomb -= Interval
  1727.  
  1728.             If isInJet() Then
  1729.                 Player.Character.Task.ClearAll()
  1730.  
  1731.                 If (timeWaitShootRocket <= 0) AndAlso controllerState.IsConnected AndAlso (controllerState.IsButtonDown(Microsoft.Xna.Framework.Input.Buttons.A)) Then
  1732.                     timeWaitShootRocket = 100
  1733.  
  1734.                     For Each r As MR In myActualJet.MRL
  1735.                         If r.enabled AndAlso Not r.isBomb AndAlso Not r.launched Then
  1736.                             If r.launch(planeDir() * 2.5, Exists(TJetLocked)) Then
  1737.                                 timeWaitSoundRocket = 150
  1738.  
  1739.                                 If camMode <> 4 Then sndRocket.Play() Else sndRocket2.Play()
  1740.  
  1741.                                 Native.Function.Call("stop_sound", IDsndRocketMove)
  1742.                                 Native.Function.Call("PLAY_SOUND_FROM_object", IDsndRocketMove, myActualJet.soundRocketMove, r.rocket)
  1743.                                 timeWaitSoundRocket = 150
  1744.                                 r.timeOut = 3000
  1745.                                 r.TRocketsJetLocked = TJetLocked
  1746.                                 r.THeliLocked = heliLocked
  1747.                                 Native.Function.Call("stop_ptfx", r.ptfxExpID)
  1748.  
  1749.                                 Exit For
  1750.                             End If
  1751.                         End If
  1752.                     Next
  1753.                 End If
  1754.  
  1755.                 If (timeWaitShootBomb <= 0) AndAlso controllerState.IsConnected AndAlso (controllerState.IsButtonDown(Microsoft.Xna.Framework.Input.Buttons.DPadDown)) Then
  1756.                     timeWaitShootBomb = 100
  1757.  
  1758.                     For Each r As MR In myActualJet.MRL
  1759.                         If r.enabled AndAlso r.isBomb AndAlso Not r.launched Then
  1760.                             r.launch((planeDir() / 1.5) * myJetSpeedAux() + Vector3.WorldDown * 50, False)
  1761.  
  1762.                             r.timeOut = 3000
  1763.  
  1764.                             Native.Function.Call("stop_sound", IDSndBombRelease)
  1765.                             Native.Function.Call("PLAY_SOUND_FROM_vehicle", IDSndBombRelease, myActualJet.soundBombRelease, myJet)
  1766.  
  1767.                             Exit For
  1768.                         End If
  1769.                     Next
  1770.                 End If
  1771.  
  1772.                 ' extras ON/OFF
  1773.                 For Each extra As jetExtras In myActualJet.extraList
  1774.                     If extra.extraID > -1 Then
  1775.                         If ((extra.hotkey <> Keys.None) AndAlso Game.isKeyPressed(extra.hotkey)) OrElse _
  1776.                            (extra.activateWhenFireCannon AndAlso (Game.isKeyPressed(hkShootCannon) OrElse (Game.isGameKeyPressed(GameKey.Attack) AndAlso (currWeapon = 1)))) OrElse _
  1777.                            (extra.activateWhenFireRocket AndAlso (Game.isKeyPressed(hkShootRocket) OrElse (Game.isGameKeyPressed(GameKey.Attack) AndAlso (currWeapon = 0)))) OrElse _
  1778.                            (extra.activateWhenFireBomb AndAlso (Game.isKeyPressed(hkDropBomb) OrElse (Game.isGameKeyPressed(GameKey.Attack) AndAlso (currWeapon = 2)))) OrElse _
  1779.                            (extra.activateWhenReleaseFlares AndAlso (Game.isKeyPressed(hkFlare))) Then
  1780.                             Native.Function.Call("TURN_OFF_VEHICLE_EXTRA", myJet, extra.extraID, extra.initiallyEnabled)
  1781.                             extra.timeOutToggle = extra.autoOffTime
  1782.                         ElseIf extra.autoOffTime <= 0 Then
  1783.                             Native.Function.Call("TURN_OFF_VEHICLE_EXTRA", myJet, extra.extraID, Not extra.initiallyEnabled)
  1784.                         End If
  1785.  
  1786.                         If extra.timeOutToggle > 0 Then
  1787.                             extra.timeOutToggle -= Me.Interval
  1788.  
  1789.                             If extra.timeOutToggle <= 0 Then
  1790.                                 extra.timeOutToggle = 0
  1791.  
  1792.                                 Native.Function.Call("TURN_OFF_VEHICLE_EXTRA", myJet, extra.extraID, Not extra.initiallyEnabled)
  1793.                             End If
  1794.                         End If
  1795.                     End If
  1796.                 Next
  1797.  
  1798.                 If (timeHKFlareDown >= 100) AndAlso (Game.isKeyPressed(hkFlare) OrElse _
  1799.                    (controllerState.IsConnected AndAlso controllerState.IsButtonDown(Microsoft.Xna.Framework.Input.Buttons.Y))) Then
  1800.                     For Each f As Flare In myFlares
  1801.                         If f.flareObj.isAttachedSomewhere Then
  1802.                             If (timeWaitNextRelFlare <= 0) Then
  1803.                                 f.flareObj.Detach()
  1804.                                 f.flareObj.ApplyForce(planeDir() * myJet.Speed * 2 + Vector3.WorldDown * 30)
  1805.                                 f.PTFXFlare = Native.Function.Call(Of Int32)("START_PTFX_ON_OBJ", "weap_rocket_player", f.flareObj, 0, 0, 0, 0, 0, 0, 0.5)
  1806.  
  1807.                                 myFlareReleased = True
  1808.                                 timeOutMyFlare = 3000
  1809.                                 timeWaitResetFlarePTFX = 200
  1810.  
  1811.                                 timeWaitNextRelFlare = 20
  1812.  
  1813.                                 Native.Function.Call("stop_sound", IDSndBombRelease)
  1814.                                 Native.Function.Call("PLAY_SOUND_FROM_vehicle", IDSndBombRelease, myActualJet.soundBombRelease, myJet)
  1815.                             Else
  1816.                                 timeWaitNextRelFlare -= Me.Interval
  1817.                             End If
  1818.  
  1819.                             Exit For
  1820.                         End If
  1821.                     Next
  1822.                 End If
  1823.             End If
  1824.  
  1825.             If timeShowFlareAux > 0 Then timeShowFlareAux -= Me.Interval
  1826.  
  1827.             If timeWaitSoundRocket > 0 Then timeWaitSoundRocket -= Me.Interval
  1828.  
  1829.             If Exists(camGun) Then
  1830.                 If camMode = 1 Then
  1831.                     camGun.Position = Player.Character.Position + planeDirUp() * myActualJet.cam1_up_offset + planeDir() * myActualJet.cam1_ahead_Offset
  1832.                     camGun.Direction = planeDir()
  1833.                     camGun.Rotation = myJet.Rotation
  1834.                 ElseIf camMode = 2 Then
  1835.                     camGun.Position = Player.Character.Position - planeDirUp() * myActualJet.cam2_up_offset + planeDir() * myActualJet.cam2_ahead_Offset
  1836.                     camGun.Direction = planeDir()
  1837.                     camGun.Rotation = myJet.Rotation
  1838.                 ElseIf camMode = 3 Then
  1839.                     camGun.Position = Player.Character.Position - planeDir() * myActualJet.cam3_ahead_Offset + planeDirUp() * myActualJet.cam3_up_offset
  1840.                     camGun.Direction = planeDir()
  1841.                     camGun.Rotation = myJet.Rotation
  1842.                 ElseIf camMode = 4 Then
  1843.                     camGun.Position = myJet.GetOffsetPosition(camPilotOffset)
  1844.                     Player.Character.Visible = Not camPilotHidePlayer
  1845.  
  1846.                     If bFixedCockpitCam AndAlso ((Math.Abs(Game.Mouse.Movement.X) > 0.01) OrElse (Math.Abs(Game.Mouse.Movement.Y) > 0.01) OrElse _
  1847.                        (controllerState.IsConnected AndAlso ((controllerState.ThumbSticks.Right.X <> 0) OrElse (controllerState.ThumbSticks.Right.Y <> 0)))) Then bFixedCockpitCam = False
  1848.  
  1849.                     If camPilotFixedRotation OrElse bFixedCockpitCam Then
  1850.                         camGun.Rotation = myJet.Rotation
  1851.                     Else
  1852.                         Dim tmpRot As Vector3 = camGun.Rotation
  1853.                         tmpRot.Y = myJet.Rotation.Y
  1854.  
  1855.                         camGun.Rotation = tmpRot
  1856.  
  1857.                         If Exists(Game.DefaultCamera.Direction) Then camGun.Direction = Game.DefaultCamera.Direction
  1858.                     End If
  1859.  
  1860.                     If Not camPilotHidePlayer Then
  1861.                         Dim tmpHeadDiff As Double = Game.CurrentCamera.Heading - myJet.Heading
  1862.  
  1863.                         '-300 -425
  1864.                         '61 -61
  1865.  
  1866.                         If ((tmpHeadDiff < -300) AndAlso (tmpHeadDiff > -425)) OrElse ((tmpHeadDiff < 61) AndAlso (tmpHeadDiff > -61)) Then
  1867.                             Native.Function.Call("SET_DRAW_PLAYER_COMPONENT", 7, False)
  1868.                             Native.Function.Call("SET_DRAW_PLAYER_COMPONENT", 0, False)
  1869.                             Native.Function.Call("SET_DRAW_PLAYER_COMPONENT", 9, False)
  1870.  
  1871.                             bResetFaceDraw = True
  1872.                         Else
  1873.                             Native.Function.Call("SET_DRAW_PLAYER_COMPONENT", 7, True)
  1874.                             Native.Function.Call("SET_DRAW_PLAYER_COMPONENT", 0, True)
  1875.                             Native.Function.Call("SET_DRAW_PLAYER_COMPONENT", 9, True)
  1876.                         End If
  1877.                     End If
  1878.                 ElseIf camMode = 5 Then
  1879.                     camGun.Position = myJet.Position + planeDir() * (myJet.Model.GetDimensions.Y / 1.8)
  1880.  
  1881.                     camGun.Rotation = myJet.Rotation
  1882.                 End If
  1883.  
  1884.                 If (camMode <> 4) AndAlso bResetFaceDraw Then
  1885.                     Native.Function.Call("SET_DRAW_PLAYER_COMPONENT", 7, True)
  1886.                     Native.Function.Call("SET_DRAW_PLAYER_COMPONENT", 0, True)
  1887.                     Native.Function.Call("SET_DRAW_PLAYER_COMPONENT", 9, True)
  1888.  
  1889.                     bResetFaceDraw = False
  1890.                 End If
  1891.  
  1892.                 If (camMode > 0) AndAlso Not camGun.isActive Then camGun.Activate()
  1893.             End If
  1894.  
  1895.             Try
  1896.                 For c As Int16 = myActualJet.MRLReset.Count - 1 To 0 Step -1
  1897.                     If myActualJet.MRLReset(c).timeResetPTFX > 0 Then
  1898.                         myActualJet.MRLReset(c).timeResetPTFX -= Me.Interval
  1899.                     Else
  1900.                         myActualJet.MRLReset(c).attach(myJet)
  1901.                         myActualJet.MRLReset.RemoveAt(c)
  1902.                     End If
  1903.                 Next
  1904.             Catch
  1905.             End Try
  1906.  
  1907.             For Each r As MR In myActualJet.MRL
  1908.                 If Not r.enabled Then Continue For
  1909.  
  1910.                 If Exists(r.rocket) AndAlso r.launched AndAlso Not r.bReseting Then
  1911.                     If r.propulsor_effect_size > 0 Then
  1912.                         'if r.timeResetPTFX <= 0 then
  1913.                         '   r.timeResetPTFX = 20
  1914.                         '   native.function.call("stop_ptfx", r.ptfxID)                        
  1915.                         '   r.ptfxID = native.function.call(of int32)("START_PTFX_ON_OBJ", "weap_rocket_player", r.rocket, 0, 0, 0, 0, 0, 0, r.propulsor_effect_size)
  1916.                         'else
  1917.                         '   r.timeResetPTFX -= me.interval
  1918.                         'end if
  1919.                     End If
  1920.  
  1921.                     If (r.rocket.Position.DistanceTo(myJet.Position) > 15) AndAlso _
  1922.                        (Native.Function.Call(Of Boolean)("HAS_OBJECT_COLLIDED_WITH_ANYTHING", r.rocket) OrElse (r.timeOut <= 0)) Then
  1923.                         Dim rocketPos As Vector3 = r.rocket.Position
  1924.  
  1925.                         r.ptfxExpID = Native.Function.Call(Of Int32)("start_PTFX", "exp_ship_destroy", rocketPos.X, rocketPos.Y, rocketPos.Z, 0, 0, 0, r.explosion_size)
  1926.  
  1927.                         If Not Exists(r.TRocketsJetLocked) Then
  1928.                             World.AddExplosion(rocketPos, ExplosionType.Rocket, 100.0, True, True, 1.0)
  1929.  
  1930.                             Dim bWanted As Boolean = False
  1931.  
  1932.                             For Each v As Vehicle In World.GetVehicles(rocketPos, 20.0 * r.explosion_force)
  1933.                                 If Exists(v) AndAlso (Math.Abs(v.Position.Z - rocketPos.Z) < 3) AndAlso Not v.Metadata.isAnJet AndAlso Not v.Metadata.isAnHeli Then
  1934.                                     bWanted = True
  1935.  
  1936.                                     If Not v.Model.isTrain Then
  1937.                                         Native.Function.Call("detach_car", v)
  1938.                                         v.FreezePosition = False
  1939.                                         v.ApplyForce((((v.Position - rocketPos) + Vector3.WorldUp * 3) / (v.Position.DistanceTo(rocketPos) / 4)) * r.explosion_force, _
  1940.                                             Vector3.WorldUp * 4)
  1941.  
  1942.                                         If (v.Position.DistanceTo(rocketPos) <= 15 * r.explosion_force) Then v.PetrolTankHealth = -1
  1943.                                     Else
  1944.                                         trainItem = New trains(v)
  1945.                                         trainList.Add(trainItem)
  1946.                                         v.Delete()
  1947.                                     End If
  1948.                                 End If
  1949.                             Next
  1950.                             For Each p As Ped In World.GetPeds(rocketPos, 25.0 * r.explosion_force)
  1951.                                 If Exists(p) AndAlso Not p.Metadata.IsJetPilot Then
  1952.                                     bWanted = True
  1953.                                     p.PreventRagdoll = False
  1954.                                     p.Euphoria.BodyBalance.Start(5000)
  1955.                                     p.ApplyForce((((p.Position - rocketPos) + Vector3.WorldUp * 2) / (p.Position.DistanceTo(rocketPos) / 10)) * r.explosion_force, Vector3.WorldNorth)
  1956.                                 End If
  1957.                             Next
  1958.  
  1959.                             Dim fakeTrain As GTA.Object = Nothing
  1960.  
  1961.                             For Each t As trains In trainList
  1962.                                 If t.bCreate Then
  1963.                                     fakeTrain = World.CreateObject(t.m, t.pos)
  1964.  
  1965.                                     If Exists(fakeTrain) Then
  1966.                                         t.train = fakeTrain
  1967.                                         t.train.Rotation = t.rot
  1968.                                     End If
  1969.                                 End If
  1970.                             Next
  1971.  
  1972.                             ' increase wanted level
  1973.                             If bWanted Then
  1974.                                 'player.character.WantedByPolice = true
  1975.                                 'native.function.call("ALTER_WANTED_LEVEL_NO_DROP", player, 6)
  1976.                                 'native.function.call("APPLY_WANTED_LEVEL_CHANGE_NOW", player, 6)
  1977.  
  1978.                                 If (timeLastAutoSpawnEnemies <= 0) Then
  1979.                                     For c As Int16 = 1 To 3
  1980.                                         If spawnEnemyJet(hkSpawnEnemy, True) Then
  1981.                                             Exit For
  1982.                                         Else
  1983.                                             Wait(50)
  1984.                                         End If
  1985.                                     Next
  1986.  
  1987.                                     timeLastAutoSpawnEnemies = 15000
  1988.                                 End If
  1989.                             End If
  1990.                         Else
  1991.                             If Exists(r.TRocketsJetLocked.jet) AndAlso (r.rocket.Position.DistanceTo(r.TRocketsJetLocked.jet.Position) < 10) Then
  1992.                                 If r.TRocketsJetLocked.jet.Health > 0 Then
  1993.                                     r.TRocketsJetLocked.jet.Health -= random(r.damage_against_jets - 100, r.damage_against_jets)
  1994.                                     'r.TRocketsJetLocked.jet.enginehealth -= random(r.damage_against_jets - 100, r.damage_against_jets)
  1995.                                     'r.TRocketsJetLocked.jet.petroltankhealth -= random(r.damage_against_jets - 100, r.damage_against_jets)
  1996.  
  1997.                                     r.TRocketsJetLocked.jet.EngineHealth = 1000
  1998.                                     r.TRocketsJetLocked.jet.PetrolTankHealth = 1000
  1999.  
  2000.                                     r.TRocketsJetLocked.DamagedByPlayer = True
  2001.                                 Else
  2002.                                     explodeEnemyJet(r.TRocketsJetLocked)
  2003.                                 End If
  2004.                             End If
  2005.  
  2006.                             timeLastAutoSpawnEnemies = 1000
  2007.                         End If
  2008.  
  2009.                         'r.attach(myJet)
  2010.                         r.timeResetPTFX = 200
  2011.                         Native.Function.Call("stop_ptfx", r.ptfxID)
  2012.                         r.bReseting = True
  2013.                         myActualJet.MRLReset.Add(r)
  2014.  
  2015.                         Native.Function.Call("stop_sound", IDsndRocketMove)
  2016.                     Else
  2017.                         If Not Exists(r.TRocketsJetLocked) Then
  2018.                             r.timeOut -= Me.Interval
  2019.                         Else
  2020.                             r.timeOut -= (Me.Interval / 3)
  2021.                         End If
  2022.  
  2023.                         If Not r.isBomb Then
  2024.                             Dim tmpDirection As Vector3
  2025.  
  2026.                             If Exists(r.TRocketsJetLocked) AndAlso Exists(r.TRocketsJetLocked.jet) Then
  2027.                                 If (r.TRocketsJetLocked.jet.Health < 500) AndAlso (r.rocket.Position.DistanceTo(enemyFlares(0).flareObj.Position) < 150) Then _
  2028.                                     releaseEnemyFlare(r.TRocketsJetLocked)
  2029.  
  2030.                                 Dim distTmp As Double = r.rocket.Position.DistanceTo(r.TRocketsJetLocked.jet.Position)
  2031.                                 Dim flareDist As Double = -1
  2032.  
  2033.                                 If r.TRocketsJetLocked.flareReleased Then
  2034.                                     flareDist = enemyFlares(0).flareObj.Position.DistanceTo(r.TRocketsJetLocked.jet.Position)
  2035.                                     If (flareDist > 400) Then
  2036.                                         If (r.rocket.Position.DistanceTo(enemyFlares(0).flareObj.Position) < 150) Then
  2037.                                             resetEnemyFlare(r.TRocketsJetLocked)
  2038.  
  2039.                                             For Each r2 As MR In myActualJet.MRL
  2040.                                                 If Not r2.enabled Then Continue For
  2041.  
  2042.                                                 If (r2.rocket.Position.DistanceTo(enemyFlares(0).flareObj.Position) < 150) Then r2.TRocketsJetLocked = Nothing
  2043.                                             Next
  2044.  
  2045.                                             Exit Sub
  2046.                                         Else
  2047.                                             resetEnemyFlare(r.TRocketsJetLocked)
  2048.                                         End If
  2049.                                     Else
  2050.                                         If enemyFlares(0).flareObj.Position.DistanceTo(r.rocket.Position) < 10 Then
  2051.                                             r.timeOut = 0
  2052.  
  2053.                                             'resetEnemyFlare(r.TRocketsJetLocked)
  2054.                                         End If
  2055.                                     End If
  2056.                                 End If
  2057.  
  2058.                                 If r.TRocketsJetLocked.flareReleased AndAlso (flareDist < 150) Then
  2059.                                     tmpDirection = (enemyFlares(Math.Round(enemyFlares.Count / 2)).flareObj.Position - r.rocket.Position) / (distTmp / 3)
  2060.                                 Else
  2061.                                     tmpDirection = ((r.TRocketsJetLocked.jet.Position - r.rocket.Position) / (distTmp / 3))
  2062.                                 End If
  2063.  
  2064.                                 r.final_dir = r.dir + tmpDirection * (myJetSpeedAux() * 1.5) * r.speed_multiplier
  2065.  
  2066.                                 Native.Function.Call("SET_OBJECT_INITIAL_VELOCITY", r.rocket, r.final_dir.X, r.final_dir.Y, r.final_dir.Z)
  2067.  
  2068.                                 r.fixRotation = Helper.DirectionToRotation(Vector3.Normalize(r.final_dir), 0)
  2069.  
  2070.                                 If r.rocket.Position.DistanceTo(r.TRocketsJetLocked.jet.Position) < 5 Then
  2071.                                     r.timeOut = 0
  2072.                                 End If
  2073.                             Else
  2074.                                 ' heli locked
  2075.                                 If Exists(r.THeliLocked) Then
  2076.                                     tmpDirection = ((r.THeliLocked.Position - r.rocket.Position) / (r.rocket.Position.DistanceTo(r.THeliLocked.Position) / 1.8))
  2077.  
  2078.                                     r.final_dir = r.dir + tmpDirection * (myJetSpeedAux() * 1.5) * r.speed_multiplier
  2079.  
  2080.                                     Native.Function.Call("SET_OBJECT_INITIAL_VELOCITY", r.rocket, r.final_dir.X, r.final_dir.Y, r.final_dir.Z)
  2081.  
  2082.                                     If r.rocket.Position.DistanceTo(r.THeliLocked.Position) < 80 Then
  2083.                                         For Each p As Ped In World.GetPeds(r.THeliLocked.Position, 15.0)
  2084.                                             If Exists(p) AndAlso (p.CurrentVehicle = r.THeliLocked) AndAlso Not p.Metadata.isLeavingHeli Then
  2085.                                                 p.Metadata.isLeavingHeli = True
  2086.                                                 p.Task.LeaveVehicleImmediately(r.THeliLocked)
  2087.                                                 Native.Function.Call("ON_FIRE_SCREAM", p)
  2088.                                             End If
  2089.                                         Next
  2090.                                     End If
  2091.  
  2092.                                     r.fixRotation = Helper.DirectionToRotation(Vector3.Normalize(r.final_dir), 0)
  2093.                                 Else
  2094.                                     If r.final_dir <> Vector3.Zero Then
  2095.                                         Native.Function.Call("SET_OBJECT_INITIAL_VELOCITY", r.rocket, _
  2096.                                             r.final_dir.X, r.final_dir.Y, r.final_dir.Z)
  2097.  
  2098.                                         r.fixRotation = Helper.DirectionToRotation(Vector3.Normalize(r.final_dir), 0)
  2099.                                     Else
  2100.                                         If myJet.Speed > 60 Then
  2101.                                             Native.Function.Call("SET_OBJECT_INITIAL_VELOCITY", r.rocket, _
  2102.                                                 r.dir.X * (myJet.Speed * 1.4) * r.speed_multiplier, _
  2103.                                                 r.dir.Y * (myJet.Speed * 1.4) * r.speed_multiplier, _
  2104.                                                 r.dir.Z * (myJet.Speed * 1.4) * r.speed_multiplier)
  2105.                                         Else
  2106.                                             Native.Function.Call("SET_OBJECT_INITIAL_VELOCITY", r.rocket, _
  2107.                                                 r.dir.X * 50 * r.speed_multiplier, _
  2108.                                                 r.dir.Y * 50 * r.speed_multiplier, _
  2109.                                                 r.dir.Z * 50 * r.speed_multiplier)
  2110.                                         End If
  2111.  
  2112.                                         r.fixRotation = Helper.DirectionToRotation(Vector3.Normalize(r.dir), 0)
  2113.                                     End If
  2114.                                 End If
  2115.                             End If
  2116.                         Else
  2117.                             Native.Function.Call("SET_OBJECT_INITIAL_VELOCITY", r.rocket, _
  2118.                                 r.dir.X * r.speed_multiplier, _
  2119.                                 r.dir.Y * r.speed_multiplier, _
  2120.                                 r.dir.Z * r.speed_multiplier)
  2121.  
  2122.                             r.fixRotation = Helper.DirectionToRotation(r.dir, 0)
  2123.                         End If
  2124.                     End If
  2125.  
  2126.                     r.rocket.Rotation = r.fixRotation
  2127.  
  2128.                     If Native.Function.Call(Of Boolean)("IS_OBJECT_IN_WATER", r.rocket) Then r.timeOut = 0
  2129.  
  2130.                     If Exists(camGun) Then
  2131.                         If r.launched AndAlso Game.isGameKeyPressed(GameKey.Aim) Then
  2132.                             bRocketCamON = True
  2133.  
  2134.                             camGun.Position = r.rocket.Position
  2135.                             camGun.Rotation = r.rocket.Rotation
  2136.  
  2137.                             If Exists(r.TRocketsJetLocked) OrElse Exists(r.THeliLocked) Then
  2138.                                 camGun.Direction = r.final_dir
  2139.                             Else
  2140.                                 camGun.Direction = r.rocket.Direction
  2141.                             End If
  2142.  
  2143.                             If Not camGun.isActive Then camGun.Activate()
  2144.                         ElseIf (camMode = 0) AndAlso camGun.isActive Then
  2145.                             camGun.Deactivate()
  2146.                             Player.Character.Visible = True
  2147.  
  2148.                             bRocketCamON = False
  2149.                         End If
  2150.                     End If
  2151.                 End If
  2152.             Next
  2153.  
  2154.             If Not bExplodeMyJet And Player.Character.Health > 0 Then bExplodeMyJet = True
  2155.  
  2156.             If Exists(myJet) AndAlso (myJet.Speed > 30) AndAlso Native.Function.Call(Of Boolean)("IS_CAR_IN_WATER", myJet) Then
  2157.                 explodeMyJet()
  2158.             End If
  2159.  
  2160.             If (Player.Character.CurrentVehicle <> myJet) Then
  2161.                 Dim vecGround As Vector3 = World.GetGroundPosition(myJet.Position, GroundType.Highest)
  2162.  
  2163.                 If (vecGround.DistanceTo(myJet.Position) > 30) Then
  2164.                 '   if not myJet.metadata.falling then
  2165.                 '       myJet.metadata.falling = true
  2166.                 '       myJet.applyforce(vector3.worlddown, vector3.worldeast * 3)
  2167.                 '   end if
  2168.  
  2169.                     If (actualJetSpeed > 40) Then actualJetSpeed -= 0.2
  2170.  
  2171.                     If actualJetSpeed > 80 Then
  2172.                         Native.Function.Call("SET_CAR_FORWARD_SPEED", myJet, actualJetSpeed)
  2173.                     Else
  2174.                         myJet.ApplyForce(Vector3.WorldDown / 2)
  2175.                     End If
  2176.  
  2177.                     If (myJet.Rotation.X > -5) Then
  2178.                         myJet.ApplyForce(Vector3.WorldDown / 10, Vector3.WorldNorth / 20)
  2179.                     End If
  2180.                 End If
  2181.  
  2182.                 If jetList.Count > 0 Then
  2183.                     For c As Int16 = jetList.Count - 1 To 0 Step -1
  2184.                         jetList(c).timeRemove = 0
  2185.                     Next
  2186.                 End If
  2187.             Else
  2188.                 ' flaps helper
  2189.                 If bFlapsHelpMode Then
  2190.                     Dim tmpJet As Vehicle = myJet
  2191.  
  2192.                     If Exists(myFakeJet) AndAlso myActualJet.use_fake_jet Then tmpJet = myFakeJet
  2193.  
  2194.                     If Game.isKeyPressed(Keys.NumPad0) Then Native.Function.Call("open_car_door", tmpJet, 0) Else Native.Function.Call("shut_car_door", tmpJet, 0)
  2195.                     If Game.isKeyPressed(Keys.NumPad1) Then Native.Function.Call("open_car_door", tmpJet, 1) Else Native.Function.Call("shut_car_door", tmpJet, 1)
  2196.                     If Game.isKeyPressed(Keys.NumPad2) Then Native.Function.Call("open_car_door", tmpJet, 2) Else Native.Function.Call("shut_car_door", tmpJet, 2)
  2197.                     If Game.isKeyPressed(Keys.NumPad3) Then Native.Function.Call("open_car_door", tmpJet, 3) Else Native.Function.Call("shut_car_door", tmpJet, 3)
  2198.                     If Game.isKeyPressed(Keys.NumPad4) Then Native.Function.Call("open_car_door", tmpJet, 4) Else Native.Function.Call("shut_car_door", tmpJet, 4)
  2199.                     If Game.isKeyPressed(Keys.NumPad5) Then Native.Function.Call("open_car_door", tmpJet, 5) Else Native.Function.Call("shut_car_door", tmpJet, 5)
  2200.                 End If
  2201.  
  2202.                 If myJet.Speed > 40 Then
  2203.                     If Game.isKeyPressed(hkTurnLeft) OrElse Game.isKeyPressed(hkTurnRight) OrElse Game.isKeyPressed(hkRollLeft) OrElse Game.isKeyPressed(hkRollRight) _
  2204.                        OrElse Game.isKeyPressed(hkUp) OrElse Game.isKeyPressed(hkDown) OrElse tmpTurningLeft OrElse tmpTurningRight Then
  2205.                         If moveForceMultAux < 1 Then
  2206.                             moveForceMultAux += 0.1
  2207.                         Else
  2208.                             moveForceMultAux = 1
  2209.                         End If
  2210.                     Else
  2211.                         moveForceMultAux = 0.1
  2212.                     End If
  2213.  
  2214.                     If Game.isKeyPressed(hkTurnLeft) OrElse tmpTurningLeft Then myJet.ApplyForceRelative(Vector3.RelativeFront / 3, Vector3.WorldEast * myActualJet.moveLeftForce * moveForceMultAux)
  2215.                     If Game.isKeyPressed(hkTurnRight) OrElse tmpTurningRight Then myJet.ApplyForceRelative(Vector3.RelativeFront / 3, Vector3.WorldWest * myActualJet.moveRightForce * moveForceMultAux)
  2216.                     If Game.isKeyPressed(hkRollLeft) Then myJet.ApplyForceRelative(Vector3.WorldUp / 10, Vector3.WorldEast * 7 * myActualJet.rollLeftForce * moveForceMultAux)
  2217.                     If Game.isKeyPressed(hkRollRight) Then myJet.ApplyForceRelative(Vector3.WorldUp / 10, Vector3.WorldWest * 7 * myActualJet.rollRightForce * moveForceMultAux)
  2218.                     If Game.isKeyPressed(hkUp) Then myJet.ApplyForceRelative(Vector3.RelativeFront, Vector3.WorldDown * 2 * myActualJet.moveUpForce * moveForceMultAux)
  2219.                     If Game.isKeyPressed(hkDown) Then myJet.ApplyForceRelative(Vector3.RelativeFront, Vector3.WorldUp * 2 * myActualJet.moveDownForce * moveForceMultAux)
  2220.                 ElseIf (myJet.Speed < 10) AndAlso (groundDist < 8) Then
  2221.                     'If Game.isKeyPressed(hkTurnLeft) OrElse Game.isKeyPressed(hkTurnRight) OrElse Game.isKeyPressed(hkRollLeft) OrElse Game.isKeyPressed(hkRollRight) _
  2222.                     '   OrElse Game.isKeyPressed(hkUp) OrElse Game.isKeyPressed(hkDown) Then
  2223.                     If tmpTurningLeft OrElse tmpTurningRight OrElse tmpRollingLeft OrElse tmpRollingRight OrElse tmpGoingUp OrElse tmpGoingDown Then
  2224.                         If moveForceMultAux < 1 Then
  2225.                             moveForceMultAux += 0.1
  2226.                         Else
  2227.                             moveForceMultAux = 1
  2228.                         End If
  2229.                     Else
  2230.                         moveForceMultAux = 0.1
  2231.                     End If
  2232.  
  2233.                     'If Game.isKeyPressed(hkTurnLeft) Then myJet.ApplyForceRelative(Vector3.RelativeFront / 10, Vector3.WorldEast * myActualJet.moveLeftForce * moveForceMultAux * 1.5)
  2234.                     'If Game.isKeyPressed(hkTurnRight) Then myJet.ApplyForceRelative(Vector3.RelativeFront / 10, Vector3.WorldWest * myActualJet.moveRightForce * moveForceMultAux * 1.5)
  2235.                     'If Game.isKeyPressed(hkDown) Then myJet.ApplyForceRelative(Vector3.RelativeFront / 10, Vector3.WorldUp * 2 * myActualJet.moveDownForce * moveForceMultAux)
  2236.                     If tmpTurningLeft Then myJet.ApplyForceRelative(Vector3.RelativeFront / 10, Vector3.WorldEast * myActualJet.moveLeftForce * moveForceMultAux * 3)
  2237.                     If tmpTurningRight Then myJet.ApplyForceRelative(Vector3.RelativeFront / 10, Vector3.WorldWest * myActualJet.moveRightForce * moveForceMultAux * 3)
  2238.                     If tmpGoingDown Then myJet.ApplyForceRelative(Vector3.RelativeFront / 10, Vector3.WorldUp * 2 * myActualJet.moveDownForce * moveForceMultAux)
  2239.  
  2240.                     If myJet.Speed > 5 AndAlso (tmpTurningLeft OrElse tmpTurningRight) Then
  2241.                         If tmpTurningLeft Then myJet.ApplyForceRelative(Vector3.RelativeBack / 10, Vector3.WorldEast * myActualJet.moveLeftForce * moveForceMultAux * -3)
  2242.                         If tmpTurningRight Then myJet.ApplyForceRelative(Vector3.RelativeBack / 10, Vector3.WorldWest * myActualJet.moveRightForce * moveForceMultAux * -3)
  2243.                     End If
  2244.  
  2245.                     'If Game.isKeyPressed(hkTurnLeft) OrElse Game.isKeyPressed(hkTurnRight) Then bMustStop = False
  2246.                     If tmpTurningLeft OrElse tmpTurningRight Then bMustStop = False
  2247.                 End If
  2248.  
  2249.                 ' max jet speed :)
  2250.                 'If ((Game.isGameKeyPressed(GameKey.MoveForward) AndAlso (lastXBoxInput <= 0)) OrElse _
  2251.                 '   (controllerState.IsConnected AndAlso (controllerState.Triggers.Right <> 0))) AndAlso _
  2252.                 If tmpAccelerating AndAlso
  2253.                    (groundDist < 700) Then
  2254.                     bMustStop = False
  2255.  
  2256.                     If actualJetSpeed < 80 Then
  2257.                         If groundDist > 10 Then
  2258.                             actualJetSpeed += 0.1
  2259.  
  2260.                             actualJetSpeed += (actualJetSpeed / 200)
  2261.  
  2262.                             If Game.isKeyPressed(Keys.Space) Then actualJetSpeed += (actualJetSpeed / 50)
  2263.                         Else
  2264.                             actualJetSpeed = myJet.Speed
  2265.                         End If
  2266.                     ElseIf actualJetSpeed < myActualJet.maxJetSpeed Then
  2267.                         actualJetSpeed += ((myActualJet.maxJetSpeed + 100) / actualJetSpeed / 5)
  2268.                     End If
  2269.                 'ElseIf (Game.isGameKeyPressed(GameKey.MoveBackward) AndAlso (lastXBoxInput <= 0)) OrElse _
  2270.                 '       (controllerState.IsConnected AndAlso (controllerState.Triggers.Left <> 0)) Then
  2271.                 ElseIf tmpBraking Then
  2272.                     If actualJetSpeed > 60 Then actualJetSpeed -= 0.8
  2273.                 Else
  2274.                     If actualJetSpeed > 80 Then actualJetSpeed -= 0.1
  2275.                 End If
  2276.  
  2277.                 If (actualJetSpeed > 80) Then
  2278.                     If (actualJetSpeed > (myActualJet.maxJetSpeed / 2)) AndAlso _
  2279.                        (tmpGoingDown OrElse tmpGoingUp) Then _
  2280.                         actualJetSpeed -= (((myActualJet.maxJetSpeed + 100) / actualJetSpeed / 5) * 2)
  2281.                        '(((lastXBoxInput <= 0) AndAlso (Game.isKeyPressed(Keys.ShiftKey) OrElse Game.isKeyPressed(Keys.ControlKey))) OrElse
  2282.                        '(controllerState.IsConnected AndAlso (controllerState.ThumbSticks.Left.Length <> 0))) Then _
  2283.                        ' actualJetSpeed -= (((myActualJet.maxJetSpeed + 100) / actualJetSpeed / 5) * 2)
  2284.                 End If
  2285.  
  2286.                 If groundDist > 6 Then
  2287.                     Native.Function.Call("SET_CAR_FORWARD_SPEED", myJet, actualJetSpeed)
  2288.                 'ElseIf (((lastXBoxInput <= 0) AndAlso Game.isGameKeyPressed(GameKey.MoveBackward)) OrElse _
  2289.                 '       (controllerState.IsConnected AndAlso (controllerState.ThumbSticks.Left.Y < 0))) AndAlso _
  2290.                 '       (groundDist < 8) Then
  2291.                 ElseIf tmpBraking AndAlso _
  2292.                        (groundDist < 8) Then
  2293.                     myJet.ApplyForceRelative(Vector3.RelativeBack * (myJet.Speed * 0.01))
  2294.  
  2295.                     actualJetSpeed = 0
  2296.  
  2297.                     If myJet.Speed < 2 Then
  2298.  
  2299.                         bMustStop = True
  2300.                     End If
  2301.                 End If
  2302.  
  2303.                 If bMustStop Then Native.Function.Call("SET_CAR_FORWARD_SPEED", myJet, 0)
  2304.  
  2305.                 ' water effect :)
  2306.                 If timeWaterEffect <= 0 Then
  2307.                     timeWaterEffect = 20
  2308.  
  2309.                     If (myJet.Speed > 40) AndAlso (Player.Character.Position.Z < 50) Then
  2310.                         Dim tmpGroundPos As Vector3 = World.GetGroundPosition(Player.Character.Position, GroundType.Highest)
  2311.                         ' this groundPos method will fail when you fly under bridges :(, because the game/scripthook detects the bridge as the ground and not the water
  2312.                         ' because of this behavior we need this timeKeepWaterEffect to help keep the effect while we pass under the bridges :)
  2313.                         If (timeKeepWaterEffect > 0) OrElse (tmpGroundPos.Z <= 0) Then
  2314.                             tmpGroundPos -= (planeDir() * (60 - (50 - myJet.Position.Z)))
  2315.  
  2316.                             tmpGroundPos = tmpGroundPos.ToGround
  2317.  
  2318.                             Native.Function.Call("stop_ptfx", PTFXWater)
  2319.  
  2320.                             If tmpGroundPos.Z > 5 Then tmpGroundPos.Z = 0
  2321.  
  2322.                             PTFXWater = Native.Function.Call(Of Int32)("start_ptfx", "water_fountain_castle_up", tmpGroundPos.X, tmpGroundPos.Y, tmpGroundPos.Z - 10, 0, 0, 0, _
  2323.                                 ((50 - Player.Character.Position.Z) / 20))
  2324.  
  2325.                             If (tmpGroundPos.Z <= 0) Then
  2326.                                 timeKeepWaterEffect = 500
  2327.                             Else
  2328.                                 timeKeepWaterEffect -= Me.Interval
  2329.                             End If
  2330.                         End If
  2331.                     Else
  2332.                         If PTFXWater <> 0 Then
  2333.                             Native.Function.Call("stop_ptfx", PTFXWater)
  2334.                             PTFXWater = 0
  2335.                         End If
  2336.                     End If
  2337.                 Else
  2338.                     timeWaterEffect -= Me.Interval
  2339.                 End If
  2340.  
  2341.                 'groundDist = Math.Round(Player.Character.Position.Z, 0)
  2342.                 groundDist = Math.Round(Math.Abs(World.GetGroundPosition(Player.Character.Position, GroundType.Highest).Z - Player.Character.Position.Z))
  2343.  
  2344.                 JetLowHealthEffects()
  2345.  
  2346.                 EnemyJetTick()
  2347.  
  2348.                 ' reset other health values
  2349.                 If myJet.Health > 0 Then
  2350.                     myJet.EngineHealth = 1000
  2351.                     myJet.PetrolTankHealth = 1000
  2352.                 Else
  2353.                     explodeMyJet()
  2354.                 End If
  2355.  
  2356.                 ' some extra gravity force
  2357.                 'if game.isgamekeypressed(gamekey.movebackward) then _
  2358.                 '   myJet.applyforce(vector3.worlddown * ((80 - myJet.speed) * 0.005))
  2359.  
  2360.                 ' move wings               
  2361.                 If Not bFlapsHelpMode Then
  2362.                     Dim tmpJet As Vehicle = myJet
  2363.  
  2364.                     If Exists(myFakeJet) AndAlso myActualJet.use_fake_jet Then tmpJet = myFakeJet
  2365.  
  2366.                     If (myActualJet.maxWingAngle > 0) AndAlso (myActualJet.left_wing_id > -1) AndAlso (myActualJet.right_wing_id > -1) Then
  2367.                         'If Game.isGameKeyPressed(GameKey.MoveForward) AndAlso (myJet.Speed > 60) Then
  2368.                         If tmpAccelerating AndAlso (myJet.Speed > 60) Then
  2369.                             If myActualJet.wingsAngle > 1 Then myActualJet.wingsAngle -= 0.1
  2370.                         Else
  2371.                             If myActualJet.wingsAngle < myActualJet.maxWingAngle Then myActualJet.wingsAngle += 0.3
  2372.                         End If
  2373.  
  2374.                         Native.Function.Call("CONTROL_CAR_DOOR", tmpJet, myActualJet.left_wing_id, True, myActualJet.wingsAngle * (3.14 / 180)) ' wing 1cockpit_id
  2375.                         Native.Function.Call("CONTROL_CAR_DOOR", tmpJet, myActualJet.right_wing_id, True, myActualJet.wingsAngle * (3.14 / 180)) ' wing 2
  2376.                     End If
  2377.  
  2378.                     ' move flaps
  2379.                     If (myActualJet.idleFlapsAngle > 0) AndAlso (myActualJet.minFlapsAngle > -1) AndAlso (myActualJet.maxFlapsAngle > 0) AndAlso (myActualJet.left_flap_id > -1) AndAlso (myActualJet.right_flap_id > -1) Then
  2380.                         'If Game.isGameKeyPressed(GameKey.MoveLeft) OrElse Game.isKeyPressed(hkRollLeft) Then
  2381.                         If tmpRollingLeft Then
  2382.                             Native.Function.Call("CONTROL_CAR_DOOR", tmpJet, myActualJet.left_flap_id, True, myActualJet.minFlapsAngle * (3.14 / 180)) ' flap 1
  2383.                             If myActualJet.right_flap_id <> myActualJet.left_flap_id Then Native.Function.Call("CONTROL_CAR_DOOR", tmpJet, myActualJet.right_flap_id, True, myActualJet.maxFlapsAngle * (3.14 / 180)) ' flap 2
  2384.                         'ElseIf Game.isGameKeyPressed(GameKey.MoveRight) OrElse Game.isKeyPressed(hkRollRight) Then
  2385.                         ElseIf tmpRollingRight Then
  2386.                             Native.Function.Call("CONTROL_CAR_DOOR", tmpJet, myActualJet.left_flap_id, True, myActualJet.maxFlapsAngle * (3.14 / 180)) ' flap 1
  2387.                             If myActualJet.right_flap_id <> myActualJet.left_flap_id Then Native.Function.Call("CONTROL_CAR_DOOR", tmpJet, myActualJet.right_flap_id, True, myActualJet.minFlapsAngle * (3.14 / 180)) ' flap 2
  2388.                         'ElseIf Game.isKeyPressed(hkJetMoveDown) OrElse Game.isKeyPressed(hkDown) Then
  2389.                         ElseIf tmpGoingDown Then
  2390.                             Native.Function.Call("CONTROL_CAR_DOOR", tmpJet, myActualJet.left_flap_id, True, myActualJet.maxFlapsAngle * (3.14 / 180)) ' flap 1
  2391.                             If myActualJet.right_flap_id <> myActualJet.left_flap_id Then Native.Function.Call("CONTROL_CAR_DOOR", tmpJet, myActualJet.right_flap_id, True, myActualJet.maxFlapsAngle * (3.14 / 180)) ' flap 2
  2392.                         'ElseIf Game.isKeyPressed(hkJetMoveUp) OrElse Game.isKeyPressed(hkUp) Then
  2393.                         ElseIf tmpGoingUp Then
  2394.                             Native.Function.Call("CONTROL_CAR_DOOR", tmpJet, myActualJet.left_flap_id, True, myActualJet.minFlapsAngle * (3.14 / 180)) ' flap 1
  2395.                             If myActualJet.right_flap_id <> myActualJet.left_flap_id Then Native.Function.Call("CONTROL_CAR_DOOR", tmpJet, myActualJet.right_flap_id, True, myActualJet.minFlapsAngle * (3.14 / 180)) ' flap 2
  2396.                         Else
  2397.                             Native.Function.Call("CONTROL_CAR_DOOR", tmpJet, myActualJet.left_flap_id, True, myActualJet.idleFlapsAngle * (3.14 / 180)) ' flap 1
  2398.                             If myActualJet.right_flap_id <> myActualJet.left_flap_id Then Native.Function.Call("CONTROL_CAR_DOOR", tmpJet, myActualJet.right_flap_id, True, myActualJet.idleFlapsAngle * (3.14 / 180)) ' flap 2
  2399.                         End If
  2400.                     End If
  2401.  
  2402.                     ' move rudder
  2403.                     If (myActualJet.rudder_idle_angle > 0) AndAlso (myActualJet.rudder_min_angle > -1) AndAlso (myActualJet.rudder_max_angle > 0) Then
  2404.                         'If Game.isGameKeyPressed(GameKey.MoveLeft) OrElse Game.isKeyPressed(hkTurnLeft) Then
  2405.                         If tmpRollingLeft OrElse tmpTurningLeft Then
  2406.                             If (myActualJet.rudder_1_id <> -1) Then Native.Function.Call("CONTROL_CAR_DOOR", tmpJet, myActualJet.rudder_1_id, True, myActualJet.rudder_min_angle * (3.14 / 180))
  2407.                             If (myActualJet.rudder_2_id <> -1) Then Native.Function.Call("CONTROL_CAR_DOOR", tmpJet, myActualJet.rudder_2_id, True, myActualJet.rudder_min_angle * (3.14 / 180))
  2408.                         'ElseIf Game.isGameKeyPressed(GameKey.MoveRight) OrElse Game.isKeyPressed(hkTurnRight) Then
  2409.                         ElseIf tmpRollingRight OrElse tmpTurningRight Then
  2410.                             If (myActualJet.rudder_1_id <> -1) Then Native.Function.Call("CONTROL_CAR_DOOR", tmpJet, myActualJet.rudder_1_id, True, myActualJet.rudder_max_angle * (3.14 / 180))
  2411.                             If (myActualJet.rudder_2_id <> -1) Then Native.Function.Call("CONTROL_CAR_DOOR", tmpJet, myActualJet.rudder_2_id, True, myActualJet.rudder_max_angle * (3.14 / 180))
  2412.                         Else
  2413.                             If (myActualJet.rudder_1_id <> -1) Then Native.Function.Call("CONTROL_CAR_DOOR", tmpJet, myActualJet.rudder_1_id, True, myActualJet.rudder_idle_angle * (3.14 / 180))
  2414.                             If (myActualJet.rudder_2_id <> -1) Then Native.Function.Call("CONTROL_CAR_DOOR", tmpJet, myActualJet.rudder_2_id, True, myActualJet.rudder_idle_angle * (3.14 / 180))
  2415.                         End If
  2416.                     End If
  2417.  
  2418.                     ' move elevator
  2419.                     If (myActualJet.elevator_idle_angle > 0) AndAlso (myActualJet.elevator_min_angle > -1) AndAlso (myActualJet.elevator_max_angle > 0) Then
  2420.                         'If Game.isGameKeyPressed(GameKey.MoveLeft) OrElse Game.isKeyPressed(hkTurnLeft) Then
  2421.                         If tmpRollingLeft OrElse tmpTurningLeft Then
  2422.                             If (myActualJet.elevator_1_id <> -1) Then Native.Function.Call("CONTROL_CAR_DOOR", tmpJet, myActualJet.elevator_1_id, True, myActualJet.elevator_min_angle * (3.14 / 180))
  2423.                             If (myActualJet.elevator_2_id <> -1) Then Native.Function.Call("CONTROL_CAR_DOOR", tmpJet, myActualJet.elevator_2_id, True, myActualJet.elevator_min_angle * (3.14 / 180))
  2424.                         'ElseIf Game.isGameKeyPressed(GameKey.MoveRight) OrElse Game.isKeyPressed(hkTurnRight) Then
  2425.                         ElseIf tmpRollingRight OrElse tmpTurningRight Then
  2426.                             If (myActualJet.elevator_1_id <> -1) Then Native.Function.Call("CONTROL_CAR_DOOR", tmpJet, myActualJet.elevator_1_id, True, myActualJet.elevator_max_angle * (3.14 / 180))
  2427.                             If (myActualJet.elevator_2_id <> -1) Then Native.Function.Call("CONTROL_CAR_DOOR", tmpJet, myActualJet.elevator_2_id, True, myActualJet.elevator_max_angle * (3.14 / 180))
  2428.                         Else
  2429.                             If (myActualJet.elevator_1_id <> -1) Then Native.Function.Call("CONTROL_CAR_DOOR", tmpJet, myActualJet.elevator_1_id, True, myActualJet.elevator_idle_angle * (3.14 / 180))
  2430.                             If (myActualJet.elevator_2_id <> -1) Then Native.Function.Call("CONTROL_CAR_DOOR", tmpJet, myActualJet.elevator_2_id, True, myActualJet.elevator_idle_angle * (3.14 / 180))
  2431.                         End If
  2432.                     End If
  2433.  
  2434.                     ' move gears
  2435.                     If (myActualJet.back_gears_r_id > -1) AndAlso (myActualJet.back_gears_l_id > -1) AndAlso (myActualJet.front_gears_r_id > -1) AndAlso (myActualJet.front_gears_l_id > -1) AndAlso _
  2436.                        (myActualJet.gears_closed_angle <> -100) AndAlso (myActualJet.gears_open_angle <> -100) Then
  2437.                         'If (tmpJet.Position.DistanceTo(World.GetGroundPosition(tmpJet.Position, GroundType.Lowest)) < 50) OrElse Game.isGameKeyPressed(GameKey.MoveBackward) Then
  2438.                         If (tmpJet.isOnAllWheels) OrElse (tmpJet.Position.DistanceTo(World.GetGroundPosition(tmpJet.Position, GroundType.Lowest)) < 50) OrElse tmpBraking Then
  2439.                             If timeWaitCloseGears <= 0 Then
  2440.                                 Native.Function.Call("CONTROL_CAR_DOOR", tmpJet, myActualJet.front_gears_r_id, True, myActualJet.gears_closed_angle * (3.14 / 180)) ' front gears
  2441.                                 Native.Function.Call("CONTROL_CAR_DOOR", tmpJet, myActualJet.front_gears_l_id, True, myActualJet.gears_closed_angle * (3.14 / 180)) ' front gears
  2442.                                 Native.Function.Call("CONTROL_CAR_DOOR", tmpJet, myActualJet.back_gears_r_id, True, myActualJet.gears_closed_angle * (3.14 / 180)) ' back gears
  2443.                                 Native.Function.Call("CONTROL_CAR_DOOR", tmpJet, myActualJet.back_gears_l_id, True, myActualJet.gears_closed_angle * (3.14 / 180)) ' back gears
  2444.  
  2445.                                 timeWaitOpenGears = 1000
  2446.                             Else
  2447.                                 timeWaitCloseGears -= Me.Interval
  2448.  
  2449.                                 Native.Function.Call("CONTROL_CAR_DOOR", tmpJet, myActualJet.front_gears_r_id, True, myActualJet.gears_open_angle * (3.14 / 180)) ' front gears
  2450.                                 Native.Function.Call("CONTROL_CAR_DOOR", tmpJet, myActualJet.front_gears_l_id, True, myActualJet.gears_open_angle * (3.14 / 180)) ' front gears
  2451.                                 Native.Function.Call("CONTROL_CAR_DOOR", tmpJet, myActualJet.back_gears_r_id, True, myActualJet.gears_open_angle * (3.14 / 180)) ' back gears
  2452.                                 Native.Function.Call("CONTROL_CAR_DOOR", tmpJet, myActualJet.back_gears_l_id, True, myActualJet.gears_open_angle * (3.14 / 180)) ' back gears
  2453.                             End If
  2454.                         Else
  2455.                             If timeWaitOpenGears <= 0 Then
  2456.                                 Native.Function.Call("CONTROL_CAR_DOOR", tmpJet, myActualJet.front_gears_r_id, True, myActualJet.gears_open_angle * (3.14 / 180)) ' front gears
  2457.                                 Native.Function.Call("CONTROL_CAR_DOOR", tmpJet, myActualJet.front_gears_l_id, True, myActualJet.gears_open_angle * (3.14 / 180)) ' front gears
  2458.                                 Native.Function.Call("CONTROL_CAR_DOOR", tmpJet, myActualJet.back_gears_r_id, True, myActualJet.gears_open_angle * (3.14 / 180)) ' back gears
  2459.                                 Native.Function.Call("CONTROL_CAR_DOOR", tmpJet, myActualJet.back_gears_l_id, True, myActualJet.gears_open_angle * (3.14 / 180)) ' back gears
  2460.  
  2461.                                 timeWaitCloseGears = 1000
  2462.                             Else
  2463.                                 timeWaitOpenGears -= Me.Interval
  2464.  
  2465.                                 Native.Function.Call("CONTROL_CAR_DOOR", tmpJet, myActualJet.front_gears_r_id, True, myActualJet.gears_closed_angle * (3.14 / 180)) ' front gears
  2466.                                 Native.Function.Call("CONTROL_CAR_DOOR", tmpJet, myActualJet.front_gears_l_id, True, myActualJet.gears_closed_angle * (3.14 / 180)) ' front gears
  2467.                                 Native.Function.Call("CONTROL_CAR_DOOR", tmpJet, myActualJet.back_gears_r_id, True, myActualJet.gears_closed_angle * (3.14 / 180)) ' back gears
  2468.                                 Native.Function.Call("CONTROL_CAR_DOOR", tmpJet, myActualJet.back_gears_l_id, True, myActualJet.gears_closed_angle * (3.14 / 180)) ' back gears
  2469.                             End If
  2470.                         End If
  2471.                     End If
  2472.                 End If
  2473.  
  2474.                 For Each j As TJet In jetList
  2475.                     If (j.timeRemove <> -1000) OrElse Not Exists(j.jet) OrElse Not Exists(j.p) Then Continue For
  2476.  
  2477.                     If Not j.isMP AndAlso (Not Exists(j.jet) OrElse Not Exists(j.p)) Then
  2478.                         j.timeRemove = 0
  2479.  
  2480.                         Continue For
  2481.                     End If
  2482.  
  2483.                     If j.jet.Health > 0 Then
  2484.                         j.jet.EngineHealth = 1000
  2485.                         j.jet.PetrolTankHealth = 1000
  2486.                     Else
  2487.                         explodeEnemyJet(j)
  2488.                     End If
  2489.  
  2490.                     For Each eng As engine In j.engines
  2491.                         Native.Function.Call("stop_ptfx", eng.ptfx)
  2492.  
  2493.                         eng.ptfx = Native.Function.Call(Of Int32)("START_PTFX_ON_VEH", "muz_pistol_large", _
  2494.                             j.jet, eng.offPosition.X, eng.offPosition.Y, eng.offPosition.Z, 0, 0, -90.0, 2.0)
  2495.  
  2496.                         eng.engLight.Intensity = j.jet.Position.DistanceTo(Player.Character.Position)
  2497.                         'eng.engLight.position = eng.attachPoint.position
  2498.                         eng.engLight.Position = j.jet.GetOffsetPosition(eng.offPosition)
  2499.                     Next
  2500.  
  2501.                     ' flaps/gears
  2502.                     If j.jet.Position.DistanceTo(Player.Character.Position) < 250 Then
  2503.                         If (j.back_gear_l <> -1) AndAlso (j.gears_closed_angle <> -100) Then Native.Function.Call("CONTROL_CAR_DOOR", j.jet, j.back_gear_l, True, j.gears_closed_angle * (3.14 / 180))
  2504.                         If (j.back_gear_r <> -1) AndAlso (j.gears_closed_angle <> -100) Then Native.Function.Call("CONTROL_CAR_DOOR", j.jet, j.back_gear_r, True, j.gears_closed_angle * (3.14 / 180))
  2505.                         If (j.front_gear_l <> -1) AndAlso (j.gears_closed_angle <> -100) Then Native.Function.Call("CONTROL_CAR_DOOR", j.jet, j.front_gear_l, True, j.gears_closed_angle * (3.14 / 180))
  2506.                         If (j.front_gear_r <> -1) AndAlso (j.gears_closed_angle <> -100) Then Native.Function.Call("CONTROL_CAR_DOOR", j.jet, j.front_gear_r, True, j.gears_closed_angle * (3.14 / 180))
  2507.                         If j.flaps_r <> -1 Then Native.Function.Call("CONTROL_CAR_DOOR", j.jet, j.flaps_r, True, j.flap_idle_angle * (3.14 / 180))
  2508.                         If j.flaps_l <> -1 Then Native.Function.Call("CONTROL_CAR_DOOR", j.jet, j.flaps_l, True, j.flap_idle_angle * (3.14 / 180))
  2509.                     End If
  2510.  
  2511.                     If isInJet() Then
  2512.                         If Not j.isMP Then
  2513.                             If (j.timeWait <= 0) Then
  2514.                                 j.timeWait = 250
  2515.  
  2516.                                 ' if we are closer to the enemy jet than the enemy jet + his jet direction it means that we can pursuit him
  2517.                                 If (j.jet.Position + enemyDir(j)).DistanceTo(myJet.Position) > j.jet.Position.DistanceTo(myJet.Position) Then
  2518.                                     If j.is_hunter Then
  2519.                                         If j.jet.Position.DistanceTo(Player.Character.Position) < 400 Then
  2520.                                             ' make him evade
  2521.                                             j.p.Task.DriveTo((j.jet.Position + j.jet.Direction * (maxRoundForEvade + 100)).Around(maxRoundForEvade) + Vector3.WorldUp * jetList.IndexOf(j) * 4 + returnJetOffPos(j), 80.0, False) ' evade                                  
  2522.                                             ' limit his speed
  2523.                                             'if (j.jet.position.distanceto(myJet.position) > 25) andalso (j.jet.speed > 70) then j.jet.applyforce(j.jet.direction * -3)    
  2524.  
  2525.                                             j.actualSpeed = 0
  2526.                                         Else
  2527.                                             ' make him go back and try to pursuit the player
  2528.                                             j.p.Task.DriveTo((Player.Character.Position + Vector3.WorldUp * 5).Around(10) + Vector3.WorldUp * jetList.IndexOf(j) * 4 + returnJetOffPos(j), 80.0, False)
  2529.  
  2530.                                             j.actualSpeed = myJet.Speed * 0.5
  2531.                                         End If
  2532.                                     Else
  2533.                                         If j.jet.Position.DistanceTo(Player.Character.Position) < 2000 Then
  2534.                                             ' make him evade
  2535.                                             j.p.Task.DriveTo((j.jet.Position + j.jet.Direction * (maxRoundForFugitiveEvade + 100)).Around(maxRoundForFugitiveEvade) + Vector3.WorldUp * jetList.IndexOf(j) * 4 + returnJetOffPos(j), 80.0, False)
  2536.  
  2537.                                             ' if its too far away, reduce his speed
  2538.                                             'if (j.jet.position.distanceto(player.character.position) > 500) then
  2539.                                             '   j.actualSpeed = myJet.speed / 2
  2540.                                             'else                                    
  2541.                                             '   j.actualSpeed = myJet.speed * 1.2
  2542.                                             'end if
  2543.                                         Else
  2544.                                             msg("Fugitive has escaped...", 3000)
  2545.                                             j.timeRemove = 0
  2546.                                         End If
  2547.                                     End If
  2548.                                 Else ' in this case, the enemy is pursuiting the player
  2549.                                     If j.is_hunter Then
  2550.                                         ' if the enemy its too close, turn and try to follow again                             
  2551.                                         If j.jet.Position.DistanceTo(Player.Character.Position) < 70 Then
  2552.                                             j.p.Task.DriveTo(j.jet.Position + j.jet.Direction * 100 - (j.jet.Direction * jetList.IndexOf(j) * 4) + returnJetOffPos(j), 10.0, False)
  2553.  
  2554.                                             j.actualSpeed = 120
  2555.                                         ElseIf j.jet.Position.DistanceTo(Player.Character.Position) < 150 Then
  2556.                                             j.p.Task.DriveTo((Player.Character.Position + myJet.Direction * 30) + Vector3.WorldUp * jetList.IndexOf(j) * 4 + _
  2557.                                                 (Vector3.WorldUp * planeDir.z) - j.jet.Direction * jetList.IndexOf(j) * 10 + returnJetOffPos(j), 80.0, False) ' follow to shoot
  2558.  
  2559.                                             j.actualSpeed = 100
  2560.                                         Else
  2561.                                             j.p.Task.DriveTo((Player.Character.Position + planeDir() * 15).Around(10) + _
  2562.                                                 Vector3.WorldUp * jetList.IndexOf(j) * 4 - j.jet.Direction * jetList.IndexOf(j) * 10 + returnJetOffPos(j), 80.0, False) ' go faster
  2563.  
  2564.                                             j.actualSpeed = myJet.Speed * 1.5
  2565.                                         End If
  2566.                                     Else ' fugitive behind the player
  2567.                                         If j.jet.Position.DistanceTo(Player.Character.Position) < 2000 Then
  2568.                                             j.p.Task.DriveTo((j.jet.Position - j.jet.Direction * 400).Around(300) + Vector3.WorldUp * jetList.IndexOf(j) * 4 - j.jet.Direction * jetList.IndexOf(j) * 10 + returnJetOffPos(j), _
  2569.                                                 45.0, False)
  2570.  
  2571.                                             ' if its too far away, reduce his speed
  2572.                                             If (j.jet.Position.DistanceTo(Player.Character.Position) > 500) Then
  2573.                                                 j.actualSpeed = myJet.Speed / 2
  2574.                                             Else
  2575.                                                 j.actualSpeed = myJet.Speed
  2576.                                             End If
  2577.                                         Else
  2578.                                             msg("Fugitive has escaped...", 3000)
  2579.                                             j.timeRemove = 0
  2580.                                         End If
  2581.                                     End If
  2582.                                 End If
  2583.  
  2584.                                 If Native.Function.Call(Of Boolean)("IS_CAR_IN_WATER", j.jet) AndAlso (j.jet.Health > 0) Then
  2585.                                     explodeEnemyJet(j)
  2586.                                 End If
  2587.                             Else
  2588.                                 j.timeWait -= Me.Interval
  2589.                             End If
  2590.                         End If
  2591.                     End If
  2592.  
  2593.                     If Not j.isMP Then
  2594.                         ' control they speed
  2595.                         If j.is_hunter Then
  2596.                             If j.actualSpeed > 200 Then j.actualSpeed = 200
  2597.  
  2598.                             If j.actualSpeed > 100 Then Native.Function.Call("SET_CAR_FORWARD_SPEED", j.jet, j.actualSpeed)
  2599.                         End If
  2600.  
  2601.                         Dim tmpJetGroundDist As Double = j.jet.Position.DistanceTo(World.GetGroundPosition(j.jet.Position, GroundType.Lowest))
  2602.                         If tmpJetGroundDist < 150 Then
  2603.                             j.jet.ApplyForce(Vector3.WorldUp * (150 - tmpJetGroundDist) / 50) ' help him go up and dont crash the plane on the ground/sea
  2604.                         End If
  2605.  
  2606.                         If j.jet.Speed < 30 Then j.jet.ApplyForce(enemyDir(j) * (30 - j.jet.Speed)) ' help him go faster
  2607.                         If j.is_fugitive AndAlso (j.jet.Speed > 70) Then
  2608.                             j.jet.ApplyForce(enemyDir(j) * (70 - j.jet.Speed)) ' slow down
  2609.                         End If
  2610.  
  2611.                         ' enemy missile launch time wait
  2612.                         If j.timeWaitLaunch > 0 Then j.timeWaitLaunch -= Me.Interval
  2613.  
  2614.                         ' move enemy rockets
  2615.                         If enemyJet_shoot_rocket Then moveEnemyRockets(j)
  2616.  
  2617.                         If enemyJet_shoot_cannon OrElse enemyJet_shoot_rocket Then
  2618.                             'if (j.jet.position.distanceto(myJet.position) < 300) andalso (j.jet.position.distanceto(myJet.position) > 25) andalso _
  2619.                             '   (math.abs(j.jet.position.z - myjet.position.z) <= 45) then
  2620.                             ' enemy lock missile and shoot cannon
  2621.                             If (j.jet.Position.DistanceTo(myJet.Position) < 300) Then
  2622.                                 ' here i check if the enemy jet its on a position close to the center of the player plane direction
  2623.                                 ' this close position tis small when the enemy jet its close to the player, and bigger when far away
  2624.                                 If myJet.Position.DistanceTo(j.jet.Position + enemyDir(j) * j.jet.Position.DistanceTo(myJet.Position)) < _
  2625.                                    (j.jet.Position.DistanceTo(myJet.Position) / 3) Then
  2626.                                     If j.timeMissileAlarmValue > 10 Then
  2627.                                         j.timeMissileAlarmValue -= 1.5
  2628.  
  2629.                                         If jetEnemyAttacking = j.jet Then
  2630.                                             jetEnemyAttacking = Nothing
  2631.                                         End If
  2632.  
  2633.                                         j.lockedOnTarget = False
  2634.                                     Else
  2635.                                         If enemyJet_shoot_rocket Then
  2636.                                             If jetEnemyAttacking = Nothing Then
  2637.                                                 jetEnemyAttacking = j.jet
  2638.                                             End If
  2639.  
  2640.                                             j.lockedOnTarget = True
  2641.                                         End If
  2642.                                     End If
  2643.  
  2644.                                     If j.is_hunter Then
  2645.                                         If j.timeMissileAlarm >= j.timeMissileAlarmValue Then
  2646.                                             j.timeMissileAlarm = 0
  2647.  
  2648.                                             If timeWaitSoundRocket <= 0 Then If camMode <> 4 Then sndAlarm.Play() Else sndAlarm2.Play()
  2649.  
  2650.                                             bWarnEnemyMissileLock = True
  2651.                                         Else
  2652.                                             j.timeMissileAlarm += Me.Interval * (25 / Game.FPS)
  2653.                                         End If
  2654.                                     End If
  2655.  
  2656.                                     If enemyJet_shoot_cannon AndAlso (Math.Abs(j.jet.Position.Z - myJet.Position.Z) <= 10) Then
  2657.                                         If ((j.jet.Direction - Player.Character.Direction).DistanceTo(Vector3.Zero) <= 0.5) Then
  2658.                                             j.shoot20mm((Player.Character.Position + planeDir() * 10).Around(3), enemyJet_cannon_dmg)
  2659.                                         ElseIf ((j.jet.Direction - Player.Character.Direction).DistanceTo(Vector3.Zero) <= 0.2) Then
  2660.                                             j.shoot20mm((Player.Character.Position + planeDir() * 5).Around(1), enemyJet_cannon_dmg)
  2661.                                         End If
  2662.                                     End If
  2663.                                 Else
  2664.                                     j.timeMissileAlarmValue = timeWaitMissileLock
  2665.  
  2666.                                     If jetEnemyAttacking = j.jet Then jetEnemyAttacking = Nothing
  2667.  
  2668.                                     j.lockedOnTarget = False
  2669.                                 End If
  2670.                             Else
  2671.                                 j.timeMissileAlarmValue = timeWaitMissileLock
  2672.  
  2673.                                 If jetEnemyAttacking = j.jet Then jetEnemyAttacking = Nothing
  2674.  
  2675.                                 j.lockedOnTarget = False
  2676.                             End If
  2677.                         End If
  2678.                     End If
  2679.  
  2680.                     ' player locking missiles on enemy jets
  2681.                     If (j.jet.Position.DistanceTo(myJet.Position) < 350) Then
  2682.                         ' same check made with enemy
  2683.                         If j.jet.Position.DistanceTo(myJet.Position + planeDir() * myJet.Position.DistanceTo(j.jet.Position)) < (myJet.Position.DistanceTo(j.jet.Position) / (3 / AimEase)) Then
  2684.                             If j.timeMissileLockValue > 10 Then
  2685.                                 If Not Exists(TJetLocked) Then
  2686.                                     j.timeMissileLockValue -= 2
  2687.                                 ElseIf Not TJetLocked.Equals(j) Then
  2688.                                     j.timeMissileLockValue = 300
  2689.                                 End If
  2690.  
  2691.                                 If Exists(TJetLocked) AndAlso TJetLocked.Equals(j) Then TJetLocked = Nothing
  2692.                             ElseIf Not Exists(TJetLocked) Then
  2693.                                 TJetLocked = j
  2694.                             End If
  2695.  
  2696.                             If j.timeMissileLock >= j.timeMissileLockValue Then
  2697.                                 j.timeMissileLock = 0
  2698.  
  2699.                                 If timeWaitSoundRocket <= 0 Then If camMode <> 4 Then sndMissileLock.Play() Else sndMissileLock2.Play()
  2700.  
  2701.                                 drawTargetedHUD(j.jet)
  2702.  
  2703.                                 bWarnMyMissileLock = True
  2704.                             Else
  2705.                                 j.timeMissileLock += Me.Interval * (25 / Game.FPS)
  2706.                             End If
  2707.                         Else
  2708.                             j.timeMissileLockValue = 300
  2709.  
  2710.                             If Exists(TJetLocked) AndAlso TJetLocked.Equals(j) Then TJetLocked = Nothing
  2711.                         End If
  2712.                     Else
  2713.                         j.timeMissileLockValue = 300
  2714.  
  2715.                         If Exists(TJetLocked) AndAlso TJetLocked.Equals(j) Then TJetLocked = Nothing
  2716.                     End If
  2717.  
  2718.                     ' enemy flare tick
  2719.                     If Not j.isMP AndAlso (j.timeOutFlare > 0) Then j.timeOutFlare -= Me.Interval
  2720.                 Next
  2721.  
  2722.                 If Not Exists(TJetLocked) Then
  2723.                     lockOnHeliTick()
  2724.                 Else
  2725.                     For Each h As THeli In heliList
  2726.                         h.timeMissileLockValue = 300
  2727.                     Next
  2728.                 End If
  2729.  
  2730.                 If (controllerState.IsConnected AndAlso controllerState.IsButtonDown(Microsoft.Xna.Framework.Input.Buttons.X)) OrElse _
  2731.                    Game.isKeyPressed(hkShootCannon) OrElse ((currWeapon = 1) AndAlso Game.isKeyPressed(Keys.LButton)) AndAlso isJetOk() Then
  2732.                     If timeShoot20mm <= 0 Then
  2733.                         timeShoot20mm = 10
  2734.  
  2735.                         sndCannonPlay()
  2736.  
  2737.                         For Each c As cannon In myActualJet.cannList
  2738.                             If Not c.enabled Then Continue For
  2739.  
  2740.                             If c.shootTime = myActualJet.actualCannon Then
  2741.                                 Native.Function.Call("stop_ptfx", c.ptfx)
  2742.                                 Native.Function.Call("stop_ptfx", c.ptfxTrace)
  2743.  
  2744.                                 Dim vecPosFin As Vector3
  2745.  
  2746.                                 vecPosFin = Player.Character.Position + planeDir() * c.range
  2747.  
  2748.                                 c.ptfx = Native.Function.Call(Of Int32)("START_PTFX_ON_VEH", "muz_machine", _
  2749.                                     myJet, c.offPosition.X, c.offPosition.Y, c.offPosition.Z, 0, 0, 90.0, c.size)
  2750.                                 c.ptfxTrace = Native.Function.Call(Of Int32)("START_PTFX_ON_VEH", "wpn_bullet_trace", _
  2751.                                     myJet, c.offPosition.X, c.offPosition.Y, c.offPosition.Z, -90.0, 0, 0, c.trace_size)
  2752.  
  2753.                             '   native.function.call("FIRE_SINGLE_BULLET", c.attachPoint.position.x, c.attachPoint.position.y, c.attachPoint.position.z, _
  2754.                             '       vecPosFin.x, vecPosFin.y, vecPosFin.z, c.damage)
  2755.                             '   native.function.call("FIRE_SINGLE_BULLET", c.attachPoint.position.x, c.attachPoint.position.y, c.attachPoint.position.z, _
  2756.                             '       vecPosFin.x, vecPosFin.y, vecPosFin.z, c.damage)
  2757.                             '   native.function.call("FIRE_SINGLE_BULLET", c.attachPoint.position.x, c.attachPoint.position.y, c.attachPoint.position.z, _
  2758.                             '       vecPosFin.x, vecPosFin.y, vecPosFin.z, c.damage)
  2759.                                 Dim tmpPos As Vector3 = myJet.GetOffsetPosition(c.offPosition)
  2760.  
  2761.                                 Native.Function.Call("FIRE_SINGLE_BULLET", tmpPos.X, tmpPos.Y, tmpPos.Z, _
  2762.                                     vecPosFin.X, vecPosFin.Y, vecPosFin.Z, c.damage)
  2763.                                 Native.Function.Call("FIRE_SINGLE_BULLET", tmpPos.X, tmpPos.Y, tmpPos.Z, _
  2764.                                     vecPosFin.X, vecPosFin.Y, vecPosFin.Z, c.damage)
  2765.                                 Native.Function.Call("FIRE_SINGLE_BULLET", tmpPos.X, tmpPos.Y, tmpPos.Z, _
  2766.                                     vecPosFin.X, vecPosFin.Y, vecPosFin.Z, c.damage)
  2767.                             End If
  2768.                         Next
  2769.  
  2770.                         myActualJet.actualCannon += 1
  2771.  
  2772.                         If myActualJet.actualCannon > myActualJet.cannonCount Then myActualJet.actualCannon = 1
  2773.                     Else
  2774.                         timeShoot20mm -= Me.Interval * (25 / Game.FPS)
  2775.                     End If
  2776.                 End If
  2777.             End If
  2778.         Else
  2779.             timeWaitMissileLock = 300
  2780.         End If
  2781.  
  2782.         If multi <> multiAux Then
  2783.             If multiAux > multi Then
  2784.                 multi += 0.05
  2785.  
  2786.                 If multiAux < multi Then multi = multiAux
  2787.             Else
  2788.                 multi -= 0.05
  2789.  
  2790.                 If multiAux > multi Then multi = multiAux
  2791.             End If
  2792.         End If
  2793.  
  2794.         If Exists(myJet) AndAlso Exists(myActualJet) Then
  2795.             If myJet.isOnAllWheels Then
  2796.                 If (Game.isKeyPressed(Keys.Left) OrElse Game.isKeyPressed(Keys.Right)) Then
  2797.                     If Game.isKeyPressed(Keys.Left) Then
  2798.                         myJet.ApplyForce(myJet.Direction / 8, Vector3.WorldEast * 3.5)
  2799.                         myJet.ApplyForce(myJet.Direction / -18)
  2800.                         bMustStop = False
  2801.                     ElseIf Game.isKeyPressed(Keys.Right) Then
  2802.                         myJet.ApplyForce(myJet.Direction / 8, Vector3.WorldWest * 3.5)
  2803.                         myJet.ApplyForce(myJet.Direction / -18)
  2804.                         bMustStop = False
  2805.                     End If
  2806.                 End If
  2807.             End If
  2808.  
  2809.             'If Game.isGameKeyPressed(GameKey.MoveForward) Then
  2810.             If tmpAccelerating Then
  2811.                 If Game.isKeyPressed(Keys.Space) Then
  2812.                     multiAux = myActualJet.engineMaxFxSize * 1.5
  2813.  
  2814.                     soundOffsetAux = 13
  2815.                 Else
  2816.                     multiAux = myActualJet.engineMaxFxSize
  2817.  
  2818.                     soundOffsetAux = 1
  2819.                 End If
  2820.             'ElseIf Game.isGameKeyPressed(GameKey.MoveBackward) Then
  2821.             ElseIf tmpBraking Then
  2822.                 multiAux = myActualJet.engineMinFxSize
  2823.  
  2824.                 Native.Function.Call("stop_sound", IDSndJetAccel)
  2825.                 timeWaitIDSndJetAccel = 0
  2826.  
  2827.                 soundOffsetAux = 20
  2828.             Else
  2829.                 multiAux = myActualJet.engineIdleFxSize
  2830.  
  2831.                 Native.Function.Call("stop_sound", IDSndJetAccel)
  2832.                 timeWaitIDSndJetAccel = 0
  2833.  
  2834.                 soundOffsetAux = 15
  2835.             End If
  2836.  
  2837.             If myJet.Health < lastJetHealth Then
  2838.                 If (myJet.Health <= 0) OrElse (lastJetHealth - myJet.Health > 200) Then
  2839.                     explodeMyJet()
  2840.  
  2841.                     If Exists(camGun) Then camGun.Deactivate()
  2842.                     camMode = 0
  2843.  
  2844.                     myJet = Nothing
  2845.                 End If
  2846.             End If
  2847.         End If
  2848.  
  2849.         If isInJet() Then
  2850.             lastJetHealth = myJet.Health
  2851.  
  2852.             If soundOffset <> soundOffsetAux Then
  2853.                 If soundOffsetAux > soundOffset Then
  2854.                     soundOffset += 0.1
  2855.                     If soundOffsetAux < soundOffset Then soundOffset = soundOffsetAux
  2856.                 Else
  2857.                     soundOffset -= 0.1
  2858.                     If soundOffsetAux > soundOffset Then soundOffset = soundOffsetAux
  2859.                 End If
  2860.             End If
  2861.  
  2862.             If timeWaitIDSndJetAccel <= 0 Then
  2863.                 If myActualJet.soundJetIdle <> "" Then
  2864.                     Native.Function.Call("stop_sound", IDSndJetIdle)
  2865.                     Native.Function.Call("PLAY_SOUND_FROM_object", IDSndJetIdle, myActualJet.soundJetIdle, soundAuxIdle)
  2866.                 End If
  2867.  
  2868.                 If myActualJet.soundJetAccel <> "" Then
  2869.                     Native.Function.Call("stop_sound", IDSndJetAccel)
  2870.                     Native.Function.Call("PLAY_SOUND_FROM_object", IDSndJetAccel, myActualJet.soundJetAccel, soundAuxAceel)
  2871.                 End If
  2872.  
  2873.                 timeWaitIDSndJetAccel = 500
  2874.             Else
  2875.                 timeWaitIDSndJetAccel -= Me.Interval
  2876.             End If
  2877.  
  2878.             If camMode = 0 Then
  2879.                 soundAuxIdle.Position = Player.Character.Position + Game.CurrentCamera.Direction * (soundOffset * 0.5)
  2880.                 soundAuxAceel.Position = Player.Character.Position + Game.CurrentCamera.Direction * soundOffset
  2881.                 soundAuxAceel2.Position = Player.Character.Position + Game.CurrentCamera.Direction * soundOffset * 0.5
  2882.             ElseIf camMode = 4 Then
  2883.                 soundAuxIdle.Position = Player.Character.Position - planeDir() * 5
  2884.                 soundAuxAceel.Position = Player.Character.Position - planeDir() * 30
  2885.                 soundAuxAceel2.Position = Player.Character.Position - planeDir() * 15
  2886.             Else
  2887.                 soundAuxIdle.Position = Player.Character.Position - planeDir() * (soundOffset * 0.5) / 2
  2888.                 soundAuxAceel.Position = Player.Character.Position - planeDir() * soundOffset / 2
  2889.                 soundAuxAceel2.Position = Player.Character.Position - planeDir() * soundOffset * 0.5 / 2
  2890.             End If
  2891.  
  2892.             For Each eng As engine In myActualJet.engineList
  2893.                 If Not eng.enabled Then Continue For
  2894.  
  2895.                 Native.Function.Call("stop_ptfx", eng.ptfx)
  2896.  
  2897.                 eng.ptfx = Native.Function.Call(Of Int32)("START_PTFX_ON_VEH", "muz_pistol_large", _
  2898.                     myJet, eng.offPosition.X, eng.offPosition.Y, eng.offPosition.Z, 0, 0, -90.0, 1.0 * multi)
  2899.             Next
  2900.         Else
  2901.             soundOffsetAux = 20
  2902.  
  2903.             soundAuxAceel.Position = Player.Character.Position + Vector3.WorldUp * soundOffset - Player.Character.Direction * 60
  2904.             soundAuxAceel2.Position = Player.Character.Position + Vector3.WorldUp * soundOffset - Player.Character.Direction * 60
  2905.         End If
  2906.         Catch
  2907.             msg("AC-IV: An error occurred :(, reload the game...", 5000)
  2908.         End Try
  2909.     End Sub
  2910.  
  2911.     Private Function tmpAccelerating() As Boolean
  2912.         Return (((lastXBoxInput <= 0) AndAlso Game.isGameKeyPressed(GameKey.MoveForward)) OrElse (controllerState.IsConnected AndAlso (controllerState.Triggers.Right <> 0)))
  2913.     End Function
  2914.  
  2915.     Private Function tmpBraking() As Boolean
  2916.         Return (((lastXBoxInput <= 0) AndAlso Game.isGameKeyPressed(GameKey.MoveBackward)) OrElse (controllerState.IsConnected AndAlso (controllerState.Triggers.Left <> 0)))
  2917.     End Function
  2918.  
  2919.     Private Function tmpTurningRight() As Boolean
  2920.         Return (((lastXBoxInput <= 0) AndAlso Game.isKeyPressed(hkTurnRight)) OrElse (controllerState.IsConnected AndAlso (controllerState.IsButtonDown(Microsoft.Xna.Framework.Input.Buttons.RightShoulder))))
  2921.     End Function
  2922.  
  2923.     Private Function tmpTurningLeft() As Boolean
  2924.         Return (((lastXBoxInput <= 0) AndAlso Game.isKeyPressed(hkTurnLeft)) OrElse (controllerState.IsConnected AndAlso (controllerState.IsButtonDown(Microsoft.Xna.Framework.Input.Buttons.LeftShoulder))))
  2925.     End Function
  2926.  
  2927.     Private Function tmpRollingLeft() As Boolean
  2928.         Return (((lastXBoxInput <= 0) AndAlso Game.isGameKeyPressed(GameKey.MoveLeft) OrElse Game.isKeyPressed(hkRollLeft)) OrElse (controllerState.IsConnected AndAlso (controllerState.ThumbSticks.Left.X < 0)))
  2929.     End Function
  2930.  
  2931.     Private Function tmpRollingRight() As Boolean
  2932.         Return (((lastXBoxInput <= 0) AndAlso Game.isGameKeyPressed(GameKey.MoveRight) OrElse Game.isKeyPressed(hkRollRight)) OrElse (controllerState.IsConnected AndAlso (controllerState.ThumbSticks.Left.X > 0)))
  2933.     End Function
  2934.  
  2935.     Private Function tmpGoingUp() As Boolean
  2936.         Return (((lastXBoxInput <= 0) AndAlso Game.isKeyPressed(hkJetMoveUp) OrElse Game.isKeyPressed(hkUp)) OrElse (controllerState.IsConnected AndAlso (controllerState.ThumbSticks.Left.Y < 0)))
  2937.     End Function
  2938.  
  2939.     Private Function tmpGoingDown() As Boolean
  2940.         Return (((lastXBoxInput <= 0) AndAlso Game.isKeyPressed(hkJetMoveDown) OrElse Game.isKeyPressed(hkDown)) OrElse (controllerState.IsConnected AndAlso (controllerState.ThumbSticks.Left.Y > 0)))
  2941.     End Function
  2942.  
  2943.     Private Sub checkSpaceTrip()
  2944.         If st_time_check_aux <= 0 Then
  2945.             st_time_check_aux = st_time_check
  2946.  
  2947.             If Not isInJet() Then Exit Sub
  2948.  
  2949.             If st_in_earth Then
  2950.                 If Player.Character.Position.Z > st_height_teleport Then
  2951.                     st_in_earth = False
  2952.  
  2953.                     Game.FadeScreenOut(2000, True)
  2954.  
  2955.                     Try
  2956.                         myJet.Position = st_teleport_pos
  2957.                     Catch
  2958.                     End Try
  2959.  
  2960.                     Game.FadeScreenIn(500, False)
  2961.                 End If
  2962.             Else
  2963.                 If Player.Character.Position.Z < st_height_teleport_back Then
  2964.                     st_in_earth = True
  2965.  
  2966.                     Game.FadeScreenOut(2000, True)
  2967.  
  2968.                     Try
  2969.                         myJet.Position = st_teleport_pos_back
  2970.                     Catch
  2971.                     End Try
  2972.  
  2973.                     Game.FadeScreenIn(500, False)
  2974.                 End If
  2975.             End If
  2976.         Else
  2977.             st_time_check_aux -= Me.Interval
  2978.         End If
  2979.     End Sub
  2980.  
  2981.     Private Sub checkJetAP()
  2982.         If timeSetAP > 0 Then timeSetAP -= Me.Interval
  2983.  
  2984.         For Each ap As TJetAP In TJetAPList
  2985.             If ap.cp.Visible AndAlso Not Exists(Player.Character.CurrentVehicle) AndAlso (Player.Character.Position.DistanceTo2D(ap.cp.Position) < (ap.diameter * 0.5)) _
  2986.                AndAlso (Math.Abs(Player.Character.Position.Z - ap.cp.Position.Z) <= 2) Then
  2987.                 Game.FadeScreenOut(250, True)
  2988.                 Wait(500)
  2989.  
  2990.                 Try
  2991.                     For Each v2 As Vehicle In World.GetVehicles(ap.jetPos, ap.jetModel.GetDimensions.Y)
  2992.                         If Exists(v2) Then v2.Delete()
  2993.                     Next
  2994.  
  2995.                     Dim v As Vehicle = World.CreateVehicle(ap.jetModel, ap.jetPos)
  2996.  
  2997.                     If ap.skin <> 0 Then
  2998.                         Native.Function.Call("SET_CAR_LIVERY", v, ap.skin)
  2999.  
  3000.                         actualSkin = ap.skin
  3001.                     End If
  3002.  
  3003.                     v.Heading = ap.heading
  3004.                     Player.Character.WarpIntoVehicle(v, VehicleSeat.Driver)
  3005.                     timeWaitCloseGears = 100
  3006.  
  3007.                     Game.FadeScreenIn(250, False)
  3008.                     Wait(500)
  3009.                 Catch
  3010.                     Game.FadeScreenIn(250, False)
  3011.                     Wait(500)
  3012.                     msg("An error occured, try again.", 3000)
  3013.                     Player.Character.Position = Player.Character.Position - Player.Character.Direction * (ap.diameter - Player.Character.Position.DistanceTo(ap.cp.Position) + 1)
  3014.                 End Try
  3015.             End If
  3016.  
  3017.             If timeSetAP <= 0 Then
  3018.                 ap.cp.Position = ap.checkPos
  3019.                 ap.cp.Diameter = ap.diameter
  3020.                 ap.cp.Color = Color.FromArgb(ap.cpAlpha, ap.cpRcolor, ap.cpGcolor, ap.cpBcolor)
  3021.                 ap.cp.Visible = ap.checkPVisible
  3022.  
  3023.                 If ap.autoCreateJet AndAlso Not Exists(ap.createdJet) Then
  3024.                     For Each v2 As Vehicle In World.GetVehicles(ap.jetPos, 10.0)
  3025.                         If Exists(v2) Then v2.Delete()
  3026.                     Next
  3027.  
  3028.                     ap.createdJet = World.CreateVehicle(ap.jetModel, ap.jetPos)
  3029.  
  3030.                     If Exists(ap.createdJet) AndAlso (ap.skin <> 0) Then Native.Function.Call("SET_CAR_LIVERY", ap.createdJet, ap.skin)
  3031.  
  3032.                     ap.resetPosition = True
  3033.                 End If
  3034.  
  3035.                 resetAPJet(ap)
  3036.             End If
  3037.         Next
  3038.  
  3039.         If timeSetAP <= 0 Then timeSetAP = 500
  3040.     End Sub
  3041.  
  3042.     Private Sub resetAPJet(ByVal ap As TJetAP)
  3043.         Try
  3044.             If Exists(ap.createdJet) AndAlso ap.resetPosition AndAlso (Player.Character.Position.DistanceTo(ap.jetPos) < 500) Then
  3045.                 ap.resetPosition = False
  3046.  
  3047.                 'for each v2 as vehicle in world.getvehicles(ap.jetPos, 10.0)
  3048.                 '   if exists(v2) andalso (v2 <> ap.createdJet) then v2.delete
  3049.                 'next
  3050.  
  3051.                 ap.createdJet.Position = ap.jetPos
  3052.                 ap.createdJet.Heading = ap.heading
  3053.                 ap.createdJet.Repair()
  3054.             End If
  3055.         Catch
  3056.         End Try
  3057.     End Sub
  3058.  
  3059.     Private Sub checkHeli()
  3060.         Try
  3061.             Dim h As THeli = Nothing
  3062.  
  3063.             For c As Int16 = heliList.Count - 1 To 0 Step -1
  3064.                 h = heliList(c)
  3065.  
  3066.                 If Not Exists(h.heli) OrElse (h.heli.Health <= 0) OrElse (h.heli.EngineHealth <= 0) OrElse (h.heli.PetrolTankHealth <= 0) Then
  3067.                     If Exists(h.heliBlip) Then h.heliBlip.Delete()
  3068.  
  3069.                     If Exists(h.heli) AndAlso (h.heli = heliLocked) Then heliLocked = Nothing
  3070.  
  3071.                     'If Exists(h.checkPAux) Then h.checkPAux.Visible = False
  3072.                     heliList.RemoveAt(c)
  3073.                 End If
  3074.             Next
  3075.         Catch
  3076.         End Try
  3077.     End Sub
  3078.  
  3079.     Private Sub lockOnHeliTick()
  3080.         Dim h As THeli = Nothing
  3081.  
  3082.         For c As Int16 = heliList.Count - 1 To 0 Step -1
  3083.             h = heliList(c)
  3084.  
  3085.             If Exists(h.heli) AndAlso (h.heli.Health > 0) AndAlso (h.heli.EngineHealth > 0) AndAlso (h.heli.PetrolTankHealth > 0) Then
  3086.                 If (h.heli.Position.DistanceTo(myJet.Position) < 700) Then
  3087.                     If Not h.isMP AndAlso (h.heli.Speed > 1) AndAlso (h.heli.Speed < 40) Then h.heli.ApplyForce(h.heli.Direction)
  3088.  
  3089.                     If h.heli.Position.DistanceTo(myJet.Position + planeDir() * myJet.Position.DistanceTo(h.heli.Position)) < (myJet.Position.DistanceTo(h.heli.Position) / (3 * AimEase)) Then
  3090.                         If h.timeMissileLockValue > 10 Then
  3091.                             If Not Exists(heliLocked) Then
  3092.                                 h.timeMissileLockValue -= 2
  3093.                             ElseIf heliLocked <> h.heli Then
  3094.                                 h.timeMissileLockValue = 300
  3095.                             End If
  3096.  
  3097.                             If heliLocked = h.heli Then heliLocked = Nothing
  3098.                         Else
  3099.                             If Not Exists(heliLocked) Then heliLocked = h.heli
  3100.                         End If
  3101.  
  3102.                         If h.timeMissileLock >= h.timeMissileLockValue Then
  3103.                             h.timeMissileLock = 0
  3104.  
  3105.                             If timeWaitSoundRocket <= 0 Then If camMode <> 4 Then sndMissileLock.Play() Else sndMissileLock2.Play()
  3106.  
  3107.                             drawTargetedHUD(h.heli)
  3108.  
  3109.                             bWarnMyMissileLock = True
  3110.                         Else
  3111.                             h.timeMissileLock += Me.Interval * (25 / Game.FPS)
  3112.                         End If
  3113.                     Else
  3114.                         h.timeMissileLockValue = 300
  3115.  
  3116.                         If heliLocked = h.heli Then heliLocked = Nothing
  3117.                     End If
  3118.  
  3119.                     If Exists(myJet) AndAlso (myJet.Speed > 30) AndAlso h.heli.isTouching(myJet) Then explodeMyJet()
  3120.                 ElseIf (h.heli.Position.DistanceTo(myJet.Position) > 2000) Then
  3121.                     If Not h.isMP Then
  3122.                         h.heli.NoLongerNeeded()
  3123.  
  3124.                         For Each p As Ped In World.GetPeds(h.heli.Position, 15.0)
  3125.                             If Exists(p) AndAlso (p.CurrentVehicle = h.heli) AndAlso Not Exists(p.GetControllingPlayer) Then
  3126.                                  p.NoLongerNeeded()
  3127.                             End If
  3128.                         Next
  3129.                     End If
  3130.                 Else
  3131.                     h.timeMissileLockValue = 300
  3132.  
  3133.                     If heliLocked = h.heli Then heliLocked = Nothing
  3134.                 End If
  3135.  
  3136.                 If h.heli.isOnScreen AndAlso (h.heli.Position.DistanceTo(myJet.Position) > drawEnemyRectDist) Then
  3137.                 '   dim float_temp_1 as double
  3138.                 '   dim TO_RADIAN = 0.017453292519943295
  3139.                 '   float_temp_1 = Math.Atan2((h.heli.Position.Y - Player.Character.Position.Y) , (h.heli.Position.X - Player.Character.Position.X))
  3140.                 '   float_temp_1 = float_temp_1 - Game.CurrentCamera.Rotation.Z * TO_RADIAN
  3141.                 '   float_temp_1 += 1.570796
  3142.                 '  
  3143.                 '   dim cam as camera = game.currentcamera
  3144.                 '   dim dist as double = h.heli.position.distanceto(cam.position)
  3145.                 '   dim compPos as vector3 = (cam.position + cam.direction * dist)
  3146.                 '   dim y as double = (((compPos - h.heli.position).z)) / dist
  3147.                 '  
  3148.                 '   GTA.Native.Function.Call("DRAW_RECT", 0.5f + 0.7f * (Math.Sin(float_temp_1)), y + 0.55, 0.01, 0.02, 255, 150, 0, 100)
  3149.  
  3150.                     'h.checkPAux.Visible = True
  3151.                     'h.checkPAux.Position = h.heli.Position
  3152.                     'h.checkPAux.Diameter = h.heli.Position.DistanceTo(Player.Character.Position) / 60
  3153.                     Native.Function.Call("DRAW_CHECKPOINT", h.heli.Position.X, h.heli.Position.Y, h.heli.Position.Z, h.heli.Position.DistanceTo(Player.Character.Position) / 60, 255, 150, 0)
  3154.                 'Else
  3155.                     'h.checkPAux.Visible = False
  3156.                 End If
  3157.             End If
  3158.         Next
  3159.     End Sub
  3160.  
  3161.     Private Sub explodeMyJet()
  3162.         If Exists(camGun) Then camGun.Deactivate()
  3163.         camMode = 0
  3164.  
  3165.         If Not bExplodeMyJet Then
  3166.             Exit Sub
  3167.         Else
  3168.             bExplodeMyJet = False
  3169.         End If
  3170.  
  3171.         TJetLocked = Nothing
  3172.  
  3173.         If Exists(myFakeJet) AndAlso (myActualJet.use_fake_jet) Then
  3174.             myFakeJet.Visible = False
  3175.             myJet.Visible = True
  3176.         End If
  3177.  
  3178.         If isInJet() Then
  3179.             Player.Character.Task.ClearAllImmediately()
  3180.             Player.Character.Detach()
  3181.             Player.Character.Visible = False
  3182.             Player.Character.Die()
  3183.             Player.Character.FreezePosition = True
  3184.             bResetPL = True
  3185.         End If
  3186.  
  3187.         Native.Function.Call("stop_sound", IDSndJetIdle)
  3188.         Native.Function.Call("stop_sound", IDSndJetAccel)
  3189.         Native.Function.Call("stop_sound", IDSndJetAccel2)
  3190.  
  3191.         If isInJet() Then
  3192.             camDeath.Deactivate()
  3193.             camDeath.Position = (myJet.Position + planeDir() * 15 + Vector3.WorldUp * 5).Around(10)
  3194.             camDeath.LookAt(myJet)
  3195.             camDeath.Activate()
  3196.             Game.TimeScale = 0.2
  3197.         End If
  3198.  
  3199.         Dim resRot As Vector3 = myJet.Rotation
  3200.         Dim resHeading As Double = myJet.Heading
  3201.         Dim resSpeed As Double = myJet.Speed
  3202.  
  3203.         World.AddExplosion(myJet.Position, ExplosionType.Rocket, 1.0)
  3204.         Native.Function.Call("stop_ptfx", PTFXMyExp)
  3205.         PTFXMyExp = Native.Function.Call(Of Int32)("start_PTFX_ON_VEH", "exp_ship_destroy", _
  3206.             myJet, 0, 0, 0, 0, 0, 0, 1.0)
  3207.         myJet.Explode()
  3208.         Native.Function.Call("stop_ptfx", PTFXMyJetSmoke)
  3209.         Native.Function.Call("stop_ptfx", PTFXMyJetFire)
  3210.         PTFXMyJetSmoke = 0
  3211.         PTFXMyJetFire = 0
  3212.  
  3213.         For Each v As Vehicle In World.GetVehicles(myJet.Position, 10.0)
  3214.             If Exists(v) Then
  3215.                 World.AddExplosion(v.Position, ExplosionType.Rocket, 1.0)
  3216.                 v.Explode()
  3217.             End If
  3218.         Next
  3219.  
  3220.         For Each r As MR In myActualJet.MRL
  3221.             If r.enabled Then Native.Function.Call("stop_ptfx", r.ptfxID)
  3222.         Next
  3223.  
  3224.         For Each e As engine In myActualJet.engineList
  3225.             If e.enabled Then Native.Function.Call("stop_ptfx", e.ptfx)
  3226.         Next
  3227.  
  3228.         For Each j As TJet In jetList
  3229.             'j.checkPAux.Visible = False
  3230.  
  3231.             If Exists(j.jet) AndAlso Exists(j.p) Then
  3232.                 If Not j.isMP Then j.p.Task.DriveTo((j.jet.Position + j.jet.Direction * 1000).Around(100), 80.0, False) ' fly away
  3233.  
  3234.                 j.timeRemove = 0
  3235.             End If
  3236.         Next
  3237.  
  3238.         Native.Function.Call("stop_ptfx", PTFXWater)
  3239.  
  3240.         Wait(100)
  3241.         myJet.Rotation = resRot
  3242.         myJet.Heading = resHeading
  3243.         myJet.Speed = resSpeed
  3244.         myJet.ApplyForce(Vector3.WorldDown * 10, Vector3.WorldEast * 300 + Vector3.WorldNorth * 300)
  3245.  
  3246.         clearHeliList()
  3247.     End Sub
  3248.  
  3249.     Private Sub explodeEnemyJet(ByVal j As TJet, Optional ByVal jet As Vehicle = Nothing)
  3250.         Try
  3251.             If jet <> Nothing Then
  3252.                 For c As Int16 = 0 To jetList.Count - 1
  3253.                     If jetList(c).jet = jet Then
  3254.                         j = jetList(c)
  3255.                         Exit For
  3256.                     End If
  3257.                 Next
  3258.             End If
  3259.  
  3260.             If Not j.bExplodeJet Then
  3261.                 Exit Sub
  3262.             Else
  3263.                 j.bExplodeJet = False
  3264.             End If
  3265.  
  3266.             If j.DamagedByPlayer Then
  3267.                 If timeWaitMissileLock > 125 Then timeWaitMissileLock -= 25 Else timeWaitMissileLock = 125
  3268.             End If
  3269.  
  3270.             j.resetRot = j.jet.Rotation
  3271.             j.resetHeading = j.jet.Heading
  3272.             j.resetSpeed = j.jet.Speed
  3273.             j.timeResetRot = 100
  3274.             World.AddExplosion(j.jet.Position, ExplosionType.Rocket, 1.0)
  3275.             j.PTFXExp = Native.Function.Call(Of Int32)("START_PTFX_ON_VEH", "exp_ship_destroy", j.jet, 0, 0, 0, 0, 0, 0, 2.0)
  3276.             j.jet.Explode()
  3277.             Native.Function.Call("stop_ptfx", j.PTFXSmoke)
  3278.             Native.Function.Call("stop_ptfx", j.PTFXFire)
  3279.             Native.Function.Call("stop_ptfx", j.PTFXExp)
  3280.             j.PTFXSmoke = 0
  3281.             j.PTFXFire = 0
  3282.             j.PTFXExp = 0
  3283.  
  3284.             If Exists(j.p) Then j.p.Die()
  3285.  
  3286.             j.jet.ApplyForce(Vector3.WorldDown * 20)
  3287.  
  3288.             For Each r As MR In j.rockets
  3289.                 Native.Function.Call("stop_ptfx", r.ptfxID)
  3290.             Next
  3291.  
  3292.             For Each e As engine In j.engines
  3293.                 Native.Function.Call("stop_ptfx", e.ptfx)
  3294.  
  3295.                 e.engLight.Enabled = True
  3296.             Next
  3297.         Catch
  3298.         End Try
  3299.     End Sub
  3300.  
  3301.     Private Sub moveEnemyRockets(ByVal j As TJet)
  3302.         For Each r As MR In j.rockets
  3303.             If Exists(jetEnemyAttacking) AndAlso (j.timeWaitLaunch <= 0) AndAlso Not r.launched AndAlso j.lockedOnTarget Then
  3304.                 r.launch(planeDir, True)
  3305.                 r.timeOut = 3000
  3306.                 j.timeWaitLaunch = enemyJet_rocket_timewait
  3307.  
  3308.                 Native.Function.Call("stop_sound", IDsndRocketMoveEnemy)
  3309.                 Native.Function.Call("PLAY_SOUND_FROM_object", IDsndRocketMoveEnemy, myActualJet.soundRocketMove, r.rocket)
  3310.  
  3311.                 Exit For
  3312.             End If
  3313.  
  3314.             If r.launched Then
  3315.                 If r.propulsor_effect_size > 0 Then
  3316.                     'if r.timeResetPTFX <= 0 then
  3317.                         'r.timeResetPTFX = 50
  3318.                         'native.function.call("stop_ptfx", r.ptfxID)                           
  3319.                         'r.ptfxID = native.function.call(of int32)("START_PTFX_ON_OBJ", "weap_rocket_player", r.rocket, 0, 0, 0, 0, 0, 0, r.propulsor_effect_size)
  3320.                     'else
  3321.                         'r.timeResetPTFX -= me.interval
  3322.                     'end if
  3323.                 End If
  3324.  
  3325.                 If (r.rocket.Position.DistanceTo(j.jet.Position) > 15) AndAlso _
  3326.                    (Native.Function.Call(Of Boolean)("HAS_OBJECT_COLLIDED_WITH_ANYTHING", r.rocket) OrElse (r.timeOut <= 0)) Then
  3327.                     r.ptfxExpID = Native.Function.Call(Of Int32)("START_PTFX", "exp_ship_destroy", r.rocket.Position.X, r.rocket.Position.Y, r.rocket.Position.Z, 0, 0, 0, 1.0)
  3328.                     World.AddExplosion(r.rocket.Position, ExplosionType.Rocket, 0.001, True, True, 1.0)
  3329.  
  3330.                     If r.rocket.Position.DistanceTo(myJet.Position) < 10 Then
  3331.                         r.ptfxExpID = Native.Function.Call(Of Int32)("start_PTFX_ON_veh", "exp_ship_destroy", _
  3332.                             myJet, 0, 0, 0, 0, 0, 0, 0.5)
  3333.  
  3334.                         myJet.Health -= random(enemyJet_rocket_damage - 100, enemyJet_rocket_damage)
  3335.                         'myJet.enginehealth -= random(enemyJet_rocket_damage - 100, enemyJet_rocket_damage)
  3336.                         'myJet.petroltankhealth -= random(enemyJet_rocket_damage - 100, enemyJet_rocket_damage)
  3337.  
  3338.                         If myJet.Health > 0 Then
  3339.                             myJet.EngineHealth = 1000
  3340.                             myJet.PetrolTankHealth = 1000
  3341.                         Else
  3342.                             explodeMyJet()
  3343.                         End If
  3344.  
  3345.                         lastJetHealth = myJet.Health
  3346.                     End If
  3347.  
  3348.                     r.attach(j.jet)
  3349.  
  3350.                     Native.Function.Call("stop_sound", IDsndRocketMoveEnemy)
  3351.  
  3352.                     j.timeWaitLaunch = enemyJet_rocket_timewait
  3353.                 End If
  3354.  
  3355.                 If r.timeOut > 0 Then
  3356.                     If Exists(jetEnemyAttacking) AndAlso (jetEnemyAttacking = j.jet) Then
  3357.                         r.timeOut -= Me.Interval
  3358.                     Else
  3359.                         r.timeOut -= (Me.Interval / 3)
  3360.                     End If
  3361.  
  3362.                     Dim tmpDirection As Vector3
  3363.  
  3364.                     If Exists(jetEnemyAttacking) Then
  3365.                         Dim distTmp As Double = r.rocket.Position.DistanceTo(myJet.Position)
  3366.                         Dim flareDist As Double = -1
  3367.  
  3368.                         If myFlareReleased Then
  3369.                             flareDist = myFlares(0).flareObj.Position.DistanceTo(myJet.Position)
  3370.  
  3371.                             If (flareDist > 400) Then
  3372.                                 myFlareReleased = False
  3373.  
  3374.                                 'native.function.call("stop_ptfx", PTFXMyFlare)
  3375.                                 For Each f As Flare In myFlares
  3376.                                     Native.Function.Call("stop_ptfx", f.PTFXFlare)
  3377.  
  3378.                                     myFlaresResetList.Add(f)
  3379.                                 Next
  3380.  
  3381.                                 If (myFlares(0).flareObj.Position.DistanceTo(r.rocket.Position) < 50) Then jetEnemyAttacking = Nothing
  3382.                             Else
  3383.                                 If myFlares(0).flareObj.Position.DistanceTo(r.rocket.Position) < 10 Then
  3384.                                     'native.function.call("stop_ptfx", PTFXMyFlare)
  3385.                                     'for each f as flare in myFlares
  3386.                                     '   native.function.call("stop_ptfx", f.PTFXFlare)
  3387.                                     'next
  3388.  
  3389.                                     r.timeOut = 0
  3390.                                 End If
  3391.                             End If
  3392.                         End If
  3393.  
  3394.                         If myFlareReleased AndAlso ((flareDist < 150) OrElse (myFlares(0).flareObj.Position.DistanceTo(r.rocket.Position) < 150)) Then
  3395.                             tmpDirection = (myFlares(0).flareObj.Position - r.rocket.Position) / (distTmp / 3)
  3396.                         Else
  3397.                             tmpDirection = (myJet.Position - r.rocket.Position) / (distTmp / 3)
  3398.                         End If
  3399.  
  3400.                         'if myJet.speed > 250 then
  3401.                             r.final_dir = r.dir + tmpDirection * j.jet.Speed * 1.15 * r.speed_multiplier
  3402.                         'else
  3403.                         '   r.final_dir = r.dir + tmpDirection * myJet.speed * 1.5 * r.speed_multiplier
  3404.                         'end if
  3405.  
  3406.                         r.fixRotation = Helper.DirectionToRotation(Vector3.Normalize(r.final_dir), 0)
  3407.  
  3408.                         Native.Function.Call("SET_OBJECT_INITIAL_VELOCITY", r.rocket, r.final_dir.X, r.final_dir.Y, r.final_dir.Z)
  3409.  
  3410.                         If r.rocket.Position.DistanceTo(myJet.Position) < 5 Then
  3411.                             r.timeOut = 0
  3412.                         End If
  3413.                     Else
  3414.                         If r.final_dir <> Vector3.Zero Then
  3415.                             Native.Function.Call("SET_OBJECT_INITIAL_VELOCITY", r.rocket, r.final_dir.X, r.final_dir.Y, r.final_dir.Z)
  3416.  
  3417.                             r.fixRotation = Helper.DirectionToRotation(Vector3.Normalize(r.final_dir), 0)
  3418.                         Else
  3419.                             Native.Function.Call("SET_OBJECT_INITIAL_VELOCITY", r.rocket, _
  3420.                                 r.dir.X * j.jet.Speed * r.speed_multiplier, _
  3421.                                 r.dir.Y * j.jet.Speed * r.speed_multiplier, _
  3422.                                 r.dir.Z * j.jet.Speed * r.speed_multiplier)
  3423.  
  3424.                             r.fixRotation = Helper.DirectionToRotation(Vector3.Normalize(r.dir), 0)
  3425.                         End If
  3426.                     End If
  3427.  
  3428.                     r.rocket.Rotation = r.fixRotation
  3429.  
  3430.                     If Native.Function.Call(Of Boolean)("IS_OBJECT_IN_WATER", r.rocket) Then r.timeOut = 0
  3431.                 End If
  3432.             End If
  3433.         Next
  3434.     End Sub
  3435.  
  3436.     Private Sub setJet()
  3437.         If Exists(Player.Character.CurrentVehicle) AndAlso Not isInJet() Then
  3438.             myActualJet = Nothing
  3439.  
  3440.             For Each j As TCustomJetCFG In TCustomJetCFGList
  3441.                 If Player.Character.CurrentVehicle.Model = j.jetModel Then
  3442.                     myActualJet = j
  3443.                     Exit For
  3444.                 End If
  3445.             Next
  3446.  
  3447.             If Not Exists(myActualJet) Then Exit Sub
  3448.  
  3449.             Native.Function.Call("SET_DRAW_PLAYER_COMPONENT", 7, True)
  3450.             Native.Function.Call("SET_DRAW_PLAYER_COMPONENT", 0, True)
  3451.             Native.Function.Call("SET_DRAW_PLAYER_COMPONENT", 9, True)
  3452.  
  3453.             bWaterImpact = False
  3454.             myJet = Player.Character.CurrentVehicle
  3455.             myJet.Metadata.falling = False
  3456.  
  3457.             ' this fake jet its just to avoid the wing/flaps break when landing the jet
  3458.             ' i hide the original jet (that have collisions) and i make visible this fake jet (that cant be damaged and touched) in the center of the original jet
  3459.             If myActualJet.use_fake_jet Then
  3460.                 If Not Exists(myFakeJet) Then myFakeJet = World.CreateVehicle(myActualJet.jetModel, Player.Character.Position + Vector3.WorldUp * 100)
  3461.                 Wait(50)
  3462.                 If Not Exists(myFakeJet) Then myFakeJet = World.CreateVehicle(myActualJet.jetModel, Player.Character.Position + Vector3.WorldUp * 100)
  3463.             End If
  3464.  
  3465.             If Exists(myFakeJet) AndAlso myActualJet.use_fake_jet Then
  3466.                 myFakeJet.Repair()
  3467.                 myFakeJet.CanBeDamaged = False
  3468.                 myFakeJet.CanBeVisiblyDamaged = False
  3469.                 myFakeJet.Visible = True
  3470.                 myFakeJet.Dirtyness = 0
  3471.                 Native.Function.Call("ATTACH_CAR_TO_CAR", myFakeJet, myJet, False, 0, 0, 0, 0, 0, 0)
  3472.                 myJet.Visible = False
  3473.                 myJet.Metadata.invisible = True
  3474.             End If
  3475.  
  3476.             lastJetHealth = myJet.Health
  3477.  
  3478.             For Each r As MR In myActualJet.MRL
  3479.                 If Not Exists(r.rocket) Then
  3480.                     r.rocket = World.CreateObject(r.model_name, Player.Character.Position.Around(5) + Vector3.WorldUp * 100)
  3481.                     r.rocket.Visible = False
  3482.  
  3483.                     Wait(50)
  3484.                 End If
  3485.  
  3486.                 Native.Function.Call("stop_ptfx", r.ptfxExpID)
  3487.                 r.attach(myJet)
  3488.             Next
  3489.  
  3490.             'for each c as cannon in cannList
  3491.             '   c.attachPoint.detach
  3492.             '   native.function.call("ATTACH_OBJECT_TO_CAR", c.attachPoint, myJet, 0, c.x, c.y, c.z, 0, 0, 0)
  3493.             'next
  3494.  
  3495.         '   if not exists(planeDirAuxFront) then planeDirAuxFront = world.createobject("cj_rpg_rocket", player.character.position.around(5) + vector3.worldup * 50)
  3496.         '   if not exists(planeDirAuxCenter) then planeDirAuxCenter = world.createobject("cj_rpg_rocket", player.character.position.around(5) + vector3.worldup * 50)
  3497.         '   if not exists(planeDirAuxUp) then planeDirAuxUp = world.createobject("cj_rpg_rocket", player.character.position.around(5) + vector3.worldup * 50)
  3498.             'if not exists(myFlareObj) then myFlareObj = world.createobject("cj_rpg_rocket", player.character.position.around(5) + vector3.worldup * 50)
  3499.  
  3500.             If myFlares.Count = 0 Then
  3501.                 For c As Int16 = 1 To 5
  3502.                     tmpFlare = New Flare
  3503.                     myFlares.Add(tmpFlare)
  3504.                 Next
  3505.             End If
  3506.  
  3507.             For Each f As Flare In myFlares
  3508.                 If Not Exists(f.flareObj) Then f.flareObj = World.CreateObject("cj_proc_brick", Player.Character.Position.Around(5) + Vector3.WorldUp * 50)
  3509.             Next
  3510.         '  
  3511.         '   planeDirAuxFront.attachtovehicle(myjet, vector3.relativeback, vector3.zero)
  3512.         '   planeDirAuxCenter.attachtovehicle(myjet, vector3.zero, vector3.zero)
  3513.         '   planeDirAuxUp.attachtovehicle(myjet, vector3.worldup, vector3.zero)
  3514.  
  3515.             For Each f As Flare In myFlares
  3516.                 f.flareObj.AttachToVehicle(myJet, Vector3.WorldDown, Vector3.Zero)
  3517.                 f.flareObj.Visible = False
  3518.             Next
  3519.  
  3520.         '   planeDirAuxFront.visible = false
  3521.         '   planeDirAuxCenter.visible = false
  3522.         '   planeDirAuxUp.visible = false
  3523.  
  3524.  
  3525.             myJet.Metadata.isAnJet = True
  3526.  
  3527.             'player.character.weapons.removeall
  3528.  
  3529.             actualJetSpeed = myJet.Speed
  3530.  
  3531.             Player.IgnoredByEveryone = True
  3532.  
  3533.             timeWaitOpenGears = 0
  3534.             timeWaitCloseGears = 0
  3535.  
  3536.             soundOffsetAux = 20
  3537.             soundOffset = 20
  3538.             timeWaitIDSndJetAccel = 0
  3539.  
  3540.             If myActualJet.soundJetAccel2 <> "" Then _
  3541.                 Native.Function.Call("PLAY_SOUND_FROM_object", IDSndJetAccel2, myActualJet.soundJetAccel2, soundAuxAceel2)
  3542.  
  3543.             If Game.CurrentEpisode <> GameEpisode.GTAIV Then
  3544.                 ' this two lines, thx to Nevitro and his simple parachute giver :)
  3545.                 ' http://www.gtagarage.com/mods/show.php?id=11910
  3546.                 Player.Character.Weapons.Item(41).Ammo = 1
  3547.                 Player.Character.Weapons.Item(41).Select()
  3548.             End If
  3549.  
  3550.             myJet.DoorLock = DoorLock.ImpossibleToOpen
  3551.  
  3552.             Native.Function.Call("stop_sound", IDsndRocketMoveEnemy)
  3553.             Native.Function.Call("stop_sound", IDsndRocketMove)
  3554.  
  3555.             st_in_earth = Player.Character.Position.Z < st_height_teleport
  3556.  
  3557.             While Not Player.Character.isSittingInVehicle(myJet)
  3558.                 Wait(100)
  3559.             End While
  3560.         End If
  3561.     End Sub
  3562.  
  3563.     Private Sub searchForOtherJets()
  3564.         Dim tmpPilot As Ped = Nothing
  3565.  
  3566.         For Each j As TJet In jetList
  3567.             If Not Exists(j.jet) OrElse (Not j.isMP AndAlso Not Exists(j.p)) Then j.timeRemove = 0
  3568.         Next
  3569.  
  3570.         For Each customJet As TCustomJetCFG In TCustomJetCFGList
  3571.             For Each v As Vehicle In World.GetAllVehicles(customJet.jetModel)
  3572.                 If (v <> myJet) AndAlso Exists(v) AndAlso (v.Health > 0) AndAlso Not v.Metadata.isAnJet Then
  3573.                     Dim tmpExistJet As TJet = Nothing
  3574.  
  3575.                     For Each j As TJet In jetList
  3576.                         If j.jet = v Then
  3577.                             tmpExistJet = j
  3578.                             Exit Sub
  3579.                         End If
  3580.                     Next
  3581.  
  3582.                     tmpPilot = v.GetPedOnSeat(VehicleSeat.Driver)
  3583.  
  3584.                     If Exists(tmpExistJet) AndAlso Exists(tmpPilot) AndAlso Not tmpPilot.Metadata.IsJetPilot Then
  3585.                         If Not Exists(tmpExistJet) Then
  3586.                             tmpJet = New TJet
  3587.                             resetEnemyFlare(tmpJet)
  3588.                         Else
  3589.                             tmpExistJet.jetblip.Delete()
  3590.                         End If
  3591.  
  3592.                         tmpJet.jet = v
  3593.                         tmpJet.p = tmpPilot
  3594.                         tmpJet.is_hunter = False
  3595.                         tmpJet.is_fugitive = False
  3596.                         tmpJet.bAutoSpawn = False
  3597.                         tmpJet.isMP = True
  3598.                         tmpJet.jetblip = v.AttachBlip
  3599.                         tmpJet.jetblip.Color = BlipColor.Grey
  3600.                         tmpJet.checkPAux.Color = Color.FromArgb(100, 100, 100, 100)
  3601.                         tmpJet.checkPAux.Visible = True
  3602.                         tmpJet.checkPAux.Diameter = 10
  3603.  
  3604.                         If Not Exists(tmpExistJet) Then jetList.Add(tmpJet)
  3605.                     End If
  3606.                 End If
  3607.             Next
  3608.         Next
  3609.  
  3610.         ' search for helis 
  3611.         If search_for_helicopter AndAlso isInJet() Then
  3612.             searchHeliAux("annihilator")
  3613.             searchHeliAux("maverick")
  3614.             searchHeliAux("polmav")
  3615.             searchHeliAux("tourmav")
  3616.         End If
  3617.     End Sub
  3618.  
  3619.     Private Sub searchHeliAux(ByVal sModelName As String)
  3620.         If Not st_in_earth Then Exit Sub
  3621.  
  3622.         For Each v As Vehicle In World.GetAllVehicles(sModelName)
  3623.             If Exists(v) AndAlso Not isHeliAdded(v) AndAlso (v.Health > 0) Then
  3624.                 If isInJet() Then v.isRequiredForMission = True
  3625.  
  3626.                 tmpHeli = New THeli(v)
  3627.                 v.Metadata.isAnHeli = True
  3628.  
  3629.                 For Each p As Ped In World.GetPeds(v.Position, 15.0)
  3630.                     If Exists(p) AndAlso (p.CurrentVehicle = v) Then
  3631.                         tmpHeli.isMP = Exists(p.GetControllingPlayer)
  3632.  
  3633.                         'if not tmpHeli.isMP then p.becomemissioncharacter
  3634.                     End If
  3635.                 Next
  3636.  
  3637.                 'tmpHeli.checkPAux.Visible = True
  3638.                 'tmpHeli.checkPAux.Diameter = 10
  3639.                 'tmpHeli.checkPAux.Color = Color.FromArgb(100, 255, 150, 0)
  3640.  
  3641.                 tmpHeli.timeMissileLockValue = 300
  3642.                 tmpHeli.timeMissileLock = 300
  3643.  
  3644.                 If isInJet() AndAlso Not tmpHeli.isMP Then tmpHeli.heli.Position = (Player.Character.Position + Player.Character.Direction * 300).Around(300) + Vector3.WorldUp * random(20, 100)
  3645.  
  3646.                 heliList.Add(tmpHeli)
  3647.             End If
  3648.         Next
  3649.     End Sub
  3650.  
  3651.     Private Function isHeliAdded(ByVal v As Vehicle)
  3652.         For Each h As THeli In heliList
  3653.             If Exists(h.heli) AndAlso (h.heli = v) Then Return True
  3654.         Next
  3655.  
  3656.         Return False
  3657.     End Function
  3658.  
  3659.     Private Function planeDir()
  3660.         Return myJet.GetOffsetPosition(Vector3.RelativeFront) - myJet.Position
  3661.  
  3662.     '   if exists(planeDirAuxFront) andalso exists(planeDirAuxCenter) then         
  3663.     '       return planeDirAuxCenter.position - planeDirAuxFront.position
  3664.     '   else
  3665.     '       return player.character.currentvehicle.direction
  3666.     '   end if
  3667.     End Function
  3668.  
  3669.     Private Function planeDirUp()
  3670.         Return myJet.GetOffsetPosition(Vector3.RelativeTop) - myJet.Position
  3671.  
  3672.     '   if exists(planeDirAuxUp) andalso exists(planeDirAuxCenter) then        
  3673.     '       return planeDirAuxUp.position - planeDirAuxCenter.position
  3674.     '   else
  3675.     '       return player.character.currentvehicle.direction
  3676.     '   end if
  3677.     End Function
  3678.  
  3679.     Private Function enemyDir(ByVal enemy As TJet)
  3680.         Return enemy.jet.GetOffsetPosition(Vector3.RelativeFront) - enemy.jet.Position
  3681.     '   if exists(enemy.dirObj) andalso exists(enemy.dirObjCenter) then    
  3682.     '       return enemy.dirObj.position - enemy.dirObjCenter.position
  3683.     '   else
  3684.     '       return enemy.jet.direction
  3685.     '   end if
  3686.     End Function
  3687.  
  3688.     Private Function isInJet()
  3689.         Return Exists(Player.Character.CurrentVehicle) AndAlso Exists(myActualJet) AndAlso (Player.Character.CurrentVehicle = myJet) AndAlso (Player.Character.isSittingInVehicle(myJet))
  3690.     End Function
  3691.  
  3692.     Private Function isJetOk()
  3693.         Return Exists(myJet) AndAlso (myJet = Player.Character.CurrentVehicle) AndAlso (myJet.Health > 0) AndAlso (myJet.EngineHealth > 0) AndAlso (myJet.PetrolTankHealth > 0)
  3694.     End Function
  3695.  
  3696.     Private Sub JetLowHealthEffects()
  3697.         'dim tmpJetHealthAux as double = (myJet.health + myJet.enginehealth + myJet.petroltankhealth) / 3000
  3698.         Dim tmpJetHealthAux As Double = (myJet.Health) / 1000
  3699.  
  3700.         If tmpJetHealthAux < 0 Then tmpJetHealthAux = 0
  3701.  
  3702.         If (tmpJetHealthAux <= 0.5) AndAlso (PTFXMyJetSmoke = 0) Then
  3703.             PTFXMyJetSmoke = Native.Function.Call(Of Int32)("START_PTFX_ON_VEH", "ambient_steam_vent_oblong", _
  3704.                 myJet, 0, 0, 0, 0, 0, 0, 2.0)
  3705.         End If
  3706.  
  3707.         If (tmpJetHealthAux <= 0.2) AndAlso (PTFXMyJetFire = 0) Then
  3708.             PTFXMyJetFire = Native.Function.Call(Of Int32)("START_PTFX_ON_VEH", "ambient_fire_generic", _
  3709.                 myJet, 0, 0, 0, 0, 0, 0, 2.0)
  3710.         End If
  3711.     End Sub
  3712.  
  3713.     Private Sub drawTargetedHUD(ByVal target As Vehicle)
  3714.         camObjectAux.Position = Game.CurrentCamera.Position - Game.CurrentCamera.Direction * 20
  3715.         camObjectAux.Rotation = Game.CurrentCamera.Rotation
  3716.  
  3717.         Dim tmpTargetPos As Vector3 = target.Position
  3718.         Dim tmpDistCoef As Double = target.Position.DistanceTo(Game.CurrentCamera.Position) / 125
  3719.  
  3720.         tmpTargetPos += (camObjectAux.Position - camObjectAux.GetOffsetPosition(Vector3.RelativeTop * 3))
  3721.         Native.Function.Call("DRAW_CHECKPOINT", tmpTargetPos.X, tmpTargetPos.Y, tmpTargetPos.Z, 1 * tmpDistCoef, 255, 0, 0)
  3722.         'Native.Function.Call("draw_corona", tmpTargetPos.X, tmpTargetPos.Y, tmpTargetPos.Z, 300.0 * tmpDistCoef, 0, 0, 255, 0, 0)
  3723.         tmpTargetPos += (camObjectAux.Position - camObjectAux.GetOffsetPosition(Vector3.RelativeTop * 3))
  3724.         Native.Function.Call("DRAW_CHECKPOINT", tmpTargetPos.X, tmpTargetPos.Y, tmpTargetPos.Z, 1 * tmpDistCoef, 255, 0, 0)
  3725.         'Native.Function.Call("draw_corona", tmpTargetPos.X, tmpTargetPos.Y, tmpTargetPos.Z, 300.0 * tmpDistCoef, 0, 0, 255, 0, 0)
  3726.         tmpTargetPos += (camObjectAux.Position - camObjectAux.GetOffsetPosition(Vector3.RelativeBottom * 9))
  3727.         Native.Function.Call("DRAW_CHECKPOINT", tmpTargetPos.X, tmpTargetPos.Y, tmpTargetPos.Z, 1 * tmpDistCoef, 255, 0, 0)
  3728.         'Native.Function.Call("draw_corona", tmpTargetPos.X, tmpTargetPos.Y, tmpTargetPos.Z, 300.0 * tmpDistCoef, 0, 0, 255, 0, 0)
  3729.         tmpTargetPos += (camObjectAux.Position - camObjectAux.GetOffsetPosition(Vector3.RelativeBottom * 3))
  3730.         Native.Function.Call("DRAW_CHECKPOINT", tmpTargetPos.X, tmpTargetPos.Y, tmpTargetPos.Z, 1 * tmpDistCoef, 255, 0, 0)
  3731.         'Native.Function.Call("draw_corona", tmpTargetPos.X, tmpTargetPos.Y, tmpTargetPos.Z, 300.0 * tmpDistCoef, 0, 0, 255, 0, 0)
  3732.  
  3733.         tmpTargetPos += (camObjectAux.Position - camObjectAux.GetOffsetPosition(Vector3.RelativeTop * 6))
  3734.         tmpTargetPos += (camObjectAux.Position - camObjectAux.GetOffsetPosition(Vector3.RelativeRight * 3))
  3735.         Native.Function.Call("DRAW_CHECKPOINT", tmpTargetPos.X, tmpTargetPos.Y, tmpTargetPos.Z, 1 * tmpDistCoef, 255, 0, 0)
  3736.         'Native.Function.Call("draw_corona", tmpTargetPos.X, tmpTargetPos.Y, tmpTargetPos.Z, 300.0 * tmpDistCoef, 0, 0, 255, 0, 0)
  3737.         tmpTargetPos += (camObjectAux.Position - camObjectAux.GetOffsetPosition(Vector3.RelativeRight * 3))
  3738.         Native.Function.Call("DRAW_CHECKPOINT", tmpTargetPos.X, tmpTargetPos.Y, tmpTargetPos.Z, 1 * tmpDistCoef, 255, 0, 0)
  3739.         'Native.Function.Call("draw_corona", tmpTargetPos.X, tmpTargetPos.Y, tmpTargetPos.Z, 300.0 * tmpDistCoef, 0, 0, 255, 0, 0)
  3740.  
  3741.         tmpTargetPos += (camObjectAux.Position - camObjectAux.GetOffsetPosition(Vector3.RelativeLeft * 9))
  3742.         Native.Function.Call("DRAW_CHECKPOINT", tmpTargetPos.X, tmpTargetPos.Y, tmpTargetPos.Z, 1 * tmpDistCoef, 255, 0, 0)
  3743.         'Native.Function.Call("draw_corona", tmpTargetPos.X, tmpTargetPos.Y, tmpTargetPos.Z, 300.0 * tmpDistCoef, 0, 0, 255, 0, 0)
  3744.         tmpTargetPos += (camObjectAux.Position - camObjectAux.GetOffsetPosition(Vector3.RelativeLeft * 3))
  3745.         Native.Function.Call("DRAW_CHECKPOINT", tmpTargetPos.X, tmpTargetPos.Y, tmpTargetPos.Z, 1 * tmpDistCoef, 255, 0, 0)
  3746.         'Native.Function.Call("draw_corona", tmpTargetPos.X, tmpTargetPos.Y, tmpTargetPos.Z, 300.0 * tmpDistCoef, 0, 0, 255, 0, 0)
  3747.     End Sub
  3748.  
  3749.     Private Sub EnemyJetTick()
  3750.         For c As Int16 = jetList.Count - 1 To 0 Step -1
  3751.             If Not jetList(c).isMP Then
  3752.                 If (jetList(c).timeRemove <> -1000) Then ' counting to remove the FX and remove from the list
  3753.                     If (jetList(c).timeRemove <= 0) Then ' if reaches 0, remove
  3754.                         removeJet(c)
  3755.  
  3756.                         Exit For
  3757.                     Else
  3758.                         jetList(c).timeRemove -= Me.Interval
  3759.  
  3760.                         If (jetList(c).resetRot <> Vector3.Zero) Then
  3761.                             If jetList(c).timeResetRot <= 0 Then
  3762.                                 jetList(c).jet.Rotation = jetList(c).resetRot
  3763.                                 jetList(c).jet.Heading = jetList(c).resetHeading
  3764.                                 jetList(c).jet.Speed = jetList(c).resetSpeed
  3765.                                 jetList(c).jet.ApplyForce(Vector3.WorldDown * 10, Vector3.WorldEast * 300 + Vector3.WorldNorth * 300)
  3766.                                 jetList(c).resetRot = Vector3.Zero
  3767.                                 jetList(c).timeResetRot = 0
  3768.                             Else
  3769.                                 jetList(c).timeResetRot -= Me.Interval
  3770.                             End If
  3771.                         End If
  3772.                     End If
  3773.                 Else
  3774.                     'dim tmpJetHealthAux as double = (jetList(c).jet.health + jetList(c).jet.enginehealth + jetList(c).jet.petroltankhealth) / 3000
  3775.                     Dim tmpJetHealthAux As Double = (jetList(c).jet.Health) / 1000
  3776.  
  3777.                     If tmpJetHealthAux <= 0 Then
  3778.                         tmpJetHealthAux = 0
  3779.  
  3780.                         If Exists(TJetLocked) AndAlso TJetLocked.Equals(jetList(c)) Then TJetLocked = Nothing
  3781.                         If jetEnemyAttacking = jetList(c).jet Then jetEnemyAttacking = Nothing
  3782.  
  3783.                         If jetList(c).jet.Position.DistanceTo(myJet.Position) < 500 Then
  3784.                             For d As Int16 = 0 To 5
  3785.                                 Native.Function.Call("break_car_door", jetList(c).jet, d, False)
  3786.                             Next
  3787.  
  3788.                             explodeEnemyJet(jetList(c))
  3789.                         Else
  3790.                             Native.Function.Call("stop_ptfx", jetList(c).PTFXSmoke)
  3791.                             Native.Function.Call("stop_ptfx", jetList(c).PTFXFire)
  3792.                             Native.Function.Call("stop_ptfx", jetList(c).PTFXExp)
  3793.                         End If
  3794.  
  3795.                         jetList(c).timeRemove = 4000
  3796.                     Else
  3797.                         If (tmpJetHealthAux <= 0.5) AndAlso (jetList(c).PTFXSmoke = 0) Then
  3798.                             jetList(c).PTFXSmoke = Native.Function.Call(Of Int32)("START_PTFX_ON_VEH", "ambient_steam_vent_oblong", _
  3799.                                 jetList(c).jet, 0, 0, 0, 0, 0, 0, 2.0)
  3800.                         End If
  3801.  
  3802.                         If (tmpJetHealthAux < 0.2) AndAlso (jetList(c).PTFXFire = 0) Then
  3803.                             jetList(c).PTFXFire = Native.Function.Call(Of Int32)("START_PTFX_ON_VEH", "ambient_fire_generic", _
  3804.                                 jetList(c).jet, 0, 0, 0, 0, 0, 0, 2.0)
  3805.                         End If
  3806.                     End If
  3807.  
  3808.                     If jetList(c).jet.isOnScreen AndAlso (jetList(c).jet.Position.DistanceTo(myJet.Position) > drawEnemyRectDist) Then
  3809.                     '   dim float_temp_1 as double
  3810.                     '   dim TO_RADIAN = 0.017453292519943295
  3811.                     '   float_temp_1 = Math.Atan2((jetList(c).jet.Position.Y - Player.Character.Position.Y) , (jetList(c).jet.Position.X - Player.Character.Position.X))
  3812.                     '   float_temp_1 = float_temp_1 - Game.CurrentCamera.Rotation.Z * TO_RADIAN
  3813.                     '   float_temp_1 += 1.570796
  3814.                     '  
  3815.                     '   dim cam as camera = game.currentcamera
  3816.                     '   dim dist as double = jetList(c).jet.position.distanceto(cam.position)
  3817.                     '   dim compPos as vector3 = (cam.position + cam.direction * dist)
  3818.                     '   dim y as double = (((compPos - jetList(c).jet.position).z)) / dist
  3819.                     '  
  3820.                     '   if jetList(c).is_hunter then
  3821.                     '       GTA.Native.Function.Call("DRAW_RECT", 0.5f + 0.7f * (Math.Sin(float_temp_1)), y + 0.55, 0.01, 0.02, 255, 0, 0, 100)
  3822.                     '   elseif jetList(c).is_fugitive then
  3823.                     '       GTA.Native.Function.Call("DRAW_RECT", 0.5f + 0.7f * (Math.Sin(float_temp_1)), y + 0.55, 0.01, 0.02, 200, 200, 0, 100)                          
  3824.                     '   else
  3825.                     '       GTA.Native.Function.Call("DRAW_RECT", 0.5f + 0.7f * (Math.Sin(float_temp_1)), y + 0.55, 0.01, 0.02, 100, 100, 100, 100)
  3826.                     '   end if
  3827.  
  3828.                         'jetList(c).checkPAux.Visible = True
  3829.                         'jetList(c).checkPAux.Position = jetList(c).jet.Position
  3830.                         'jetList(c).checkPAux.Diameter = jetList(c).jet.Position.DistanceTo(Player.Character.Position) / 60
  3831.                         If jetList(c).is_hunter Then
  3832.                             Native.Function.Call("DRAW_CHECKPOINT", jetList(c).jet.Position.X, jetList(c).jet.Position.Y, jetList(c).jet.Position.Z, jetList(c).jet.Position.DistanceTo(Player.Character.Position) / 60, 255, 0, 0)
  3833.                         Else
  3834.                             Native.Function.Call("DRAW_CHECKPOINT", jetList(c).jet.Position.X, jetList(c).jet.Position.Y, jetList(c).jet.Position.Z, jetList(c).jet.Position.DistanceTo(Player.Character.Position) / 60, 255, 255, 0)
  3835.                         End If
  3836.                     'Else
  3837.                         'jetList(c).checkPAux.Visible = False
  3838.                     End If
  3839.                 End If
  3840.             Else
  3841.                 If Exists(jetList(c).jet) Then
  3842.                     If jetList(c).jet.Health <= 0 Then
  3843.                         If Exists(TJetLocked) AndAlso TJetLocked.Equals(jetList(c)) Then TJetLocked = Nothing
  3844.  
  3845.                         If jetEnemyAttacking = jetList(c).jet Then jetEnemyAttacking = Nothing
  3846.  
  3847.                         If jetList(c).jet.Position.DistanceTo(myJet.Position) < 500 Then
  3848.                             For d As Int16 = 0 To 5
  3849.                                 Native.Function.Call("break_car_door", jetList(c).jet, d, False)
  3850.                             Next
  3851.  
  3852.                             explodeEnemyJet(jetList(c))
  3853.                         Else
  3854.                             Native.Function.Call("stop_ptfx", jetList(c).PTFXSmoke)
  3855.                             Native.Function.Call("stop_ptfx", jetList(c).PTFXFire)
  3856.                             Native.Function.Call("stop_ptfx", jetList(c).PTFXExp)
  3857.                         End If
  3858.  
  3859.                         jetList(c).timeRemove = 3000
  3860.                     Else
  3861.                         If jetList(c).timeRemove <> -1000 Then
  3862.                             If (jetList(c).timeRemove <= 0) Then ' if reaches 0, remove
  3863.                                 removeJet(c)
  3864.  
  3865.                                 Exit For
  3866.                             Else
  3867.                                 jetList(c).timeRemove -= Me.Interval
  3868.                             End If
  3869.                         End If
  3870.                     End If
  3871.                 End If
  3872.             End If
  3873.         Next
  3874.     End Sub
  3875.  
  3876.     Private Function myJetSpeedAux()
  3877.         If myJet.Speed > 40 Then
  3878.             Return myJet.Speed
  3879.         Else
  3880.             Return 40
  3881.         End If
  3882.     End Function
  3883.  
  3884.     ' draw the textures adapting the position, width and height to the user resolution
  3885.     Private Sub drawSpriteAux(ByVal e As GTA.GraphicsEventArgs, ByVal tex As Texture, ByVal x As Double, ByVal y As Double, ByVal w As Double, ByVal h As Double, _
  3886.        ByVal rot As Double, ByVal col As Color, Optional ByVal square As Boolean = False)
  3887.         If square Then
  3888.             e.Graphics.DrawSprite(tex, x * width_Coef, y * height_Coef, w * width_Coef, h * width_Coef, rot, col)
  3889.         Else
  3890.             e.Graphics.DrawSprite(tex, x * width_Coef, y * height_Coef, w * width_Coef, h * height_Coef, rot, col)
  3891.         End If
  3892.     End Sub
  3893.  
  3894.     Private Sub drawLineAux(ByVal e As GTA.GraphicsEventArgs, ByVal xIni As Double, ByVal yIni As Double, ByVal xFin As Double, ByVal yFin As Double, _
  3895.        ByVal w As Double, ByVal col As Color)
  3896.         e.Graphics.DrawLine(xIni * width_Coef, yIni * height_Coef, xFin * width_Coef, yFin * height_Coef, w * width_Coef, col)
  3897.     End Sub
  3898.  
  3899.     Private Sub drawTextAux(ByVal e As GTA.GraphicsEventArgs, ByVal text As String, ByVal x As Double, ByVal y As Double, ByVal col As Color)
  3900.         e.Graphics.DrawText(text, x * width_Coef, y * height_Coef, col)
  3901.     End Sub
  3902.  
  3903.     Private Sub GraphicsEventHandler(ByVal sender As Object, ByVal e As GTA.GraphicsEventArgs) Handles MyBase.PerFrameDrawing
  3904.         Try
  3905.             If bSetupHelpMode Then
  3906.                 drawTextAux(e, "Jet Setup mode", 20, 20, Color.White)
  3907.                 drawTextAux(e, "  Controls:", 20, 50, Color.White)
  3908.                 drawTextAux(e, "   Navigate between itens: Left/Right arrow", 20, 70, Color.White)
  3909.                 drawTextAux(e, "   Navigate between types: Down arrow", 20, 90, Color.White)
  3910.                 drawTextAux(e, "   Move up or down: Numpad + or -", 20, 110, Color.White)
  3911.                 drawTextAux(e, "   Move item left, right, backward or forward: Numpads: 4, 6, 8, 2", 20, 130, Color.White)
  3912.                 drawTextAux(e, "   Move faster: hold Control", 20, 150, Color.White)
  3913.                 drawTextAux(e, "   Toggle enabled: Enter", 20, 170, Color.White)
  3914.                 drawTextAux(e, "   Generate oposite rocket, cannon or engine: G", 20, 190, Color.White)
  3915.                 drawTextAux(e, "   Toggle free camera: C", 20, 210, Color.White)
  3916.                 drawTextAux(e, "   Save actual setup: Numpad0", 20, 230, Color.White)
  3917.  
  3918.                 If SM_type = 0 Then drawTextAux(e, "   Toggle is_bomb: B", 20, 250, Color.White)
  3919.  
  3920.                 If SM_type = 0 Then
  3921.                     drawTextAux(e, "Type: Rocket, item: " & (SM_actual_rocket + 1).ToString & ", enabled: " & myActualJet.MRL(SM_actual_rocket).enabled.ToString & _
  3922.                         ", is_bomb: " & myActualJet.MRL(SM_actual_rocket).isBomb.ToString, 20, 290, Color.White)
  3923.                     drawTextAux(e, "X offset: " & myActualJet.MRL(SM_actual_rocket).xAttach.ToString, 20, 310, Color.White)
  3924.                     drawTextAux(e, "Y offset: " & myActualJet.MRL(SM_actual_rocket).yAttach.ToString, 20, 330, Color.White)
  3925.                     drawTextAux(e, "X offset: " & myActualJet.MRL(SM_actual_rocket).zAttach.ToString, 20, 350, Color.White)
  3926.                 ElseIf SM_type = 1 Then
  3927.                     drawTextAux(e, "Type: Cannon, item: " & (SM_actual_cannon + 1).ToString & ", enabled: " & myActualJet.cannList(SM_actual_cannon).enabled.ToString, _
  3928.                         20, 290, Color.White)
  3929.                     drawTextAux(e, "X offset: " & myActualJet.cannList(SM_actual_cannon).offPosition.X.ToString, 20, 310, Color.White)
  3930.                     drawTextAux(e, "Y offset: " & myActualJet.cannList(SM_actual_cannon).offPosition.Y.ToString, 20, 330, Color.White)
  3931.                     drawTextAux(e, "Z offset: " & myActualJet.cannList(SM_actual_cannon).offPosition.Z.ToString, 20, 350, Color.White)
  3932.                 ElseIf SM_type = 2 Then
  3933.                     drawTextAux(e, "Type: Engine, item: " & (SM_actual_engine + 1).ToString & ", enabled: " & myActualJet.engineList(SM_actual_engine).enabled.ToString, _
  3934.                         20, 290, Color.White)
  3935.                     drawTextAux(e, "X offset: " & myActualJet.engineList(SM_actual_engine).offPosition.X.ToString, 20, 310, Color.White)
  3936.                     drawTextAux(e, "Y offset: " & myActualJet.engineList(SM_actual_engine).offPosition.Y.ToString, 20, 330, Color.White)
  3937.                     drawTextAux(e, "Z offset: " & myActualJet.engineList(SM_actual_engine).offPosition.Z.ToString, 20, 350, Color.White)
  3938.                 End If
  3939.  
  3940.                 drawTextAux(e, "Actual jet file: " & myActualJet.fileName, 20, 390, Color.White)
  3941.  
  3942.                 Exit Sub
  3943.             End If
  3944.  
  3945.             If bSpawnMenuON Then
  3946.                 drawTextAux(e, "Jet spawn menu:", 20, 20, Color.White)
  3947.  
  3948.                 For c As Int16 = 0 To TCustomJetCFGList.Count - 1
  3949.                     If c = SM_Current_index Then
  3950.                         drawLineAux(e, 20, _
  3951.                         70 + c * 20, _
  3952.                         500, _
  3953.                         70 + c * 20, 2, Color.Red)
  3954.  
  3955.                         If Not TCustomJetCFGList(c).texPreview Is Nothing Then drawSpriteAux(e, TCustomJetCFGList(c).texPreview, 700, 220 + c * 20, 387, 200, 0, Color.White)
  3956.                     End If
  3957.  
  3958.                     drawTextAux(e, TCustomJetCFGList(c).display_name, 20, 50 + c * 20, Color.White)
  3959.                 Next
  3960.  
  3961.                 drawTextAux(e, "Controls:", 20, 80 + TCustomJetCFGList.Count * 20, Color.White)
  3962.                 drawTextAux(e, "   Navigate: " + hkPrevMenuItem.ToString & " and " & hkNextMenuItem.ToString, 20, 105 + TCustomJetCFGList.Count * 20, Color.White)
  3963.                 drawTextAux(e, "   Spawn: Enter", 20, 130 + TCustomJetCFGList.Count * 20, Color.White)
  3964.                 drawTextAux(e, "XBox 360 Control:", 20, 155 + TCustomJetCFGList.Count * 20, Color.White)
  3965.                 drawTextAux(e, "   Navigate: Dpad left or right", 20, 180 + TCustomJetCFGList.Count * 20, Color.White)
  3966.                 drawTextAux(e, "   Spawn: A spawn on air, X spawn on ground", 20, 205 + TCustomJetCFGList.Count * 20, Color.White)
  3967.             End If
  3968.  
  3969.             If isInJet() Then
  3970.                 Dim hPos As Int16 = Math.Round((myHeight / 2) + (myHeight / 500) * Player.Character.Position.Z)
  3971.                 Dim maxH, minH As Int16
  3972.                 maxH = 320
  3973.                 minH = 170
  3974.                 Dim hPosAux As Int16
  3975.  
  3976.                 If jetList.Count > 0 Then
  3977.                     If jetList.Count < 22 Then
  3978.                         drawSpriteAux(e, texBotton, myWidth + Math.Round(myWidth / 4) - (65 * jetList.Count) + 115, 950, 1920, 220, 0, Color.White)
  3979.                     Else
  3980.                         drawSpriteAux(e, texBotton, myWidth + Math.Round(myWidth / 4) - (65 * 21) + 115, 950, 1920, 220, 0, Color.White)
  3981.                     End If
  3982.                 End If
  3983.  
  3984.                 drawSpriteAux(e, texBackg, myWidth - 157, 188, 331, 403, 0, Color.White)
  3985.                 drawTextAux(e, groundDist.ToString, myWidth - 55, 330, Color.FromArgb(175, 0, 255, 150))
  3986.  
  3987.                 For c As Int16 = -200 To 200
  3988.                     hPosAux = hPos + c * 30
  3989.  
  3990.                     If (hPosAux < maxH) AndAlso (hPosAux > minH) Then
  3991.                         'drawLineAux(e, myWidth - 50, hPosAux, _
  3992.                         '   myWidth - 25, hPosAux, 5, color.fromargb(255, 255, 150, 0))
  3993.                         drawSpriteAux(e, texLineAux, myWidth - 38, hPosAux, 33, 8, 0, Color.FromArgb(255, 255, 255, 255))
  3994.                     End If
  3995.                 Next
  3996.  
  3997.                 Dim tmpJetHealthAux As Double
  3998.  
  3999.                 'tmpJetHealthAux = ((myJet.health + myJet.enginehealth + myJet.petroltankhealth) / 3000)
  4000.                 tmpJetHealthAux = ((myJet.Health) / 1000)
  4001.  
  4002.                 If tmpJetHealthAux < 0 Then tmpJetHealthAux = 0
  4003.  
  4004.                 If rpmAnim >= 360 Then rpmAnim = 0
  4005.  
  4006.                 rpmAnim += 50 * (myJet.Speed / myActualJet.maxJetSpeed)
  4007.  
  4008.                 drawSpriteAux(e, texJet, myWidth - 40, 115, 57, 73, 0, Color.FromArgb(255, 255, 255, 255))
  4009.                 drawSpriteAux(e, texRpm, myWidth - 39, 416, 75, 75, rpmAnim * (3.14 / 180), Color.FromArgb(255, 255, 255, 255), True)
  4010.  
  4011.                 If Exists(jetEnemyAttacking) OrElse bWarnEnemyMissileLock Then _
  4012.                     drawSpriteAux(e, texMissileAlarm, Math.Round(myWidth / 2), 45, 300, 60, 0, Color.FromArgb(255, 255, 255, 255))
  4013.  
  4014.                 If Exists(TJetLocked) OrElse Exists(heliLocked) OrElse bWarnMyMissileLock Then
  4015.                     drawSpriteAux(e, texMissileLocked, Math.Round(myWidth / 2), 85, 300, 60, 0, Color.FromArgb(255, 255, 255, 255))
  4016.  
  4017.                     If Exists(TJetLocked) Then drawTargetedHUD(TJetLocked.jet)
  4018.                     If Exists(heliLocked) Then drawTargetedHUD(heliLocked)
  4019.                 End If
  4020.  
  4021.                 bWarnEnemyMissileLock = False
  4022.                 bWarnMyMissileLock = False
  4023.  
  4024.                 If tmpJetHealthAux <= 1 Then
  4025.                     drawLineAux(e, myWidth - 20, 155, _
  4026.                         myWidth - 20, 155 - Math.Round((75 * tmpJetHealthAux)), _
  4027.                         5, Color.FromArgb(200, 255, 255 * tmpJetHealthAux, 0))
  4028.                 End If
  4029.  
  4030.                 For Each m As MR In myActualJet.MRL
  4031.                     If Not m.enabled Then Continue For
  4032.  
  4033.                     If Not m.launched Then
  4034.                         If Not m.isBomb Then
  4035.                             drawSpriteAux(e, texMissile, myWidth - 20 * myActualJet.MRL.IndexOf(m) - 15, 35, 15, 58, 0, Color.FromArgb(255, 255, 255, 255))
  4036.                         Else
  4037.                             drawSpriteAux(e, texBomb, myWidth - 30 * myActualJet.MRL.IndexOf(m) - 15, 35, 30, 58, 0, Color.FromArgb(255, 255, 255, 255))
  4038.                         End If
  4039.                     Else
  4040.                         If Not m.isBomb Then
  4041.                             drawSpriteAux(e, texMissile, myWidth - 20 * myActualJet.MRL.IndexOf(m) - 15, 35, 15, 58, 0, Color.FromArgb(255, 100, 100, 100))
  4042.                         Else
  4043.                             drawSpriteAux(e, texBomb, myWidth - 30 * myActualJet.MRL.IndexOf(m) - 15, 35, 30, 58, 0, Color.FromArgb(255, 100, 100, 100))
  4044.                         End If
  4045.                     End If
  4046.                 Next
  4047.  
  4048.                 ' flare indicator
  4049.                 If (timeShowFlareAux <= 0) AndAlso (timeOutMyFlare > 0) Then
  4050.                     timeShowFlareAux = 50
  4051.                     drawSpriteAux(e, texFlares, myWidth - 270, 15, 35, 35, 0, Color.FromArgb(255, 255 - (255 * (timeOutMyFlare / 3000)), 255 - (255 * (timeOutMyFlare / 3000)), 255 - (255 * (timeOutMyFlare / 3000))))
  4052.                 ElseIf timeOutMyFlare <= 0 Then
  4053.                     drawSpriteAux(e, texFlares, myWidth - 270, 15, 35, 35, 0, Color.FromArgb(255, 255, 255, 255))
  4054.                 End If
  4055.  
  4056.                 For c As Int16 = jetList.Count - 1 To 0 Step -1
  4057.                     If Exists(jetList(c).jet) AndAlso Exists(jetList(c).p) Then
  4058.                         If (c < 21) AndAlso (jetList(c).timeRemove = -1000) AndAlso Exists(jetList(c).p) Then
  4059.                             'tmpJetHealthAux = ((jetList(c).jet.health + jetList(c).jet.enginehealth + jetList(c).jet.petroltankhealth) / 3000)                
  4060.                             tmpJetHealthAux = ((jetList(c).jet.Health) / 1000)
  4061.  
  4062.                             If tmpJetHealthAux < 0 Then tmpJetHealthAux = 0
  4063.  
  4064.                             If jetList(c).is_hunter Then
  4065.                                 drawSpriteAux(e, texJet, myWidth - 65 * c - 35, myHeight - 85, 57, 73, 0, Color.FromArgb(100, 255, 0, 0))
  4066.                             Else
  4067.                                 drawSpriteAux(e, texJet, myWidth - 65 * c - 35, myHeight - 85, 57, 73, 0, Color.FromArgb(100, 200, 200, 0))
  4068.                             End If
  4069.  
  4070.                             If tmpJetHealthAux <= 1 Then
  4071.                                 drawLineAux(e, myWidth - 65 * c - 10, myHeight - 45, _
  4072.                                     myWidth - 65 * c - 10, myHeight - Math.Round(45 + (75 * tmpJetHealthAux)), _
  4073.                                     5, Color.FromArgb(200, 255, 255 * tmpJetHealthAux, 0))
  4074.                             End If
  4075.  
  4076.                             If jetList(c).jet = jetEnemyAttacking Then
  4077.                                 drawTextAux(e, "Missile", myWidth - 65 * c - 75, myHeight - 110, Color.FromArgb(175, 0, 255, 150))
  4078.                                 drawTextAux(e, "locked", myWidth - 65 * c - 75, myHeight - 85, Color.FromArgb(175, 0, 255, 150))
  4079.                             End If
  4080.                         End If
  4081.                     End If
  4082.                 Next
  4083.  
  4084.                 If jetList.Count > 21 Then drawTextAux(e, "+", 300, myHeight - 100, Color.FromArgb(175, 0, 255, 150))
  4085.  
  4086.                 If bFlapsHelpMode Then
  4087.                     drawTextAux(e, "*** Flaps helper ***", 10, 10, Color.FromArgb(255, 255, 255, 255))
  4088.                     drawTextAux(e, "Hold the number of the Door ID to see what flap/gear/wing it is...", 10, 35, Color.FromArgb(255, 255, 255, 255))
  4089.                     drawTextAux(e, " then use this number in the .INI file in the wings_flaps section", 10, 60, Color.FromArgb(255, 255, 255, 255))
  4090.                     drawTextAux(e, "Numpad 0 - Left front door", 10, 100, Color.FromArgb(255, 255, 255, 255))
  4091.                     drawTextAux(e, "Numpad 1 - Right front door", 10, 125, Color.FromArgb(255, 255, 255, 255))
  4092.                     drawTextAux(e, "Numpad 2 - Left rear door", 10, 150, Color.FromArgb(255, 255, 255, 255))
  4093.                     drawTextAux(e, "Numpad 3 - Right rear door", 10, 175, Color.FromArgb(255, 255, 255, 255))
  4094.                     drawTextAux(e, "Numpad 4 - Hood", 10, 200, Color.FromArgb(255, 255, 255, 255))
  4095.                     drawTextAux(e, "Numpad 5 - Trunk", 10, 225, Color.FromArgb(255, 255, 255, 255))
  4096.                 End If
  4097.             End If
  4098.         Catch
  4099.         End Try
  4100.     End Sub
  4101.  
  4102.     Private Sub removeJet(ByVal pos As Int16)
  4103.         Try
  4104.             If jetList(pos).jet = jetEnemyAttacking Then jetEnemyAttacking = Nothing
  4105.  
  4106.             Native.Function.Call("stop_ptfx", jetList(pos).PTFXSmoke)
  4107.             Native.Function.Call("stop_ptfx", jetList(pos).PTFXFire)
  4108.             Native.Function.Call("stop_ptfx", jetList(pos).PTFXExp)
  4109.  
  4110.             jetList(pos).jetblip.Delete()
  4111.             jetList(pos).timeRemove = -1000
  4112.  
  4113.             If Not jetList(pos).isMP AndAlso Exists(jetList(pos).jet) Then jetList(pos).jet.NoLongerNeeded()
  4114.             If Not jetList(pos).isMP AndAlso Exists(jetList(pos).p) Then jetList(pos).p.NoLongerNeeded()
  4115.  
  4116.             'wreckedJetList.add(jetList(pos))
  4117.  
  4118.             'jetList(pos).checkPAux.Visible = False
  4119.             jetList.RemoveAt(pos)
  4120.         Catch
  4121.         End Try
  4122.     End Sub
  4123.  
  4124.     Private Function rotateVec(ByVal vec As Vector3, ByVal angle As Double)
  4125.         angle = angle * (3.1415 / 180)
  4126.  
  4127.         Dim s As Double = System.Math.Sin(angle)
  4128.         Dim c As Double = System.Math.Cos(angle)
  4129.  
  4130.         vec.X = vec.X * c - vec.Y * s
  4131.         vec.Y = vec.X * s + vec.Y * c
  4132.  
  4133.         Return vec
  4134.     End Function
  4135.  
  4136.     Private Sub console_CMD(ByVal sender As Object, ByVal e As ConsoleEventArgs) Handles MyBase.ConsoleCommand
  4137.         If e.Command = "anyjet" Then
  4138.             If e.ParameterCount > 0 Then
  4139.                 If (e.Parameter(0) = "flaps") Then
  4140.                     bSetupHelpMode = False
  4141.                     bSpawnMenuON = False
  4142.                     bShowPosition = False
  4143.  
  4144.                     bFlapsHelpMode = Not bFlapsHelpMode
  4145.  
  4146.                     If bFlapsHelpMode AndAlso Not isInJet() Then
  4147.                         msg("enter in an jet and repeat the command...", 3000)
  4148.                         bFlapsHelpMode = False
  4149.                     End If
  4150.                 ElseIf (e.Parameter(0) = "pos") Then
  4151.                     bSpawnMenuON = False
  4152.                     bSetupHelpMode = False
  4153.                     bFlapsHelpMode = False
  4154.  
  4155.                     bShowPosition = Not bShowPosition
  4156.                 ElseIf (e.Parameter(0) = "setup") Then
  4157.                     bSpawnMenuON = False
  4158.                     bShowPosition = False
  4159.                     bFlapsHelpMode = False
  4160.  
  4161.                     bSetupHelpMode = Not bSetupHelpMode
  4162.  
  4163.                     If bSetupHelpMode AndAlso Not Exists(myJet) Then
  4164.                         bSetupHelpMode = False
  4165.                         msg("Enter in a jet and repeat the command...", 3000)
  4166.                         Exit Sub
  4167.                     End If
  4168.  
  4169.                     If bSetupHelpMode Then
  4170.                         msg("Setup mode ON...", 5000)
  4171.                         myJet.FreezePosition = True
  4172.                         myJet.Position = myJet.Position.ToGround + Vector3.WorldUp * 300
  4173.  
  4174.                         For Each m As MR In myActualJet.MRL
  4175.                             m.rocket.Visible = False
  4176.                             Native.Function.Call("stop_ptfx", m.ptfxID)
  4177.  
  4178.                             If myActualJet.MRL.IndexOf(m) = SM_actual_rocket Then
  4179.                                 m.attach(myJet)
  4180.                                 m.ptfxID = Native.Function.Call(Of Int32)("START_PTFX_ON_OBJ", "weap_rocket_player", m.rocket, 0, 0, 0, 0, 0, 0, 1.0)
  4181.                                 m.rocket.Visible = True
  4182.                             End If
  4183.                         Next
  4184.                     Else
  4185.                         msg("Setup mode OFF...", 5000)
  4186.                         myJet.FreezePosition = False
  4187.                     End If
  4188.                 Else
  4189.                     For Each j As TCustomJetCFG In TCustomJetCFGList
  4190.                         If j.console_cmd_spawn = e.Parameter(0) Then
  4191.                             spawnMyJet(j)
  4192.                             Exit For
  4193.                         End If
  4194.                     Next
  4195.                 End If
  4196.             End If
  4197.         End If
  4198.     End Sub
  4199.  
  4200.     Private Sub sndCannonPlay()
  4201.         Dim vecPos As Vector3
  4202.  
  4203.         If camMode = 0 Then
  4204.             vecPos = Player.Character.Position + Game.CurrentCamera.Direction * 15
  4205.         ElseIf camMode = 4 Then
  4206.             vecPos = Player.Character.Position - planeDir() * 30
  4207.         Else
  4208.             vecPos = Player.Character.Position + planeDir() * 10
  4209.         End If
  4210.  
  4211.         Native.Function.Call("stop_sound", IDsndCannon)
  4212.         'native.function.call("PLAY_SOUND_FROM_position", IDsndCannon, soundCannon, player.character)
  4213.         Native.Function.Call("PLAY_SOUND_FROM_position", IDsndCannon, myActualJet.soundCannon, vecPos.X, vecPos.Y, vecPos.Z)
  4214.     End Sub
  4215.  
  4216.     Private Sub clearHeliList()
  4217.         For Each h As THeli In heliList
  4218.             Try
  4219.                 h.heli.Metadata.isAnHeli = False
  4220.  
  4221.                 For Each p As Ped In World.GetPeds(h.heli.Position, 15.0)
  4222.                     If Exists(p) AndAlso (p.CurrentVehicle = h.heli) Then
  4223.                         If Not Exists(p.GetControllingPlayer) Then p.NoLongerNeeded()
  4224.                     End If
  4225.                 Next
  4226.  
  4227.                 h.heli.isRequiredForMission = False
  4228.                 h.heli.NoLongerNeeded()
  4229.             Catch
  4230.             End Try
  4231.         Next
  4232.  
  4233.         heliList.Clear()
  4234.     End Sub
  4235.  
  4236.     Private Sub saveNewSetup()
  4237.         msg("Saving...", 30000)
  4238.  
  4239.         iniFile = ".\Scripts\JetFiles\Jets\" & myActualJet.fileName
  4240.         checkIniExists()
  4241.  
  4242.         Try
  4243.             For c As Int16 = 1 To myActualJet.MRL.Count
  4244.                 If myActualJet.MRL(c - 1).enabled Then WriteINI("enabled", "rocket_" & c.ToString, "1") Else WriteINI("enabled", "rocket_" & c.ToString, "0")
  4245.                 If myActualJet.MRL(c - 1).isBomb Then WriteINI("is_bomb", "rocket_" & c.ToString, "1") Else WriteINI("is_bomb", "rocket_" & c.ToString, "0")
  4246.                 WriteINI("x", "rocket_" & c.ToString, myActualJet.MRL(c - 1).xAttach.ToString)
  4247.                 WriteINI("y", "rocket_" & c.ToString, myActualJet.MRL(c - 1).yAttach.ToString)
  4248.                 WriteINI("z", "rocket_" & c.ToString, myActualJet.MRL(c - 1).zAttach.ToString)
  4249.             Next
  4250.             For c As Int16 = 1 To myActualJet.cannList.Count
  4251.                 If myActualJet.cannList(c - 1).enabled Then WriteINI("enabled", "cannon_" & c.ToString, "1") Else WriteINI("enabled", "cannon_" & c.ToString, "0")
  4252.                 WriteINI("x", "cannon_" & c.ToString, myActualJet.cannList(c - 1).offPosition.X.ToString)
  4253.                 WriteINI("y", "cannon_" & c.ToString, myActualJet.cannList(c - 1).offPosition.Y.ToString)
  4254.                 WriteINI("z", "cannon_" & c.ToString, myActualJet.cannList(c - 1).offPosition.Z.ToString)
  4255.             Next
  4256.             For c As Int16 = 1 To myActualJet.engineList.Count
  4257.                 If myActualJet.engineList(c - 1).enabled Then WriteINI("enabled", "engine_" & c.ToString, "1") Else WriteINI("enabled", "engine_" & c.ToString, "0")
  4258.                 WriteINI("x", "engine_" & c.ToString, myActualJet.engineList(c - 1).offPosition.X.ToString)
  4259.                 WriteINI("y", "engine_" & c.ToString, myActualJet.engineList(c - 1).offPosition.Y.ToString)
  4260.                 WriteINI("z", "engine_" & c.ToString, myActualJet.engineList(c - 1).offPosition.Z.ToString)
  4261.             Next
  4262.  
  4263.             msg("Saved!", 3000)
  4264.         Catch ex As Exception
  4265.             msg("Error: " & ex.Message, 60000)
  4266.         End Try
  4267.     End Sub
  4268.  
  4269.     Private Sub loadConfig()
  4270.         ' hotkeys
  4271.         If Settings.GetValueKey("hkShootRocket", "general", -1) = -1 Then Settings.SetValue("hkShootRocket", "general", Keys.Space)
  4272.         If Settings.GetValueKey("hkShootCannon", "general", -1) = -1 Then Settings.SetValue("hkShootCannon", "general", Keys.NumPad0)
  4273.         If Settings.GetValueKey("hkDropBomb", "general", -1) = -1 Then Settings.SetValue("hkDropBomb", "general", Keys.Q)
  4274.         If Settings.GetValueKey("hkSwitchGun", "general", -1) = -1 Then Settings.SetValue("hkSwitchGun", "general", Keys.RButton)
  4275.         If Settings.GetValueKey("hkSpawnEnemy", "general", -1) = -1 Then Settings.SetValue("hkSpawnEnemy", "general", Keys.D2)
  4276.         If Settings.GetValueKey("hkSpawnFugitive", "general", -1) = -1 Then Settings.SetValue("hkSpawnFugitive", "general", Keys.D3)
  4277.         If Settings.GetValueKey("hkJetMoveDown", "general", -1) = -1 Then Settings.SetValue("hkJetMoveDown", "general", Keys.ShiftKey)
  4278.         If Settings.GetValueKey("hkJetMoveUp", "general", -1) = -1 Then Settings.SetValue("hkJetMoveUp", "general", Keys.ControlKey)
  4279.         If Settings.GetValueKey("hkEject", "general", -1) = -1 Then Settings.SetValue("hkEject", "general", Keys.F)
  4280.         If Settings.GetValueKey("hkEnterJet", "general", -1) = -1 Then Settings.SetValue("hkEnterJet", "general", Keys.F)
  4281.         If Settings.GetValueKey("hkSwitchCam", "general", -1) = -1 Then Settings.SetValue("hkSwitchCam", "general", Keys.X)
  4282.         If Settings.GetValueKey("hkFlare", "general", -1) = -1 Then Settings.SetValue("hkFlare", "general", Keys.E)
  4283.         If Settings.GetValueKey("hkTurnLeft", "general", -1) = -1 Then Settings.SetValue("hkTurnLeft", "general", Keys.NumPad7)
  4284.         If Settings.GetValueKey("hkTurnRight", "general", -1) = -1 Then Settings.SetValue("hkTurnRight", "general", Keys.NumPad9)
  4285.         If Settings.GetValueKey("hkRollLeft", "general", -1) = -1 Then Settings.SetValue("hkRollLeft", "general", Keys.NumPad4)
  4286.         If Settings.GetValueKey("hkRollRight", "general", -1) = -1 Then Settings.SetValue("hkRollRight", "general", Keys.NumPad6)
  4287.         If Settings.GetValueKey("hkUp", "general", -1) = -1 Then Settings.SetValue("hkUp", "general", Keys.NumPad5)
  4288.         If Settings.GetValueKey("hkDown", "general", -1) = -1 Then Settings.SetValue("hkDown", "general", Keys.NumPad8)
  4289.         If Settings.GetValueKey("hkSpawnMenu", "general", -1) = -1 Then Settings.SetValue("hkSpawnMenu", "general", Keys.D0)
  4290.         If Settings.GetValueKey("hkNextMenuItem", "general", -1) = -1 Then Settings.SetValue("hkNextMenuItem", "general", Keys.Right)
  4291.         If Settings.GetValueKey("hkPrevMenuItem", "general", -1) = -1 Then Settings.SetValue("hkPrevMenuItem", "general", Keys.Left)
  4292.         If Settings.GetValueKey("useResolutionFix", "general", -1) = -1 Then Settings.SetValue("useResolutionFix", "general", "0")
  4293.         If Settings.GetValueKey("myGameWidth", "general", -1) = -1 Then Settings.SetValue("myGameWidth", "general", Game.Resolution.Width)
  4294.         If Settings.GetValueKey("myGameHeight", "general", -1) = -1 Then Settings.SetValue("myGameHeight", "general", Game.Resolution.Height)
  4295.         If Settings.GetValueFloat("AimEase", "general", -1) = -1 Then Settings.SetValue("AimEase", "general", "1.0")
  4296.         If Settings.GetValueString("search_for_helicopter", "general", "") = "" Then Settings.SetValue("search_for_helicopter", "general", "1")
  4297.  
  4298.         If Settings.GetValueString("camPilotHidePlayer", "extra_cams", "-100") = "-100" Then Settings.SetValue("camPilotHidePlayer", "extra_cams", "0")
  4299.         If Settings.GetValueString("camPilotFixedRotation", "extra_cams", "-100") = "-100" Then Settings.SetValue("camPilotFixedRotation", "extra_cams", "0")
  4300.  
  4301.         camPilotHidePlayer = Settings.GetValueString("camPilotHidePlayer", "extra_cams", "-100") = "1"
  4302.         camPilotFixedRotation = Settings.GetValueString("camPilotFixedRotation", "extra_cams", "-100") = "1"
  4303.  
  4304.         ' space trip
  4305.         If Settings.GetValueFloat("st_height_teleport", "space_trip", 0) = 0 Then Settings.SetValue("st_height_teleport", "space_trip", "4000.0")
  4306.         If Settings.GetValueFloat("st_height_teleport_back", "space_trip", 0) = 0 Then Settings.SetValue("st_height_teleport_back", "space_trip", "19700.0")
  4307.         If Settings.GetValueFloat("st_teleport_pos_x", "space_trip", 0) = 0 Then Settings.SetValue("st_teleport_pos_x", "space_trip", "400")
  4308.         If Settings.GetValueFloat("st_teleport_pos_y", "space_trip", 0) = 0 Then Settings.SetValue("st_teleport_pos_y", "space_trip", "220")
  4309.         If Settings.GetValueFloat("st_teleport_pos_z", "space_trip", 0) = 0 Then Settings.SetValue("st_teleport_pos_z", "space_trip", "20000")
  4310.         If Settings.GetValueFloat("st_teleport_pos_back_x", "space_trip", 0) = 0 Then Settings.SetValue("st_teleport_pos_back_x", "space_trip", "400")
  4311.         If Settings.GetValueFloat("st_teleport_pos_back_y", "space_trip", 0) = 0 Then Settings.SetValue("st_teleport_pos_back_y", "space_trip", "220")
  4312.         If Settings.GetValueFloat("st_teleport_pos_back_z", "space_trip", 0) = 0 Then Settings.SetValue("st_teleport_pos_back_z", "space_trip", "3000")
  4313.         If Settings.GetValueFloat("st_time_check", "space_trip", 0) = 0 Then Settings.SetValue("st_time_check", "space_trip", "1000.0")
  4314.  
  4315.         ' enemy cfg
  4316.         If Settings.GetValueKey("enemyJet_shoot_cannon", "enemy_cfg", -1) = -1 Then Settings.SetValue("enemyJet_shoot_cannon", "enemy_cfg", 1)
  4317.         If Settings.GetValueKey("enemyJet_shoot_rocket", "enemy_cfg", -1) = -1 Then Settings.SetValue("enemyJet_shoot_rocket", "enemy_cfg", 1)
  4318.         If Settings.GetValueKey("enemyJet_cannon_dmg", "enemy_cfg", -1) = -1 Then Settings.SetValue("enemyJet_cannon_dmg", "enemy_cfg", 15)
  4319.         If Settings.GetValueKey("enemyJet_rocket_damage", "enemy_cfg", -1) = -1 Then Settings.SetValue("enemyJet_rocket_damage", "enemy_cfg", 300)
  4320.         If Settings.GetValueKey("enemyJet_rocket_timewait", "enemy_cfg", -1) = -1 Then Settings.SetValue("enemyJet_rocket_timewait", "enemy_cfg", 2000)
  4321.         If Settings.GetValueKey("maxRoundForEvade", "enemy_cfg", -1) = -1 Then Settings.SetValue("maxRoundForEvade", "enemy_cfg", 200)
  4322.         If Settings.GetValueKey("maxRoundForFugitiveEvade", "enemy_cfg", -1) = -1 Then Settings.SetValue("maxRoundForFugitiveEvade", "enemy_cfg", 300)
  4323.         If Settings.GetValueKey("drawEnemyRectDist", "enemy_cfg", -1) = -1 Then Settings.SetValue("drawEnemyRectDist", "enemy_cfg", 350)
  4324.  
  4325.         hkShootRocket = Settings.GetValueKey("hkShootRocket", "general", -1)
  4326.         hkShootCannon = Settings.GetValueKey("hkShootCannon", "general", -1)
  4327.         hkDropBomb = Settings.GetValueKey("hkDropBomb", "general", -1)
  4328.         hkSwitchGun = Settings.GetValueKey("hkSwitchGun", "general", -1)
  4329.         hkSpawnEnemy = Settings.GetValueKey("hkSpawnEnemy", "general", -1)
  4330.         hkSpawnFugitive = Settings.GetValueKey("hkSpawnFugitive", "general", -1)
  4331.         hkJetMoveDown = Settings.GetValueKey("hkJetMoveDown", "general", -1)
  4332.         hkJetMoveUp = Settings.GetValueKey("hkJetMoveUp", "general", -1)
  4333.         hkEject = Settings.GetValueKey("hkEject", "general", -1)
  4334.         hkEnterJet = Settings.GetValueKey("hkEnterJet", "general", -1)
  4335.         hkSwitchCam = Settings.GetValueKey("hkSwitchCam", "general", -1)
  4336.         hkFlare = Settings.GetValueKey("hkFlare", "general", -1)
  4337.         hkTurnLeft = Settings.GetValueKey("hkTurnLeft", "general", -1)
  4338.         hkTurnRight = Settings.GetValueKey("hkTurnRight", "general", -1)
  4339.         hkRollLeft = Settings.GetValueKey("hkRollLeft", "general", -1)
  4340.         hkRollRight = Settings.GetValueKey("hkRollRight", "general", -1)
  4341.         hkUp = Settings.GetValueKey("hkUp", "general", -1)
  4342.         hkDown = Settings.GetValueKey("hkDown", "general", -1)
  4343.         hkSpawnMenu = Settings.GetValueKey("hkSpawnMenu", "general", -1)
  4344.         hkNextMenuItem = Settings.GetValueKey("hkNextMenuItem", "general", -1)
  4345.         hkPrevMenuItem = Settings.GetValueKey("hkPrevMenuItem", "general", -1)
  4346.         search_for_helicopter = Settings.GetValueString("search_for_helicopter", "general", "") = "1"
  4347.  
  4348.         useResolutionFix = Settings.GetValueInteger("useResolutionFix", "general", -1) = 1
  4349.  
  4350.         If useResolutionFix Then
  4351.             myGameWidth = Settings.GetValueInteger("myGameWidth", "general", -1)
  4352.             myGameHeight = Settings.GetValueInteger("myGameHeight", "general", -1)
  4353.         Else
  4354.             myGameWidth = Game.Resolution.Width
  4355.             myGameHeight = Game.Resolution.Height
  4356.         End If
  4357.  
  4358.         width_Coef = myGameWidth / myWidth
  4359.         height_Coef = myGameHeight / myHeight
  4360.  
  4361.         AimEase = Settings.GetValueFloat("AimEase", "general", -1)
  4362.  
  4363.         enemyJet_shoot_cannon = Settings.GetValueKey("enemyJet_shoot_cannon", "enemy_cfg", -1) = 1
  4364.         enemyJet_shoot_rocket = Settings.GetValueKey("enemyJet_shoot_rocket", "enemy_cfg", -1) = 1
  4365.         enemyJet_cannon_dmg = Settings.GetValueKey("enemyJet_cannon_dmg", "enemy_cfg", -1)
  4366.         enemyJet_rocket_damage = Settings.GetValueKey("enemyJet_rocket_damage", "enemy_cfg", -1)
  4367.         enemyJet_rocket_timewait = Settings.GetValueKey("enemyJet_rocket_timewait", "enemy_cfg", -1)
  4368.         maxRoundForEvade = Settings.GetValueKey("maxRoundForEvade", "enemy_cfg", -1)
  4369.         maxRoundForFugitiveEvade = Settings.GetValueKey("maxRoundForFugitiveEvade", "enemy_cfg", -1)
  4370.         drawEnemyRectDist = Settings.GetValueKey("drawEnemyRectDist", "enemy_cfg", -1)
  4371.  
  4372.         ' space trip
  4373.         st_height_teleport = Settings.GetValueFloat("st_height_teleport", "space_trip", 0)
  4374.         st_height_teleport_back = Settings.GetValueFloat("st_height_teleport_back", "space_trip", 0)
  4375.         st_teleport_pos.X = Settings.GetValueFloat("st_teleport_pos_x", "space_trip", 0)
  4376.         st_teleport_pos.Y = Settings.GetValueFloat("st_teleport_pos_y", "space_trip", 0)
  4377.         st_teleport_pos.Z = Settings.GetValueFloat("st_teleport_pos_z", "space_trip", 0)
  4378.         st_teleport_pos_back.X = Settings.GetValueFloat("st_teleport_pos_back_x", "space_trip", 0)
  4379.         st_teleport_pos_back.Y = Settings.GetValueFloat("st_teleport_pos_back_y", "space_trip", 0)
  4380.         st_teleport_pos_back.Z = Settings.GetValueFloat("st_teleport_pos_back_z", "space_trip", 0)
  4381.         st_time_check = Settings.GetValueFloat("st_time_check", "space_trip", 0) = 0
  4382.  
  4383.         Settings.Save()
  4384.     End Sub
  4385.  
  4386.     Private Sub loadJetConfig()
  4387.         myRockets.Clear()
  4388.  
  4389.         Dim tmpObj As GTA.Object = Nothing
  4390.  
  4391.         For c As Int16 = 0 To 16
  4392.             tmpObj = World.CreateObject("cj_rpg_rocket", Player.Character.Position.Around(5) + Vector3.WorldUp * 100)
  4393.  
  4394.             Wait(20)
  4395.  
  4396.             If Not Exists(tmpObj) Then tmpObj = World.CreateObject("cj_rpg_rocket", Player.Character.Position.Around(5) + Vector3.WorldUp * 100)
  4397.  
  4398.             tmpObj.Visible = False
  4399.  
  4400.             myRockets.Add(tmpObj)
  4401.         Next
  4402.  
  4403.         Dim dirInfo As New IO.DirectoryInfo(".\Scripts\JetFiles\Jets\")
  4404.         Dim fileList As IO.FileInfo() = dirInfo.GetFiles("jet_*.ini")
  4405.         Dim f As IO.FileInfo
  4406.  
  4407.         For Each f In fileList
  4408.             If f.Name.Substring(0, 4) = "jet_" Then
  4409.                 iniFile = f.FullName
  4410.                 checkIniExists()
  4411.  
  4412.                 Wait(50)
  4413.  
  4414.                 tmpTCustomJetCFG = New TCustomJetCFG
  4415.  
  4416.                 tmpTCustomJetCFG.fileName = f.Name
  4417.  
  4418.                 If ReadINI("preview_img", "general", "-1") = "-1" Then WriteINI("preview_img", "general", "")
  4419.  
  4420.                 Try
  4421.                     If (ReadINI("preview_img", "general", "-1") <> "") AndAlso File.Exists(f.Directory.FullName & "\" & ReadINI("preview_img", "general", "-1")) Then _
  4422.                         tmpTCustomJetCFG.texPreview = New Texture(File.ReadAllBytes(f.Directory.FullName & "\" & ReadINI("preview_img", "general", "-1")))
  4423.                 Catch
  4424.                     tmpTCustomJetCFG.texPreview = Nothing
  4425.                 End Try
  4426.  
  4427.                 ' custom jet cfg
  4428.                 If ReadINI("display_name", "general", "-1") = "-1" Then WriteINI("display_name", "general", "")
  4429.                 'if ReadINI("hotKeySpawn", "general", "-1") = "-1" then WriteINI("hotKeySpawn", "general", "0")
  4430.                 If ReadINI("console_cmd_spawn", "general", "-1") = "-1" Then WriteINI("console_cmd_spawn", "general", "")
  4431.                 If ReadINI("jet_model", "general", "") = "" Then WriteINI("jet_model", "general", "airtug")
  4432.                 If ReadINI("pilot_model", "general", "-1") = "-1" Then WriteINI("pilot_model", "general", "")
  4433.                 If ReadINI("enemy_model", "general", "-1") = "-1" Then WriteINI("enemy_model", "general", "")
  4434.                 If ReadINI("maxJetSpeed", "general", "0") = "0" Then WriteINI("maxJetSpeed", "general", "400.0")
  4435.                 If ReadINI("use_fake_jet", "general", "-1") = "-1" Then WriteINI("use_fake_jet", "general", "0")
  4436.  
  4437.                 tmpTCustomJetCFG.display_name = ReadINI("display_name", "general", "")
  4438.                 'tmpTCustomJetCFG.hotKeySpawn = Helper.StringToKey(ReadINI("hotKeySpawn", "general", "0"), Keys.VolumeUp)
  4439.                 tmpTCustomJetCFG.console_cmd_spawn = ReadINI("console_cmd_spawn", "general", "")
  4440.                 tmpTCustomJetCFG.jetModel = New Model(ReadINI("jet_model", "general", "-1"))
  4441.  
  4442.                 If ReadINI("pilot_model", "general", "-1") <> "" Then
  4443.                     tmpTCustomJetCFG.pilot_model = New Model(ReadINI("pilot_model", "general", "-1"))
  4444.                 Else
  4445.                     tmpTCustomJetCFG.pilot_model = New Model("player")
  4446.                 End If
  4447.  
  4448.                 tmpTCustomJetCFG.sEnemy_model = ReadINI("enemy_model", "general", "-1")
  4449.                 If tmpTCustomJetCFG.sEnemy_model <> "" Then
  4450.                     tmpTCustomJetCFG.enemy_model = New Model(tmpTCustomJetCFG.sEnemy_model)
  4451.                 Else
  4452.                     tmpTCustomJetCFG.enemy_model = Nothing
  4453.                 End If
  4454.  
  4455.                 tmpTCustomJetCFG.maxJetSpeed = Double.Parse(ReadINI("maxJetSpeed", "general", "-1"))
  4456.                 tmpTCustomJetCFG.use_fake_jet = ReadINI("use_fake_jet", "general", "-1") = "1"
  4457.  
  4458.                 ' move/roll force      
  4459.                 'moveLeftForce, moveRightForce, rollLeftForce, rollRightForce, moveUpForce, moveDownForce
  4460.                 If ReadINI("moveLeftForce", "general", "-1") = "-1" Then WriteINI("moveLeftForce", "general", "1")
  4461.                 If ReadINI("moveRightForce", "general", "-1") = "-1" Then WriteINI("moveRightForce", "general", "1")
  4462.                 If ReadINI("rollLeftForce", "general", "-1") = "-1" Then WriteINI("rollLeftForce", "general", "1")
  4463.                 If ReadINI("rollRightForce", "general", "-1") = "-1" Then WriteINI("rollRightForce", "general", "1")
  4464.                 If ReadINI("moveUpForce", "general", "-1") = "-1" Then WriteINI("moveUpForce", "general", "1")
  4465.                 If ReadINI("moveDownForce", "general", "-1") = "-1" Then WriteINI("moveDownForce", "general", "1")
  4466.  
  4467.                 tmpTCustomJetCFG.moveLeftForce = Double.Parse(ReadINI("moveLeftForce", "general", "-1"))
  4468.                 tmpTCustomJetCFG.moveRightForce = Double.Parse(ReadINI("moveRightForce", "general", "-1"))
  4469.                 tmpTCustomJetCFG.rollLeftForce = Double.Parse(ReadINI("rollLeftForce", "general", "-1"))
  4470.                 tmpTCustomJetCFG.rollRightForce = Double.Parse(ReadINI("rollRightForce", "general", "-1"))
  4471.                 tmpTCustomJetCFG.moveUpForce = Double.Parse(ReadINI("moveUpForce", "general", "-1"))
  4472.                 tmpTCustomJetCFG.moveDownForce = Double.Parse(ReadINI("moveDownForce", "general", "-1"))
  4473.  
  4474.                 writeDiv("general")
  4475.  
  4476.                 'engines       
  4477.                 If ReadINI("minFxSize", "engineFX", "-100") = "-100" Then WriteINI("minFxSize", "engineFX", "0.1")
  4478.                 If ReadINI("idleFxSize", "engineFX", "-100") = "-100" Then WriteINI("idleFxSize", "engineFX", "1.5")
  4479.                 If ReadINI("maxFxSize", "engineFX", "-100") = "-100" Then WriteINI("maxFxSize", "engineFX", "3.0")
  4480.  
  4481.                 tmpTCustomJetCFG.engineMinFxSize = Double.Parse(ReadINI("minFxSize", "engineFX", "-100"))
  4482.                 tmpTCustomJetCFG.engineIdleFxSize = Double.Parse(ReadINI("idleFxSize", "engineFX", "-100"))
  4483.                 tmpTCustomJetCFG.engineMaxFxSize = Double.Parse(ReadINI("maxFxSize", "engineFX", "-100"))
  4484.  
  4485.                 writeDiv("engineFX")
  4486.  
  4487.                 For c As Int16 = 1 To 4
  4488.                     If ReadINI("enabled", "engine_" & c.ToString, "-100") = "-100" Then WriteINI("enabled", "engine_" & c.ToString, "0")
  4489.                     If ReadINI("x", "engine_" & c.ToString, "-100") = "-100" Then WriteINI("x", "engine_" & c.ToString, "0")
  4490.                     If ReadINI("y", "engine_" & c.ToString, "-100") = "-100" Then WriteINI("y", "engine_" & c.ToString, "-9.0")
  4491.                     If ReadINI("z", "engine_" & c.ToString, "-100") = "-100" Then WriteINI("z", "engine_" & c.ToString, "-0.1")
  4492.                     'if ReadINI("enabled", "engine_" & c.tostring, "-100") = "1" then
  4493.                         tmpEngine = New engine
  4494.                         tmpEngine.enabled = ReadINI("enabled", "engine_" & c.ToString, "-100") = "1"
  4495.                         tmpEngine.offPosition.X = Double.Parse(ReadINI("x", "engine_" & c.ToString, "-100"))
  4496.                         tmpEngine.offPosition.Y = Double.Parse(ReadINI("y", "engine_" & c.ToString, "-100"))
  4497.                         tmpEngine.offPosition.Z = Double.Parse(ReadINI("z", "engine_" & c.ToString, "-100"))
  4498.                         tmpTCustomJetCFG.engineList.Add(tmpEngine)
  4499.                     'end if
  4500.  
  4501.                     If c = 4 Then writeDiv("engine_" & c.ToString)
  4502.                 Next
  4503.  
  4504.                 ' extra cams
  4505.                 If Double.Parse(ReadINI("cam1_ahead_Offset", "extra_cams", "-100")) = "-100" Then WriteINI("cam1_ahead_Offset", "extra_cams", "2.0")
  4506.                 If Double.Parse(ReadINI("cam1_up_offset", "extra_cams", "-100")) = "-100" Then WriteINI("cam1_up_offset", "extra_cams", "1.4")
  4507.                 If Double.Parse(ReadINI("cam2_ahead_Offset", "extra_cams", "-100")) = "-100" Then WriteINI("cam2_ahead_Offset", "extra_cams", "2.0")
  4508.                 If Double.Parse(ReadINI("cam2_up_offset", "extra_cams", "-100")) = "-100" Then WriteINI("cam2_up_offset", "extra_cams", "1.5")
  4509.                 If Double.Parse(ReadINI("cam3_ahead_Offset", "extra_cams", "-100")) = "-100" Then WriteINI("cam3_ahead_Offset", "extra_cams", "14.0")
  4510.                 If Double.Parse(ReadINI("cam3_up_offset", "extra_cams", "-100")) = "-100" Then WriteINI("cam3_up_offset", "extra_cams", "2.5")
  4511.  
  4512.                 tmpTCustomJetCFG.cam1_ahead_Offset = Double.Parse(ReadINI("cam1_ahead_Offset", "extra_cams", "-100"))
  4513.                 tmpTCustomJetCFG.cam1_up_offset = Double.Parse(ReadINI("cam1_up_offset", "extra_cams", "-100"))
  4514.                 tmpTCustomJetCFG.cam2_ahead_Offset = Double.Parse(ReadINI("cam2_ahead_Offset", "extra_cams", "-100"))
  4515.                 tmpTCustomJetCFG.cam2_up_offset = Double.Parse(ReadINI("cam2_up_offset", "extra_cams", "-100"))
  4516.                 tmpTCustomJetCFG.cam3_ahead_Offset = Double.Parse(ReadINI("cam3_ahead_Offset", "extra_cams", "-100"))
  4517.                 tmpTCustomJetCFG.cam3_up_offset = Double.Parse(ReadINI("cam3_up_offset", "extra_cams", "-100"))
  4518.  
  4519.                 writeDiv("extra_cams")
  4520.  
  4521.                 ' wings/flaps
  4522.                 If ReadINI("maxWingAngle", "wing_flaps", "-100") = "-100" Then WriteINI("maxWingAngle", "wing_flaps", "0")
  4523.                 If ReadINI("cockpit_id", "wing_flaps", "-100") = "-100" Then WriteINI("cockpit_id", "wing_flaps", "-1")
  4524.                 If ReadINI("left_wing_id", "wing_flaps", "-100") = "-100" Then WriteINI("left_wing_id", "wing_flaps", "-1")
  4525.                 If ReadINI("right_wing_id", "wing_flaps", "-100") = "-100" Then WriteINI("right_wing_id", "wing_flaps", "-1")
  4526.                 If ReadINI("left_flap_id", "wing_flaps", "-100") = "-100" Then WriteINI("left_flap_id", "wing_flaps", "-1")
  4527.                 If ReadINI("right_flap_id", "wing_flaps", "-100") = "-100" Then WriteINI("right_flap_id", "wing_flaps", "-1")
  4528.                 If ReadINI("back_gears_r_id", "wing_flaps", "-100") = "-100" Then WriteINI("back_gears_r_id", "wing_flaps", "-1")
  4529.                 If ReadINI("back_gears_l_id", "wing_flaps", "-100") = "-100" Then WriteINI("back_gears_l_id", "wing_flaps", "-1")
  4530.                 If ReadINI("front_gears_r_id", "wing_flaps", "-100") = "-100" Then WriteINI("front_gears_r_id", "wing_flaps", "-1")
  4531.                 If ReadINI("front_gears_l_id", "wing_flaps", "-100") = "-100" Then WriteINI("front_gears_l_id", "wing_flaps", "-1")
  4532.                 If ReadINI("rudder_1_id", "wing_flaps", "-100") = "-100" Then WriteINI("rudder_1_id", "wing_flaps", "-1")
  4533.                 If ReadINI("rudder_2_id", "wing_flaps", "-100") = "-100" Then WriteINI("rudder_2_id", "wing_flaps", "-1")
  4534.                 If ReadINI("elevator_1_id", "wing_flaps", "-100") = "-100" Then WriteINI("elevator_1_id", "wing_flaps", "-1")
  4535.                 If ReadINI("elevator_2_id", "wing_flaps", "-100") = "-100" Then WriteINI("elevator_2_id", "wing_flaps", "-1")
  4536.  
  4537.                 If ReadINI("idleFlapsAngle", "wing_flaps", "-100") = "-100" Then WriteINI("idleFlapsAngle", "wing_flaps", "0")
  4538.                 If ReadINI("minFlapsAngle", "wing_flaps", "-100") = "-100" Then WriteINI("minFlapsAngle", "wing_flaps", "0")
  4539.                 If ReadINI("maxFlapsAngle", "wing_flaps", "-100") = "-100" Then WriteINI("maxFlapsAngle", "wing_flaps", "0")
  4540.                 If ReadINI("gears_closed_angle", "wing_flaps", "-100") = "-100" Then WriteINI("gears_closed_angle", "wing_flaps", "-100")
  4541.                 If ReadINI("gears_open_angle", "wing_flaps", "-100") = "-100" Then WriteINI("gears_open_angle", "wing_flaps", "-100")
  4542.                 If ReadINI("rudder_idle_angle", "wing_flaps", "-100") = "-100" Then WriteINI("rudder_idle_angle", "wing_flaps", "-100")
  4543.                 If ReadINI("rudder_min_angle", "wing_flaps", "-100") = "-100" Then WriteINI("rudder_min_angle", "wing_flaps", "-100")
  4544.                 If ReadINI("rudder_max_angle", "wing_flaps", "-100") = "-100" Then WriteINI("rudder_max_angle", "wing_flaps", "-100")
  4545.                 If ReadINI("elevator_max_angle", "wing_flaps", "-100") = "-100" Then WriteINI("elevator_max_angle", "wing_flaps", "-100")
  4546.                 If ReadINI("elevator_min_angle", "wing_flaps", "-100") = "-100" Then WriteINI("elevator_min_angle", "wing_flaps", "-100")
  4547.                 If ReadINI("elevator_idle_angle", "wing_flaps", "-100") = "-100" Then WriteINI("elevator_idle_angle", "wing_flaps", "-100")
  4548.  
  4549.                 tmpTCustomJetCFG.maxWingAngle = Double.Parse(ReadINI("maxWingAngle", "wing_flaps", "-100"))
  4550.                 tmpTCustomJetCFG.idleFlapsAngle = Double.Parse(ReadINI("idleFlapsAngle", "wing_flaps", "-100"))
  4551.                 tmpTCustomJetCFG.minFlapsAngle = Double.Parse(ReadINI("minFlapsAngle", "wing_flaps", "-100"))
  4552.                 tmpTCustomJetCFG.maxFlapsAngle = Double.Parse(ReadINI("maxFlapsAngle", "wing_flaps", "-100"))
  4553.                 tmpTCustomJetCFG.cockpit_id = Int32.Parse(ReadINI("cockpit_id", "wing_flaps", "-1"))
  4554.                 tmpTCustomJetCFG.left_wing_id = Int32.Parse(ReadINI("left_wing_id", "wing_flaps", "-2"))
  4555.                 tmpTCustomJetCFG.right_wing_id = Int32.Parse(ReadINI("right_wing_id", "wing_flaps", "-2"))
  4556.                 tmpTCustomJetCFG.left_flap_id = Int32.Parse(ReadINI("left_flap_id", "wing_flaps", "-1"))
  4557.                 tmpTCustomJetCFG.right_flap_id = Int32.Parse(ReadINI("right_flap_id", "wing_flaps", "-1"))
  4558.                 tmpTCustomJetCFG.back_gears_r_id = Int32.Parse(ReadINI("back_gears_r_id", "wing_flaps", "-1"))
  4559.                 tmpTCustomJetCFG.back_gears_l_id = Int32.Parse(ReadINI("back_gears_l_id", "wing_flaps", "-1"))
  4560.                 tmpTCustomJetCFG.front_gears_r_id = Int32.Parse(ReadINI("front_gears_r_id", "wing_flaps", "-1"))
  4561.                 tmpTCustomJetCFG.front_gears_l_id = Int32.Parse(ReadINI("front_gears_l_id", "wing_flaps", "-1"))
  4562.                 tmpTCustomJetCFG.rudder_1_id = Int32.Parse(ReadINI("rudder_1_id", "wing_flaps", "-100"))
  4563.                 tmpTCustomJetCFG.rudder_2_id = Int32.Parse(ReadINI("rudder_2_id", "wing_flaps", "-100"))
  4564.                 tmpTCustomJetCFG.elevator_1_id = Int32.Parse(ReadINI("elevator_1_id", "wing_flaps", "-100"))
  4565.                 tmpTCustomJetCFG.elevator_2_id = Int32.Parse(ReadINI("elevator_2_id", "wing_flaps", "-100"))
  4566.                 tmpTCustomJetCFG.gears_closed_angle = Double.Parse(ReadINI("gears_closed_angle", "wing_flaps", "-1"))
  4567.                 tmpTCustomJetCFG.gears_open_angle = Double.Parse(ReadINI("gears_open_angle", "wing_flaps", "-1"))
  4568.                 tmpTCustomJetCFG.rudder_idle_angle = Double.Parse(ReadINI("rudder_idle_angle", "wing_flaps", "-100"))
  4569.                 tmpTCustomJetCFG.rudder_min_angle = Double.Parse(ReadINI("rudder_min_angle", "wing_flaps", "-100"))
  4570.                 tmpTCustomJetCFG.rudder_max_angle = Double.Parse(ReadINI("rudder_max_angle", "wing_flaps", "-100"))
  4571.                 tmpTCustomJetCFG.elevator_max_angle = Double.Parse(ReadINI("elevator_max_angle", "wing_flaps", "-100"))
  4572.                 tmpTCustomJetCFG.elevator_min_angle = Double.Parse(ReadINI("elevator_min_angle", "wing_flaps", "-100"))
  4573.                 tmpTCustomJetCFG.elevator_idle_angle = Double.Parse(ReadINI("elevator_idle_angle", "wing_flaps", "-100"))
  4574.  
  4575.                 writeDiv("wing_flaps")
  4576.  
  4577.                 ' native game sounds
  4578.                 'soundCannon, soundJetIdle, soundJetAccel, soundBombRelease, soundRocketMove
  4579.                 If ReadINI("soundJetIdle", "sounds", "-1") = "-1" Then WriteINI("soundJetIdle", "sounds", "JET_DISTANT_WRAPPER")
  4580.                 If ReadINI("soundJetAccel", "sounds", "-1") = "-1" Then WriteINI("soundJetAccel", "sounds", "VEHICLES_AMBIENT_JETS_MIDRANGE_PHASE_JET_1")
  4581.                 If ReadINI("soundJetAccel2", "sounds", "-1") = "-1" Then WriteINI("soundJetAccel2", "sounds", "JETS_AMBIENT_IDLES_LIGHT_JET")
  4582.                 If ReadINI("soundCannon", "sounds", "") = "" Then WriteINI("soundCannon", "sounds", "shotgun_fire")
  4583.                 If ReadINI("soundBombRelease", "sounds", "") = "" Then WriteINI("soundBombRelease", "sounds", "COLLISIONS_COLLISIONS_BOMBER_JACKET_STRIKE_1")
  4584.                 If ReadINI("soundRocketMove", "sounds", "") = "" Then WriteINI("soundRocketMove", "sounds", "GENERAL_WEAPONS_ROCKET_LOOP")
  4585.  
  4586.                 tmpTCustomJetCFG.soundJetIdle = ReadINI("soundJetIdle", "sounds", "")
  4587.                 tmpTCustomJetCFG.soundJetAccel = ReadINI("soundJetAccel", "sounds", "")
  4588.                 tmpTCustomJetCFG.soundJetAccel2 = ReadINI("soundJetAccel2", "sounds", "")
  4589.                 tmpTCustomJetCFG.soundCannon = ReadINI("soundCannon", "sounds", "")
  4590.                 tmpTCustomJetCFG.soundBombRelease = ReadINI("soundBombRelease", "sounds", "")
  4591.                 tmpTCustomJetCFG.soundRocketMove = ReadINI("soundRocketMove", "sounds", "")
  4592.  
  4593.                 writeDiv("sounds")
  4594.  
  4595.                 ' rockets/bombs
  4596.                 For c As Int16 = 1 To 16
  4597.                     If ReadINI("enabled", "rocket_" & c.ToString, "-1") = "-1" Then WriteINI("enabled", "rocket_" & c.ToString, "0")
  4598.                     If ReadINI("visible_when_fired", "rocket_" & c.ToString, "-1") = "-1" Then WriteINI("visible_when_fired", "rocket_" & c.ToString, "1")
  4599.                     If ReadINI("visible_when_idle", "rocket_" & c.ToString, "-1") = "-1" Then WriteINI("visible_when_idle", "rocket_" & c.ToString, "0")
  4600.                     If ReadINI("is_bomb", "rocket_" & c.ToString, "-1") = "-1" Then WriteINI("is_bomb", "rocket_" & c.ToString, "0")
  4601.                     If ReadINI("model", "rocket_" & c.ToString, "") = "" Then WriteINI("model", "rocket_" & c.ToString, "cj_rpg_rocket")
  4602.                     If ReadINI("x", "rocket_" & c.ToString, "-100") = "-100" Then WriteINI("x", "rocket_" & c.ToString, "2.5")
  4603.                     If ReadINI("y", "rocket_" & c.ToString, "-100") = "-100" Then WriteINI("y", "rocket_" & c.ToString, "-3.0")
  4604.                     If ReadINI("z", "rocket_" & c.ToString, "-100") = "-100" Then WriteINI("z", "rocket_" & c.ToString, "-0.3")
  4605.                     If ReadINI("xr", "rocket_" & c.ToString, "-100") = "-100" Then WriteINI("xr", "rocket_" & c.ToString, "0")
  4606.                     If ReadINI("yr", "rocket_" & c.ToString, "-100") = "-100" Then WriteINI("yr", "rocket_" & c.ToString, "0")
  4607.                     If ReadINI("zr", "rocket_" & c.ToString, "-100") = "-100" Then WriteINI("zr", "rocket_" & c.ToString, "0")
  4608.                     If ReadINI("damage_against_jets", "rocket_" & c.ToString, "-100") = "-100" Then WriteINI("damage_against_jets", "rocket_" & c.ToString, "400")
  4609.                     If ReadINI("speed_multiplier", "rocket_" & c.ToString, "-100") = "-100" Then WriteINI("speed_multiplier", "rocket_" & c.ToString, "1.0")
  4610.                     If ReadINI("explosion_size", "rocket_" & c.ToString, "-100") = "-100" Then WriteINI("explosion_size", "rocket_" & c.ToString, "1.0")
  4611.                     If ReadINI("explosion_force", "rocket_" & c.ToString, "-100") = "-100" Then WriteINI("explosion_force", "rocket_" & c.ToString, "1.0")
  4612.                     If ReadINI("propulsor_effect_size", "rocket_" & c.ToString, "-100") = "-100" Then WriteINI("propulsor_effect_size", "rocket_" & c.ToString, "0.2")
  4613.  
  4614.                     ' create the rocket
  4615.                     'if ReadINI("enabled", "rocket_" & c.tostring, "-1") = "1" then
  4616.                         tmpRocket = New MR
  4617.                         tmpRocket.model_name = ReadINI("model", "rocket_" & c.ToString, "")
  4618.  
  4619.                         If tmpRocket.model_name <> "cj_rpg_rocket" Then
  4620.                             tmpRocket.rocket = World.CreateObject(tmpRocket.model_name, Player.Character.Position.Around(5) + Vector3.WorldUp * 100)
  4621.                         Else
  4622.                             tmpRocket.rocket = myRockets(c - 1)
  4623.                         End If
  4624.  
  4625.                         tmpRocket.enabled = ReadINI("enabled", "rocket_" & c.ToString, "-1") = "1"
  4626.                         tmpRocket.Hide(tmpRocket.rocket)
  4627.                         tmpRocket.xAttach = Double.Parse(ReadINI("x", "rocket_" & c.ToString, "-100"))
  4628.                         tmpRocket.yAttach = Double.Parse(ReadINI("y", "rocket_" & c.ToString, "-100"))
  4629.                         tmpRocket.zAttach = Double.Parse(ReadINI("z", "rocket_" & c.ToString, "-100"))
  4630.                         tmpRocket.xRotAttach = Double.Parse(ReadINI("xr", "rocket_" & c.ToString, "-100"))
  4631.                         tmpRocket.yRotAttach = Double.Parse(ReadINI("yr", "rocket_" & c.ToString, "-100"))
  4632.                         tmpRocket.zRotAttach = Double.Parse(ReadINI("zr", "rocket_" & c.ToString, "-100"))
  4633.                         tmpRocket.isBomb = ReadINI("is_bomb", "rocket_" & c.ToString, "-1") = "1"
  4634.                         tmpRocket.visible_fired = ReadINI("visible_when_fired", "rocket_" & c.ToString, "-1") = "1"
  4635.                         tmpRocket.visible_idle = ReadINI("visible_when_idle", "rocket_" & c.ToString, "-1") = "1"
  4636.                         tmpRocket.damage_against_jets = Double.Parse(ReadINI("damage_against_jets", "rocket_" & c.ToString, "-1"))
  4637.                         tmpRocket.speed_multiplier = Double.Parse(ReadINI("speed_multiplier", "rocket_" & c.ToString, "-1"))
  4638.                         tmpRocket.explosion_size = Double.Parse(ReadINI("explosion_size", "rocket_" & c.ToString, "-1"))
  4639.                         tmpRocket.explosion_force = Double.Parse(ReadINI("explosion_force", "rocket_" & c.ToString, "-1"))
  4640.                         tmpRocket.propulsor_effect_size = Double.Parse(ReadINI("propulsor_effect_size", "rocket_" & c.ToString, "-1"))
  4641.                         tmpTCustomJetCFG.MRL.Add(tmpRocket)
  4642.                     'end if
  4643.  
  4644.                     If c = 16 Then
  4645.                         writeDiv("rocket_" & c.ToString)
  4646.                     Else
  4647.                         writeDiv("rocket_" & c.ToString, ".")
  4648.                     End If
  4649.                 Next
  4650.  
  4651.                 tmpTCustomJetCFG.cannonCount = 0
  4652.  
  4653.                 ' cannon
  4654.                 For c As Int16 = 1 To 4
  4655.                     If ReadINI("enabled", "cannon_" & c.ToString, "-1") = "-1" Then WriteINI("enabled", "cannon_" & c.ToString, "0")
  4656.                     If ReadINI("x", "cannon_" & c.ToString, "-100") = "-100" Then WriteINI("x", "cannon_" & c.ToString, "0.85")
  4657.                     If ReadINI("y", "cannon_" & c.ToString, "-100") = "-100" Then WriteINI("y", "cannon_" & c.ToString, "2.0")
  4658.                     If ReadINI("z", "cannon_" & c.ToString, "-100") = "-100" Then WriteINI("z", "cannon_" & c.ToString, "-0.3")
  4659.                     If ReadINI("size", "cannon_" & c.ToString, "-100") = "-100" Then WriteINI("size", "cannon_" & c.ToString, "2.0")
  4660.                     If ReadINI("trace_size", "cannon_" & c.ToString, "-100") = "-100" Then WriteINI("trace_size", "cannon_" & c.ToString, "1.0")
  4661.                     If ReadINI("range", "cannon_" & c.ToString, "-100") = "-100" Then WriteINI("range", "cannon_" & c.ToString, "300")
  4662.                     If ReadINI("damage", "cannon_" & c.ToString, "-100") = "-100" Then WriteINI("damage", "cannon_" & c.ToString, "50")
  4663.                     If ReadINI("shootTime", "cannon_" & c.ToString, "-100") = "-100" Then
  4664.                         If c Mod 2 = 0 Then
  4665.                             WriteINI("shootTime", "cannon_" & c.ToString, "1")
  4666.                         Else
  4667.                             WriteINI("shootTime", "cannon_" & c.ToString, "2")
  4668.                         End If
  4669.                     End If
  4670.                     'if ReadINI("enabled", "cannon_" & c.tostring, "-1") = "1" then
  4671.                         tmpCannon = New cannon
  4672.                         tmpCannon.enabled = ReadINI("enabled", "cannon_" & c.ToString, "-1") = "1"
  4673.                         tmpCannon.offPosition.X = Double.Parse(ReadINI("x", "cannon_" & c.ToString, "-100"))
  4674.                         tmpCannon.offPosition.Y = Double.Parse(ReadINI("y", "cannon_" & c.ToString, "-100"))
  4675.                         tmpCannon.offPosition.Z = Double.Parse(ReadINI("z", "cannon_" & c.ToString, "-100"))
  4676.                         tmpCannon.size = Double.Parse(ReadINI("size", "cannon_" & c.ToString, "-100"))
  4677.                         tmpCannon.trace_size = Double.Parse(ReadINI("trace_size", "cannon_" & c.ToString, "-100"))
  4678.                         tmpCannon.range = Double.Parse(ReadINI("range", "cannon_" & c.ToString, "-100"))
  4679.                         tmpCannon.damage = Int32.Parse(ReadINI("damage", "cannon_" & c.ToString, "-100"))
  4680.                         tmpCannon.shootTime = Int32.Parse(ReadINI("shootTime", "cannon_" & c.ToString, "-100"))
  4681.                         tmpTCustomJetCFG.cannList.Add(tmpCannon)
  4682.                     'end if
  4683.  
  4684.                     If c = 4 Then
  4685.                         writeDiv("cannon_" & c.ToString)
  4686.                     Else
  4687.                         writeDiv("cannon_" & c.ToString, ".")
  4688.                     End If
  4689.                 Next
  4690.  
  4691.                 For Each c As cannon In tmpTCustomJetCFG.cannList
  4692.                     If c.enabled AndAlso (c.shootTime > tmpTCustomJetCFG.cannonCount) Then tmpTCustomJetCFG.cannonCount = c.shootTime
  4693.                 Next
  4694.  
  4695.                 ' extras
  4696.                 For c As Int16 = 0 To 4
  4697.                     If ReadINI("extraID", "extra_" & c.ToString, "") = "" Then
  4698.                         WriteINI("extraID", "extra_" & c.ToString, "-1")
  4699.                         WriteINI("initiallyEnabled", "extra_" & c.ToString, "-1")
  4700.                         WriteINI("activateWhenFireCannon", "extra_" & c.ToString, "-1")
  4701.                         WriteINI("activateWhenFireRocket", "extra_" & c.ToString, "-1")
  4702.                         WriteINI("activateWhenFireBomb", "extra_" & c.ToString, "-1")
  4703.                         WriteINI("activateWhenReleaseFlares", "extra_" & c.ToString, "-1")
  4704.                         WriteINI("hotkey", "extra_" & c.ToString, "-1")
  4705.                         WriteINI("autoOffTime", "extra_" & c.ToString, "-1")
  4706.                     End If
  4707.  
  4708.                     If ReadINI("extraID", "extra_" & c.ToString, "") <> "-1" Then
  4709.                         tmpExtra = New jetExtras
  4710.                         tmpExtra.extraID = Int32.Parse(ReadINI("extraID", "extra_" & c.ToString, "-1"))
  4711.                         tmpExtra.initiallyEnabled = ReadINI("initiallyEnabled", "extra_" & c.ToString, "") = "1"
  4712.                         tmpExtra.activateWhenFireCannon = ReadINI("activateWhenFireCannon", "extra_" & c.ToString, "") = "1"
  4713.                         tmpExtra.activateWhenFireRocket = ReadINI("activateWhenFireRocket", "extra_" & c.ToString, "") = "1"
  4714.                         tmpExtra.activateWhenFireBomb = ReadINI("activateWhenFireBomb", "extra_" & c.ToString, "") = "1"
  4715.                         tmpExtra.activateWhenReleaseFlares = ReadINI("activateWhenReleaseFlares", "extra_" & c.ToString, "") = "1"
  4716.                         tmpExtra.hotkey = Helper.StringToKey(ReadINI("hotkey", "extra_" & c.ToString, "none"), Keys.None)
  4717.                         tmpExtra.autoOffTime = Double.Parse(ReadINI("autoOffTime", "extra_" & c.ToString, "0"))
  4718.                         tmpTCustomJetCFG.extraList.Add(tmpExtra)
  4719.                     End If
  4720.                 Next
  4721.  
  4722.                 ' skins
  4723.                 If ReadINI("skin_count", "general", "") = "" Then WriteINI("skin_count", "general", "0")
  4724.                 If ReadINI("skin", "general", "") = "" Then WriteINI("skin", "general", "1")
  4725.  
  4726.                 tmpTCustomJetCFG.skin_count = Int16.Parse(ReadINI("skin_count", "general", ""))
  4727.                 tmpTCustomJetCFG.skin = Int16.Parse(ReadINI("skin", "general", ""))
  4728.  
  4729.                 TCustomJetCFGList.Add(tmpTCustomJetCFG)
  4730.             End If
  4731.         Next
  4732.     End Sub
  4733.  
  4734.     Private Sub loadJetAquirementPos()
  4735.         iniFile = ".\Scripts\JetFiles\Jet_Spawn.ini"
  4736.         checkIniExists()
  4737.  
  4738.         ' jet aquirement positions
  4739.         For c As Int16 = 1 To 10
  4740.             If ReadINI("enabled", "jet_aquirement_" & c.ToString, "") = "" Then WriteINI("enabled", "jet_aquirement_" & c.ToString, "0")
  4741.             If ReadINI("display_name", "jet_aquirement_" & c.ToString, "") = "" Then WriteINI("display_name", "jet_aquirement_" & c.ToString, "Jet")
  4742.             If ReadINI("showOnMap", "jet_aquirement_" & c.ToString, "") = "" Then WriteINI("showOnMap", "jet_aquirement_" & c.ToString, "1")
  4743.             If ReadINI("checkPVisible", "jet_aquirement_" & c.ToString, "") = "" Then WriteINI("checkPVisible", "jet_aquirement_" & c.ToString, "1")
  4744.             If ReadINI("autoCreateJet", "jet_aquirement_" & c.ToString, "") = "" Then WriteINI("autoCreateJet", "jet_aquirement_" & c.ToString, "0")
  4745.             If ReadINI("jetModel", "jet_aquirement_" & c.ToString, "") = "" Then WriteINI("jetModel", "jet_aquirement_" & c.ToString, "airtug")
  4746.             If ReadINI("check_x", "jet_aquirement_" & c.ToString, "") = "" Then WriteINI("check_x", "jet_aquirement_" & c.ToString, "0")
  4747.             If ReadINI("check_y", "jet_aquirement_" & c.ToString, "") = "" Then WriteINI("check_y", "jet_aquirement_" & c.ToString, "0")
  4748.             If ReadINI("check_z", "jet_aquirement_" & c.ToString, "") = "" Then WriteINI("check_z", "jet_aquirement_" & c.ToString, "0")
  4749.             If ReadINI("jet_x", "jet_aquirement_" & c.ToString, "") = "" Then WriteINI("jet_x", "jet_aquirement_" & c.ToString, "0")
  4750.             If ReadINI("jet_y", "jet_aquirement_" & c.ToString, "") = "" Then WriteINI("jet_y", "jet_aquirement_" & c.ToString, "0")
  4751.             If ReadINI("jet_z", "jet_aquirement_" & c.ToString, "") = "" Then WriteINI("jet_z", "jet_aquirement_" & c.ToString, "0")
  4752.             If ReadINI("diameter", "jet_aquirement_" & c.ToString, "") = "" Then WriteINI("diameter", "jet_aquirement_" & c.ToString, "3")
  4753.             If ReadINI("heading", "jet_aquirement_" & c.ToString, "") = "" Then WriteINI("heading", "jet_aquirement_" & c.ToString, "0")
  4754.             If ReadINI("cpAlpha", "jet_aquirement_" & c.ToString, "") = "" Then WriteINI("cpAlpha", "jet_aquirement_" & c.ToString, "100")
  4755.             If ReadINI("cpRcolor", "jet_aquirement_" & c.ToString, "") = "" Then WriteINI("cpRcolor", "jet_aquirement_" & c.ToString, "255")
  4756.             If ReadINI("cpGcolor", "jet_aquirement_" & c.ToString, "") = "" Then WriteINI("cpGcolor", "jet_aquirement_" & c.ToString, "255")
  4757.             If ReadINI("cpBcolor", "jet_aquirement_" & c.ToString, "") = "" Then WriteINI("cpBcolor", "jet_aquirement_" & c.ToString, "255")
  4758.             If ReadINI("skin", "jet_aquirement_" & c.ToString, "") = "" Then WriteINI("skin", "jet_aquirement_" & c.ToString, "1")
  4759.  
  4760.             writeDiv("jet_aquirement_" & c.ToString)
  4761.  
  4762.             If ReadINI("enabled", "jet_aquirement_" & c.ToString, "") = "1" Then
  4763.                 tmpTJetAP = New TJetAP
  4764.                 tmpTJetAP.display_name = ReadINI("display_name", "jet_aquirement_" & c.ToString, "")
  4765.                 tmpTJetAP.showOnMap = ReadINI("showOnMap", "jet_aquirement_" & c.ToString, "1") = "1"
  4766.                 tmpTJetAP.checkPVisible = ReadINI("checkPVisible", "jet_aquirement_" & c.ToString, "1") = "1"
  4767.                 tmpTJetAP.autoCreateJet = ReadINI("autoCreateJet", "jet_aquirement_" & c.ToString, "0") = "1"
  4768.                 tmpTJetAP.checkPos.X = Double.Parse(ReadINI("check_x", "jet_aquirement_" & c.ToString, "0"))
  4769.                 tmpTJetAP.checkPos.Y = Double.Parse(ReadINI("check_y", "jet_aquirement_" & c.ToString, "0"))
  4770.                 tmpTJetAP.checkPos.Z = Double.Parse(ReadINI("check_z", "jet_aquirement_" & c.ToString, "0"))
  4771.                 tmpTJetAP.jetPos.X = Double.Parse(ReadINI("jet_x", "jet_aquirement_" & c.ToString, "0"))
  4772.                 tmpTJetAP.jetPos.Y = Double.Parse(ReadINI("jet_y", "jet_aquirement_" & c.ToString, "0"))
  4773.                 tmpTJetAP.jetPos.Z = Double.Parse(ReadINI("jet_z", "jet_aquirement_" & c.ToString, "0"))
  4774.                 tmpTJetAP.jetPos = tmpTJetAP.jetPos.ToGround
  4775.                 tmpTJetAP.diameter = Double.Parse(ReadINI("diameter", "jet_aquirement_" & c.ToString, "0"))
  4776.                 tmpTJetAP.heading = Double.Parse(ReadINI("heading", "jet_aquirement_" & c.ToString, "0"))
  4777.                 tmpTJetAP.cpAlpha = Double.Parse(ReadINI("cpAlpha", "jet_aquirement_" & c.ToString, "0"))
  4778.                 tmpTJetAP.cpRcolor = Double.Parse(ReadINI("cpRcolor", "jet_aquirement_" & c.ToString, "0"))
  4779.                 tmpTJetAP.cpGcolor = Double.Parse(ReadINI("cpGcolor", "jet_aquirement_" & c.ToString, "0"))
  4780.                 tmpTJetAP.cpBcolor = Double.Parse(ReadINI("cpBcolor", "jet_aquirement_" & c.ToString, "0"))
  4781.                 tmpTJetAP.skin = Int16.Parse(ReadINI("skin", "jet_aquirement_" & c.ToString, "0"))
  4782.  
  4783.                 tmpTJetAP.cp.Visible = tmpTJetAP.checkPVisible
  4784.  
  4785.                 If ReadINI("jetModel", "jet_aquirement_" & c.ToString, "") <> "" Then _
  4786.                     tmpTJetAP.jetModel = New Model(ReadINI("jetModel", "jet_aquirement_" & c.ToString, ""))
  4787.  
  4788.                 If tmpTJetAP.showOnMap Then
  4789.                     tmpTJetAP.tblip = Blip.AddBlip(tmpTJetAP.checkPos)
  4790.  
  4791.                     If Exists(tmpTJetAP.tblip) Then
  4792.                         tmpTJetAP.tblip.SetColorRGB(Color.FromArgb(0, 255, 255, 255))
  4793.                         tmpTJetAP.tblip.Color = BlipColor.White
  4794.                         tmpTJetAP.tblip.ShowOnlyWhenNear = True
  4795.                         tmpTJetAP.tblip.Name = tmpTJetAP.display_name
  4796.                     End If
  4797.                 End If
  4798.  
  4799.                 TJetAPList.Add(tmpTJetAP)
  4800.             End If
  4801.         Next
  4802.     End Sub
  4803.  
  4804.     Private Function random(ByVal min As Int32, ByVal max As Int32)
  4805.         Dim rnd As Random = New Random(System.DateTime.Now.Millisecond)
  4806.         random = rnd.Next(min, max)
  4807.     End Function
  4808.  
  4809.     Private Declare Auto Function GetPrivateProfileString Lib "Kernel32" _
  4810.         (ByVal lpAppName As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As StringBuilder, ByVal nSize As Integer, ByVal lpFileName As String) As Integer
  4811.  
  4812.     Private Declare Auto Function WritePrivateProfileString Lib "Kernel32" _
  4813.         (ByVal lpAppName As String, ByVal lpKeyName As String, ByVal lpString As String, ByVal lpFileName As String) As Integer
  4814.  
  4815.     Private Function ReadINI(ByVal key_name As String, ByVal section_name As String, ByVal default_value As String) As String
  4816.         Const MAX_LENGTH As Integer = 500
  4817.         Dim string_builder As New StringBuilder(MAX_LENGTH)
  4818.  
  4819.         GetPrivateProfileString(section_name, key_name, default_value, string_builder, MAX_LENGTH, iniFile)
  4820.  
  4821.         Return string_builder.ToString()
  4822.     End Function
  4823.  
  4824.     Private Sub WriteINI(ByVal key_name As String, ByVal section_name As String, ByVal value As String)
  4825.         WritePrivateProfileString(section_name, key_name, value, iniFile)
  4826.     End Sub
  4827.  
  4828.     Private Sub writeDiv(ByVal section_name As String, Optional ByVal sChar As String = "-")
  4829.         If ReadINI("div", section_name, "") = "" Then
  4830.             If sChar = "-" Then
  4831.                 WriteINI("div", section_name, "===============================================div")
  4832.             Else
  4833.                 WriteINI("div", section_name, "...............................................div")
  4834.             End If
  4835.         End If
  4836.     End Sub
  4837.  
  4838.     Private Sub checkIniExists()
  4839.         If Not File.Exists(iniFile) Then
  4840.             File.CreateText(iniFile).Dispose()
  4841.  
  4842.             Wait(100)
  4843.         End If
  4844.     End Sub
  4845. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement