Advertisement
julioCCs

Iron Man IV Source code - GTA iV

May 24th, 2013
2,282
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 286.43 KB | None | 0 0
  1. 'http://gtaxscripting.blogspot.com/
  2. 'http://www.facebook.com/GtaIVScripting
  3. 'https://www.youtube.com/user/GTAScripting
  4.  
  5. 'Iron Man IV script by JulioNIB
  6.  
  7. 'requested and help (tests, HUD, sounds, etc.) by
  8. 'H1Vltg3 (http://www.facebook.com/H1Vltg3 - https://www.youtube.com/user/IH1Vltg3I)
  9.  
  10. 'HUD v2 and v3 by
  11. 'Wapeddell (http://www.facebook.com/WapeddellMods - https://www.youtube.com/user/wapeddell)
  12.  
  13. 'Obs.: Some things in this script can be redundant, some variables im not using and i forgot to remove
  14. 'The classes, great part, are just used to hold the properties and dont have methods that they should
  15.  
  16. 'Thx Rockstar for this amazing game
  17.  
  18. Imports System
  19. Imports GTA
  20. Imports System.Windows.Forms
  21. Imports System.Drawing
  22. Imports System.Collections.Generic
  23. Imports System.IO
  24. 'Imports SlimDX.XInput
  25. Imports System.Text
  26. Imports ObjectsHandler
  27. Imports NAudio.Wave
  28.  
  29. Public Class IronMan
  30.     Inherits Script
  31.  
  32.     Shared myInterval As Double = 10
  33.  
  34.     Shared OH As ObjectsHandler
  35.  
  36.     Private Class NAudioPlayer
  37.         Private wfr As WaveFileReader
  38.         Private wc As WaveChannel32
  39.         Private dso As DirectSoundOut
  40.  
  41.         Public Sub New(s As String)
  42.             wfr = New WaveFileReader(s)
  43.             wc = New WaveChannel32(wfr)
  44.             dso = New DirectSoundOut
  45.             dso.Init(wc)
  46.         End Sub
  47.  
  48.         Public Sub volume(dVolumeMulti As Double)
  49.             wc.Volume = dVolumeMulti
  50.         End Sub
  51.  
  52.         Public Sub play()
  53.             wc.Seek(0, SeekOrigin.Begin)
  54.             dso.Play()
  55.         End Sub
  56.     End Class
  57.  
  58.     Private Class TDisplayMsg
  59.         Private sMsg As String = ""
  60.         Private time As Double = 3000
  61.         Private timeCount As Double = 0
  62.         Private bDisplay As Boolean = False
  63.         Private x As Int16
  64.  
  65.         Public Sub Display(sMessage As String, Optional display_time As Double = 3000)
  66.             bDisplay = False
  67.             time = display_time
  68.             timeCount = 0
  69.             sMsg = sMessage + "    "
  70.             bDisplay = sMsg.Trim.Length > 0
  71.             x = 840 - ((sMsg.Trim.Length / 2) * 10)
  72.         End Sub
  73.  
  74.         Public Sub Tick(e As GraphicsEventArgs)
  75.             If bDisplay AndAlso (sMsg.Length > 0) AndAlso (timeCount < time) Then
  76.                 timeCount += 20
  77.  
  78.                 drawTextAuxEffect2(e, sMsg, x * height_Coef, 950, Color.LightBlue)
  79.             End If
  80.         End Sub
  81.     End Class
  82.  
  83.     Shared DisplayMessage As TDisplayMsg = New TDisplayMsg
  84.  
  85.     Private jarvis_congrats_1 As NAudioPlayer
  86.     Private jarvis_congrats_2 As NAudioPlayer
  87.     Private jarvis_congrats_3 As NAudioPlayer
  88.     Private jarvis_congrats_4 As NAudioPlayer
  89.     Private jarvis_enemy As NAudioPlayer
  90.     Private jarvis_warning As NAudioPlayer
  91.     Private jarvis_warning_2 As NAudioPlayer
  92.     Private jarvis_warning_3 As NAudioPlayer
  93.  
  94.     Private jarvisVolume As Double = 0.3
  95.     Private timePlayJarvisWarn As Double = 0
  96.     Private timePlayJarvisCongrats As Double = 0
  97.  
  98.     Private timeWaitLoad As Double = 500
  99.     Private flying As Boolean = False
  100.     Private bDrawDamageIndicator As Boolean = False
  101.     Private myFlyHabs As Vehicle = Nothing
  102.     Private myFlyHabsNormal As Vehicle = Nothing
  103.     Private myFlyHabsHitObject As Vehicle = Nothing
  104.     Private timeWaitCheckHighSpeed As Double = 0
  105.     Private mySpeed As Double = 0
  106.     Private myRealSpeed As Double = 0
  107.     Private timeKeepHighSpeed As Double = 0
  108.     Private camAux As Camera
  109.     Private camXAttach As Double = -1
  110.     Private camYAttach As Double = -2
  111.     Private camZAttach As Double = 0.5
  112.     Private timeResetFlight As Double = 0
  113.     Private animSetFlight As AnimationSet
  114.     Private animSetPointArm As AnimationSet
  115.     Private animSetPunchKick As AnimationSet
  116.     Private animSetPunch As AnimationSet
  117.     Private myLastPos As GTA.Vector3
  118.     Private vRotation As GTA.Vector3
  119.     Private upAmount, downAmount, forwardAmount, backwardAmount As Double
  120.     Private camMode As Int16 = 0
  121.     Private bLandAnim As Boolean = False
  122.     Private playerLandVel As Vector3
  123.     Private timeLandAnim As Double = 0
  124.     Private inAIrTime As Double = 0
  125.     Private PTFXDamage As Int32
  126.     Private lastHealth As Int16 = -999
  127.     Private healthAux As Double = Player.Character.Health
  128.     Private timeHeal As Double = 0
  129.     Private GameTimeScale As Double = 1
  130.     Private timeDisableMouseControl As Double = 0
  131.     Private timeHideFlyAbs As Double = 0
  132.     Private lastFlightZ As Double = 0
  133.     Private lastFlightZ2 As Double = 0
  134.     Private timeRestorePreventRagdoll As Double = 0
  135.  
  136.     Private WeapXSelection As Double = 0
  137.     Private WeapYSelection As Double = 0
  138.     Private timeCheckWSelect As Double = 0
  139.  
  140.     Private bDrawTextures As Boolean = False
  141.     Private bFirstDraw As Boolean = False
  142.     Private bArmorON As Boolean = False
  143.     Private bShowMenu As Boolean = False
  144.     Private bShowArmorMenu As Boolean = False
  145.     Private bShowArmorOptionsMenu As Boolean = False
  146.     Private armorMenuIndex As Int16 = 0
  147.     Private armorOptionsMenuIndex As Int16 = 0
  148.     Private menuIndex As Int16 = 0
  149.  
  150.     Private HUDIndex As Double = 0
  151.     Private HUDName As String = "Simple"
  152.  
  153.     Private bPlayerFallingDamageProof As Boolean = True
  154.     Private bNoFlightCollisionDetection As Boolean = False
  155.     Private speedChange As Double = 0
  156.  
  157.     Private bAnTargetLocked As Boolean
  158.     Private timeCheckTargetLocked As Double = 0
  159.  
  160.     Private timeCheckHair As Double = 0
  161.     Private timeWaitAntiMeleeAnim As Double = 0
  162.  
  163.     Private GroundZDist As Double = 0
  164.  
  165.     Private maxEnemy, maxAlly As Int16
  166.  
  167.     Private lastXFlight As Double = 0
  168.  
  169.     'armor delivery :)
  170.     Private bUseArmorDelivery As Boolean = False
  171.     Private heliDelivery As Vehicle = Nothing
  172.     Private pilotDelivery As Ped = Nothing
  173.     Private armorCase As GTA.Object = Nothing
  174.     Private heliDeliveryModel As String = "maverick"
  175.     Private pilotDeliveryModel As String = "m_y_nhelipilot"
  176.     Private armorCaseModel As String = "bm_lev_guncase01b"
  177.     Private ArmorDeliveryStatus As Int16 = 0
  178.     Private heliDeliveryBlip As Blip = Nothing
  179.     Private HeliDeliveryTimeCheckRoute As Double = 0
  180.     Private DeliveryTime As Double = 0
  181.  
  182.     ' hotkeys
  183.     Private hkSwitchGun, hkCannon, hkDarts, hkRockets, hkHandRep, hkChestRep, hkShowMenu, hkKick, hkPunch, hkSpawnAlly, hkSwitchCam, _
  184.         hkUnlockFlightCam, hkWeaponSelectMenu, hkShoot, hkSpawnEnemy, hkNoWantedLevel, hkGodMode As Int32
  185.  
  186.     Private bNoWanted As Boolean = False
  187.     Private bGodMode As Boolean = False
  188.  
  189.     ' textures
  190.     Private texHUD, texBar, texCannon, texDarts, texRockets, texHandRep, texChestRep, texWSelect, _
  191.         texCrossHair, texHudRing, texHUDBottom, texHUDLeft, texHUDRight, texHUDRight_FlightMode, texHUDTop, _
  192.         texHUDBottonIcon1, texHUDBottonIcon1_2, texHUDBottonIcon2, texHUDBottonIcon2_2, _
  193.         texHUDBottonIcon3, texHUDBottonIcon3_2, texHUDBottonIcon3_3, texHUDBottonIcon3_4, texHUDBottonIcon4, texHUDBottonIcon4_2, _
  194.         texHUDBottonIcon5, texHUDBottonIcon5_2, texHUDHearthIndicator, _
  195.         texHUDRIGHT_Damage, texHUDLEFT_FlightMode, texHUDLEFT_MissileAlarm, texHUD_ThrusterBar As Texture
  196.  
  197.     Shared damageTime As Int16 = 255
  198.     Shared lowHealthIndicator As Int16 = 255
  199.     Private bMissileAlarm As Boolean = False
  200.  
  201.     Private hudRotation As Double = 0
  202.  
  203.     Private Class TTexNumber
  204.         Public tex As Texture
  205.  
  206.         Public Sub New(sFile As String)
  207.             Try
  208.                 tex = New Texture(File.ReadAllBytes(sFile))
  209.             Catch
  210.             End Try
  211.         End Sub
  212.     End Class
  213.  
  214.     Private texNumbers As New List(Of TTexNumber)
  215.  
  216.     Shared TRandom As Random = New Random(System.DateTime.Now.Millisecond)
  217.  
  218.     Private speedSlow As Double = 20
  219.     Private speedFast As Double = 50
  220.  
  221.     Private FlightTurningRight As Double = 0
  222.     Private FlightTurningLeft As Double = 0
  223.  
  224.     Shared width_Coef, height_Coef As Double
  225.  
  226.     Private lastZPos As Double = 0
  227.     Private bFast As Boolean = False
  228.     Private timeActivateDown As Double = 0
  229.     Private timeOfFlight As Double = 0
  230.     Private heightFix As Double = 0
  231.     Private timeRestartFlight As Double = 0
  232.     Private smokeTime As Double = 0
  233.     Private bAdaptToFlightHeading As Boolean = True
  234.     Private FlightSpeedChange As Vector3
  235.  
  236.     Private camAimPosition As Vector3
  237.     Private camAimMoveEase As Double = 0.1
  238.     Private bResetCamAim As Boolean = True
  239.     Private camLastZDiff As Double = 0
  240.     Private camLastXMove As Double = 0
  241.  
  242.     Private timeClearTask As Double = 0
  243.     Private timeShooting As Double = 0
  244.  
  245.     ' gun switch
  246.     Private gunMode As Int16 = 0
  247.     'Private IDsndGunSwitch As Int32 = 0
  248.     Private WeaponSelectTime As Double = 0
  249.     Private bShowingWeaponSelector As Boolean = False
  250.  
  251.     Private timeKeeArmAnim As Double = 0
  252.  
  253.     Private weaponHeat0 As Double = 0
  254.     Private weaponHeat1 As Double = 0
  255.     Private weaponHeat2 As Double = 0
  256.     Private weaponHeat3 As Double = 0
  257.     Private weaponHeat4 As Double = 0
  258.     Private bBlinkWeaponHeat As Boolean = True
  259.  
  260.     Private timeWaitStartCannonShoot As Double = 0
  261.  
  262.     ' repulsor beam
  263.     Private timeRepulsorBeamON As Double = 0
  264.     Private timeWaitShootRepulsor As Double = 0
  265.     Private timeWaitRepulsorSound As Double = 0
  266.     Private pedsRepulsorHit As Ped()
  267.     Private vehRepulsorHit As Vehicle()
  268.     Private PTFXRepulsor As Int32 = 0
  269.     Private repulsorDiameter As Double = 5
  270.     Private repulsorChest As Boolean = False
  271.     Private sndRepulsorStart As System.Media.SoundPlayer
  272.     Private sndRepulsorBlast As System.Media.SoundPlayer
  273.     Private repulsorLight As Light
  274.     Private bWasAlive As Boolean = True
  275.     Private bWasDead As Boolean = False
  276.     Private timeKeepRepulsorSound As Double = 0
  277.     Private bArrested As Boolean = False
  278.     Private TimeDontCheckArrest As Double = 0
  279.     Private bSoundOK As Boolean = True
  280.  
  281.     ' cannon
  282.     'Private IDsndCannon As Int32
  283.     Private IDsndCannonRotate As Int32
  284.     Private timeShootCannon As Double = 0
  285.     Private timeShootSuperCannon As Double = 0
  286.     Private cannPTFX1 As Int32
  287.  
  288.     ' jets
  289.     Private PTFX_SmokeRB, PTFX_SmokeLB As Int32
  290.     Private ptfxBootSize, ptfxLeftHandSize, ptfxRrightHandSize As Double
  291.     Private IDsndJets1 As Int32
  292.     Private jetSoundAux As GTA.Object = Nothing
  293.     Private jetSoundDistance As Double = 0
  294.     Private jetSoundDesiredDistance As Double = 0
  295.  
  296.     ' xbox
  297.     'Private XControl As Controller = New Controller(UserIndex.One)
  298.     Private controllerState As Microsoft.Xna.Framework.Input.GamePadState
  299.     Private lasPacketNumber As Int64
  300.     Private timeWaitCheckXKeys As Double = 0
  301.     Private lastAutoAimedPed As Ped = Nothing
  302.     Private AutoAimedPed As Ped = Nothing
  303.     Private autoAimPedList As Ped()
  304.     Private timeCheckAutoAimPed As Double = 0
  305.     Private timeWaitSearchAutoAImPed As Double = 0
  306.     Private camFixAutoAimRot As Vector3
  307.     Private bFixCamRotation As Boolean = False
  308.     Private timeShowMenuDown As Double = 0
  309.     Private timeWaitXControlCheck As Double = 0
  310.  
  311.     Private bMoveFDown, bMoveBDown, bMoveLDown, bMoveRDown, bJumpDown, bAttackDown, bAimDown, bActionDown, bCrouchDown, bEnterCarDown, _
  312.         bEscDown, bPhoneDown, bRadarZoomDown, bReloadDown, bSeekCoverDown, bSoundHornDown, bSprintDown, _
  313.         bDPadDown, bDPadLeft, bDPadRight As Boolean
  314.  
  315.     ' darts
  316.     Private Class TDarts
  317.         Public dart As GTA.Object = Nothing
  318.         Public launched As Boolean = False
  319.         Public targetReady As Boolean = False
  320.         Public readyToBlowUp As Boolean = False
  321.         Public target As Ped = Nothing
  322.         Public targetVeh As Vehicle = Nothing
  323.         Public targetSuperGuy As Ped = Nothing
  324.         Public PTFXFlight, PTFXHit As Int32
  325.         Public initial_direction As Vector3
  326.         Public attachPos As Vector3
  327.         Public IDsndMove As Int32 = 0
  328.         Public timeOut As Double = 0
  329.         Public attachBone As Bone = Bone.RightUpperarmRoll
  330.         Public attachRotation As Vector3 = Vector3.Zero
  331.         Public diameterMulti As Double = 1
  332.         Public hiden As Boolean = False
  333.         Public attached As Boolean = False
  334.  
  335.         Public Sub New()
  336.             'IDsndMove = Native.Function.Call(Of Int32)("get_sound_id")
  337.         End Sub
  338.  
  339.         Public Sub attach(tped As Ped)
  340.             If attached Then Exit Sub
  341.  
  342.             'msg("attach darts", 15)
  343.  
  344.             If hiden Then OH.releaseObject(dart, True, False)
  345.  
  346.             stopPTFX(PTFXFlight)
  347.             'getGameSoundID(IDsndMove)
  348.  
  349.             Native.Function.Call("SET_OBJECT_RECORDS_COLLISIONS", dart, False)
  350.  
  351.             If playerArmor.weaponSet = 0 Then
  352.                 dart.AttachToPed(tped, attachBone, attachPos, attachRotation)
  353.             Else
  354.                 Dim vecPos As Vector3
  355.                 vecPos.X = 0.15
  356.                 vecPos.Y = 0
  357.                 vecPos.Z = 0.6
  358.  
  359.                 dart.AttachToPed(tped, Bone.Root, vecPos, attachRotation)
  360.             End If
  361.  
  362.             dart.isOnFire = False
  363.  
  364.             hiden = False
  365.             attached = True
  366.         End Sub
  367.  
  368.         Public Sub Hide()
  369.             If hiden Then Exit Sub
  370.  
  371.             'msg("detach darts", 15)
  372.  
  373.             attached = False
  374.             launched = False
  375.             readyToBlowUp = False
  376.             dart.isOnFire = False
  377.             targetReady = False
  378.             timeOut = 0
  379.  
  380.             Native.Function.Call("SET_OBJECT_RECORDS_COLLISIONS", dart, False)
  381.  
  382.             OH.hideObject(dart)
  383.  
  384.             hiden = True
  385.         End Sub
  386.     End Class
  387.  
  388.     Private DartsList As New List(Of TDarts)
  389.     Private LaunchedDartsList As New List(Of TDarts)
  390.     Private tmpDart As TDarts
  391.     Private pedTargets As PedCollection = New PedCollection
  392.     Private vehTargets As Vehicle()
  393.     Private timeSearchForPedTargets As Double = 0
  394.     Private indexCheckDartShoot As Double = -1
  395.     Private targetObejctAux As GTA.Object = Nothing
  396.     Private targetHUDRotation As Double = 0
  397.     'Shared IDsndLaunchDarts As Int32
  398.     Private timeWaitLaunchDarts As Double = 0
  399.  
  400.     Private timeKeepArmorConfig As Double = 0
  401.  
  402.     ' ped enemy
  403.     Private Class TSuperGuy
  404.         Public p As Ped = Nothing
  405.         Public r As GTA.Object = Nothing
  406.         Public AimingTime As Double = 0
  407.         Public AimCoolDown As Double = 0
  408.         Public bLaunched As Boolean = False
  409.         Public bLocked As Boolean = False
  410.         Public flightDir As Vector3
  411.         Public timeOut As Double = 0
  412.         Public bReadyToBlowUp As Boolean = False
  413.         'Public IDLaunchSound as int32
  414.         Public IDMoveSound As Int32
  415.         Public PTFXMove As Int32
  416.         Public followTime As Double = 0
  417.         Public heli As Vehicle = Nothing
  418.         Public blip As Blip
  419.         Public isRagDoll As Boolean = False
  420.         Public unstableTime As Double = 0
  421.         Public ptfxL, ptfxR, ptfxDamage As Int32
  422.         Private bCollision As Boolean = True
  423.         Public targetPed As Ped = Nothing
  424.         Public targetPedSecondary As Ped = Nothing
  425.         Public enemy As Boolean = True
  426.         Public timeToReact As Double = 0
  427.         Public timeReacting As Double = 0
  428.         Public reactDir As Vector3
  429.         Public explosionEffectTIme As Double = 0
  430.         Public stuckTime As Double = 0
  431.         Public moveForce As Double = 1
  432.         Private lastHealth As Int16 = -999
  433.         Private ptfxCannon, ptfxCannonMuz As Int32
  434.         Private timeIntervalShootCannon As Double = 10
  435.         'Public AIM_Robot As Boolean = False
  436.         Public timeToExplode As Double = 2000
  437.         Public heliPassenger As Boolean = False
  438.         'Public weaponSet As Int16 = 0
  439.         Public removeTime As Double = -666
  440.         Public armor As TArmor
  441.  
  442.         Public Sub collision(bcol As Boolean)
  443.             If bCollision <> bcol Then
  444.                 Native.Function.Call("set_char_collision", p, bcol)
  445.                 bCollision = bcol
  446.             End If
  447.         End Sub
  448.  
  449.         Public Function lifeChanged() As Boolean
  450.             If (lastHealth <> -999) AndAlso (lastHealth <> p.Health) Then
  451.                 lastHealth = p.Health
  452.                 Return True
  453.             Else
  454.                 lastHealth = p.Health
  455.                 Return False
  456.             End If
  457.         End Function
  458.  
  459.         Public Sub shootCannonTick()
  460.             If Not (heli Is Nothing) Then Exit Sub
  461.  
  462.             stopPTFX(ptfxCannon)
  463.             stopPTFX(ptfxCannonMuz)
  464.  
  465.             If p.isRagdoll OrElse p.isGettingUp Then Exit Sub
  466.  
  467.             If timeIntervalShootCannon <= 0 Then
  468.                 timeIntervalShootCannon = 20
  469.  
  470.                 Dim tmpPosIni, tmpPosFin As Vector3
  471.  
  472.                 tmpPosIni = p.GetBonePosition(Bone.RightArmRoll) + p.Direction * 2
  473.  
  474.                 If Not targetPed Is Nothing Then
  475.                     If (Math.Abs(targetPed.Position.Z - p.Position.Z) > 5) OrElse _
  476.                         (targetPed.Position.DistanceTo(p.Position) > 50) Then Exit Sub
  477.  
  478.                     tmpPosFin = (targetPed.Position + Vector3.Normalize(targetPed.Position - p.Position) * 100).Around(targetPed.Velocity.DistanceTo(Vector3.Zero) * 10)
  479.                 ElseIf Not targetPedSecondary Is Nothing Then
  480.                     If (targetPedSecondary.Position.DistanceTo(p.Position) > 65) Then
  481.                         targetPedSecondary = Nothing
  482.                         Exit Sub
  483.                     End If
  484.  
  485.                     If (Math.Abs(targetPedSecondary.Position.Z - p.Position.Z) > targetPedSecondary.Position.DistanceTo(p.Position) * 0.5) Then Exit Sub
  486.  
  487.                     tmpPosFin = (targetPedSecondary.Position + Vector3.Normalize(targetPedSecondary.Position + Vector3.WorldDown * TRandom.NextDouble * 1.5 - p.Position) * 70).Around(2)
  488.  
  489.                     If (targetPedSecondary.PedType = PedType.Cop) AndAlso Not targetPedSecondary.Metadata.shootingSG Then
  490.                         targetPedSecondary.Metadata.shootingSG = True
  491.                         targetPedSecondary.Task.ClearAllImmediately()
  492.                         targetPedSecondary.Task.ShootAt(p, ShootMode.Burst)
  493.                     End If
  494.                 Else
  495.                     tmpPosFin = tmpPosIni + p.Direction * 300
  496.                 End If
  497.  
  498.                 'If Not AIM_Robot Then
  499.                 '    ptfxCannon = Native.Function.Call(Of Int32)("START_PTFX_ON_ped", "muz_machine", p,
  500.                 '        -0.15, 0, 0.7, 0, 0, 90.0, 0.5)
  501.                 '    ptfxCannonMuz = Native.Function.Call(Of Int32)("START_PTFX_ON_ped", "wpn_bullet_trace", p,
  502.                 '        -0.15, 0, 0.7, -90.0, 0, 0, 1.0)
  503.                 'Else
  504.                 '    ptfxCannon = Native.Function.Call(Of Int32)("START_PTFX_ON_ped", "muz_machine", p,
  505.                 '        0, 0.2, 0.5, 0, 0, 90.0, 0.5)
  506.                 '    ptfxCannonMuz = Native.Function.Call(Of Int32)("START_PTFX_ON_ped", "wpn_bullet_trace", p,
  507.                 '        0, 0.2, 0.5, -90.0, 0, 0, 1.0)
  508.                 'End If
  509.                 Dim rot As Vector3 = Helper.DirectionToRotation(Vector3.Normalize(tmpPosFin - tmpPosIni), 0)
  510.  
  511.                 If armor.timeWaitShootSuperCannon > 0 Then armor.timeWaitShootSuperCannon -= intervalFix()
  512.  
  513.                 If Not armor.AIM_Robot Then
  514.                     If armor.superCannon AndAlso (armor.timeWaitShootSuperCannon <= 0) Then
  515.                         armor.timeWaitShootSuperCannon = 50
  516.  
  517.                         Native.Function.Call(Of Int32)("trigger_PTFX_ON_ped", "muz_machine", p,
  518.                             -0.2, 0.28, 0.8, 0, 0, 90.0, 0.5)
  519.                         Native.Function.Call(Of Int32)("trigger_PTFX_ON_ped", "wpn_bullet_trace", p,
  520.                             -0.2, 0.28, 0.8, -90.0 + rot.X, 0, 0, 1.0)
  521.  
  522.                         Native.Function.Call("FIRE_SINGLE_BULLET", tmpPosIni.X, tmpPosIni.Y, tmpPosIni.Z, tmpPosFin.X, tmpPosFin.Y, tmpPosFin.Z, armor.superCannon_Power)
  523.                         Native.Function.Call("FIRE_SINGLE_BULLET", tmpPosIni.X, tmpPosIni.Y, tmpPosIni.Z, tmpPosFin.X, tmpPosFin.Y, tmpPosFin.Z, armor.superCannon_Power)
  524.                         Native.Function.Call("FIRE_SINGLE_BULLET", tmpPosIni.X, tmpPosIni.Y, tmpPosIni.Z, tmpPosFin.X, tmpPosFin.Y, tmpPosFin.Z, armor.superCannon_Power)
  525.                         Native.Function.Call("FIRE_SINGLE_BULLET", tmpPosIni.X, tmpPosIni.Y, tmpPosIni.Z, tmpPosFin.X, tmpPosFin.Y, tmpPosFin.Z, armor.superCannon_Power)
  526.                         Native.Function.Call("FIRE_SINGLE_BULLET", tmpPosIni.X, tmpPosIni.Y, tmpPosIni.Z, tmpPosFin.X, tmpPosFin.Y, tmpPosFin.Z, armor.superCannon_Power)
  527.  
  528.                         Native.Function.Call("PLAY_SOUND_FROM_position", -1, "shotgun_fire", tmpPosIni.X, tmpPosIni.Y, tmpPosIni.Z)
  529.                     End If
  530.  
  531.                     If armor.handCannon OrElse armor.shoulderCannon Then
  532.                         If armor.weaponSet = 0 Then
  533.                             Native.Function.Call(Of Int32)("trigger_PTFX_ON_ped", "muz_machine", p,
  534.                                 -0.15, 0, 0.7, 0, 0, 90.0, 0.5)
  535.                             Native.Function.Call(Of Int32)("trigger_PTFX_ON_ped", "wpn_bullet_trace", p,
  536.                                 -0.15, 0, 0.7, -90.0 + rot.X, 0, 0, 1.0)
  537.                         Else
  538.                             Native.Function.Call(Of Int32)("trigger_PTFX_ON_ped", "muz_machine", p,
  539.                                 -0.2, 0.28, 0.8, 0, 0, 90.0, 0.5)
  540.                             Native.Function.Call(Of Int32)("trigger_PTFX_ON_ped", "wpn_bullet_trace", p,
  541.                                 -0.2, 0.28, 0.8, -90.0 + rot.X, 0, 0, 1.0)
  542.                         End If
  543.  
  544.                         If armor.handCannon Then
  545.                             Native.Function.Call("FIRE_SINGLE_BULLET", tmpPosIni.X, tmpPosIni.Y, tmpPosIni.Z, tmpPosFin.X, tmpPosFin.Y, tmpPosFin.Z, armor.handCannon_Damage)
  546.                             Native.Function.Call("PLAY_SOUND_FROM_position", -1, "shotgun_fire", tmpPosIni.X, tmpPosIni.Y, tmpPosIni.Z)
  547.                         End If
  548.                         If armor.shoulderCannon Then
  549.                             Native.Function.Call("FIRE_SINGLE_BULLET", tmpPosIni.X, tmpPosIni.Y, tmpPosIni.Z, tmpPosFin.X, tmpPosFin.Y, tmpPosFin.Z, armor.shoulderCannon_Damage)
  550.                             Native.Function.Call("PLAY_SOUND_FROM_position", -1, "shotgun_fire", tmpPosIni.X, tmpPosIni.Y, tmpPosIni.Z)
  551.                         End If
  552.                     End If
  553.                 Else
  554.                     Native.Function.Call(Of Int32)("trigger_PTFX_ON_ped", "muz_machine", p,
  555.                         0, 0.2, 0.5, 0, 0, 90.0, 0.5)
  556.                     Native.Function.Call(Of Int32)("trigger_PTFX_ON_ped", "wpn_bullet_trace", p,
  557.                         0, 0.2, 0.5, -90.0 + rot.X, 0, 0, 1.0)
  558.  
  559.                     Native.Function.Call("FIRE_SINGLE_BULLET", tmpPosIni.X, tmpPosIni.Y, tmpPosIni.Z, tmpPosFin.X, tmpPosFin.Y, tmpPosFin.Z, 50)
  560.  
  561.                     Native.Function.Call("PLAY_SOUND_FROM_position", -1, "shotgun_fire", tmpPosIni.X, tmpPosIni.Y, tmpPosIni.Z)
  562.                 End If
  563.  
  564.                 'Native.Function.Call("PLAY_SOUND_FROM_position", IDMoveSound, "shotgun_fire", tmpPosIni.X, tmpPosIni.Y, tmpPosIni.Z)
  565.                 'Native.Function.Call("PLAY_SOUND_FROM_position", -1, "shotgun_fire", tmpPosIni.X, tmpPosIni.Y, tmpPosIni.Z)
  566.  
  567.                 'If (targetPed = charCheck) AndAlso (TRandom.NextDouble < 0.3) Then
  568.                 '    charCheck.Health -= 1
  569.                 '    damageTime = 0
  570.                 'End If
  571.             Else
  572.                 timeIntervalShootCannon -= intervalFix()
  573.             End If
  574.         End Sub
  575.     End Class
  576.  
  577.     Private tmpEnemy As TSuperGuy
  578.     Private TSuperGuyList As New List(Of TSuperGuy)
  579.     Private TSuperGuyExplodeList As New List(Of TSuperGuy)
  580.     Private freeRocketList As New List(Of GTA.Object)
  581.  
  582.     Private explosionEffectTIme As Double = 0
  583.     Private sndBeep As System.Media.SoundPlayer
  584.     Private timeWaitBeep As Double = 50
  585.     Private sndTargetSet As System.Media.SoundPlayer
  586.  
  587.     ' enemy blip list
  588.     Private Class TEnemyBlip
  589.         Public p As Ped = Nothing
  590.         Public v As Vehicle = Nothing
  591.         Public blip As Blip = Nothing
  592.     End Class
  593.  
  594.     Private wantedLevel As Double = 0
  595.  
  596.     Private tmpTEnemyBlip As TEnemyBlip
  597.     Private TEnemyBlipList As New List(Of TEnemyBlip)
  598.     Private timeWaitSearchEnemy As Double = 0
  599.     Private timeSetWanted As Double = 0
  600.     Private copKillCont As Int16 = 0
  601.  
  602.     ' armors class
  603.     Private Class TArmor
  604.         Public name As String = ""
  605.         Public file_name As String = ""
  606.         Public model As Model
  607.         Public anim_group As String = "move_player"
  608.         Public removeHair As Boolean = True
  609.         Public removeHead As Boolean = False
  610.         Public component_0_Var As Int16 = 0
  611.         Public component_1_Var As Int16 = 0
  612.         Public component_2_Var As Int16 = 0
  613.         Public component_3_Var As Int16 = 0
  614.         Public component_4_Var As Int16 = 0
  615.         Public component_5_Var As Int16 = 0
  616.         Public component_6_Var As Int16 = 0
  617.         Public component_7_Var As Int16 = 0
  618.         Public component_8_Var As Int16 = 0
  619.         Public component_9_Var As Int16 = 0
  620.         Public enemy As Boolean = False
  621.         Public ally As Boolean = False
  622.         Public weaponSet As Int16 = 0
  623.         Public img_preview As String = ""
  624.         Public drawTexture As Boolean = False
  625.         Public texMenu As Texture
  626.         Public AIM_Robot As Boolean = False
  627.         Public cannonHandOffset As Vector3
  628.         Public cannonShoulderOffset As Vector3
  629.         Public superCannonShoulderOffset As Vector3
  630.         Public superCannon As Boolean = False
  631.         Public shoulderCannon As Boolean = False
  632.         Public handCannon As Boolean = True
  633.         Public handCannon_ShootInterval As Double = 20
  634.         Public shoulderCannon_ShootInterval As Double = 10
  635.         Public superCannon_ShootInterval As Double = 100
  636.         Public handCannon_Damage As Int16 = 100
  637.         Public shoulderCannon_Damage As Int16 = 100
  638.         Public superCannon_Power As Int16 = 100
  639.         Public timeWaitShootSuperCannon As Double = 0
  640.  
  641.         Public bHandThrusters As Boolean = True
  642.         Public bFootThrusters As Boolean = True
  643.         Public bBackThrusters As Boolean = False
  644.         Public bThrustersSound As Boolean = True
  645.  
  646.         Public back_rep_x_off As Double = 0.15
  647.         Public back_rep_y_off As Double = -0.2
  648.         Public back_rep_z_off As Double = -0.16
  649.         Public back_rep_x_rot_off As Double = 0
  650.         Public back_rep_y_rot_off As Double = 0
  651.         Public back_rep_z_rot_off As Double = 192
  652.     End Class
  653.  
  654.     Private tmpTArmor As TArmor
  655.     Private TArmorList As New List(Of TArmor)
  656.     Private TEnemyAllyArmorList As New List(Of TArmor)
  657.     Shared playerArmor As TArmor
  658.  
  659.     Private iniFile As String
  660.  
  661.     Private Class TGameSounds
  662.         Public id As Int32 = 0
  663.         Public timeWait As Double = 0
  664.     End Class
  665.  
  666.     Private tmpTGameSounds As TGameSounds
  667.     Private TGameSoundsList As New List(Of TGameSounds)
  668.  
  669.     Private Class meleeAffected
  670.         Public p As Ped = Nothing
  671.         Public v As Vehicle = Nothing
  672.         Public bApplyforce As Boolean = False
  673.     End Class
  674.  
  675.     Private meleeAffectedList As New List(Of meleeAffected)
  676.     Private tmpmeleeAffected As meleeAffected = Nothing
  677.     Private meleeAffectedFront As meleeAffected = New meleeAffected
  678.  
  679.     Public Sub New()
  680.         Me.Interval = myInterval
  681.  
  682.         'offx = 100
  683.         'offy = 800
  684.         'offH = 59
  685.  
  686.         Wait(100)
  687.  
  688.         bWasAlive = Player.Character.Health > 0
  689.         bWasDead = Player.Character.Health <= 0
  690.  
  691.         hkShowMenu = Settings.GetValueKey("hkShowMenu", "controls", Keys.D0)
  692.  
  693.         Game.Console.Print("Iron Man IV Script v1.1 by JulioNIB")
  694.         Game.Console.Print("Armors and HUD images by H1Vltg3, Wapeddell and Quechus13")
  695.     End Sub
  696.  
  697.     Private Sub loadAux()
  698.         OH = New ObjectsHandler
  699.  
  700.         While Not Exists(OH.attachMaster)
  701.             Wait(50)
  702.  
  703.             OH = New ObjectsHandler
  704.         End While
  705.  
  706.         loadArmors()
  707.  
  708.         If Settings.GetValueString("start_with_armor", "general") = "" Then Settings.SetValue("start_with_armor", "general", "0")
  709.         If Settings.GetValueString("initial_armor_model", "general") = "" Then Settings.SetValue("initial_armor_model", "general", "")
  710.  
  711.         If Settings.GetValueString("hkSwitchGun", "controls") = "" Then Settings.SetValue("hkSwitchGun", "controls", Keys.E)
  712.         If Settings.GetValueString("hkCannon", "controls") = "" Then Settings.SetValue("hkCannon", "controls", Keys.D1)
  713.         If Settings.GetValueString("hkDarts", "controls") = "" Then Settings.SetValue("hkDarts", "controls", Keys.D2)
  714.         If Settings.GetValueString("hkRockets", "controls") = "" Then Settings.SetValue("hkRockets", "controls", Keys.D3)
  715.         If Settings.GetValueString("hkHandRep", "controls") = "" Then Settings.SetValue("hkHandRep", "controls", Keys.D4)
  716.         If Settings.GetValueString("hkChestRep", "controls") = "" Then Settings.SetValue("hkChestRep", "controls", Keys.D5)
  717.  
  718.         If Settings.GetValueString("hkShowMenu", "controls") = "" Then Settings.SetValue("hkShowMenu", "controls", Keys.D0)
  719.         If Settings.GetValueString("hkKick", "controls") = "" Then Settings.SetValue("hkKick", "controls", Keys.Q)
  720.         If Settings.GetValueString("hkPunch", "controls") = "" Then Settings.SetValue("hkPunch", "controls", Keys.R)
  721.         If Settings.GetValueString("hkShoot", "controls") = "" Then Settings.SetValue("hkShoot", "controls", Keys.LButton)
  722.         If Settings.GetValueString("hkSpawnAlly", "controls") = "" Then Settings.SetValue("hkSpawnAlly", "controls", Keys.NumPad0)
  723.         If Settings.GetValueString("hkSpawnEnemy", "controls") = "" Then Settings.SetValue("hkSpawnEnemy", "controls", Keys.NumPad1)
  724.         If Settings.GetValueString("hkSwitchCam", "controls") = "" Then Settings.SetValue("hkSwitchCam", "controls", Keys.X)
  725.         If Settings.GetValueString("hkUnlockFlightCam", "controls") = "" Then Settings.SetValue("hkUnlockFlightCam", "controls", Keys.B)
  726.         If Settings.GetValueString("hkWeaponSelectMenu", "controls") = "" Then Settings.SetValue("hkWeaponSelectMenu", "controls", Keys.MButton)
  727.         If Settings.GetValueString("hkNoWantedLevel", "controls") = "" Then Settings.SetValue("hkNoWantedLevel", "controls", Keys.Subtract)
  728.         If Settings.GetValueString("hkGodMode", "controls") = "" Then Settings.SetValue("hkGodMode", "controls", Keys.Add)
  729.  
  730.         If Settings.GetValueString("maxAlly", "general", "") = "" Then Settings.SetValue("maxAlly", "general", 1)
  731.         If Settings.GetValueString("maxEnemy", "general", "") = "" Then Settings.SetValue("maxEnemy", "general", 2)
  732.         If Settings.GetValueString("bUseArmorDelivery", "general", "") = "" Then Settings.SetValue("bUseArmorDelivery", "general", "0")
  733.         If Settings.GetValueString("HUDIndex", "general", "") = "" Then Settings.SetValue("HUDIndex", "general", "1")
  734.         If Settings.GetValueString("bNoFlightCollisionDetection", "general", "") = "" Then Settings.SetValue("bNoFlightCollisionDetection", "general", "0")
  735.  
  736.         If Settings.GetValueString("jarvisVolume", "general", "") = "" Then Settings.SetValue("jarvisVolume", "general", "0.3")
  737.  
  738.         Settings.Save()
  739.  
  740.         bArmorON = Settings.GetValueString("start_with_armor", "general") = "1"
  741.  
  742.         jarvisVolume = Double.Parse(Settings.GetValueString("jarvisVolume", "general", "0.3"))
  743.  
  744.         If bArmorON Then
  745.             Dim tmpModelName As String = Settings.GetValueString("initial_armor_model", "general")
  746.  
  747.             For Each a As TArmor In TArmorList
  748.                 If a.model = tmpModelName Then
  749.                     playerArmor = a
  750.  
  751.                     Game.FadeScreenOut(500, True)
  752.  
  753.                     Try
  754.                         Wait(100)
  755.  
  756.                         Player.Model = playerArmor.model
  757.  
  758.                         Wait(500)
  759.                     Catch
  760.                     End Try
  761.  
  762.                     Game.FadeScreenIn(500, False)
  763.  
  764.                     Native.Function.Call("SET_CHAR_DEFAULT_COMPONENT_VARIATION", Player.Character, True)
  765.  
  766.                     setArmorComponentVar()
  767.  
  768.                     Exit For
  769.                 End If
  770.             Next
  771.         End If
  772.  
  773.         hkSwitchGun = Settings.GetValueKey("hkSwitchGun", "controls", Keys.E)
  774.         hkCannon = Settings.GetValueKey("hkCannon", "controls", Keys.D1)
  775.         hkDarts = Settings.GetValueKey("hkDarts", "controls", Keys.D2)
  776.         hkRockets = Settings.GetValueKey("hkRockets", "controls", Keys.D3)
  777.         hkHandRep = Settings.GetValueKey("hkHandRep", "controls", Keys.D4)
  778.         hkChestRep = Settings.GetValueKey("hkChestRep", "controls", Keys.D5)
  779.  
  780.         hkShowMenu = Settings.GetValueKey("hkShowMenu", "controls", Keys.D0)
  781.         hkKick = Settings.GetValueKey("hkKick", "controls", Keys.Q)
  782.         hkPunch = Settings.GetValueKey("hkPunch", "controls", Keys.R)
  783.         hkShoot = Settings.GetValueKey("hkShoot", "controls", Keys.LButton)
  784.         hkSpawnAlly = Settings.GetValueKey("hkSpawnAlly", "controls", Keys.NumPad0)
  785.         hkSpawnEnemy = Settings.GetValueKey("hkSpawnEnemy", "controls", Keys.NumPad1)
  786.         hkSwitchCam = Settings.GetValueKey("hkSwitchCam", "controls", Keys.X)
  787.         hkUnlockFlightCam = Settings.GetValueKey("hkUnlockFlightCam", "controls", Keys.B)
  788.         hkWeaponSelectMenu = Settings.GetValueKey("hkWeaponSelectMenu", "controls", Keys.MButton)
  789.         hkNoWantedLevel = Settings.GetValueKey("hkNoWantedLevel", "controls", Keys.Subtract)
  790.         hkGodMode = Settings.GetValueKey("hkGodMode", "controls", Keys.Add)
  791.  
  792.         maxAlly = Settings.GetValueInteger("maxAlly", "general", 1)
  793.         maxEnemy = Settings.GetValueInteger("maxEnemy", "general", 2)
  794.         bUseArmorDelivery = Settings.GetValueString("bUseArmorDelivery", "general", "0") = "1"
  795.         HUDIndex = Int16.Parse(Settings.GetValueString("HUDIndex", "general", "1"))
  796.         bNoFlightCollisionDetection = Settings.GetValueString("bNoFlightCollisionDetection", "general", "0") = "1"
  797.  
  798.         switchHUDname()
  799.  
  800.         myFlyHabsNormal = Nothing
  801.  
  802.         While Not Exists(myFlyHabsNormal)
  803.             myFlyHabsNormal = OH.createVehicle("faggio", Player.Character.Position.Around(20) + Vector3.WorldUp * 200)
  804.             Wait(50)
  805.         End While
  806.  
  807.         OH.hideVehicle(myFlyHabsNormal)
  808.  
  809.         myFlyHabsHitObject = Nothing
  810.  
  811.         While Not Exists(myFlyHabsHitObject)
  812.             myFlyHabsHitObject = OH.createVehicle("airtug", Player.Character.Position.Around(25) + Vector3.WorldUp * 200)
  813.             Wait(50)
  814.         End While
  815.  
  816.         OH.hideVehicle(myFlyHabsHitObject)
  817.  
  818.         myFlyHabs = myFlyHabsNormal
  819.  
  820.         width_Coef = Game.Resolution.Width / 1680
  821.         height_Coef = Game.Resolution.Height / 1050
  822.  
  823.         'IDsndCannon = Native.Function.Call(Of Int32)("get_sound_id")
  824.         IDsndCannonRotate = Native.Function.Call(Of Int32)("get_sound_id")
  825.         'IDsndGunSwitch = Native.Function.Call(Of Int32)("get_sound_id")
  826.         'IDsndJets1 = Native.Function.Call(Of Int32)("get_sound_id")
  827.         'IDsndLaunchDarts = Native.Function.Call(Of Int32)("get_sound_id")
  828.  
  829.         'tmpTGameSounds = New TGameSounds
  830.         'tmpTGameSounds.id = IDsndCannon
  831.         'TGameSoundsList.Add(tmpTGameSounds)
  832.         tmpTGameSounds = New TGameSounds
  833.         tmpTGameSounds.id = IDsndCannonRotate
  834.         TGameSoundsList.Add(tmpTGameSounds)
  835.         'tmpTGameSounds = New TGameSounds
  836.         'tmpTGameSounds.id = IDsndGunSwitch
  837.         'TGameSoundsList.Add(tmpTGameSounds)
  838.         'tmpTGameSounds = New TGameSounds
  839.         'tmpTGameSounds.id = IDsndLaunchDarts
  840.         'TGameSoundsList.Add(tmpTGameSounds)
  841.  
  842.         While Not createObject("cj_dart_1", GTA.Vector3.Zero + Vector3.WorldUp * 3, jetSoundAux, 50)
  843.             Wait(10)
  844.         End While
  845.  
  846.         Native.Function.Call("set_object_collision", jetSoundAux, False)
  847.         jetSoundAux.Visible = False
  848.         jetSoundAux.FreezePosition = True
  849.  
  850.         camAux = New Camera
  851.         Wait(100)
  852.         camAux.FOV = 40
  853.  
  854.         While Not createObject("cj_dart_6", Vector3.Zero + Vector3.WorldUp * 6, targetObejctAux, 50)
  855.             Wait(10)
  856.         End While
  857.  
  858.         targetObejctAux.FreezePosition = True
  859.         targetObejctAux.Visible = False
  860.         Native.Function.Call("SET_OBJECT_COLLISION", targetObejctAux, False)
  861.  
  862.         For c As Int16 = 1 To 10
  863.             tmpDart = New TDarts
  864.  
  865.             While Not createObject("cj_dart_6", Vector3.Zero + Vector3.WorldUp * 9, tmpDart.dart, 50)
  866.                 Wait(0)
  867.             End While
  868.  
  869.             If Exists(tmpDart.dart) Then DartsList.Add(tmpDart)
  870.         Next
  871.  
  872.         sndRepulsorStart = New System.Media.SoundPlayer
  873.         sndRepulsorBlast = New System.Media.SoundPlayer
  874.         sndBeep = New System.Media.SoundPlayer
  875.         sndTargetSet = New System.Media.SoundPlayer
  876.  
  877.         If Not Directory.Exists(".\Scripts\Iron man files\") Then Directory.CreateDirectory(".\Scripts\Iron man files\")
  878.  
  879.         sndRepulsorStart.SoundLocation = ".\scripts\iron man files\repulsorStart.wav"
  880.         sndRepulsorBlast.SoundLocation = ".\scripts\iron man files\repulsorBlast.wav"
  881.         sndBeep.SoundLocation = ".\scripts\iron man files\beep.wav"
  882.         sndTargetSet.SoundLocation = ".\scripts\iron man files\targetSet.wav"
  883.  
  884.         Try
  885.             sndRepulsorStart.LoadAsync()
  886.             sndRepulsorBlast.LoadAsync()
  887.             sndBeep.LoadAsync()
  888.             sndTargetSet.LoadAsync()
  889.         Catch
  890.             bSoundOK = False
  891.             Game.Console.Print("Error loading Iron Man IV sounds, check your Iron Man files folder...")
  892.         End Try
  893.  
  894.         repulsorLight = New Light
  895.  
  896.         repulsorLight.Enabled = False
  897.  
  898.         Dim tmpbDrawTextures As Boolean = True
  899.  
  900.         Try
  901.             Dim tmpTexNumber As TTexNumber
  902.  
  903.             For c As Int16 = 0 To 9
  904.                 tmpTexNumber = New TTexNumber(".\scripts\iron man files\" & Int16.Parse(c) & ".png")
  905.                 texNumbers.Add(tmpTexNumber)
  906.             Next
  907.  
  908.             If Not loadHUD() Then Throw New Exception("Error loading HUD")
  909.         Catch
  910.             tmpbDrawTextures = False
  911.             Game.Console.Print("Error loading Iron Man IV images, check your Iron Man files folder...")
  912.         End Try
  913.  
  914.         animSetFlight = New AnimationSet("parachute")
  915.         animSetPointArm = New AnimationSet("cop")
  916.         animSetPunchKick = New AnimationSet("melee_player_unarmed")
  917.  
  918.         Native.Function.Call("REQUEST_ANIMS", "parachute")
  919.         Native.Function.Call("REQUEST_ANIMS", "full_brake_for_landing")
  920.         Native.Function.Call("REQUEST_ANIMS", "cop")
  921.  
  922.         If bArmorON Then
  923.             Player.MaxHealth = 1000
  924.             Player.Character.MaxHealth = 1000
  925.             Player.Character.Health = 1000
  926.  
  927.             Player.Character.Weapons.RemoveAll()
  928.             Player.Character.MakeProofTo(False, True, False, bNoFlightCollisionDetection OrElse bPlayerFallingDamageProof, True)
  929.         End If
  930.  
  931.         getGameSoundID(IDsndJets1)
  932.  
  933.         If bSoundOK AndAlso tmpbDrawTextures Then
  934.             Game.Console.Print("Iron Man IV Script loaded")
  935.         Else
  936.             Game.Console.Print("Iron Man IV Script loaded with errors :(")
  937.         End If
  938.  
  939.         resetCamCfg()
  940.  
  941.         jarvis_congrats_1 = New NAudioPlayer(".\scripts\Iron man files\jarvis\j_c.wav")
  942.         jarvis_congrats_2 = New NAudioPlayer(".\scripts\Iron man files\jarvis\j_c2.wav")
  943.         jarvis_congrats_3 = New NAudioPlayer(".\scripts\Iron man files\jarvis\j_c3.wav")
  944.         jarvis_congrats_4 = New NAudioPlayer(".\scripts\Iron man files\jarvis\j_c4.wav")
  945.         jarvis_enemy = New NAudioPlayer(".\scripts\Iron man files\jarvis\j_enemy_alert.wav")
  946.         jarvis_warning = New NAudioPlayer(".\scripts\Iron man files\jarvis\j_warning.wav")
  947.         jarvis_warning_2 = New NAudioPlayer(".\scripts\Iron man files\jarvis\j_warning2.wav")
  948.         jarvis_warning_3 = New NAudioPlayer(".\scripts\Iron man files\jarvis\j_warning3.wav")
  949.  
  950.         jarvis_congrats_1.volume(jarvisVolume)
  951.         jarvis_congrats_2.volume(jarvisVolume)
  952.         jarvis_congrats_3.volume(jarvisVolume)
  953.         jarvis_congrats_4.volume(jarvisVolume)
  954.         jarvis_enemy.volume(jarvisVolume)
  955.         jarvis_warning.volume(jarvisVolume)
  956.         jarvis_warning_2.volume(jarvisVolume)
  957.         jarvis_warning_3.volume(jarvisVolume)
  958.  
  959.         bDrawTextures = tmpbDrawTextures
  960.     End Sub
  961.  
  962.     Private Function controllerConnected()
  963.         Return controllerState.IsConnected
  964.     End Function
  965.  
  966.     Private Function loadHUD()
  967.         If HUDIndex = 4 Then
  968.             texCrossHair = New Texture(File.ReadAllBytes(".\scripts\Iron Man files\CrossHair.png"))
  969.  
  970.             Return True
  971.         End If
  972.  
  973.         Dim sTmp As String = "Iron Man files\HUD " + HUDIndex.ToString
  974.  
  975.         Try
  976.             texCannon = New Texture(File.ReadAllBytes(".\scripts\" + sTmp + "\Bullets.png"))
  977.             texDarts = New Texture(File.ReadAllBytes(".\scripts\" + sTmp + "\darts.png"))
  978.             texRockets = New Texture(File.ReadAllBytes(".\scripts\" + sTmp + "\rockets.png"))
  979.             texHandRep = New Texture(File.ReadAllBytes(".\scripts\" + sTmp + "\rep_hand.png"))
  980.             texChestRep = New Texture(File.ReadAllBytes(".\scripts\" + sTmp + "\rep_chest.png"))
  981.             texWSelect = New Texture(File.ReadAllBytes(".\scripts\" + sTmp + "\wselect.png"))
  982.  
  983.             texHUD = New Texture(File.ReadAllBytes(".\scripts\" + sTmp + "\HUD.png"))
  984.             texBar = New Texture(File.ReadAllBytes(".\scripts\" + sTmp + "\bar.png"))
  985.             texCrossHair = New Texture(File.ReadAllBytes(".\scripts\" + sTmp + "\CrossHair.png"))
  986.             texHudRing = New Texture(File.ReadAllBytes(".\scripts\" + sTmp + "\HUDRING.png"))
  987.  
  988.             texHUDLeft = New Texture(File.ReadAllBytes(".\scripts\" + sTmp + "\HUDLeft.png"))
  989.             If HUDIndex = 1 Then texHUDBottom = New Texture(File.ReadAllBytes(".\scripts\" + sTmp + "\HUDBottom.png"))
  990.             If (HUDIndex = 2) OrElse (HUDIndex = 3) Then texHUDLEFT_FlightMode = New Texture(File.ReadAllBytes(".\scripts\" + sTmp + "\HUDLEFT FlightMode.png"))
  991.             If (HUDIndex = 2) OrElse (HUDIndex = 3) Then texHUDLEFT_MissileAlarm = New Texture(File.ReadAllBytes(".\scripts\" + sTmp + "\HUDLEFT MissileAlarm.png"))
  992.  
  993.             texHUDRight = New Texture(File.ReadAllBytes(".\scripts\" + sTmp + "\HUDRight.png"))
  994.             If (HUDIndex = 2) OrElse (HUDIndex = 3) Then texHUDRIGHT_Damage = New Texture(File.ReadAllBytes(".\scripts\" + sTmp + "\HUDRIGHT_Damage.png"))
  995.             If HUDIndex = 3 Then texHUDRight_FlightMode = New Texture(File.ReadAllBytes(".\scripts\" + sTmp + "\HUDRIGHT_flight_mode.png"))
  996.  
  997.             If HUDIndex = 3 Then texHUD_ThrusterBar = New Texture(File.ReadAllBytes(".\scripts\" + sTmp + "\Thruster Bar.png"))
  998.  
  999.             texHUDTop = New Texture(File.ReadAllBytes(".\scripts\" + sTmp + "\HUDTop.png"))
  1000.  
  1001.             If (HUDIndex = 2) OrElse (HUDIndex = 3) Then
  1002.                 texHUDBottonIcon1 = New Texture(File.ReadAllBytes(".\scripts\" + sTmp + "\HBI1.png"))
  1003.                 texHUDBottonIcon1_2 = New Texture(File.ReadAllBytes(".\scripts\" + sTmp + "\HBI12.png"))
  1004.  
  1005.                 texHUDBottonIcon2 = New Texture(File.ReadAllBytes(".\scripts\" + sTmp + "\HBI2.png"))
  1006.                 texHUDBottonIcon2_2 = New Texture(File.ReadAllBytes(".\scripts\" + sTmp + "\HBI22.png"))
  1007.  
  1008.                 texHUDBottonIcon3 = New Texture(File.ReadAllBytes(".\scripts\" + sTmp + "\HBI3.png"))
  1009.                 texHUDBottonIcon3_2 = New Texture(File.ReadAllBytes(".\scripts\" + sTmp + "\HBI32.png"))
  1010.                 texHUDBottonIcon3_3 = New Texture(File.ReadAllBytes(".\scripts\" + sTmp + "\HBI33.png"))
  1011.                 texHUDBottonIcon3_4 = New Texture(File.ReadAllBytes(".\scripts\" + sTmp + "\HBI34.png"))
  1012.  
  1013.                 texHUDBottonIcon4 = New Texture(File.ReadAllBytes(".\scripts\" + sTmp + "\HBI4.png"))
  1014.                 texHUDBottonIcon4_2 = New Texture(File.ReadAllBytes(".\scripts\" + sTmp + "\HBI42.png"))
  1015.  
  1016.                 texHUDBottonIcon5 = New Texture(File.ReadAllBytes(".\scripts\" + sTmp + "\HBI5.png"))
  1017.                 texHUDBottonIcon5_2 = New Texture(File.ReadAllBytes(".\scripts\" + sTmp + "\HBI52.png"))
  1018.             End If
  1019.  
  1020.             Return True
  1021.         Catch
  1022.             Return False
  1023.         End Try
  1024.     End Function
  1025.  
  1026.     Private Sub switchHUDname()
  1027.         If HUDIndex = 1 Then
  1028.             HUDName = "v1.0"
  1029.         ElseIf HUDIndex = 2 Then
  1030.             HUDName = "v2.0"
  1031.         ElseIf HUDIndex = 3 Then
  1032.             HUDName = "v3.0"
  1033.         Else
  1034.             HUDName = "None"
  1035.         End If
  1036.     End Sub
  1037.  
  1038.     Private Sub resetCamCfg()
  1039.         Native.Function.Call("UNATTACH_CAM", camAux)
  1040.         Native.Function.Call("ATTACH_CAM_TO_PED", camAux, Player.Character)
  1041.         Native.Function.Call("SET_CAM_ATTACH_OFFSET", camAux, -1.0, -2.0, 0.5)
  1042.         Native.Function.Call("SET_CAM_ATTACH_OFFSET_IS_RELATIVE", camAux, True)
  1043.         Native.Function.Call("SET_CAM_PROPAGATE", camAux, True)
  1044.     End Sub
  1045.  
  1046.     Private Function createObject(sModelName As String, position As Vector3, ByRef returnObj As GTA.Object, timeOut As Int16) As Boolean
  1047.         returnObj = World.CreateObject(sModelName, position)
  1048.  
  1049.         Wait(timeOut)
  1050.  
  1051.         Return Exists(returnObj)
  1052.     End Function
  1053.  
  1054.     Private Function createVehicle(sModelName As String, position As Vector3, ByRef returnVeh As Vehicle, timeOut As Int16) As Boolean
  1055.         returnVeh = World.CreateVehicle(sModelName, position)
  1056.  
  1057.         Wait(timeOut)
  1058.  
  1059.         Return Exists(returnVeh)
  1060.     End Function
  1061.  
  1062.     Private Function createPed(sModelName As String, position As Vector3, ByRef returnPed As Ped, timeOut As Int16) As Boolean
  1063.         If sModelName <> "" Then
  1064.             returnPed = World.CreatePed(sModelName, position)
  1065.         Else
  1066.             returnPed = World.CreatePed(position)
  1067.         End If
  1068.  
  1069.         Wait(timeOut)
  1070.  
  1071.         Return Exists(returnPed)
  1072.     End Function
  1073.  
  1074.     Shared Sub msg(ByVal sMsg As String, ByVal time As Int32)
  1075.         'Native.Function.Call("PRINT_STRING_WITH_LITERAL_STRING_NOW", "STRING", sMsg, time, 1)
  1076.         DisplayMessage.Display(sMsg, time)
  1077.     End Sub
  1078.  
  1079.     Private Sub setArmorComponentVar()
  1080.         Native.Function.Call("SET_CHAR_COMPONENT_VARIATION", Player.Character, 0, playerArmor.component_0_Var, 0)
  1081.         Native.Function.Call("SET_CHAR_COMPONENT_VARIATION", Player.Character, 1, playerArmor.component_1_Var, 0) '15
  1082.         Native.Function.Call("SET_CHAR_COMPONENT_VARIATION", Player.Character, 2, playerArmor.component_2_Var, 0) '7
  1083.         Native.Function.Call("SET_CHAR_COMPONENT_VARIATION", Player.Character, 3, playerArmor.component_3_Var, 0)
  1084.         Native.Function.Call("SET_CHAR_COMPONENT_VARIATION", Player.Character, 4, playerArmor.component_4_Var, 0) '1
  1085.         Native.Function.Call("SET_CHAR_COMPONENT_VARIATION", Player.Character, 5, playerArmor.component_5_Var, 0) '5
  1086.         Native.Function.Call("SET_CHAR_COMPONENT_VARIATION", Player.Character, 6, playerArmor.component_6_Var, 0)
  1087.         Native.Function.Call("SET_CHAR_COMPONENT_VARIATION", Player.Character, 7, playerArmor.component_7_Var, 0)
  1088.         Native.Function.Call("SET_CHAR_COMPONENT_VARIATION", Player.Character, 8, playerArmor.component_8_Var, 0) '1
  1089.         Native.Function.Call("SET_CHAR_COMPONENT_VARIATION", Player.Character, 9, playerArmor.component_9_Var, 0)
  1090.     End Sub
  1091.  
  1092.     Private Sub keyDown(ByVal sender As Object, ByVal e As GTA.KeyEventArgs) Handles MyBase.KeyDown
  1093.         If e.Key = hkShowMenu Then
  1094.             bShowArmorMenu = False
  1095.             bShowArmorOptionsMenu = False
  1096.  
  1097.             If ArmorDeliveryStatus = 0 Then
  1098.                 bShowMenu = Not bShowMenu
  1099.             Else
  1100.                 bShowMenu = False
  1101.             End If
  1102.         End If
  1103.  
  1104.         If bShowMenu OrElse bShowArmorMenu OrElse bShowArmorOptionsMenu Then checkMenu(e.Key)
  1105.  
  1106.         If Not bArmorON Then Exit Sub
  1107.  
  1108.         fakeKeydown(e)
  1109.     End Sub
  1110.     Private Sub keyUp(ByVal sender As Object, ByVal e As GTA.KeyEventArgs) Handles MyBase.KeyUp
  1111.         If (e.Key = hkWeaponSelectMenu) Then
  1112.             resetPlayerControl()
  1113.         End If
  1114.     End Sub
  1115.  
  1116.     Private Sub switchGodMode()
  1117.         bGodMode = Not bGodMode
  1118.  
  1119.         If bGodMode Then
  1120.             Player.Character.MakeProofTo(True, True, True, True, True)
  1121.  
  1122.             If Not bShowMenu Then msg("Invincible Iron Man...", 2000)
  1123.         Else
  1124.             Player.Character.MakeProofTo(False, True, False, bNoFlightCollisionDetection OrElse bPlayerFallingDamageProof, True)
  1125.  
  1126.             If Not bShowMenu Then msg("Normal Iron Man...", 2000)
  1127.         End If
  1128.     End Sub
  1129.  
  1130.     Private Sub switchNoWanted()
  1131.         bNoWanted = Not bNoWanted
  1132.  
  1133.         If bNoWanted Then
  1134.             Player.WantedLevel = 0
  1135.             Native.Function.Call("SET_MAX_WANTED_LEVEL", 6)
  1136.             Native.Function.Call("ALTER_WANTED_LEVEL", Player, 0)
  1137.             Native.Function.Call("APPLY_WANTED_LEVEL_CHANGE_NOW", Player)
  1138.  
  1139.             For c As Int16 = TEnemyBlipList.Count - 1 To 0 Step -1
  1140.                 If Exists(TEnemyBlipList(c).p) AndAlso TEnemyBlipList(c).p.PedType = PedType.Cop Then
  1141.                     If Exists(TEnemyBlipList(c).blip) Then TEnemyBlipList(c).blip.Delete()
  1142.  
  1143.                     TEnemyBlipList(c).p.NoLongerNeeded()
  1144.  
  1145.                     TEnemyBlipList.RemoveAt(c)
  1146.                 End If
  1147.             Next
  1148.  
  1149.             If Not bShowMenu Then msg("Never Wanted mode ON...", 2000)
  1150.         Else
  1151.             If Not bShowMenu Then msg("Never Wanted mode OFF...", 2000)
  1152.         End If
  1153.     End Sub
  1154.  
  1155.     Private Sub checkMenu(key As Keys)
  1156.         If bShowArmorOptionsMenu Then
  1157.             checkArmorOptionMenu(key)
  1158.  
  1159.             Exit Sub
  1160.         End If
  1161.  
  1162.         If bShowArmorMenu Then
  1163.             checkArmorIndex(key)
  1164.  
  1165.             Exit Sub
  1166.         End If
  1167.  
  1168.         If key = Keys.Left Then menuIndex -= 1
  1169.         If key = Keys.Right Then menuIndex += 1
  1170.  
  1171.         If menuIndex > 9 Then menuIndex = 0
  1172.         If menuIndex < 0 Then menuIndex = 9
  1173.  
  1174.         If key = Keys.Enter Then
  1175.             If (menuIndex = 8) AndAlso Not bArmorON Then
  1176.                 msg("You need to equip an armor first", 3000)
  1177.  
  1178.                 Exit Sub
  1179.             End If
  1180.  
  1181.             If menuIndex = 0 Then
  1182.                 bShowArmorMenu = True
  1183.                 bShowMenu = False
  1184.             ElseIf menuIndex = 1 Then
  1185.                 switchGodMode()
  1186.             ElseIf menuIndex = 2 Then
  1187.                 switchNoWanted()
  1188.             ElseIf menuIndex = 3 Then
  1189.                 createNewTSuperGuy(Nothing, True, True)
  1190.             ElseIf menuIndex = 4 Then
  1191.                 createNewTSuperGuy(Nothing, False, True)
  1192.             ElseIf menuIndex = 5 Then
  1193.                 bDrawTextures = False
  1194.  
  1195.                 HUDIndex += 1
  1196.  
  1197.                 If HUDIndex > 4 Then HUDIndex = 1
  1198.  
  1199.                 bDrawTextures = loadHUD()
  1200.                 bFirstDraw = bDrawTextures
  1201.  
  1202.                 switchHUDname()
  1203.  
  1204.                 Settings.SetValue("HUDIndex", "general", HUDIndex.ToString)
  1205.                 Settings.Save()
  1206.             ElseIf menuIndex = 6 Then
  1207.                 bNoFlightCollisionDetection = Not bNoFlightCollisionDetection
  1208.  
  1209.                 If bNoFlightCollisionDetection Then
  1210.                     Settings.SetValue("bNoFlightCollisionDetection", "general", "1")
  1211.                 Else
  1212.                     Settings.SetValue("bNoFlightCollisionDetection", "general", "0")
  1213.                 End If
  1214.  
  1215.                 Settings.Save()
  1216.             ElseIf menuIndex = 7 Then
  1217.                 jarvisVolume += 0.1
  1218.  
  1219.                 If jarvisVolume > 1.0 Then jarvisVolume = 0.1
  1220.  
  1221.                 Settings.SetValue("jarvisVolume", "general", jarvisVolume.ToString)
  1222.                 Settings.Save()
  1223.  
  1224.                 jarvis_congrats_1.volume(jarvisVolume)
  1225.                 jarvis_congrats_2.volume(jarvisVolume)
  1226.                 jarvis_congrats_3.volume(jarvisVolume)
  1227.                 jarvis_congrats_4.volume(jarvisVolume)
  1228.                 jarvis_enemy.volume(jarvisVolume)
  1229.                 jarvis_warning.volume(jarvisVolume)
  1230.                 jarvis_warning_2.volume(jarvisVolume)
  1231.                 jarvis_warning_3.volume(jarvisVolume)
  1232.  
  1233.                 jarvis_congrats_1.play()
  1234.             ElseIf menuIndex = 8 Then
  1235.                 bShowArmorOptionsMenu = True
  1236.                 bShowMenu = False
  1237.             Else
  1238.                 bShowMenu = False
  1239.             End If
  1240.         End If
  1241.     End Sub
  1242.  
  1243.     Private Sub checkArmorIndex(key As Keys)
  1244.         If key = Keys.Left Then armorMenuIndex -= 1
  1245.         If key = Keys.Right Then armorMenuIndex += 1
  1246.  
  1247.         If armorMenuIndex >= TArmorList.Count Then armorMenuIndex = 0
  1248.         If armorMenuIndex < 0 Then armorMenuIndex = TArmorList.Count - 1
  1249.  
  1250.         'If (armorMenuIndex < TArmorList.Count) AndAlso TArmorList(armorMenuIndex).AIM_Robot Then
  1251.         '    If key = Keys.Right Then armorMenuIndex += 1 Else armorMenuIndex -= 1
  1252.         'End If
  1253.  
  1254.         'If armorMenuIndex > TArmorList.Count Then armorMenuIndex = 0
  1255.         'If armorMenuIndex < 0 Then armorMenuIndex = TArmorList.Count
  1256.  
  1257.         If key = Keys.Enter Then
  1258.             bShowArmorMenu = False
  1259.  
  1260.             If Not bUseArmorDelivery OrElse (armorMenuIndex = TArmorList.Count - 1) Then
  1261.                 resetHeliDelivery()
  1262.                 switchArmor()
  1263.             ElseIf ArmorDeliveryStatus = 0 Then
  1264.                 ArmorDeliveryStatus = 1
  1265.  
  1266.                 checkHeliDeliveryExists(Player.Character.Position.Around(50).ToGround + Vector3.WorldUp * 100)
  1267.  
  1268.                 heliDelivery.FreezePosition = False
  1269.                 Native.Function.Call("SET_CAR_COLLISION", heliDelivery, True)
  1270.                 heliDelivery.Position = Player.Character.Position.Around(200)
  1271.                 heliDelivery.PlaceOnNextStreetProperly()
  1272.                 heliDelivery.Position = heliDelivery.Position + Vector3.WorldUp * 70
  1273.  
  1274.                 pilotDelivery.Task.ClearAll()
  1275.                 pilotDelivery.Task.AlwaysKeepTask = True
  1276.                 pilotDelivery.Task.DriveTo(Player.Character.Position + Vector3.WorldUp * 150, 50, True)
  1277.                 heliDelivery.EngineRunning = True
  1278.                 heliDeliveryBlip = armorCase.AttachBlip
  1279.                 heliDeliveryBlip.Color = BlipColor.Green
  1280.  
  1281.                 HeliDeliveryTimeCheckRoute = 2000
  1282.  
  1283.                 DeliveryTime = 0
  1284.             End If
  1285.         End If
  1286.     End Sub
  1287.  
  1288.     Private Sub checkArmorOptionMenu(key As Keys)
  1289.         If key = Keys.Left Then armorOptionsMenuIndex -= 1
  1290.         If key = Keys.Right Then armorOptionsMenuIndex += 1
  1291.  
  1292.         If armorOptionsMenuIndex < 0 Then armorOptionsMenuIndex = 12
  1293.         If armorOptionsMenuIndex > 12 Then armorOptionsMenuIndex = 0
  1294.  
  1295.         If key = Keys.Enter Then
  1296.             If Not bArmorON Then
  1297.                 bShowArmorOptionsMenu = False
  1298.                 bShowMenu = False
  1299.                 Exit Sub
  1300.             End If
  1301.  
  1302.             If armorOptionsMenuIndex = 12 Then
  1303.                 bShowArmorOptionsMenu = False
  1304.                 Exit Sub
  1305.             End If
  1306.  
  1307.             If armorOptionsMenuIndex = 0 Then
  1308.                 playerArmor.handCannon = Not playerArmor.handCannon
  1309.  
  1310.                 If playerArmor.handCannon Then
  1311.                     playerArmor.shoulderCannon = False
  1312.                     playerArmor.superCannon = False
  1313.                 End If
  1314.             End If
  1315.  
  1316.             If armorOptionsMenuIndex = 1 Then
  1317.                 playerArmor.shoulderCannon = Not playerArmor.shoulderCannon
  1318.  
  1319.                 If playerArmor.shoulderCannon Then
  1320.                     playerArmor.handCannon = False
  1321.                     playerArmor.superCannon = False
  1322.                 End If
  1323.             End If
  1324.  
  1325.             If armorOptionsMenuIndex = 2 Then
  1326.                 playerArmor.superCannon = Not playerArmor.superCannon
  1327.  
  1328.                 If playerArmor.superCannon Then
  1329.                     playerArmor.shoulderCannon = False
  1330.                     playerArmor.handCannon = False
  1331.                 End If
  1332.             End If
  1333.  
  1334.             If armorOptionsMenuIndex = 3 Then playerArmor.bHandThrusters = Not playerArmor.bHandThrusters
  1335.             If armorOptionsMenuIndex = 4 Then playerArmor.bFootThrusters = Not playerArmor.bFootThrusters
  1336.             If armorOptionsMenuIndex = 5 Then playerArmor.bBackThrusters = Not playerArmor.bBackThrusters
  1337.  
  1338.             saveArmorCFG(playerArmor)
  1339.         End If
  1340.  
  1341.         If key = Keys.Add Then
  1342.             If armorOptionsMenuIndex = 6 Then playerArmor.back_rep_x_off += 0.01
  1343.             If armorOptionsMenuIndex = 7 Then playerArmor.back_rep_y_off += 0.01
  1344.             If armorOptionsMenuIndex = 8 Then playerArmor.back_rep_z_off += 0.01
  1345.             If armorOptionsMenuIndex = 9 Then playerArmor.back_rep_x_rot_off += 1
  1346.             If armorOptionsMenuIndex = 10 Then playerArmor.back_rep_y_rot_off += 1
  1347.             If armorOptionsMenuIndex = 11 Then playerArmor.back_rep_z_rot_off += 1
  1348.  
  1349.             saveArmorCFG(playerArmor)
  1350.         End If
  1351.  
  1352.         If key = Keys.Subtract Then
  1353.             If armorOptionsMenuIndex = 6 Then playerArmor.back_rep_x_off -= 0.01
  1354.             If armorOptionsMenuIndex = 7 Then playerArmor.back_rep_y_off -= 0.01
  1355.             If armorOptionsMenuIndex = 8 Then playerArmor.back_rep_z_off -= 0.01
  1356.             If armorOptionsMenuIndex = 9 Then playerArmor.back_rep_x_rot_off -= 1
  1357.             If armorOptionsMenuIndex = 10 Then playerArmor.back_rep_y_rot_off -= 1
  1358.             If armorOptionsMenuIndex = 11 Then playerArmor.back_rep_z_rot_off -= 1
  1359.  
  1360.             saveArmorCFG(playerArmor)
  1361.         End If
  1362.     End Sub
  1363.  
  1364.     Private Sub checkHeliDeliveryExists(pos As Vector3)
  1365.         If Not Exists(heliDelivery) Then
  1366.             While Not createVehicle(heliDeliveryModel, pos, heliDelivery, 50)
  1367.                 Wait(0)
  1368.             End While
  1369.             heliDelivery.Color = ColorIndex.Black
  1370.         End If
  1371.  
  1372.         heliDelivery.MakeProofTo(False, False, False, True, True)
  1373.  
  1374.         If Not Exists(pilotDelivery) Then
  1375.             While Not createPed(pilotDeliveryModel, pos.Around(10), pilotDelivery, 50)
  1376.                 Wait(0)
  1377.             End While
  1378.         End If
  1379.  
  1380.         pilotDelivery.WarpIntoVehicle(heliDelivery, VehicleSeat.Driver)
  1381.  
  1382.         If Not Exists(armorCase) Then
  1383.             While Not createObject(armorCaseModel, pos.Around(10), armorCase, 50)
  1384.                 Wait(10)
  1385.             End While
  1386.         End If
  1387.  
  1388.         armorCase.AttachToVehicle(heliDelivery, Vector3.RelativeFront * 2, Vector3.Zero)
  1389.     End Sub
  1390.  
  1391.     Private Sub resetHeliDelivery()
  1392.         If Not bUseArmorDelivery Then Exit Sub
  1393.  
  1394.         checkHeliDeliveryExists(Player.Character.Position.Around(200))
  1395.  
  1396.         armorCase.AttachToVehicle(heliDelivery, Vector3.RelativeFront * 2, Vector3.Zero)
  1397.         Native.Function.Call("SET_CAR_COLLISION", heliDelivery, False)
  1398.         heliDelivery.FreezePosition = True
  1399.         heliDelivery.Position = Vector3.Zero
  1400.  
  1401.         If Exists(heliDeliveryBlip) Then heliDeliveryBlip.Delete()
  1402.     End Sub
  1403.  
  1404.     Private Sub switchArmor()
  1405.         Game.FadeScreenOut(500, True)
  1406.  
  1407.         Try
  1408.             Dim camPos As Vector3 = Game.CurrentCamera.Position
  1409.             Dim camRot As Vector3 = Game.CurrentCamera.Rotation
  1410.  
  1411.             Wait(100)
  1412.  
  1413.             Dim bWasFlying As Boolean = flying
  1414.  
  1415.             If bWasFlying Then switchFlight()
  1416.  
  1417.             If armorMenuIndex = TArmorList.Count - 1 Then
  1418.                 Player.Model = "player"
  1419.                 Player.MaxHealth = 100
  1420.                 Player.Character.MaxHealth = 100
  1421.                 Player.Character.Health = 100
  1422.                 Player.Character.MakeProofTo(False, False, False, False, False)
  1423.  
  1424.                 Native.Function.Call("SET_CHAR_DEFAULT_COMPONENT_VARIATION", Player.Character, True)
  1425.  
  1426.                 Native.Function.Call("SET_ANIM_GROUP_FOR_CHAR", Player.Character, "move_player")
  1427.  
  1428.                 playerArmor = Nothing
  1429.             Else
  1430.                 playerArmor = TArmorList(armorMenuIndex)
  1431.                 Player.Model = playerArmor.model
  1432.  
  1433.                 Wait(500)
  1434.  
  1435.                 Player.Character.FreezePosition = False
  1436.                 Player.MaxHealth = 1000
  1437.                 Player.Character.MaxHealth = 1000
  1438.                 Player.Character.Health = 1000
  1439.                 Player.Character.MakeProofTo(False, True, False, bNoFlightCollisionDetection OrElse bPlayerFallingDamageProof, True)
  1440.  
  1441.                 Native.Function.Call("SET_CHAR_DEFAULT_COMPONENT_VARIATION", Player.Character, True)
  1442.  
  1443.                 setArmorComponentVar()
  1444.  
  1445.                 reattachDarts()
  1446.  
  1447.                 Native.Function.Call("SET_ANIM_GROUP_FOR_CHAR", Player.Character, playerArmor.anim_group)
  1448.  
  1449.                 bFirstDraw = True
  1450.             End If
  1451.  
  1452.             bArmorON = armorMenuIndex < TArmorList.Count - 1
  1453.  
  1454.             bShowArmorMenu = False
  1455.  
  1456.             If bWasFlying Then switchFlight()
  1457.  
  1458.             If Exists(Game.DefaultCamera) Then
  1459.                 Native.Function.Call("SET_CAM_POS", Game.DefaultCamera, camPos.X, camPos.Y, camPos.Z)
  1460.                 Native.Function.Call("SET_CAM_ROT", Game.DefaultCamera, camRot.X, camRot.Y, camRot.Z)
  1461.             End If
  1462.  
  1463.             If Not bArmorON Then
  1464.                 Player.Character.Animation.Play(animSetFlight, "", 5.0, AnimationFlags.Unknown05)
  1465.  
  1466.                 While TEnemyBlipList.Count > 0
  1467.                     Try
  1468.                         TEnemyBlipList(0).blip.Delete()
  1469.                     Catch
  1470.                     End Try
  1471.  
  1472.                     Try
  1473.                         TEnemyBlipList(0).p.NoLongerNeeded()
  1474.                     Catch
  1475.                     End Try
  1476.  
  1477.                     TEnemyBlipList.RemoveAt(0)
  1478.  
  1479.                     Wait(5)
  1480.                 End While
  1481.             End If
  1482.         Catch
  1483.         End Try
  1484.  
  1485.         lastHealth = 0
  1486.  
  1487.         Game.FadeScreenIn(500)
  1488.     End Sub
  1489.  
  1490.     Private Sub resetPlayerControl()
  1491.         bShowingWeaponSelector = False
  1492.         Native.Function.Call("SET_PLAYER_CONTROL", Player, True)
  1493.         GameTimeScale = 1.0
  1494.     End Sub
  1495.  
  1496.     Private Sub reattachDarts()
  1497.         Native.Function.Call("play_sound_from_ped", -1, "general_explosions_debris_1", Player.Character)
  1498.         'taskResetSoundID(IDsndGunSwitch)
  1499.  
  1500.         For Each d As TDarts In DartsList
  1501.             d.target = Nothing
  1502.             d.targetVeh = Nothing
  1503.             d.targetSuperGuy = Nothing
  1504.         Next
  1505.  
  1506.         If gunMode = 1 Then
  1507.             For c As Int16 = 0 To DartsList.Count - 1
  1508.                 If c Mod 2 = 0 Then
  1509.                     DartsList(c).attachPos = Vector3.WorldUp * 0.15 + Vector3.RelativeFront * 0.1 + Vector3.RelativeRight * 0.1
  1510.                 Else
  1511.                     DartsList(c).attachPos = Vector3.WorldUp * 0.15 + Vector3.RelativeFront * 0.1 + Vector3.RelativeRight * -0.2
  1512.                 End If
  1513.  
  1514.                 DartsList(c).attachBone = Bone.RightUpperarmRoll
  1515.  
  1516.                 DartsList(c).attachRotation.Z = -80
  1517.                 DartsList(c).attachRotation.Y = -80 * (3.15 / 180)
  1518.                 DartsList(c).attachRotation.X = 0
  1519.  
  1520.                 DartsList(c).Hide()
  1521.             Next
  1522.         ElseIf gunMode = 2 Then
  1523.             For c As Int16 = 0 To DartsList.Count - 1
  1524.                 If c Mod 2 = 0 Then
  1525.                     DartsList(c).attachPos = Vector3.RelativeTop * 0.05
  1526.                 Else
  1527.                     DartsList(c).attachPos = Vector3.RelativeTop * -0.1
  1528.                 End If
  1529.  
  1530.                 DartsList(c).attachBone = Bone.LeftHand
  1531.  
  1532.                 DartsList(c).attachRotation.Z = 0
  1533.                 DartsList(c).attachRotation.Y = -80 * (3.15 / 180)
  1534.                 DartsList(c).attachRotation.X = 0
  1535.  
  1536.                 DartsList(c).Hide()
  1537.             Next
  1538.         End If
  1539.     End Sub
  1540.  
  1541.     Private Sub switchFlight(Optional bExplosioResult As Boolean = False, Optional bWaterImpact As Boolean = False)
  1542.         If Not bWaterImpact AndAlso ((timeRestartFlight > 0) OrElse (Player.Character.Health <= 0) OrElse _
  1543.            (Exists(Player.Character.CurrentVehicle) AndAlso (Player.Character.CurrentVehicle.Model <> myFlyHabs.Model))) Then Exit Sub
  1544.  
  1545.         timeRestartFlight = 200
  1546.  
  1547.         flying = Not flying
  1548.  
  1549.         stopPTFX(PTFX_SmokeLB)
  1550.         stopPTFX(PTFX_SmokeRB)
  1551.  
  1552.         If flying AndAlso Player.Character.isRagdoll AndAlso Native.Function.Call(Of Boolean)("is_char_in_water", Player.Character) Then
  1553.             flying = False
  1554.             Exit Sub
  1555.         End If
  1556.  
  1557.         If flying Then
  1558.             Player.Character.isRagdoll = False
  1559.  
  1560.             If Native.Function.Call(Of Boolean)("is_char_in_water", Player.Character) Then
  1561.                 Player.Character.Position = Player.Character.Position + Vector3.WorldUp * 2
  1562.             End If
  1563.  
  1564.             timeHideFlyAbs = 0
  1565.  
  1566.             OH.releaseVehicle(myFlyHabs, True, False)
  1567.  
  1568.             Dim tmpVehList As Vehicle() = World.GetVehicles(Player.Character.Position, 10)
  1569.  
  1570.             For Each v As Vehicle In tmpVehList
  1571.                 If Exists(v) AndAlso (v <> myFlyHabs) Then
  1572.                     v.isRequiredForMission = True
  1573.                 End If
  1574.             Next
  1575.  
  1576.             Dim tmpWarPos As Vector3 = Player.Character.Position + Vector3.WorldUp * 0.5
  1577.  
  1578.             Native.Function.Call("set_car_collision", myFlyHabs, False)
  1579.             myFlyHabs.FreezePosition = False
  1580.             myFlyHabs.Position = tmpWarPos
  1581.             myFlyHabs.FreezePosition = True
  1582.             myFlyHabs.Heading = Player.Character.Heading
  1583.  
  1584.             Player.Character.Task.ClearAll()
  1585.  
  1586.             Player.Character.Animation.Play(animSetFlight, "full_brake_for_landing", 5.0, AnimationFlags.Unknown05)
  1587.  
  1588.             myFlyHabs.MakeProofTo(True, True, True, False, True)
  1589.             myFlyHabs.CanBeDamaged = False
  1590.             myFlyHabs.CanBeVisiblyDamaged = False
  1591.  
  1592.             mySpeed = myFlyHabs.Speed
  1593.  
  1594.             myLastPos = Player.Character.Position
  1595.             myLastPos.Z += 2
  1596.  
  1597.             vRotation = myFlyHabs.Rotation
  1598.  
  1599.             upAmount = 0
  1600.             downAmount = 0
  1601.             forwardAmount = 0
  1602.             backwardAmount = 0
  1603.  
  1604.             lastZPos = myLastPos.Z
  1605.  
  1606.             bFast = False
  1607.  
  1608.             Player.Character.Weapons.RemoveAll()
  1609.  
  1610.             jetSoundDistance = 10
  1611.             jetSoundDesiredDistance = 10
  1612.  
  1613.             If Not Exists(jetSoundAux) Then
  1614.                 createObject("cj_dart_1", GTA.Vector3.Zero + Vector3.WorldUp * 3, jetSoundAux, 50)
  1615.             Else
  1616.                 jetSoundAux.FreezePosition = False
  1617.  
  1618.                 If getGameSoundID(IDsndJets1) Then _
  1619.                     Native.Function.Call("play_sound_from_object", IDsndJets1, "GENERAL_WEAPONS_ROCKET_LOOP", jetSoundAux)
  1620.             End If
  1621.  
  1622.             If Not bAimDown Then heightFix = 6
  1623.  
  1624.             Player.Character.WarpIntoVehicle(myFlyHabs, VehicleSeat.Driver)
  1625.             Native.Function.Call("set_car_collision", myFlyHabs, True)
  1626.             myFlyHabs.FreezePosition = False
  1627.             myFlyHabs.Position = tmpWarPos
  1628.         Else
  1629.             Dim tmpVel As Vector3 = myFlyHabs.Velocity
  1630.  
  1631.             If Exists(jetSoundAux) Then jetSoundAux.FreezePosition = True
  1632.  
  1633.             getGameSoundID(IDsndJets1)
  1634.  
  1635.             myFlyHabs.Visible = False
  1636.             Native.Function.Call("set_car_collision", myFlyHabs, False)
  1637.             myFlyHabs.FreezePosition = True
  1638.  
  1639.             Player.Character.Task.ClearAllImmediately()
  1640.  
  1641.             lastFlightZ2 = Player.Character.Position.Z
  1642.  
  1643.             'crashEffect()
  1644.  
  1645.             If bWaterImpact Then
  1646.                 Player.Character.Velocity = tmpVel / 2 + Vector3.WorldUp
  1647.                 Player.Character.Euphoria.BodyBalance.Start(1000)
  1648.             ElseIf Not bExplosioResult Then
  1649.                 Player.Character.Velocity = tmpVel
  1650.  
  1651.                 'If (World.GetGroundPosition(Player.Character.Position, GroundType.NextBelowCurrent).DistanceTo(Player.Character.Position) > 2) Then
  1652.                     'Player.Character.Animation.Play(animSetFlight, "full_brake_for_landing", 5.0, AnimationFlags.Unknown05)
  1653.                 'End If
  1654.  
  1655.                 If tmpVel.Length <= speedSlow Then
  1656.                     Player.Character.Animation.Play(animSetFlight, "full_brake_for_landing", 5.0, AnimationFlags.Unknown05)
  1657.                 ElseIf tmpVel.Length > speedFast Then
  1658.                     Player.Character.Animation.Play(animSetFlight, "free_fall", 5.0, AnimationFlags.Unknown05)
  1659.                 Else
  1660.                     Player.Character.Animation.Play(animSetFlight, "free_fall_deccelerate", 5.0, AnimationFlags.Unknown05)
  1661.                 End If
  1662.  
  1663.                 playerLandVel = Player.Character.Velocity
  1664.                 playerLandVel.Z = 0
  1665.  
  1666.                 bLandAnim = True
  1667.                 timeLandAnim = 0
  1668.             End If
  1669.  
  1670.             timeHideFlyAbs = 500
  1671.         End If
  1672.  
  1673.         timeResetFlight = -666
  1674.  
  1675.         timeOfFlight = 0
  1676.     End Sub
  1677.  
  1678.     Private Sub playLandAnim()
  1679.         If flying Then Exit Sub
  1680.  
  1681.         'Dim tmpVel As GTA.Vector3 = Player.Character.Velocity
  1682.  
  1683.         'tmpVel.Z = 0
  1684.  
  1685.         'If animSetFlight.isInMemory Then
  1686.             'If tmpVel.DistanceTo(GTA.Vector3.Zero) < 30 Then
  1687.             If Player.Character.Animation.isPlaying(animSetFlight, "full_brake_for_landing") Then
  1688.                 Player.Character.Velocity = Player.Character.Direction
  1689.  
  1690.                 'If tmpZ > 0 Then
  1691.                 Player.Character.Animation.Play(animSetFlight, "land_safe", 10.0, AnimationFlags.Unknown01)
  1692.  
  1693.                 crashEffect()
  1694.             'ElseIf tmpVel.DistanceTo(GTA.Vector3.Zero) < 50 Then
  1695.             ElseIf Player.Character.Animation.isPlaying(animSetFlight, "free_fall_deccelerate") Then
  1696.                 Player.Character.Velocity /= 2
  1697.                 Player.Character.Animation.Play(animSetFlight, "land_fast", 5.0, AnimationFlags.Unknown01)
  1698.             Else
  1699.                 Player.Character.Animation.Play(animSetFlight, "land_fast", 20.0, AnimationFlags.Unknown01)
  1700.                 Wait(100)
  1701.  
  1702.                 Dim tmpTimeOut As Double = 0
  1703.  
  1704.                 While (tmpTimeOut < 300) AndAlso (Player.Character.Animation.GetCurrentAnimationTime(animSetFlight, "land_fast") < 0.3)
  1705.                     Wait(10)
  1706.                     tmpTimeOut += 10
  1707.                 End While
  1708.  
  1709.                 Player.Character.Animation.Play(animSetFlight, "land_fast", 5.0, AnimationFlags.Unknown01)
  1710.             End If
  1711.  
  1712.             Wait(500)
  1713.         'End If
  1714.     End Sub
  1715.  
  1716.     Private Sub crashEffect()
  1717.         If (lastXFlight <= -30) OrElse (Math.Abs(lastFlightZ2 - Player.Character.Position.Z) > 0.5) OrElse (Math.Abs(lastFlightZ2 - Player.Character.Position.Z) > 5) Then
  1718.             Dim tmpVel As Vector3 = Player.Character.Velocity
  1719.  
  1720.             Dim tmpHitObject As Vehicle = myFlyHabsHitObject
  1721.  
  1722.             If Math.Abs(lastFlightZ2 - Player.Character.Position.Z) < 10 Then
  1723.                 tmpHitObject = myFlyHabs
  1724.             End If
  1725.  
  1726.             If tmpHitObject = myFlyHabsHitObject Then
  1727.                 Dim tmpPosIni As Vector3 = Player.Character.Position + Vector3.WorldUp * 2
  1728.                 Dim tmpPosFin As Vector3 = Player.Character.Position + Vector3.WorldDown
  1729.                 Dim dmg As Int16 = Math.Abs(Math.Round(lastFlightZ2 - Player.Character.Position.Z)) * 5
  1730.  
  1731.                 Native.Function.Call("FIRE_SINGLE_BULLET", tmpPosIni.X, tmpPosIni.Y, tmpPosIni.Z, tmpPosFin.X, tmpPosFin.Y, tmpPosFin.Z, dmg)
  1732.             End If
  1733.  
  1734.             If (lastXFlight > -30) AndAlso Not Player.Character.Animation.isPlaying(animSetFlight, "full_brake_for_landing") Then Exit Sub
  1735.  
  1736.             Player.Character.PreventRagdoll = True
  1737.             Player.Character.FreezePosition = True
  1738.             Player.CanControlCharacter = False
  1739.  
  1740.             Dim tmpVList As New List(Of Vehicle)
  1741.  
  1742.             For Each v As Vehicle In World.GetVehicles(Player.Character.Position, 15)
  1743.                 If Exists(v) AndAlso (v <> myFlyHabs) AndAlso (v <> myFlyHabsHitObject) Then
  1744.                     v.isRequiredForMission = True
  1745.                     tmpVList.Add(v)
  1746.  
  1747.                     If Player.Character.isTouching(v) Then v.ApplyForce(Vector3.WorldDown * 5)
  1748.  
  1749.                     v.CanBeVisiblyDamaged = True
  1750.                     v.CanBeDamaged = True
  1751.                     v.MakeProofTo(False, False, False, False, False)
  1752.                 End If
  1753.             Next
  1754.  
  1755.             If tmpHitObject = myFlyHabsHitObject Then
  1756.                 Native.Function.Call("UNATTACH_CAM", camAux)
  1757.                 camAux.Position = Game.CurrentCamera.Position '+ Vector3.WorldDown
  1758.                 camAux.LookAt(Player.Character)
  1759.                 camAux.Activate()
  1760.  
  1761.                 Game.TimeScale = 0.5
  1762.             End If
  1763.  
  1764.             Native.Function.Call("set_char_collision", Player.Character, False)
  1765.  
  1766.             tmpHitObject.CanBeDamaged = False
  1767.             tmpHitObject.CanBeVisiblyDamaged = False
  1768.             tmpHitObject.MakeProofTo(True, True, True, True, True)
  1769.             OH.releaseVehicle(tmpHitObject, True, False)
  1770.             tmpHitObject.Position = Player.Character.Position + Vector3.WorldUp * (tmpHitObject.Model.GetDimensions.Y * 1.5)
  1771.             Wait(50)
  1772.             tmpHitObject.Rotation = Vector3.RelativeRight * 90
  1773.             tmpHitObject.FreezePosition = False
  1774.             tmpHitObject.ApplyForce(Vector3.WorldDown * 200)
  1775.  
  1776.             Dim timeOut As Double = 0
  1777.  
  1778.             While (timeOut < 150)
  1779.                 Wait(10)
  1780.                 timeOut += 10
  1781.             End While
  1782.  
  1783.             For Each v As Vehicle In tmpVList
  1784.                 If Exists(v) Then
  1785.                     v.Speed = 0
  1786.                     v.isRequiredForMission = False
  1787.                 End If
  1788.             Next
  1789.  
  1790.             Wait(100)
  1791.  
  1792.             OH.hideVehicle(tmpHitObject)
  1793.             Native.Function.Call("set_char_collision", Player.Character, True)
  1794.             Player.Character.FreezePosition = False
  1795.             Wait(500)
  1796.  
  1797.             If tmpHitObject = myFlyHabsHitObject Then
  1798.                 For tmpTimeScale As Double = 0.5 To 1 Step 0.01
  1799.                     Game.TimeScale = tmpTimeScale
  1800.                     camAux.Position += Vector3.Normalize(Game.DefaultCamera.Position - camAux.Position) * 0.05
  1801.                     Wait(10)
  1802.                 Next
  1803.  
  1804.                 resetCamCfg()
  1805.                 camAux.Deactivate()
  1806.             End If
  1807.  
  1808.             Player.CanControlCharacter = True
  1809.  
  1810.             timeRestorePreventRagdoll = 500
  1811.  
  1812.             'Player.Character.Velocity = tmpVel
  1813.         End If
  1814.     End Sub
  1815.  
  1816.     Private Sub tryFixRotation(ByVal rot As GTA.Vector3, ByVal item As Int16, ByVal ease As Double)
  1817.         If Game.isKeyPressed(hkUnlockFlightCam) OrElse Game.isGameKeyPressed(GameKey.LookBehind) Then
  1818.             timeDisableMouseControl = 100
  1819.         End If
  1820.  
  1821.         If timeDisableMouseControl > 0 Then
  1822.             timeDisableMouseControl -= intervalFix()
  1823.             Exit Sub
  1824.         End If
  1825.  
  1826.         If Exists(Game.DefaultCamera) Then
  1827.             'If (item = 0) OrElse (item = 2) Then
  1828.             '    rot.Y -= ((rot.Y - Game.DefaultCamera.Rotation.Y) * ease)
  1829.             'End If
  1830.  
  1831.             Dim bCloseToWater As Boolean = (Player.Character.Position.Z < 3)
  1832.  
  1833.             If (item = 0) OrElse (item = 1) Then
  1834.                 'If (padState.ThumbSticks.Right.Y <> 0) OrElse (Game.Mouse.Movement.Y <> 0) Then
  1835.                 'If (XControl.IsConnected AndAlso (XControl.GetState().Gamepad.RightThumbY <> 0)) OrElse (Game.Mouse.Movement.Y <> 0) Then
  1836.                 If (controllerConnected() AndAlso (controllerState.ThumbSticks.Right.Y <> 0)) OrElse (Game.Mouse.Movement.Y <> 0) Then
  1837.                     Dim tmpRotX As Double = rot.X
  1838.  
  1839.                     rot.X -= ((rot.X - Game.DefaultCamera.Rotation.X) * 0.5)
  1840.  
  1841.                     If bCloseToWater And (rot.X < tmpRotX) Then rot.X = tmpRotX
  1842.                 End If
  1843.             End If
  1844.  
  1845.             If (item = 0) OrElse (item = 3) Then
  1846.                 Dim tmpDif As Double = ((rot.Z - Game.DefaultCamera.Rotation.Z) * ease)
  1847.  
  1848.                 If bAdaptToFlightHeading Then
  1849.                     If rot.Z - Game.DefaultCamera.Rotation.Z < -20 Then
  1850.                         rot.Z += 10
  1851.                         If rot.Z > Game.DefaultCamera.Rotation.Z Then
  1852.                             rot.Z = Game.DefaultCamera.Rotation.Z
  1853.                             bAdaptToFlightHeading = False
  1854.                         End If
  1855.                     ElseIf rot.Z - Game.DefaultCamera.Rotation.Z > 20 Then
  1856.                         rot.Z -= 10
  1857.                         If rot.Z < Game.DefaultCamera.Rotation.Z Then
  1858.                             rot.Z = Game.DefaultCamera.Rotation.Z
  1859.                             bAdaptToFlightHeading = False
  1860.                         End If
  1861.                     Else
  1862.                         bAdaptToFlightHeading = False
  1863.                     End If
  1864.                 Else
  1865.                     If (Math.Abs(Game.DefaultCamera.Rotation.Z - rot.Z) > 100) Then
  1866.                         rot.Z = Game.DefaultCamera.Rotation.Z
  1867.                     Else
  1868.                         rot.Z -= tmpDif
  1869.                     End If
  1870.                 End If
  1871.  
  1872.                 If myRealSpeed > speedSlow Then
  1873.                     If (tmpDif > 0.2) AndAlso (rot.Y < tmpDif) Then rot.Y += 2
  1874.                     If (tmpDif < -0.2) AndAlso (rot.Y > tmpDif) Then rot.Y -= 2
  1875.  
  1876.                     If rot.Y > 60 Then rot.Y = 60
  1877.                     If rot.Y < -60 Then rot.Y = -60
  1878.  
  1879.                     If rot.Y < -8 Then FlightTurningLeft = 50
  1880.                     If rot.Y > 8 Then FlightTurningRight = 50
  1881.                 End If
  1882.  
  1883.                 If Math.Abs(tmpDif) <= 0.1 Then
  1884.                     If rot.Y > 0 Then
  1885.                         rot.Y -= 1.5
  1886.                         If rot.Y <= 0 Then rot.Y = 0
  1887.                     End If
  1888.                     If rot.Y < 0 Then
  1889.                         rot.Y += 1.5
  1890.                         If rot.Y >= 0 Then rot.Y = 0
  1891.                     End If
  1892.                 End If
  1893.             End If
  1894.  
  1895.             If Not bAimDown And (myFlyHabs.Speed > speedSlow) Then
  1896.                 If bCloseToWater Then
  1897.                     If rot.X < 0 Then
  1898.                         rot.X += rot.X * -0.2
  1899.                         If rot.X > 0 Then rot.X = 0
  1900.                     End If
  1901.                 Else
  1902.                     If rot.X > 70 Then
  1903.                         rot.X = 70
  1904.                     End If
  1905.  
  1906.                     If rot.X < -80 Then
  1907.                         rot.X = -80
  1908.                     End If
  1909.                 End If
  1910.  
  1911.                 If Not bFast Then
  1912.                     bFast = True
  1913.  
  1914.                     mySpeed = myFlyHabs.Speed
  1915.                 End If
  1916.  
  1917.                 If timeKeepHighSpeed < 1000 Then timeKeepHighSpeed += myInterval
  1918.             Else
  1919.                 If rot.X > 15 Then
  1920.                     rot.X = 15
  1921.                 End If
  1922.  
  1923.                 If rot.X < -40 Then
  1924.                     rot.X = -40
  1925.                 End If
  1926.  
  1927.                 bFast = False
  1928.             End If
  1929.  
  1930.             If bAimDown AndAlso (myRealSpeed > speedSlow) Then rot.X = Game.DefaultCamera.Rotation.X
  1931.  
  1932.             vRotation = rot
  1933.         End If
  1934.     End Sub
  1935.  
  1936.     Private Sub general_tick(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Tick
  1937.         'If Game.isKeyPressed(Keys.Left) Then offx -= 1
  1938.         'If Game.isKeyPressed(Keys.Right) Then offx += 1
  1939.         'If Game.isKeyPressed(Keys.Up) Then offy -= 1
  1940.         'If Game.isKeyPressed(Keys.Down) Then offy += 1
  1941.         'If Game.isKeyPressed(Keys.Subtract) Then offH -= 1
  1942.         'If Game.isKeyPressed(Keys.Add) Then offH += 1
  1943.         'If Game.isKeyPressed(Keys.NumPad4) Then offR -= 1
  1944.         'If Game.isKeyPressed(Keys.NumPad6) Then offR += 1
  1945.  
  1946.         controllerState = Microsoft.Xna.Framework.Input.GamePad.GetState(Microsoft.Xna.Framework.PlayerIndex.One)
  1947.  
  1948.         If bArmorON AndAlso (timeWaitAntiMeleeAnim <= 0) AndAlso ((Native.Function.Call(Of Boolean)("IS_CHAR_PLAYING_ANIM", Player.Character, "move_melee", "walk") OrElse _
  1949.             Native.Function.Call(Of Boolean)("IS_CHAR_PLAYING_ANIM", Player.Character, "move_melee", "idle") OrElse _
  1950.             Native.Function.Call(Of Boolean)("IS_CHAR_PLAYING_ANIM", Player.Character, "move_melee", "idle_outro"))) Then
  1951.             Player.Character.Task.ClearAllImmediately()
  1952.             timeWaitAntiMeleeAnim = 50
  1953.         End If
  1954.  
  1955.         If timeWaitAntiMeleeAnim > 0 Then timeWaitAntiMeleeAnim -= intervalFix()
  1956.  
  1957.         If controllerConnected() Then
  1958.             If controllerState.IsButtonDown(Microsoft.Xna.Framework.Input.Buttons.LeftShoulder) AndAlso _
  1959.                controllerState.IsButtonDown(Microsoft.Xna.Framework.Input.Buttons.RightShoulder) Then
  1960.                 timeShowMenuDown += intervalFix()
  1961.  
  1962.                 If timeShowMenuDown > 100 Then
  1963.                     timeShowMenuDown = 0
  1964.  
  1965.                     bShowMenu = Not bShowMenu
  1966.                 End If
  1967.             Else
  1968.                 If timeShowMenuDown > 0 Then timeShowMenuDown -= intervalFix()
  1969.             End If
  1970.  
  1971.             If bShowArmorMenu OrElse bShowMenu OrElse bShowArmorOptionsMenu Then
  1972.                 If timeWaitXControlCheck <= 0 Then
  1973.                     If controllerState.IsButtonDown(Microsoft.Xna.Framework.Input.Buttons.DPadRight) Then
  1974.                         timeWaitXControlCheck = 50
  1975.  
  1976.                         checkMenu(Keys.Right)
  1977.                     ElseIf controllerState.IsButtonDown(Microsoft.Xna.Framework.Input.Buttons.DPadLeft) Then
  1978.                         timeWaitXControlCheck = 50
  1979.  
  1980.                         checkMenu(Keys.Left)
  1981.                     ElseIf controllerState.IsButtonDown(Microsoft.Xna.Framework.Input.Buttons.A) Then
  1982.                         timeWaitXControlCheck = 50
  1983.  
  1984.                         checkMenu(Keys.Enter)
  1985.                     End If
  1986.                 Else
  1987.                     If timeWaitXControlCheck > 0 Then
  1988.                         timeWaitXControlCheck -= intervalFix()
  1989.  
  1990.                         Exit Sub
  1991.                     End If
  1992.                 End If
  1993.             End If
  1994.         End If
  1995.  
  1996.         If timeWaitLoad > 0 Then
  1997.             timeWaitLoad -= intervalFix()
  1998.  
  1999.             If timeWaitLoad <= 0 Then loadAux()
  2000.  
  2001.             Exit Sub
  2002.         End If
  2003.  
  2004.         If timeHideFlyAbs > 0 Then
  2005.             timeHideFlyAbs -= intervalFix()
  2006.  
  2007.             If timeHideFlyAbs <= 0 Then OH.hideVehicle(myFlyHabs)
  2008.         End If
  2009.  
  2010.         If timeCheckHair <= 0 Then
  2011.             timeCheckHair = 300
  2012.  
  2013.             If bArmorON Then
  2014.                 Native.Function.Call("SET_DRAW_PLAYER_COMPONENT", 0, Not playerArmor.removeHead AndAlso (camMode <> 1))
  2015.                 Native.Function.Call("SET_DRAW_PLAYER_COMPONENT", 7, Not playerArmor.removeHair AndAlso (camMode <> 1))
  2016.             Else
  2017.                 Native.Function.Call("SET_DRAW_PLAYER_COMPONENT", 0, True)
  2018.                 Native.Function.Call("SET_DRAW_PLAYER_COMPONENT", 7, True)
  2019.             End If
  2020.  
  2021.             GroundZDist = Player.Character.Position.DistanceTo(World.GetGroundPosition(Player.Character.Position))
  2022.         Else
  2023.             timeCheckHair -= intervalFix()
  2024.         End If
  2025.  
  2026.         If bArmorON Then
  2027.             If timeCheckTargetLocked <= 0 Then
  2028.                 timeCheckTargetLocked = 100
  2029.  
  2030.                 bAnTargetLocked = False
  2031.  
  2032.                 For Each d As TDarts In DartsList
  2033.                     bAnTargetLocked = d.targetReady
  2034.  
  2035.                     If bAnTargetLocked Then Exit For
  2036.                 Next
  2037.  
  2038.                 If flying Then lastXFlight = myFlyHabs.Rotation.X
  2039.             Else
  2040.                 timeCheckTargetLocked -= intervalFix()
  2041.             End If
  2042.         End If
  2043.  
  2044.         If flying Then
  2045.             If Not bGodMode AndAlso Not bNoFlightCollisionDetection Then
  2046.                 If (speedChange > 0) Then
  2047.                     Dim bTmp As Boolean = bPlayerFallingDamageProof
  2048.  
  2049.                     bPlayerFallingDamageProof = (speedChange - myFlyHabs.Speed) < 10
  2050.  
  2051.                     If bTmp <> bPlayerFallingDamageProof Then _
  2052.                         Player.Character.MakeProofTo(False, True, False, bPlayerFallingDamageProof, True)
  2053.                 End If
  2054.  
  2055.                 speedChange = myFlyHabs.Speed
  2056.             End If
  2057.  
  2058.             'If myFlyHabs.Speed > speedFast Then
  2059.             '    If (timeWaitCheckHighSpeed <= 0) AndAlso (myFlyHabs <> myFlyHabsHitObject) Then
  2060.             '        For Each v As Vehicle In World.GetVehicles(myFlyHabs.Position, 15)
  2061.             '            If Exists(v) Then v.isRequiredForMission = True
  2062.             '        Next
  2063.             '
  2064.             '        Native.Function.Call("detach_car", myFlyHabsHitObject, False)
  2065.             '        myFlyHabsHitObject.FreezePosition = False
  2066.             '        Native.Function.Call("set_car_collision", myFlyHabs, False)
  2067.             '        myFlyHabsHitObject.Position = myFlyHabs.Position
  2068.             '        myFlyHabsHitObject.Velocity = myFlyHabs.Velocity
  2069.             '        myFlyHabsHitObject.Rotation = myFlyHabs.Rotation
  2070.             '        myFlyHabs.FreezePosition = True
  2071.             '        myFlyHabs = myFlyHabsHitObject
  2072.             '        Player.Character.WarpIntoVehicle(myFlyHabsHitObject, VehicleSeat.Driver)
  2073.             '        Native.Function.Call("set_car_collision", myFlyHabs, True)
  2074.             '        Player.Character.Animation.Play(animSetFlight, "free_fall_fast", 8.0, AnimationFlags.Unknown05)
  2075.             '    End If
  2076.             'ElseIf myFlyHabs <> myFlyHabsNormal Then
  2077.             '    For Each v As Vehicle In World.GetVehicles(myFlyHabs.Position, 15)
  2078.             '        If Exists(v) Then v.isRequiredForMission = True
  2079.             '    Next
  2080.             '
  2081.             '    Native.Function.Call("detach_car", myFlyHabsNormal, False)
  2082.             '    myFlyHabsNormal.FreezePosition = False
  2083.             '    Native.Function.Call("set_car_collision", myFlyHabs, False)
  2084.             '    myFlyHabsNormal.Position = myFlyHabs.Position
  2085.             '    myFlyHabsNormal.Velocity = myFlyHabs.Velocity
  2086.             '    myFlyHabsNormal.Rotation = myFlyHabs.Rotation
  2087.             '    myFlyHabs.FreezePosition = True
  2088.             '    myFlyHabs = myFlyHabsNormal
  2089.             '    Player.Character.WarpIntoVehicle(myFlyHabsNormal, VehicleSeat.Driver)
  2090.             '    Native.Function.Call("set_car_collision", myFlyHabs, True)
  2091.             '    Player.Character.Animation.Play(animSetFlight, "free_fall_deccelerate", 8.0, AnimationFlags.Unknown05)
  2092.             '    timeWaitCheckHighSpeed = 500
  2093.             'End If
  2094.         'ElseIf myFlyHabs <> myFlyHabsNormal Then
  2095.         '    Native.Function.Call("detach_car", myFlyHabsNormal, False)
  2096.         '    myFlyHabsNormal.FreezePosition = False
  2097.         '    Native.Function.Call("set_car_collision", myFlyHabs, False)
  2098.         '    Native.Function.Call("set_car_collision", myFlyHabsNormal, False)
  2099.         '    myFlyHabs.FreezePosition = True
  2100.         '    myFlyHabsNormal.FreezePosition = True
  2101.         '    myFlyHabs = myFlyHabsNormal
  2102.         End If
  2103.  
  2104.         If timeWaitCheckHighSpeed > 0 Then timeWaitCheckHighSpeed -= intervalFix()
  2105.  
  2106.         keepArmorConfig()
  2107.  
  2108.         ' search for enemies
  2109.         If bArmorON Then searchEnemies()
  2110.  
  2111.         ' superGuy tick
  2112.         Try
  2113.             superGuyTick()
  2114.         Catch
  2115.         End Try
  2116.  
  2117.         If bUseArmorDelivery AndAlso Exists(heliDelivery) Then
  2118.             If ArmorDeliveryStatus = 1 Then
  2119.                 If heliDelivery.Position.DistanceTo2D(Player.Character.Position) < 10 Then
  2120.                     ArmorDeliveryStatus = 2
  2121.  
  2122.                     armorCase.Detach()
  2123.  
  2124.                     pilotDelivery.Task.DriveTo((heliDelivery.Position + Vector3.WorldUp * 300).Around(300), 80, True)
  2125.                 End If
  2126.  
  2127.                 If (DeliveryTime > 200) Then
  2128.                     If Game.isKeyPressed(Keys.Enter) Then
  2129.                         switchArmor()
  2130.                         resetHeliDelivery()
  2131.                         ArmorDeliveryStatus = 0
  2132.                     End If
  2133.                 Else
  2134.                     DeliveryTime += intervalFix()
  2135.                 End If
  2136.  
  2137.                 msg("Press enter to skip delivery...", 100)
  2138.             ElseIf (ArmorDeliveryStatus = 2) Then
  2139.                 If (heliDelivery.Position.DistanceTo(Player.Character.Position) > 220) OrElse ((heliDelivery.Position.DistanceTo(Player.Character.Position) > 100) AndAlso Not heliDelivery.isOnScreen) Then
  2140.                     ArmorDeliveryStatus = 0
  2141.                     resetHeliDelivery()
  2142.                 End If
  2143.  
  2144.                 If Not armorCase.isAttachedSomewhere Then msg("Press enter to skip delivery...", 100)
  2145.             End If
  2146.  
  2147.             If Exists(armorCase) AndAlso Not armorCase.isAttachedSomewhere AndAlso (Player.Character.Position.DistanceTo(armorCase.Position) < 2) Then
  2148.                 switchArmor()
  2149.                 resetHeliDelivery()
  2150.                 ArmorDeliveryStatus = 0
  2151.             End If
  2152.         End If
  2153.  
  2154.         If bWasAlive AndAlso (Player.Character.Health <= 0) Then
  2155.             camMode = 0
  2156.  
  2157.             gunMode = 0
  2158.  
  2159.             For Each en As TSuperGuy In TSuperGuyList
  2160.                 Try
  2161.                     If Exists(en.r) Then
  2162.                         en.r.Detach()
  2163.                         en.r.FreezePosition = True
  2164.                         en.r.Visible = False
  2165.                         Native.Function.Call("set_object_collision", en.r, False)
  2166.  
  2167.                         freeRocketList.Add(en.r)
  2168.                     End If
  2169.  
  2170.                     stopPTFX(en.PTFXMove)
  2171.                     Native.Function.Call("stop_sound", en.IDMoveSound)
  2172.  
  2173.                     If Exists(en.p) Then en.p.NoLongerNeeded()
  2174.  
  2175.                     If Exists(en.heli) Then en.heli.NoLongerNeeded()
  2176.  
  2177.                     en.p = Nothing
  2178.                     en.heli = Nothing
  2179.                 Catch
  2180.                 End Try
  2181.             Next
  2182.  
  2183.             TSuperGuyList.Clear()
  2184.  
  2185.             Player.Character.FreezePosition = False
  2186.         End If
  2187.  
  2188.         bWasAlive = Player.Character.Health > 0
  2189.  
  2190.         If (bArrested AndAlso Not Native.Function.Call(Of Boolean)("IS_PLAYER_BEING_ARRESTED")) OrElse (bWasDead AndAlso (Player.Character.Health > 0)) Then
  2191.             bArrested = False
  2192.             TimeDontCheckArrest = 15000
  2193.  
  2194.             stopPTFX(PTFXDamage)
  2195.  
  2196.             Wait(2000)
  2197.  
  2198.             Player.Character.FreezePosition = False
  2199.  
  2200.             If bArmorON Then
  2201.                 Player.MaxHealth = 1000
  2202.                 Player.Character.MaxHealth = 1000
  2203.                 Player.Character.Health = 1000
  2204.  
  2205.                 setArmorComponentVar()
  2206.             End If
  2207.         End If
  2208.  
  2209.         bWasDead = Player.Character.Health <= 0
  2210.  
  2211.         If TimeDontCheckArrest > 0 Then TimeDontCheckArrest -= intervalFix()
  2212.  
  2213.         If TimeDontCheckArrest <= 0 Then _
  2214.             bArrested = Native.Function.Call(Of Boolean)("IS_PLAYER_BEING_ARRESTED")
  2215.  
  2216.         If Not bArmorON Then Exit Sub
  2217.  
  2218.         If timeRestorePreventRagdoll > 0 Then
  2219.             timeRestorePreventRagdoll -= intervalFix()
  2220.  
  2221.             If timeRestorePreventRagdoll <= 0 Then Player.Character.PreventRagdoll = False
  2222.         End If
  2223.  
  2224.         lastFlightZ = Player.Character.Position.Z
  2225.  
  2226.         If bNoWanted AndAlso Native.Function.Call(Of Boolean)("IS_WANTED_LEVEL_GREATER", Player, 0) Then
  2227.             Player.WantedLevel = 0
  2228.         End If
  2229.  
  2230.         If controllerConnected() Then
  2231.             If controllerState.IsButtonDown(Microsoft.Xna.Framework.Input.Buttons.LeftShoulder) Then meleeAttack(hkKick)
  2232.             If controllerState.IsButtonDown(Microsoft.Xna.Framework.Input.Buttons.RightShoulder) Then meleeAttack(hkPunch)
  2233.         End If
  2234.  
  2235.         If copKillCont > 20 Then
  2236.             copKillCont = 0
  2237.  
  2238.             If TSuperGuyList.Count = 0 Then createNewTSuperGuy(Nothing)
  2239.         End If
  2240.  
  2241.         If flying AndAlso (Native.Function.Call(Of Boolean)("IS_CHAR_IN_WATER", Player.Character) OrElse (Player.Character.CurrentVehicle <> myFlyHabs)) Then
  2242.             timePlayJarvisWarn = TRandom.Next(200, 400)
  2243.  
  2244.             switchFlight(False, True)
  2245.         End If
  2246.  
  2247.         If timePlayJarvisWarn > 0 Then
  2248.             timePlayJarvisWarn -= intervalFix()
  2249.  
  2250.             If timePlayJarvisWarn <= 0 Then
  2251.                 If bArmorON Then
  2252.                     Dim s As Int16 = TRandom.Next(0, 20)
  2253.  
  2254.                     If s < 7 Then
  2255.                         jarvis_warning.play()
  2256.                     ElseIf s < 13 Then
  2257.                         jarvis_warning_2.play()
  2258.                     Else
  2259.                         jarvis_warning_3.play()
  2260.                     End If
  2261.                 End If
  2262.             End If
  2263.         End If
  2264.  
  2265.         If timePlayJarvisCongrats > 0 Then
  2266.             timePlayJarvisCongrats -= intervalFix()
  2267.  
  2268.             If timePlayJarvisCongrats <= 0 Then
  2269.                 If bArmorON Then
  2270.                     Dim s As Int16 = TRandom.Next(0, 30)
  2271.  
  2272.                     If s < 7 Then
  2273.                         jarvis_congrats_1.play()
  2274.                     ElseIf s < 13 Then
  2275.                         jarvis_congrats_2.play()
  2276.                     ElseIf s < 20 Then
  2277.                         jarvis_congrats_3.play()
  2278.                     Else
  2279.                         jarvis_congrats_4.play()
  2280.                     End If
  2281.                 End If
  2282.             End If
  2283.         End If
  2284.  
  2285.         Native.Function.Call("CANCEL_CURRENTLY_PLAYING_AMBIENT_SPEECH", Player.Character)
  2286.  
  2287.         If timeKeepRepulsorSound > 0 Then timeKeepRepulsorSound -= intervalFix()
  2288.  
  2289.         If (lastHealth <> -999) AndAlso ((lastHealth - Player.Character.Health) > 10) Then
  2290.             stopPTFX(PTFXDamage)
  2291.  
  2292.             Dim tmpRand As Double = TRandom.NextDouble
  2293.  
  2294.             If tmpRand < 0.3 Then
  2295.                 PTFXDamage = Native.Function.Call(Of Int32)("START_PTFX_ON_ped_bone", "break_electrical", Player.Character,
  2296.                     0, 0, 0, 0, 0, 0, Bone.Head, 0.5)
  2297.             ElseIf tmpRand < 0.6 Then
  2298.                 PTFXDamage = Native.Function.Call(Of Int32)("START_PTFX_ON_ped_bone", "break_electrical", Player.Character,
  2299.                     0, 0, 0.2, 0, 0, 0, Bone.Pelvis, 0.7)
  2300.             ElseIf tmpRand < 0.75 Then
  2301.                 PTFXDamage = Native.Function.Call(Of Int32)("START_PTFX_ON_ped_bone", "break_electrical", Player.Character,
  2302.                     0, 0, 0, 0, 0, 0, Bone.LeftHand, 0.5)
  2303.             Else
  2304.                 PTFXDamage = Native.Function.Call(Of Int32)("START_PTFX_ON_ped_bone", "break_electrical", Player.Character,
  2305.                     0, 0, 0, 0, 0, 0, Bone.RightHand, 0.5)
  2306.             End If
  2307.  
  2308.             damageTime = 100
  2309.         End If
  2310.  
  2311.         lastHealth = Player.Character.Health
  2312.  
  2313.         healthAux = lastHealth
  2314.  
  2315.         If timeHeal <= 0 Then
  2316.             timeHeal = 200
  2317.  
  2318.             If Player.Character.Health < 1000 Then
  2319.                 healthAux += 10
  2320.  
  2321.                 Player.MaxHealth = 1000
  2322.                 Player.Character.MaxHealth = 1000
  2323.  
  2324.                 Player.Character.Health = healthAux
  2325.             End If
  2326.         Else
  2327.             timeHeal -= intervalFix()
  2328.         End If
  2329.  
  2330.         Game.TimeScale = GameTimeScale
  2331.  
  2332.         If bShowingWeaponSelector Then
  2333.             If WeaponSelectTime < 500 Then
  2334.                 WeaponSelectTime += intervalFix()
  2335.             Else
  2336.                 resetPlayerControl()
  2337.             End If
  2338.         End If
  2339.  
  2340.         ' reset global sounds IDs
  2341.         For Each s As TGameSounds In TGameSoundsList
  2342.             If s.timeWait > 0 Then
  2343.  
  2344.                 s.timeWait -= intervalFix()
  2345.  
  2346.                 If s.timeWait <= 0 Then getGameSoundID(s.id)
  2347.             End If
  2348.         Next
  2349.  
  2350.         If Game.isGameKeyPressed(GameKey.Jump) Then
  2351.             If (timeActivateDown > 100) Then
  2352.                 switchFlight()
  2353.                 bAdaptToFlightHeading = True
  2354.                 timeActivateDown = 0
  2355.             Else
  2356.                 timeActivateDown += intervalFix()
  2357.             End If
  2358.         Else
  2359.             timeActivateDown = 0
  2360.         End If
  2361.  
  2362.         If Exists(Player.Character.CurrentVehicle) AndAlso (Player.Character.CurrentVehicle <> myFlyHabs) Then
  2363.             Exit Sub
  2364.         End If
  2365.  
  2366.         ' melee attacks
  2367.         If Not Player.Character.isRagdoll Then
  2368.             Dim kickAnimTime As Double = Player.Character.Animation.GetCurrentAnimationTime(animSetPunchKick, "low_kick_r_long")
  2369.             Dim punchAnimTime As Double = Player.Character.Animation.GetCurrentAnimationTime(animSetPunchKick, "uppercut_r")
  2370.  
  2371.             If (punchAnimTime > 0) OrElse (kickAnimTime > 0) Then
  2372.                 Dim bPunchAttack As Boolean = (punchAnimTime >= 0.3) AndAlso (punchAnimTime <= 0.5)
  2373.                 Dim bKickAttack As Boolean = (kickAnimTime >= 0.3) AndAlso (kickAnimTime <= 0.7)
  2374.  
  2375.                 If Exists(meleeAffectedFront.p) Then
  2376.                     Player.Character.Heading = Helper.DirectionToHeading(meleeAffectedFront.p.Position - Player.Character.Position)
  2377.                 End If
  2378.                 If Exists(meleeAffectedFront.v) Then
  2379.                     Player.Character.Heading = Helper.DirectionToHeading(meleeAffectedFront.v.Position - Player.Character.Position)
  2380.                 End If
  2381.  
  2382.                 'If (kickAnimTime > 0.2) AndAlso (kickAnimTime < 0.55) Then
  2383.                 '    PTFX_RB = Native.Function.Call(Of Int32)("START_PTFX_ON_PED_BONE", "muz_smg", Player.Character, 0.08, 0.05, 0.0, 90.0, 0, 0, Bone.RightFoot, 0.5)
  2384.                 'ElseIf (punchAnimTime > 0.2) AndAlso (punchAnimTime < 0.7) Then
  2385.                 '    PTFX_LB = Native.Function.Call(Of Int32)("START_PTFX_ON_PED_BONE", "muz_smg", Player.Character, 0.08, 0.05, 0.0, 90.0, 0, 0, Bone.LeftFoot, 0.5)
  2386.                 '    PTFX_RB = Native.Function.Call(Of Int32)("START_PTFX_ON_PED_BONE", "muz_smg", Player.Character, 0.08, 0.05, 0.0, 90.0, 0, 0, Bone.RightFoot, 0.5)
  2387.                 'End If
  2388.                 If playerArmor.bFootThrusters AndAlso (kickAnimTime > 0.2) AndAlso (kickAnimTime < 0.55) Then
  2389.                     Native.Function.Call(Of Int32)("trigger_PTFX_ON_PED_BONE", "muz_smg", Player.Character, 0.08, 0.05, 0.0, 90.0, 0, 0, Bone.RightFoot, 0.5)
  2390.                 ElseIf playerArmor.bHandThrusters AndAlso (punchAnimTime > 0.2) AndAlso (punchAnimTime < 0.7) Then
  2391.                     Native.Function.Call(Of Int32)("trigger_PTFX_ON_PED_BONE", "muz_smg", Player.Character, 0.08, 0.05, 0.0, 90.0, 0, 0, Bone.LeftFoot, 0.5)
  2392.                     Native.Function.Call(Of Int32)("trigger_PTFX_ON_PED_BONE", "muz_smg", Player.Character, 0.08, 0.05, 0.0, 90.0, 0, 0, Bone.RightFoot, 0.5)
  2393.                 End If
  2394.  
  2395.                 If bPunchAttack OrElse bKickAttack Then
  2396.                     If bPunchAttack Then
  2397.                         Player.Character.Velocity = (Player.Character.Direction * 4 + Vector3.WorldUp * 0.5)
  2398.                     Else
  2399.                         Player.Character.Velocity = (Player.Character.Direction * 4 + Vector3.WorldUp * 0.5)
  2400.                     End If
  2401.  
  2402.                     For Each m As meleeAffected In meleeAffectedList
  2403.                         If Exists(m.p) AndAlso m.p.isTouching(Player.Character) Then
  2404.                             m.p.PreventRagdoll = False
  2405.                             m.p.ForceRagdoll(3000, True)
  2406.                             m.bApplyforce = True
  2407.                         ElseIf Exists(m.v) AndAlso Player.Character.isTouching(m.v) Then
  2408.                             m.v.ApplyForce(Player.Character.Direction * 10 + Vector3.WorldUp * 2, Vector3.WorldUp + Vector3.WorldNorth)
  2409.                             m.v = Nothing
  2410.  
  2411.                             'Native.Function.Call("stop_sound", IDsndGunSwitch)
  2412.                             'Native.Function.Call("play_sound_from_ped", IDsndGunSwitch, "collisions_collisions_bullet_hit_car_7", Player.Character)
  2413.                             Native.Function.Call("play_sound_from_ped", -1, "collisions_collisions_bullet_hit_car_7", Player.Character)
  2414.                         End If
  2415.                     Next
  2416.  
  2417.                     For Each m As meleeAffected In meleeAffectedList
  2418.                         If Exists(m.p) AndAlso m.bApplyforce Then
  2419.                             If bKickAttack Then
  2420.                                 m.p.ApplyForce(Player.Character.Direction * 7 + Vector3.WorldUp * 3, Vector3.WorldNorth * 2)
  2421.                             Else
  2422.                                 m.p.ApplyForce(Player.Character.Direction * 5 + Vector3.WorldUp * 7, Vector3.WorldNorth * 2)
  2423.                             End If
  2424.  
  2425.                             m.p = Nothing
  2426.  
  2427.                             'Native.Function.Call("stop_sound", IDsndGunSwitch)
  2428.                             'Native.Function.Call("play_sound_from_ped", IDsndGunSwitch, "baseballbat_uppercut", Player.Character)
  2429.                             Native.Function.Call("play_sound_from_ped", -1, "baseballbat_uppercut", Player.Character)
  2430.                         End If
  2431.                     Next
  2432.                 End If
  2433.             End If
  2434.         End If
  2435.  
  2436.         If bLandAnim Then
  2437.             If (World.GetGroundPosition(Player.Character.Position, GroundType.NextBelowCurrent).DistanceTo(Player.Character.Position) <= 2) OrElse _
  2438.                ((timeLandAnim > 100) AndAlso (Player.Character.Velocity.Z > -0.5)) Then
  2439.                 bLandAnim = False
  2440.  
  2441.                 playLandAnim()
  2442.             Else
  2443.                 Player.Character.ApplyForce(playerLandVel * 0.1 + Vector3.WorldDown * 2.5)
  2444.  
  2445.                 timeLandAnim += intervalFix()
  2446.             End If
  2447.         End If
  2448.  
  2449.         If timeRestartFlight > 0 Then timeRestartFlight -= intervalFix()
  2450.  
  2451.         If Player.Character.Weapons.Current.Type <> Weapon.Unarmed Then _
  2452.             Player.Character.Weapons.RemoveAll()
  2453.  
  2454.         checkKeys()
  2455.  
  2456.         If bAimDown Then
  2457.             If bResetCamAim Then
  2458.                 bResetCamAim = False
  2459.                 camAimMoveEase = 0.1
  2460.  
  2461.                 If camMode = 0 Then
  2462.                     If Exists(Game.DefaultCamera) Then
  2463.                         'camAux.Position = Game.DefaultCamera.Position
  2464.                         camAux.Direction = Game.DefaultCamera.Direction
  2465.                         camAux.FOV = Game.CurrentCamera.FOV
  2466.                     Else
  2467.                         'camAux.Position = Game.CurrentCamera.Position
  2468.                         camAux.Direction = Game.CurrentCamera.Direction
  2469.                         camAux.FOV = Game.CurrentCamera.FOV
  2470.                     End If
  2471.  
  2472.                     camAimPosition = Player.Character.Position + GTA.Vector3.WorldUp - camAux.Direction * 4 + rotateVec(camAux.Direction, -45) * 2
  2473.  
  2474.                     If Not camAux.isActive Then
  2475.                         resetCamCfg()
  2476.                         camAux.Activate()
  2477.                     End If
  2478.                 End If
  2479.             End If
  2480.         Else
  2481.             bResetCamAim = True
  2482.         End If
  2483.  
  2484.         If bAimDown Then timeClearTask = 500
  2485.  
  2486.         If timeClearTask > 0 Then
  2487.             timeClearTask -= intervalFix()
  2488.             Player.Character.Task.ClearAll()
  2489.         End If
  2490.  
  2491.         If flying AndAlso (explosionEffectTIme <= 0) Then
  2492.             If Player.Character.CurrentVehicle = myFlyHabs Then
  2493.                 Dim groundDist As Double = World.GetGroundPosition(myFlyHabs.Position, GroundType.NextBelowCurrent).DistanceTo(myFlyHabs.Position)
  2494.  
  2495.                 If (timeOfFlight > 200) AndAlso Not bMoveFDown AndAlso (((FlightSpeedChange - myFlyHabs.Velocity).Length > 10) OrElse (lastXFlight <= -40)) AndAlso _
  2496.                    (groundDist <= 1.2) Then
  2497.                     switchFlight()
  2498.  
  2499.                     Exit Sub
  2500.                 End If
  2501.  
  2502.                 If groundDist < 1.1 Then myFlyHabs.ApplyForce(Vector3.WorldUp)
  2503.  
  2504.                 FlightSpeedChange = myFlyHabs.Velocity
  2505.  
  2506.                 If timeOfFlight < 200 Then timeOfFlight += intervalFix()
  2507.  
  2508.                 If camMode = 0 Then
  2509.                     If playerArmor.bFootThrusters Then
  2510.                         Native.Function.Call(Of Int32)("trigger_PTFX_ON_PED_BONE", "muz_smg", Player.Character, 0.08, 0.05, 0.0, 90.0, 0, 0, Bone.LeftFoot, 0.5 * ptfxBootSize)
  2511.                         Native.Function.Call(Of Int32)("trigger_PTFX_ON_PED_BONE", "muz_smg", Player.Character, 0.08, 0.05, 0.0, 90.0, 0, 0, Bone.RightFoot, 0.5 * ptfxBootSize)
  2512.  
  2513.                         If smokeTime <= 0 Then
  2514.                             smokeTime = 100
  2515.                             stopPTFX(PTFX_SmokeLB)
  2516.                             stopPTFX(PTFX_SmokeRB)
  2517.  
  2518.                             If myFlyHabs.Speed > speedSlow Then
  2519.                                 PTFX_SmokeLB = Native.Function.Call(Of Int32)("START_PTFX_ON_PED_BONE", "shot_directed_steam", Player.Character, 0.08, 0.05, 0.0, 1.0, 90.0, 50.0, Bone.LeftFoot, 0.5 * ptfxBootSize)
  2520.                                 PTFX_SmokeRB = Native.Function.Call(Of Int32)("START_PTFX_ON_PED_BONE", "shot_directed_steam", Player.Character, 0.08, 0.05, 0.0, 1.0, 90.0, 50.0, Bone.RightFoot, 0.5 * ptfxBootSize)
  2521.                             Else
  2522.                                 PTFX_SmokeLB = Native.Function.Call(Of Int32)("START_PTFX_ON_PED_BONE", "shot_directed_steam", Player.Character, 0.08, 0.05, 0.0, 1.0, 90.0, 50.0, Bone.LeftFoot, 0.1 * ptfxBootSize)
  2523.                                 PTFX_SmokeRB = Native.Function.Call(Of Int32)("START_PTFX_ON_PED_BONE", "shot_directed_steam", Player.Character, 0.08, 0.05, 0.0, 1.0, 90.0, 50.0, Bone.RightFoot, 0.1 * ptfxBootSize)
  2524.                             End If
  2525.                         Else
  2526.                             smokeTime -= intervalFix()
  2527.                         End If
  2528.                     End If
  2529.  
  2530.                     If playerArmor.bHandThrusters AndAlso Not Player.Character.Animation.isPlaying(animSetPointArm, "dir_traffic_idle") Then
  2531.                         'PTFX_LH = Native.Function.Call(Of Int32)("START_PTFX_ON_PED_BONE", "muz_smg", Player.Character, 0, 0, 0.0, 0.0, 0.0, 90.0, Bone.LeftHand, 0.2 * ptfxLeftHandSize)
  2532.                         'PTFX_RH = Native.Function.Call(Of Int32)("START_PTFX_ON_PED_BONE", "muz_smg", Player.Character, 0, 0, 0.0, 0.0, 0.0, 90.0, Bone.RightHand, 0.2 * ptfxRrightHandSize)
  2533.                         Native.Function.Call(Of Int32)("trigger_PTFX_ON_PED_BONE", "muz_smg", Player.Character, 0, 0, 0.0, 0.0, 0.0, 90.0, Bone.LeftHand, 0.2 * ptfxLeftHandSize)
  2534.                         Native.Function.Call(Of Int32)("trigger_PTFX_ON_PED_BONE", "muz_smg", Player.Character, 0, 0, 0.0, 0.0, 0.0, 90.0, Bone.RightHand, 0.2 * ptfxRrightHandSize)
  2535.                     End If
  2536.  
  2537.                     If playerArmor.bBackThrusters Then
  2538.                         Native.Function.Call(Of Int32)("trigger_PTFX_ON_PED_BONE", "muz_smg", Player.Character, playerArmor.back_rep_x_off, _
  2539.                             playerArmor.back_rep_y_off, _
  2540.                             playerArmor.back_rep_z_off, _
  2541.                             playerArmor.back_rep_x_rot_off, _
  2542.                             playerArmor.back_rep_y_rot_off, _
  2543.                             playerArmor.back_rep_z_rot_off, Bone.Spine, 0.7 * ptfxBootSize)
  2544.                         Native.Function.Call(Of Int32)("trigger_PTFX_ON_PED_BONE", "muz_smg", Player.Character, playerArmor.back_rep_x_off, _
  2545.                             playerArmor.back_rep_y_off, _
  2546.                             playerArmor.back_rep_z_off * -1, _
  2547.                             playerArmor.back_rep_x_rot_off, _
  2548.                             playerArmor.back_rep_y_rot_off, _
  2549.                             playerArmor.back_rep_z_rot_off, Bone.Spine, 0.7 * ptfxBootSize)
  2550.                     End If
  2551.                 End If
  2552.  
  2553.                 myFlyHabs.EngineRunning = False
  2554.  
  2555.                 KeyboardControlTick()
  2556.  
  2557.                 mySpeed = Math.Round(mySpeed, 2)
  2558.  
  2559.                 If mySpeed < 0 Then mySpeed = 0
  2560.                 If mySpeed > 300 Then mySpeed = 300
  2561.  
  2562.                 myFlyHabs.isOnFire = False
  2563.  
  2564.                 timeResetFlight = -666
  2565.  
  2566.                 If (Not bAimDown) OrElse (timeKeepHighSpeed > 0) Then
  2567.                     If bAimDown Then timeKeepHighSpeed -= myInterval
  2568.  
  2569.                     Native.Function.Call("SET_CAR_FORWARD_SPEED", myFlyHabs, mySpeed)
  2570.                     lastZPos = myFlyHabs.Position.Z
  2571.                 Else
  2572.                     'If bMoveBDown Then
  2573.                         'Native.Function.Call("SET_CAR_FORWARD_SPEED", myFlyHabs, 0)
  2574.                     'Else
  2575.                         Native.Function.Call("SET_CAR_FORWARD_SPEED", myFlyHabs, mySpeed)
  2576.                     'End If
  2577.                 End If
  2578.  
  2579.                 If Not Player.Character.Animation.isPlaying(animSetPointArm, "dir_traffic_idle") Then
  2580.                     If (myFlyHabs.Speed <= speedSlow) Then
  2581.                         If animSetFlight.isInMemory AndAlso Not Player.Character.Animation.isPlaying(animSetFlight, "full_brake_for_landing") Then _
  2582.                             Player.Character.Animation.Play(animSetFlight, "full_brake_for_landing", 5.0, AnimationFlags.Unknown05)
  2583.  
  2584.                         jetSoundDesiredDistance = 35
  2585.                     ElseIf FlightTurningLeft > 0 Then
  2586.                         If animSetFlight.isInMemory AndAlso Not Player.Character.Animation.isPlaying(animSetFlight, "free_fall_veer_left") Then _
  2587.                             Player.Character.Animation.Play(animSetFlight, "free_fall_veer_left", 8.0, AnimationFlags.Unknown05)
  2588.  
  2589.                         'Native.Function.Call("SET_CHAR_ANIM_SPEED", Player.Character, animSetFlight.Name, "free_fall_veer_left", 0.1)
  2590.                     ElseIf FlightTurningRight > 0 Then
  2591.                         If animSetFlight.isInMemory AndAlso Not Player.Character.Animation.isPlaying(animSetFlight, "free_fall_veer_right") Then _
  2592.                             Player.Character.Animation.Play(animSetFlight, "free_fall_veer_right", 8.0, AnimationFlags.Unknown05)
  2593.  
  2594.                         'Native.Function.Call("SET_CHAR_ANIM_SPEED", Player.Character, animSetFlight.Name, "free_fall_veer_right", 0.1)
  2595.                     ElseIf myFlyHabs.Speed > speedFast Then
  2596.                         If animSetFlight.isInMemory AndAlso Not Player.Character.Animation.isPlaying(animSetFlight, "free_fall_fast") Then _
  2597.                             Player.Character.Animation.Play(animSetFlight, "free_fall_fast", 3.0, AnimationFlags.Unknown05)
  2598.  
  2599.                         jetSoundDesiredDistance = 15
  2600.                     ElseIf myFlyHabs.Speed > speedSlow Then
  2601.                         If animSetFlight.isInMemory AndAlso Not Player.Character.Animation.isPlaying(animSetFlight, "free_fall_deccelerate") Then _
  2602.                             Player.Character.Animation.Play(animSetFlight, "free_fall_deccelerate", 3.0, AnimationFlags.Unknown05)
  2603.  
  2604.                         jetSoundDesiredDistance = 25
  2605.                     End If
  2606.                 End If
  2607.  
  2608.                 If FlightTurningRight > 0 Then FlightTurningRight -= intervalFix()
  2609.                 If FlightTurningLeft > 0 Then FlightTurningLeft -= intervalFix()
  2610.  
  2611.                 If jetSoundDistance > jetSoundDesiredDistance Then
  2612.                     jetSoundDistance -= 0.5
  2613.  
  2614.                     If jetSoundDistance < jetSoundDesiredDistance Then jetSoundDistance = jetSoundDesiredDistance
  2615.                 ElseIf jetSoundDistance < jetSoundDesiredDistance Then
  2616.                     jetSoundDistance += 0.5
  2617.  
  2618.                     If jetSoundDistance > jetSoundDesiredDistance Then jetSoundDistance = jetSoundDesiredDistance
  2619.                 End If
  2620.  
  2621.                 If Exists(jetSoundAux) Then jetSoundAux.Position = Player.Character.Position - Game.CurrentCamera.Direction * jetSoundDistance
  2622.             Else
  2623.                 If timeResetFlight <= 0 Then
  2624.                     If Player.Character.isAlive Then
  2625.                         'camAux.Position = Game.CurrentCamera.Position - Player.Character.Direction * 5
  2626.                         camAux.LookAt(Player.Character)
  2627.  
  2628.                         timeResetFlight = 100
  2629.                     Else
  2630.                         flying = False
  2631.                     End If
  2632.                 End If
  2633.             End If
  2634.  
  2635.             If timeResetFlight > 0 Then
  2636.                 timeResetFlight -= myInterval
  2637.  
  2638.                 'camAux.Position = Player.Character.Position - Player.Character.Direction * 5
  2639.  
  2640.                 If (timeResetFlight <= 0) AndAlso (timeResetFlight <> -666) Then
  2641.                     timeResetFlight = -666
  2642.  
  2643.                     myFlyHabs.Position = Player.Character.Position
  2644.                     myFlyHabs.Heading = Player.Character.Heading
  2645.                     mySpeed = Player.Character.Velocity.DistanceTo(GTA.Vector3.Zero)
  2646.                     Player.Character.WarpIntoVehicle(myFlyHabs, VehicleSeat.Driver)
  2647.  
  2648.                     camAux.Deactivate()
  2649.                 End If
  2650.             End If
  2651.  
  2652.             If (Player.Character.Position.DistanceTo(myLastPos) < 0.3) _
  2653.                AndAlso Not (Game.isGameKeyPressed(GameKey.MoveForward)) Then mySpeed /= 4
  2654.  
  2655.             myLastPos = Player.Character.Position
  2656.         End If
  2657.  
  2658.         If explosionEffectTIme > 0 Then
  2659.             explosionEffectTIme -= intervalFix()
  2660.  
  2661.             If Not Player.Character.isRagdoll Then explosionEffectTIme = 0
  2662.  
  2663.             If (explosionEffectTIme <= 0) AndAlso Not flying AndAlso _
  2664.                (World.GetGroundPosition(Player.Character.Position, GroundType.NextBelowCurrent).DistanceTo(Player.Character.Position) > 5) Then
  2665.                switchFlight()
  2666.             End If
  2667.         End If
  2668.  
  2669.         If bAimDown AndAlso (Player.Character.Health > 0) AndAlso controllerConnected() Then
  2670.             Dim tmpThumbLength As Double = controllerState.ThumbSticks.Right.Length
  2671.  
  2672.             If tmpThumbLength > 0 Then
  2673.                 If timeCheckAutoAimPed <= 0 Then
  2674.                     timeCheckAutoAimPed = 100
  2675.  
  2676.                     autoAimPedList = World.GetPeds(Player.Character.Position + Game.CurrentCamera.Direction * 50, 50)
  2677.                 Else
  2678.                     timeCheckAutoAimPed -= intervalFix()
  2679.                 End If
  2680.  
  2681.                 If (timeWaitSearchAutoAImPed <= 0) AndAlso (tmpThumbLength > 0.1) Then '(Not Exists(AutoAimedPed) OrElse (tmpThumbLength > 0.1)) Then
  2682.                     Dim tmpPosCompare As Vector3
  2683.                     Dim tmpDist As Double
  2684.                     Dim tmpRotation As Vector3
  2685.  
  2686.                     AutoAimedPed = Nothing
  2687.  
  2688.                     tmpRotation = Game.CurrentCamera.Rotation
  2689.                     tmpRotation.Z -= controllerState.ThumbSticks.Right.X * 10
  2690.                     tmpRotation.X += controllerState.ThumbSticks.Right.Y * 5
  2691.                     tmpRotation = Helper.RotationToDirection(tmpRotation)
  2692.  
  2693.                     For Each p As Ped In autoAimPedList
  2694.                         If Exists(p) AndAlso (p.Health > 0) AndAlso (p <> Player.Character) AndAlso (p <> lastAutoAimedPed) AndAlso p.isOnScreen Then
  2695.                             tmpDist = p.Position.DistanceTo(Game.CurrentCamera.Position)
  2696.                             tmpPosCompare = Game.CurrentCamera.Position + tmpRotation * tmpDist
  2697.  
  2698.                             If p.Position.DistanceTo(tmpPosCompare) < 2 Then
  2699.                                 lastAutoAimedPed = p
  2700.                                 AutoAimedPed = p
  2701.  
  2702.                                 timeWaitSearchAutoAImPed = 100
  2703.  
  2704.                                 Exit For
  2705.                             End If
  2706.                         End If
  2707.                     Next
  2708.  
  2709.                     If timeWaitSearchAutoAImPed <> 100 Then
  2710.                         For Each p As Ped In autoAimPedList
  2711.                             If Exists(p) AndAlso (p.Health > 0) AndAlso (p <> Player.Character) AndAlso (p <> lastAutoAimedPed) AndAlso p.isOnScreen Then
  2712.                                 tmpDist = p.Position.DistanceTo(Game.CurrentCamera.Position)
  2713.                                 tmpPosCompare = Game.CurrentCamera.Position + tmpRotation * tmpDist
  2714.  
  2715.                                 If p.Position.DistanceTo(tmpPosCompare) < 3 Then
  2716.                                     lastAutoAimedPed = p
  2717.                                     AutoAimedPed = p
  2718.  
  2719.                                     timeWaitSearchAutoAImPed = 100
  2720.  
  2721.                                     Exit For
  2722.                                 End If
  2723.                             End If
  2724.                         Next
  2725.                     End If
  2726.  
  2727.                     If timeWaitSearchAutoAImPed <> 100 Then
  2728.                         lastAutoAimedPed = Nothing
  2729.                         'AutoAimedPed = Nothing
  2730.                     End If
  2731.                 End If
  2732.             End If
  2733.  
  2734.             If Exists(AutoAimedPed) Then
  2735.                 If AutoAimedPed.Health <= 0 Then AutoAimedPed = Nothing
  2736.  
  2737.                 If Not flying Then
  2738.                     Player.Character.Heading = Game.CurrentCamera.Heading
  2739.                 Else
  2740.                     myFlyHabs.Rotation = Game.CurrentCamera.Rotation
  2741.                 End If
  2742.             End If
  2743.         Else
  2744.             AutoAimedPed = Nothing
  2745.         End If
  2746.  
  2747.         If timeWaitSearchAutoAImPed > 0 Then timeWaitSearchAutoAImPed -= intervalFix()
  2748.  
  2749.         If (((camMode = 0) AndAlso bAimDown) OrElse (camMode = 1)) AndAlso Exists(Game.DefaultCamera) Then
  2750.             If camMode = 0 Then
  2751.                 If Not bMoveBDown AndAlso Not bMoveLDown AndAlso Not bMoveRDown Then
  2752.                     If (gunMode <> 3) AndAlso (gunMode <> 4) Then
  2753.                         camAimPosition = Player.Character.GetOffsetPosition(Vector3.RelativeLeft * 0.6 + Vector3.RelativeTop) - Game.DefaultCamera.Direction * 2
  2754.                     Else
  2755.                         camAimPosition = Player.Character.GetOffsetPosition(Vector3.RelativeLeft * 0.5 + Vector3.RelativeTop) - Game.DefaultCamera.Direction
  2756.                     End If
  2757.                 Else
  2758.                     camAimPosition = Player.Character.Position + Vector3.WorldUp - rotateVec(camAux.Direction, -25) * 3
  2759.                 End If
  2760.             ElseIf camMode = 1 Then
  2761.                 Dim tmpDirOffset As Double = Player.Character.Velocity.DistanceTo(Vector3.Zero)
  2762.  
  2763.                 If tmpDirOffset < 0.1 Then tmpDirOffset = 0.1
  2764.  
  2765.                 If Not flying Then
  2766.                     camAimPosition = Player.Character.Position + GTA.Vector3.WorldUp * 0.7
  2767.                 Else
  2768.                     camAimPosition = Player.Character.GetBonePosition(Bone.Head) + Player.Character.Direction * tmpDirOffset
  2769.                 End If
  2770.             End If
  2771.  
  2772.             If Not flying AndAlso Not bMoveFDown AndAlso Not bMoveBDown AndAlso (bMoveLDown OrElse bMoveRDown) Then
  2773.                 If bMoveRDown Then
  2774.                     'Native.Function.Call("SET_CAM_ATTACH_OFFSET", camAux, 3.0, 1.5, 0.5)
  2775.                     If camXAttach < 3 Then camXAttach += 0.5
  2776.                     If camYAttach < 1 Then camYAttach += 0.3
  2777.                 ElseIf bMoveLDown Then
  2778.                     'Native.Function.Call("SET_CAM_ATTACH_OFFSET", camAux, -3.0, 1.5, 0.5)
  2779.                     If camXAttach > -3 Then camXAttach -= 0.5
  2780.                     If camYAttach < 1 Then camYAttach += 0.3
  2781.                 End If
  2782.             Else
  2783.                 'Native.Function.Call("SET_CAM_ATTACH_OFFSET", camAux, -1.0, -2.0, 0.5)
  2784.                 Dim camX As Double = -0.7
  2785.                 Dim camY As Double = -2
  2786.  
  2787.                 If (gunMode = 3) OrElse (gunMode = 4) Then
  2788.                     camX = -0.6
  2789.                     camY = -3.5
  2790.                 End If
  2791.  
  2792.                 If camXAttach > camX Then
  2793.                     camXAttach -= 0.1
  2794.                     If camXAttach < camX Then camXAttach = camX
  2795.                 End If
  2796.                 If camXAttach < camX Then
  2797.                     camXAttach += 0.1
  2798.                     If camXAttach > camX Then camXAttach = camX
  2799.                 End If
  2800.  
  2801.                 If (gunMode = 4) Then
  2802.                     Dim tmpRotX As Double = (camY + Math.Abs(Game.CurrentCamera.Rotation.X / 40))
  2803.  
  2804.                     If camYAttach > tmpRotX Then
  2805.                         camYAttach -= 0.1
  2806.                         If camYAttach < tmpRotX Then camYAttach = tmpRotX
  2807.                     End If
  2808.                     If camYAttach < tmpRotX Then
  2809.                         camYAttach += 0.1
  2810.                         If camYAttach > tmpRotX Then camYAttach = tmpRotX
  2811.                     End If
  2812.                 Else
  2813.                     camYAttach = camY
  2814.                 End If
  2815.             End If
  2816.  
  2817.             If (gunMode = 4) Then _
  2818.                 camZAttach = 0.5 - Game.CurrentCamera.Rotation.X / 60
  2819.  
  2820.             If camMode = 1 Then
  2821.                 camXAttach = 0
  2822.                 camYAttach = 0
  2823.                 camZAttach = 0.7
  2824.             End If
  2825.  
  2826.             Native.Function.Call("SET_CAM_ATTACH_OFFSET", camAux, camXAttach, camYAttach, camZAttach)
  2827.  
  2828.             Dim tmpPos As Vector3 = camAux.Position
  2829.  
  2830.             tmpPos.X += (camAimPosition.X - tmpPos.X) * 0.5
  2831.             tmpPos.Y += (camAimPosition.Y - tmpPos.Y) * 0.5
  2832.             tmpPos.Z += (camAimPosition.Z - tmpPos.Z) * 0.5
  2833.  
  2834.             If camAimMoveEase < 1 Then
  2835.                 camAimMoveEase += 0.02
  2836.  
  2837.                 If camAimMoveEase > 1 Then camAimMoveEase = 1
  2838.             End If
  2839.  
  2840.             'camAux.Position = tmpPos
  2841.  
  2842.             tmpPos = camAux.Rotation
  2843.  
  2844.             Dim tmpRot As Vector3
  2845.  
  2846.             If Exists(AutoAimedPed) Then
  2847.                 tmpRot = Helper.DirectionToRotation(Vector3.Normalize(AutoAimedPed.Position - Game.CurrentCamera.Position), 0)
  2848.             Else
  2849.                 tmpRot = Game.DefaultCamera.Rotation
  2850.             End If
  2851.  
  2852.             tmpPos.X += (tmpRot.X - tmpPos.X) * 0.5
  2853.             tmpPos.Y += (tmpRot.Y - tmpPos.Y) * 0.5
  2854.  
  2855.             If Math.Abs(tmpRot.Z - tmpPos.Z) < 50 Then
  2856.                 tmpPos.Z += (tmpRot.Z - tmpPos.Z) * 0.5
  2857.             Else
  2858.                 tmpPos.Z = tmpRot.Z
  2859.             End If
  2860.  
  2861.  
  2862.             'If (Game.Mouse.Movement.X <> 0) OrElse (padState.ThumbSticks.Left.X <> 0) Then
  2863.             'If (Game.Mouse.Movement.X <> 0) OrElse (XControl.IsConnected AndAlso (XControl.GetState.Gamepad.LeftThumbX <> 0)) Then
  2864.             If (Game.Mouse.Movement.X <> 0) OrElse (controllerConnected() AndAlso (controllerState.ThumbSticks.Left.X <> 0)) Then
  2865.                 camLastXMove = 300
  2866.             Else
  2867.                 If camLastXMove > 0 Then camLastXMove -= intervalFix()
  2868.             End If
  2869.  
  2870.             If (camMode = 1) AndAlso (tmpPos.X < -40) Then tmpPos.X = -40
  2871.  
  2872.             camAux.Rotation = tmpPos
  2873.  
  2874.             If Not bMoveBDown AndAlso Not bMoveLDown AndAlso Not bMoveRDown Then
  2875.                 If Not flying Then
  2876.                     Player.Character.Heading = camAux.Heading
  2877.                 ElseIf Not bAimDown Then
  2878.                     If camMode = 0 Then myFlyHabs.Heading = camAux.Heading
  2879.                 End If
  2880.             End If
  2881.  
  2882.             If Not camAux.isActive Then
  2883.                 resetCamCfg()
  2884.                 camAux.Activate()
  2885.             End If
  2886.         ElseIf camAux.isActive Then
  2887.             camAux.Deactivate()
  2888.         End If
  2889.  
  2890.         gunsTick()
  2891.  
  2892.         If bShowingWeaponSelector Then
  2893.             If timeCheckWSelect <= 0 Then
  2894.                 Dim tmpPrevGunMode As Int16 = gunMode
  2895.  
  2896.                 WeapXSelection += Game.Mouse.Movement.X
  2897.                 WeapYSelection += Game.Mouse.Movement.Y
  2898.  
  2899.                 If (WeapXSelection > 0.05) Then
  2900.                     If gunMode = 4 Then
  2901.                         gunMode = 0
  2902.                     ElseIf gunMode = 0 Then
  2903.                         gunMode = 1
  2904.                     ElseIf gunMode = 3 Then
  2905.                         gunMode = 2
  2906.                     End If
  2907.                 ElseIf (WeapXSelection < -0.05) Then
  2908.                     If gunMode = 0 Then
  2909.                         gunMode = 4
  2910.                     ElseIf gunMode = 1 Then
  2911.                         gunMode = 0
  2912.                     ElseIf gunMode = 2 Then
  2913.                         gunMode = 3
  2914.                     ElseIf gunMode = 3 Then
  2915.                         gunMode = 4
  2916.                     End If
  2917.                 End If
  2918.  
  2919.                 If (WeapYSelection < -0.05) Then
  2920.                     If gunMode = 2 Then
  2921.                         gunMode = 1
  2922.                     ElseIf gunMode = 3 Then
  2923.                         gunMode = 4
  2924.                     ElseIf gunMode = 1 Then
  2925.                         gunMode = 0
  2926.                     ElseIf gunMode = 4 Then
  2927.                         gunMode = 0
  2928.                     End If
  2929.                 ElseIf (WeapYSelection > 0.05) Then
  2930.                     If gunMode = 1 Then
  2931.                         gunMode = 2
  2932.                     ElseIf gunMode = 4 Then
  2933.                         gunMode = 3
  2934.                     End If
  2935.                 End If
  2936.  
  2937.                 If Math.Abs(WeapXSelection) > 0.05 Then WeapXSelection = 0
  2938.                 If Math.Abs(WeapYSelection) > 0.05 Then WeapYSelection = 0
  2939.  
  2940.                 If tmpPrevGunMode <> gunMode Then
  2941.                     timeCheckWSelect = 20
  2942.                     reattachDarts()
  2943.                 End If
  2944.             Else
  2945.                 timeCheckWSelect -= intervalFix()
  2946.             End If
  2947.         Else
  2948.             WeapXSelection = 0
  2949.             WeapYSelection = 0
  2950.         End If
  2951.  
  2952.         weaponHeat0 -= 0.2
  2953.         weaponHeat1 -= 0.2
  2954.         weaponHeat2 -= 0.2
  2955.         weaponHeat3 -= 0.2
  2956.         weaponHeat4 -= 0.2
  2957.  
  2958.         If weaponHeat0 < 0 Then weaponHeat0 = 0
  2959.         If weaponHeat1 < 0 Then weaponHeat1 = 0
  2960.         If weaponHeat2 < 0 Then weaponHeat2 = 0
  2961.         If weaponHeat3 < 0 Then weaponHeat3 = 0
  2962.         If weaponHeat4 < 0 Then weaponHeat4 = 0
  2963.  
  2964.         'msg(weaponHeat0.ToString & "  " & weaponHeat1.ToString & "  " & weaponHeat2.ToString & "  " & weaponHeat3.ToString & "  " & weaponHeat4.ToString & "  ", 15)
  2965.  
  2966.         If flying Then
  2967.             myRealSpeed = myFlyHabs.Speed
  2968.         Else
  2969.             myRealSpeed = Player.Character.Velocity.DistanceTo(Vector3.Zero)
  2970.         End If
  2971.  
  2972.         If (Player.Character.Health <= 0) AndAlso Player.Character.isAlive Then Player.Character.Die()
  2973.  
  2974.         controlKeyCheck()
  2975.     End Sub
  2976.  
  2977.     Private Sub controlKeyCheck()
  2978.         'If Not XControl.IsConnected Then Exit Sub
  2979.         If Not controllerConnected() Then Exit Sub
  2980.  
  2981.         'If lasPacketNumber <> XControl.GetState.PacketNumber Then
  2982.             'lasPacketNumber = XControl.GetState.PacketNumber
  2983.         If lasPacketNumber <> controllerState.PacketNumber Then
  2984.             lasPacketNumber = controllerState.PacketNumber
  2985.  
  2986.             If timeWaitCheckXKeys <= 0 Then
  2987.                 timeWaitCheckXKeys = 50
  2988.  
  2989.                 'bDPadDown = XControl.GetState.Gamepad.Buttons = GamepadButtonFlags.DPadDown
  2990.                 'bDPadLeft = XControl.GetState.Gamepad.Buttons = GamepadButtonFlags.DPadLeft
  2991.                 'bDPadRight = XControl.GetState.Gamepad.Buttons = GamepadButtonFlags.DPadRight
  2992.  
  2993.                 bDPadDown = controllerState.DPad.Down
  2994.                 bDPadLeft = controllerState.DPad.Left
  2995.                 bDPadRight = controllerState.DPad.Right
  2996.  
  2997.                 fakeKeydown(Nothing)
  2998.             End If
  2999.         End If
  3000.  
  3001.         If timeWaitCheckXKeys > 0 Then timeWaitCheckXKeys -= intervalFix()
  3002.     End Sub
  3003.  
  3004.     Private Sub fakeKeydown(e As GTA.KeyEventArgs)
  3005.         '        If e.Key = Keys.NumPad0 Then
  3006. '            Dim f As StreamWriter
  3007. '            Dim s As String
  3008. '
  3009. '            If Not File.Exists("c:\test.txt") Then File.CreateText("c:\test.txt").Dispose()
  3010. '
  3011. '            s = File.ReadAllText("c:\test.txt")
  3012. '
  3013. '            f = File.CreateText("c:\test.txt")
  3014. '
  3015. '            f.WriteLine(s)
  3016. '            f.WriteLine("drawSpriteAux(e, texBar, " & offx.ToString & ", " & offy.ToString & ", 10, " & offH.ToString & ", Helper.DegreeToRadian(" & offR.ToString & "), Color.White)")
  3017. '
  3018. '            f.Dispose()
  3019. '
  3020. '            tmpline = New tline
  3021. '            tmpline.x = offx
  3022. '            tmpline.y = offy
  3023. '            tmpline.h = offH
  3024. '            tmpline.r = offR
  3025. '            tlineList.Add(tmpline)
  3026. '
  3027. '            msg("saved", 1000)
  3028. '        End If
  3029. '
  3030. '        If e.Key = Keys.Delete AndAlso tlineList.Count > 0 Then tlineList.RemoveAt(tlineList.Count - 1)
  3031.  
  3032.         Dim key As Keys
  3033.  
  3034.         If Exists(e) Then key = e.Key Else key = Keys.None
  3035.  
  3036.         If Not bShowArmorOptionsMenu AndAlso (key = hkNoWantedLevel) Then
  3037.             switchNoWanted()
  3038.         End If
  3039.  
  3040.         If Not bShowArmorOptionsMenu AndAlso (key = hkGodMode) Then
  3041.             switchGodMode()
  3042.         End If
  3043.  
  3044.         If key = hkSpawnAlly Then createNewTSuperGuy(Nothing, True, True)
  3045.  
  3046.         If key = hkSpawnEnemy Then createNewTSuperGuy(Nothing, False, True)
  3047.  
  3048.         If (key = hkWeaponSelectMenu) AndAlso (flying OrElse (Not flying AndAlso Not Exists(Player.Character.CurrentVehicle))) Then
  3049.             Native.Function.Call("SET_PLAYER_CONTROL", Player, False)
  3050.             GameTimeScale = 0.3
  3051.             WeaponSelectTime = 0
  3052.             bShowingWeaponSelector = True
  3053.             Player.IgnoredByEveryone = False
  3054.         End If
  3055.  
  3056.         If (key = hkKick) OrElse (key = hkPunch) Then
  3057.             meleeAttack(e.Key)
  3058.         End If
  3059.  
  3060.         'If (key = hkCannon) OrElse (key = hkDarts) OrElse (key = hkRockets) OrElse (key = hkHandRep) OrElse (key = hkChestRep) OrElse (key = hkSwitchGun) _
  3061.         '   OrElse (Microsoft.Xna.Framework.Input.GamePad.GetState(Microsoft.Xna.Framework.PlayerIndex.One).DPad.Down = Microsoft.Xna.Framework.Input.ButtonState.Pressed) OrElse _
  3062.        '     (Microsoft.Xna.Framework.Input.GamePad.GetState(Microsoft.Xna.Framework.PlayerIndex.One).DPad.Left = Microsoft.Xna.Framework.Input.ButtonState.Pressed) OrElse _
  3063.        '     (Microsoft.Xna.Framework.Input.GamePad.GetState(Microsoft.Xna.Framework.PlayerIndex.One).DPad.Right = Microsoft.Xna.Framework.Input.ButtonState.Pressed) Then
  3064.        If (key = hkCannon) OrElse (key = hkDarts) OrElse (key = hkRockets) OrElse (key = hkHandRep) OrElse (key = hkChestRep) OrElse (key = hkSwitchGun) _
  3065.            OrElse (controllerConnected() AndAlso (bDPadDown OrElse _
  3066.             bDPadLeft OrElse _
  3067.             bDPadRight)) Then
  3068.  
  3069.             If key = hkCannon Then gunMode = 0
  3070.             If key = hkDarts Then gunMode = 1
  3071.             If key = hkRockets Then gunMode = 2
  3072.             If key = hkHandRep Then gunMode = 3
  3073.             If key = hkChestRep Then gunMode = 4
  3074.  
  3075.             'If (key = hkSwitchGun) OrElse (Microsoft.Xna.Framework.Input.GamePad.GetState(Microsoft.Xna.Framework.PlayerIndex.One).DPad.Down = Microsoft.Xna.Framework.Input.ButtonState.Pressed) Then
  3076.             If (key = hkSwitchGun) OrElse bDPadDown Then
  3077.                 gunMode += 1
  3078.  
  3079.                 If gunMode > 4 Then gunMode = 0
  3080.             End If
  3081.  
  3082.             'If (Microsoft.Xna.Framework.Input.GamePad.GetState(Microsoft.Xna.Framework.PlayerIndex.One).DPad.Left = Microsoft.Xna.Framework.Input.ButtonState.Pressed) Then
  3083.             If bDPadLeft Then
  3084.                 gunMode -= 1
  3085.  
  3086.                 If gunMode < 0 Then gunMode = 4
  3087.             End If
  3088.  
  3089.             'If (Microsoft.Xna.Framework.Input.GamePad.GetState(Microsoft.Xna.Framework.PlayerIndex.One).DPad.Right = Microsoft.Xna.Framework.Input.ButtonState.Pressed) Then
  3090.             If bDPadRight Then
  3091.                 gunMode += 1
  3092.  
  3093.                 If gunMode > 4 Then gunMode = 0
  3094.             End If
  3095.  
  3096.             reattachDarts()
  3097.         End If
  3098.  
  3099.         If key = hkSwitchCam Then
  3100.             camMode += 1
  3101.  
  3102.             If camMode > 1 Then camMode = 0
  3103.  
  3104.             If camMode = 1 Then
  3105.                 Dim tmpSpeed As Double = myFlyHabs.Speed
  3106.  
  3107.                 myFlyHabs.FreezePosition = True
  3108.  
  3109.                 camAux.Rotation = Game.DefaultCamera.Rotation
  3110.                 myFlyHabs.Rotation = camAux.Rotation
  3111.  
  3112.                 Wait(10)
  3113.  
  3114.                 If Not camAux.isActive Then
  3115.                     resetCamCfg()
  3116.                     camAux.Activate()
  3117.                 End If
  3118.  
  3119.                 'camAux.Position = Player.Character.Position + GTA.Vector3.WorldUp + camAux.Direction * 0.1
  3120.  
  3121.                 camAux.Rotation = Game.CurrentCamera.Rotation
  3122.  
  3123.                 myFlyHabs.FreezePosition = False
  3124.                 myFlyHabs.Speed = tmpSpeed
  3125.  
  3126.                 Player.Character.Visible = False
  3127.             Else
  3128.                 If camAux.isActive Then camAux.Deactivate()
  3129.  
  3130.                 Player.Character.Visible = True
  3131.             End If
  3132.         End If
  3133.  
  3134.         If (((weaponHeat1 + 20 < 100) AndAlso (gunMode = 1)) OrElse ((weaponHeat2 + 10 < 100) AndAlso (gunMode = 2))) AndAlso _
  3135.            (bAttackDown OrElse (key = hkShoot)) Then
  3136.             indexCheckDartShoot = 0
  3137.  
  3138.             If (gunMode = 2) AndAlso (playerArmor.weaponSet = 0) Then timeWaitLaunchDarts = 100
  3139.         End If
  3140.  
  3141.         If bAimDown AndAlso (myRealSpeed <= speedSlow) AndAlso ((((weaponHeat3 + 40) < 100) AndAlso (gunMode = 3)) OrElse (((weaponHeat4 + 55) < 100) AndAlso (gunMode = 4))) AndAlso _
  3142.            (bAttackDown OrElse (key = hkShoot)) Then
  3143.             Dim timeOut As Double = 0
  3144.  
  3145.             If (gunMode = 3) Then
  3146.                 'animSetGunAim = New AnimationSet("melee_gun")
  3147.                 'Native.Function.Call("REQUEST_ANIMS", "melee_gun")
  3148.                 'Native.Function.Call("TASK_PLAY_ANIM_SECONDARY_UPPER_BODY", Player.Character, "hold_pistol", "melee_gun", 8.0, 1, 0, 0, 0, -1)
  3149.  
  3150.                 If Not Player.Character.Animation.isPlaying(animSetPointArm, "dir_traffic_idle") Then
  3151.                     Player.Character.Animation.Play(animSetPointArm, "dir_traffic_idle", 3.5, AnimationFlags.Unknown06)
  3152.  
  3153.                     timeWaitStartCannonShoot = 20
  3154.                 End If
  3155.  
  3156.                 While Not Player.Character.Animation.isPlaying(animSetPointArm, "dir_traffic_idle") AndAlso (timeOut < 1000)
  3157.                     Wait(10)
  3158.                     timeOut += intervalFix()
  3159.                 End While
  3160.  
  3161.                 repulsorDiameter = 40
  3162.                 repulsorChest = False
  3163.             ElseIf (gunMode = 4) Then
  3164.                 If Not Player.Character.Animation.isPlaying(animSetFlight, "full_brake_for_landing") Then _
  3165.                     Player.Character.Animation.Play(animSetFlight, "full_brake_for_landing", 10.0, AnimationFlags.Unknown05)
  3166.  
  3167.                 timeOut = 0
  3168.  
  3169.                 While Not Player.Character.Animation.isPlaying(animSetFlight, "full_brake_for_landing") AndAlso (timeOut < 1000)
  3170.                     Wait(10)
  3171.                     timeOut += intervalFix()
  3172.                 End While
  3173.  
  3174.                 repulsorDiameter = 60
  3175.                 repulsorChest = True
  3176.             End If
  3177.  
  3178.             timeWaitShootRepulsor = 200
  3179.             timeWaitRepulsorSound = 100
  3180.  
  3181.             timeRepulsorBeamON = 0
  3182.  
  3183.             pedsRepulsorHit = World.GetPeds(Game.CurrentCamera.Position + Game.CurrentCamera.Direction * 50, 55)
  3184.             vehRepulsorHit = World.GetVehicles(Game.CurrentCamera.Position + Game.CurrentCamera.Direction * 50, 55)
  3185.  
  3186.             For Each v As Vehicle In vehRepulsorHit
  3187.                 v.Metadata.chestExp = False
  3188.             Next
  3189.  
  3190.             stopPTFX(PTFXRepulsor)
  3191.  
  3192.             If bSoundOK Then sndRepulsorStart.Play()
  3193.         End If
  3194.     End Sub
  3195.  
  3196.     Private Sub meleeAttack(key As Keys)
  3197.         If flying Then Exit Sub
  3198.  
  3199.         If Player.Character.Animation.isPlaying(animSetPunchKick, "low_kick_r_long") OrElse _
  3200.            Player.Character.Animation.isPlaying(animSetPunchKick, "uppercut_r") Then Exit Sub
  3201.  
  3202.         If (key = hkKick) Then
  3203.             If Not Player.Character.Animation.isPlaying(animSetPunchKick, "low_kick_r_long") Then
  3204.                 Player.Character.Animation.Play(animSetPunchKick, "low_kick_r_long", 10.0, AnimationFlags.Unknown01)
  3205.             Else
  3206.                 Exit Sub
  3207.             End If
  3208.         End If
  3209.  
  3210.         If (key = hkPunch) Then
  3211.             If Not Player.Character.Animation.isPlaying(animSetPunchKick, "uppercut_r") Then
  3212.                 Player.Character.Animation.Play(animSetPunchKick, "uppercut_r", 10.0, AnimationFlags.Unknown01)
  3213.             Else
  3214.                 Exit Sub
  3215.             End If
  3216.         End If
  3217.  
  3218.         meleeAffectedList.Clear()
  3219.  
  3220.         meleeAffectedFront.p = Nothing
  3221.         meleeAffectedFront.v = Nothing
  3222.  
  3223.         For Each p As Ped In World.GetPeds(Player.Character.Position + Player.Character.Direction, 5)
  3224.             If Exists(p) AndAlso (p <> Player.Character) AndAlso Not p.isRagdoll AndAlso (p.Health > 0) AndAlso (p.Position.DistanceTo(p.Position.ToGround) > 0.25) Then
  3225.                 tmpmeleeAffected = New meleeAffected
  3226.                 tmpmeleeAffected.p = p
  3227.                 meleeAffectedList.Add(tmpmeleeAffected)
  3228.  
  3229.                 If Not Exists(meleeAffectedFront.p) AndAlso (p.Position.DistanceTo(Player.Character.Position + Player.Character.Direction * 3) < 3) Then meleeAffectedFront.p = p
  3230.             End If
  3231.         Next
  3232.         For Each v As Vehicle In World.GetVehicles(Player.Character.Position + Player.Character.Direction, 7)
  3233.             If Exists(v) AndAlso (v <> Player.Character.CurrentVehicle) Then
  3234.                 tmpmeleeAffected = New meleeAffected
  3235.                 tmpmeleeAffected.v = v
  3236.                 meleeAffectedList.Add(tmpmeleeAffected)
  3237.  
  3238.                 If Not Exists(meleeAffectedFront.p) AndAlso Not Exists(meleeAffectedFront.v) AndAlso (v.Position.DistanceTo(Player.Character.Position + Player.Character.Direction * 3) < 3) Then meleeAffectedFront.v = v
  3239.             End If
  3240.         Next
  3241.     End Sub
  3242.  
  3243.     Private Sub KeyboardControlTick()
  3244.         Dim myRot As Vector3 = myFlyHabs.Rotation
  3245.  
  3246.         If bMoveFDown Then
  3247.             'If bAimDown Then
  3248.                 'myFlyHabs.ApplyForce(myFlyHabs.Direction * forwardAmount)
  3249.  
  3250.                 'If mySpeed > myFlyHabs.Speed Then mySpeed -= (mySpeed - myFlyHabs.Speed) / 2
  3251.                 'If mySpeed < myFlyHabs.Speed Then mySpeed += (mySpeed - myFlyHabs.Speed) / 2
  3252.  
  3253.                 'If forwardAmount < 10 Then forwardAmount += 0.5
  3254.             'Else
  3255.                 mySpeed += 0.5
  3256.  
  3257.                 If mySpeed > 100 Then mySpeed += 0.5
  3258.  
  3259.                 'If forwardAmount < 0.5 Then forwardAmount += 0.1
  3260.             'End If
  3261.         Else
  3262.             If forwardAmount > 0 Then
  3263.                 forwardAmount -= 0.5
  3264.  
  3265.                 If forwardAmount < 0 Then forwardAmount = 0
  3266.  
  3267.                 If bAimDown Then
  3268.                     myFlyHabs.ApplyForce(myFlyHabs.Direction * forwardAmount)
  3269.                 End If
  3270.             End If
  3271.         End If
  3272.  
  3273.         If bAimDown AndAlso (mySpeed > 60) Then
  3274.             mySpeed -= 1
  3275.  
  3276.             If mySpeed < 60 Then mySpeed = 60
  3277.         End If
  3278.  
  3279.         If bMoveBDown Then
  3280.             mySpeed -= 2
  3281.  
  3282.             If mySpeed < 0 Then
  3283.                 myFlyHabs.ApplyForce(myFlyHabs.Direction * backwardAmount)
  3284.  
  3285.                 lastZPos = myFlyHabs.Position.Z
  3286.  
  3287.                 If backwardAmount > -10 Then backwardAmount -= 0.5
  3288.             End If
  3289.         Else
  3290.             If backwardAmount < 0 Then
  3291.                 backwardAmount += 0.5
  3292.  
  3293.                 If backwardAmount > 0 Then backwardAmount = 0
  3294.  
  3295.                 myFlyHabs.ApplyForce(Game.CurrentCamera.Direction * backwardAmount)
  3296.             End If
  3297.         End If
  3298.  
  3299.         'If bSprintDown OrElse (XControl.IsConnected AndAlso (XControl.GetState.Gamepad.Buttons = GamepadButtonFlags.RightShoulder)) Then
  3300.         If bSprintDown OrElse (controllerConnected() AndAlso _
  3301.           (controllerConnected() AndAlso controllerState.Buttons.RightShoulder)) Then
  3302.             myFlyHabs.ApplyForce(GTA.Vector3.WorldUp * upAmount)
  3303.  
  3304.             lastZPos = myFlyHabs.Position.Z
  3305.  
  3306.             If upAmount < 15 Then upAmount += 0.5
  3307.         Else
  3308.             If upAmount > 0 Then
  3309.                 upAmount -= 1
  3310.  
  3311.                 If upAmount < 0 Then upAmount = 0
  3312.  
  3313.                 myFlyHabs.ApplyForce(GTA.Vector3.WorldUp * upAmount)
  3314.  
  3315.                 lastZPos = myFlyHabs.Position.Z
  3316.             End If
  3317.         End If
  3318.  
  3319.         'If bCrouchDown OrElse (XControl.IsConnected AndAlso (XControl.GetState.Gamepad.Buttons = GamepadButtonFlags.LeftShoulder)) Then
  3320.         If bCrouchDown OrElse (controllerConnected() AndAlso (controllerConnected() AndAlso controllerState.Buttons.LeftShoulder)) Then
  3321.             myFlyHabs.ApplyForce(GTA.Vector3.WorldDown * downAmount)
  3322.  
  3323.             lastZPos = myFlyHabs.Position.Z
  3324.  
  3325.             If downAmount < 15 Then downAmount += 0.5
  3326.         Else
  3327.             If downAmount > 0 Then
  3328.                 downAmount -= 1
  3329.  
  3330.                 If downAmount < 0 Then downAmount = 0
  3331.  
  3332.                 myFlyHabs.ApplyForce(GTA.Vector3.WorldDown * downAmount)
  3333.  
  3334.                 lastZPos = myFlyHabs.Position.Z
  3335.             End If
  3336.         End If
  3337.  
  3338.         If myRealSpeed <= speedSlow Then
  3339.             If bAimDown AndAlso (World.GetGroundPosition(Player.Character.Position, GroundType.NextBelowCurrent).DistanceTo(Player.Character.Position) < 1.5) Then
  3340.                 If heightFix < (4 - World.GetGroundPosition(Player.Character.Position, GroundType.NextBelowCurrent).DistanceTo(Player.Character.Position)) Then heightFix += 0.8
  3341.  
  3342.                 lastZPos = myFlyHabs.Position.Z
  3343.             ElseIf myFlyHabs.Position.Z - lastZPos < 0 Then
  3344.                 myFlyHabs.ApplyForce(GTA.Vector3.WorldDown * ((myFlyHabs.Position.Z - lastZPos)))
  3345.             End If
  3346.  
  3347.             If bMoveLDown AndAlso (myFlyHabs.Speed <= speedSlow) Then
  3348.                 myFlyHabs.ApplyForceRelative(GTA.Vector3.RelativeLeft * 4 + Vector3.RelativeTop * 2)
  3349.             End If
  3350.             If bMoveRDown AndAlso (myFlyHabs.Speed <= speedSlow) Then
  3351.                 myFlyHabs.ApplyForceRelative(GTA.Vector3.RelativeRight * 4 + Vector3.RelativeTop * 2)
  3352.             End If
  3353.  
  3354.             If heightFix > 0 Then
  3355.                 myFlyHabs.ApplyForce(GTA.Vector3.WorldUp * heightFix)
  3356.  
  3357.                 heightFix -= 0.2
  3358.             End If
  3359.         End If
  3360.  
  3361.         If bMoveLDown Then
  3362.             ptfxRrightHandSize = 1.5
  3363.             ptfxLeftHandSize = 1.0
  3364.         ElseIf bMoveRDown Then
  3365.             ptfxLeftHandSize = 1.5
  3366.             ptfxRrightHandSize = 1.0
  3367.         Else
  3368.             ptfxLeftHandSize = 1.0
  3369.             ptfxRrightHandSize = 1.0
  3370.         End If
  3371.  
  3372.         If bMoveFDown Then
  3373.             If ptfxBootSize < 1.5 Then
  3374.                 ptfxBootSize += 0.01
  3375.  
  3376.                 If ptfxBootSize > 1.5 Then ptfxBootSize = 1.5
  3377.             End If
  3378.         Else
  3379.             ptfxLeftHandSize = 1.5
  3380.             ptfxRrightHandSize = 1.5
  3381.             ptfxBootSize = 1.0
  3382.         End If
  3383.  
  3384.         If Not Exists(AutoAimedPed) Then
  3385.             tryFixRotation(vRotation, 0, 0.5)
  3386.  
  3387.             myFlyHabs.Rotation = vRotation
  3388.         End If
  3389.     End Sub
  3390.  
  3391.     Private Sub searchEnemies()
  3392.         Try
  3393.             If timeWaitSearchEnemy <= 0 Then
  3394.                 timeWaitSearchEnemy = 1000
  3395.  
  3396.                 If (Player.WantedLevel > 0) OrElse Native.Function.Call(Of Boolean)("IS_WANTED_LEVEL_GREATER", Player, 0) OrElse _
  3397.                    Native.Function.Call(Of Boolean)("ARE_ENEMY_PEDS_IN_AREA", Player.Character, _
  3398.                                                     Player.Character.Position.X, Player.Character.Position.Y, Player.Character.Position.Z, 200.0) Then
  3399.  
  3400.                     Dim bExists As Boolean
  3401.  
  3402.                     For Each p As Ped In World.GetPeds(Player.Character.Position, 200)
  3403.                         If Exists(p) AndAlso (p.Health > 0) Then
  3404.                             If ((Player.WantedLevel > 0) OrElse Native.Function.Call(Of Boolean)("IS_WANTED_LEVEL_GREATER", Player, 0)) AndAlso (p.PedType = PedType.Cop) Then
  3405.                                 bExists = False
  3406.  
  3407.                                 For Each b As TEnemyBlip In TEnemyBlipList
  3408.                                     If b.p = p Then
  3409.                                         bExists = True
  3410.  
  3411.                                         Exit For
  3412.                                     End If
  3413.                                 Next
  3414.  
  3415.                                 If bExists Then Continue For
  3416.  
  3417.                                 Dim bChopperPassenger As Boolean = Exists(p.CurrentVehicle) AndAlso p.CurrentVehicle.Model.isHelicopter AndAlso _
  3418.                                    (p.CurrentVehicle.GetPedOnSeat(VehicleSeat.LeftRear) = p)
  3419.  
  3420.                                 tmpTEnemyBlip = New TEnemyBlip
  3421.                                 tmpTEnemyBlip.p = p
  3422.                                 tmpTEnemyBlip.blip = p.AttachBlip
  3423.                                 tmpTEnemyBlip.blip.Color = BlipColor.Orange
  3424.                                 tmpTEnemyBlip.blip.Friendly = False
  3425.                                 tmpTEnemyBlip.blip.Scale = 0.7
  3426.  
  3427.                                 TEnemyBlipList.Add(tmpTEnemyBlip)
  3428.  
  3429.                                 If bChopperPassenger Then
  3430.                                     bExists = False
  3431.  
  3432.                                     For Each s As TSuperGuy In TSuperGuyList
  3433.                                         If s.p = p Then
  3434.                                            bExists = True
  3435.                                            Exit For
  3436.                                         End If
  3437.                                     Next
  3438.  
  3439.                                     If Not bExists Then createNewTSuperGuy(p)
  3440.                                 End If
  3441.                             End If
  3442.                         End If
  3443.                     Next
  3444.                 End If
  3445.  
  3446.                 For c As Int16 = TEnemyBlipList.Count - 1 To 0 Step -1
  3447.                     If (Player.WantedLevel <= 0) Then
  3448.                         If Exists(TEnemyBlipList(c).p) AndAlso (TEnemyBlipList(c).p.PedType = PedType.Cop) Then
  3449.                             TEnemyBlipList(c).p.NoLongerNeeded()
  3450.  
  3451.                             If Exists(TEnemyBlipList(c).v) Then TEnemyBlipList(c).v.NoLongerNeeded()
  3452.  
  3453.                             TEnemyBlipList.RemoveAt(c)
  3454.  
  3455.                             Continue For
  3456.                         End If
  3457.                     End If
  3458.  
  3459.                     If Not Exists(TEnemyBlipList(c).p) OrElse (TEnemyBlipList(c).p.Health <= 0) Then
  3460.                         If Exists(TEnemyBlipList(c).p) AndAlso (TEnemyBlipList(c).p.Health <= 0) Then
  3461.                             If Not bNoWanted Then
  3462.                                 wantedLevel += 0.2
  3463.  
  3464.                                 If wantedLevel > 6 Then wantedLevel = 6
  3465.  
  3466.                                 Native.Function.Call("SET_MAX_WANTED_LEVEL", 6)
  3467.                                 Native.Function.Call("ALTER_WANTED_LEVEL_NO_DROP", Player, Math.Round(wantedLevel))
  3468.                                 Native.Function.Call("APPLY_WANTED_LEVEL_CHANGE_NOW", Player)
  3469.  
  3470.                                 copKillCont += 1
  3471.                             End If
  3472.                         End If
  3473.  
  3474.                         If Exists(TEnemyBlipList(c).p) Then TEnemyBlipList(c).p.NoLongerNeeded()
  3475.  
  3476.                         If Exists(TEnemyBlipList(c).v) Then TEnemyBlipList(c).v.NoLongerNeeded()
  3477.  
  3478.                         TEnemyBlipList(c).blip.Delete()
  3479.                         TEnemyBlipList.RemoveAt(c)
  3480.                     End If
  3481.                 Next
  3482.             Else
  3483.                 timeWaitSearchEnemy -= intervalFix()
  3484.             End If
  3485.         Catch
  3486.         End Try
  3487.     End Sub
  3488.  
  3489.     Private Sub createNewTSuperGuy(p As Ped, Optional ally As Boolean = False, Optional bShowMsg As Boolean = False)
  3490.         Dim bPlayerFrozen = flying AndAlso (myRealSpeed <= speedSlow)
  3491.         Dim newPed As Boolean = False
  3492.  
  3493.         If bShowMsg Then
  3494.             bShowMenu = False
  3495.  
  3496.             If ally Then
  3497.                 msg("Creating new ally", 3000)
  3498.             Else
  3499.                 msg("Creating new enemy", 3000)
  3500.             End If
  3501.         End If
  3502.  
  3503.         Try
  3504.             If bPlayerFrozen Then myFlyHabs.FreezePosition = True
  3505.  
  3506.             'If Not ally AndAlso Not bArmorON Then Throw New NonExistingObjectException
  3507.  
  3508.             Dim tmpCount As Int16 = 0
  3509.  
  3510.             For Each s As TSuperGuy In TSuperGuyList
  3511.                 If (ally AndAlso Not s.enemy) OrElse (Not ally AndAlso s.enemy) Then tmpCount += 1
  3512.             Next
  3513.  
  3514.             If ally AndAlso (tmpCount >= maxAlly) Then
  3515.                 If bShowMsg Then msg("Maximum number of Allies reached...", 2000)
  3516.                 Throw New NonExistingObjectException
  3517.             ElseIf Not ally AndAlso (tmpCount >= maxEnemy) Then
  3518.                 If bShowMsg Then msg("Maximum number of Enemies reached...", 2000)
  3519.                 Throw New NonExistingObjectException
  3520.             End If
  3521.  
  3522.             Dim bNew As Boolean = Not Exists(p)
  3523.             Dim m As Model
  3524.             Dim bFound As Boolean = False
  3525.             Dim bAIM_Robot As Boolean = False
  3526.             Dim tmpArmorList As New List(Of TArmor)
  3527.             Dim tmpArmor As TArmor
  3528.  
  3529.             For c As Int16 = 0 To TEnemyAllyArmorList.Count - 1
  3530.                 If (Not ally AndAlso TEnemyAllyArmorList(c).enemy) OrElse (ally AndAlso TEnemyAllyArmorList(c).ally) Then
  3531.                     tmpArmorList.Add(TEnemyAllyArmorList(c))
  3532.  
  3533.                     bFound = True
  3534.                 End If
  3535.             Next
  3536.  
  3537.             If Not bFound Then
  3538.                 If bShowMsg Then
  3539.                     If ally Then
  3540.                         msg("There is no armors to be used as ally", 3000)
  3541.                     Else
  3542.                         msg("There is no armors to be used as enemy", 3000)
  3543.                     End If
  3544.                 End If
  3545.  
  3546.                 Throw New NonExistingObjectException
  3547.             End If
  3548.  
  3549.             TRandom.Next()
  3550.             TRandom.Next()
  3551.  
  3552.             tmpArmor = tmpArmorList(TRandom.Next(0, tmpArmorList.Count))
  3553.  
  3554.             m = tmpArmor.model
  3555.             bAIM_Robot = tmpArmor.AIM_Robot
  3556.  
  3557.             tmpEnemy = New TSuperGuy
  3558.             'tmpEnemy.AIM_Robot = bAIM_Robot
  3559.             'tmpEnemy.weaponSet = tmpArmor.weaponSet
  3560.             tmpEnemy.armor = tmpArmor
  3561.  
  3562.             Dim tmpPos As Vector3
  3563.  
  3564.             If Not Exists(p) Then
  3565.                 tmpPos = World.GetNextPositionOnPavement(Player.Character.Position.Around(180))
  3566.  
  3567.                 If tmpPos.DistanceTo(Player.Character.Position) > 180 Then tmpPos = Player.Character.Position.Around(180)
  3568.  
  3569.                 newPed = True
  3570.  
  3571.                 Native.Function.Call("REQUEST_MODEL", m.Hash)
  3572.  
  3573.                 Dim timeOut As Double = 0
  3574.  
  3575.                 While (timeOut < 500) AndAlso Not Native.Function.Call(Of Boolean)("HAS_MODEL_LOADED", m.Hash)
  3576.                     timeOut += intervalFix()
  3577.                     Wait(25)
  3578.                 End While
  3579.  
  3580.                 If Not ally Then
  3581.                     p = World.CreatePed(m, Player.Character.Position.Around(10) + Vector3.WorldUp * 100)
  3582.                 Else
  3583.                     p = World.CreatePed(m, Player.Character.Position.Around(10) + Vector3.WorldUp * 100)
  3584.                 End If
  3585.             End If
  3586.  
  3587.             If Not Exists(p) Then
  3588.                 If bShowMsg Then
  3589.                     If ally Then
  3590.                         msg("Error creating new ally :(", 3000)
  3591.                     Else
  3592.                         msg("Error creating new enemy :(", 3000)
  3593.                     End If
  3594.                 End If
  3595.  
  3596.                 Throw New NonExistingObjectException
  3597.             End If
  3598.  
  3599.             If newPed Then p.Position = tmpPos
  3600.  
  3601.             tmpEnemy.p = p
  3602.             tmpEnemy.r = Nothing
  3603.  
  3604.             If Not ally Then tmpEnemy.targetPed = Player.Character
  3605.  
  3606.             tmpEnemy.enemy = Not ally
  3607.  
  3608.             If freeRocketList.Count > 0 Then
  3609.                 tmpEnemy.r = freeRocketList(0)
  3610.                 freeRocketList.RemoveAt(0)
  3611.             End If
  3612.  
  3613.             If Not Exists(tmpEnemy.r) Then createObject("cj_dart_1", Vector3.Zero, tmpEnemy.r, 20)
  3614.  
  3615.             If Exists(tmpEnemy.r) Then
  3616.                 Native.Function.Call("set_object_collision", tmpEnemy.r, True)
  3617.                 tmpEnemy.r.Visible = False
  3618.                 tmpEnemy.r.FreezePosition = False
  3619.                 tmpEnemy.r.AttachToPed(tmpEnemy.p, Bone.LeftArmRoll, Vector3.Zero, Vector3.Zero)
  3620.                 Native.Function.Call("SET_OBJECT_RECORDS_COLLISIONS", tmpEnemy.r, False)
  3621.  
  3622.                 'tmpEnemy.p.Weapons.RemoveAll()
  3623.                 'tmpEnemy.p.Weapons.RocketLauncher.Ammo = 0
  3624.                 'tmpEnemy.p.Weapons.RocketLauncher.Select()
  3625.                 'tmpEnemy.p.SetPathfinding(True, True, False)
  3626.  
  3627.                 If Not bNew Then
  3628.                     tmpEnemy.heliPassenger = Exists(p.CurrentVehicle) AndAlso p.CurrentVehicle.Model.isHelicopter
  3629.  
  3630.                     If tmpEnemy.heliPassenger Then
  3631.                         tmpEnemy.heli = p.CurrentVehicle
  3632.                     End If
  3633.  
  3634.                     tmpEnemy.blip = tmpEnemy.heli.AttachBlip
  3635.                 Else
  3636.                     tmpEnemy.blip = tmpEnemy.p.AttachBlip
  3637.                 End If
  3638.  
  3639.                 tmpEnemy.blip.Friendly = ally
  3640.  
  3641.                 If Not ally Then
  3642.                     tmpEnemy.blip.Color = BlipColor.Red
  3643.  
  3644.                     If bArmorON Then jarvis_enemy.play()
  3645.                 Else
  3646.                     tmpEnemy.blip.Color = BlipColor.White
  3647.                 End If
  3648.  
  3649.                 tmpEnemy.p.MaxHealth = 1000
  3650.                 tmpEnemy.p.Health = 1000
  3651.                 tmpEnemy.p.BecomeMissionCharacter()
  3652.                 tmpEnemy.p.PreventRagdoll = True
  3653.                 tmpEnemy.p.MakeProofTo(False, True, False, True, True)
  3654.  
  3655.                 TSuperGuyList.Add(tmpEnemy)
  3656.             End If
  3657.         Catch
  3658.  
  3659.         End Try
  3660.  
  3661.         If bPlayerFrozen Then myFlyHabs.FreezePosition = False
  3662.     End Sub
  3663.  
  3664.     'superGuy tick
  3665.     Private Sub superGuyTick()
  3666.         Dim superGuy As TSuperGuy
  3667.         Dim bBeeped As Boolean = False
  3668.         Dim bAiming As Boolean = False
  3669.  
  3670.         For c As Int16 = TSuperGuyList.Count - 1 To 0 Step -1
  3671.             superGuy = TSuperGuyList(c)
  3672.  
  3673.             If Exists(superGuy.p) AndAlso Exists(superGuy.r) Then
  3674.                 If superGuy.p.Position.DistanceTo(Player.Character.Position) > 300 Then
  3675.                     superGuy.p.Die()
  3676.                     superGuy.p = Nothing
  3677.                     superGuy.heli = Nothing
  3678.                     If Exists(superGuy.blip) Then superGuy.blip.Delete()
  3679.  
  3680.                     Exit Sub
  3681.                 End If
  3682.  
  3683.                 If (superGuy.p.Health > 0) Then
  3684.                     If Not Exists(superGuy.heli) Then
  3685.                         stopPTFX(superGuy.ptfxL)
  3686.                         stopPTFX(superGuy.ptfxR)
  3687.  
  3688.                         'If Not superGuy.AIM_Robot Then
  3689.                         '    superGuy.ptfxL = Native.Function.Call(Of Int32)("START_PTFX_ON_PED_BONE", "muz_smg", superGuy.p, 0.08, 0.05, 0.0, 90.0, 0, 0, Bone.LeftFoot, 0.5)
  3690.                         '    superGuy.ptfxR = Native.Function.Call(Of Int32)("START_PTFX_ON_PED_BONE", "muz_smg", superGuy.p, 0.08, 0.05, 0.0, 90.0, 0, 0, Bone.RightFoot, 0.5)
  3691.                         'Else
  3692.                         '    superGuy.ptfxL = Native.Function.Call(Of Int32)("START_PTFX_ON_PED", "muz_smg", superGuy.p, 0.5, 0, 0.5, 0, 90.0, 0, 0.5)
  3693.                         '    superGuy.ptfxR = Native.Function.Call(Of Int32)("START_PTFX_ON_PED", "muz_smg", superGuy.p, -0.5, 0, 0.5, 0, 90.0, 0, 0.5)
  3694.                         'End If
  3695.                         If Not superGuy.armor.AIM_Robot Then
  3696.                             Native.Function.Call(Of Int32)("trigger_PTFX_ON_PED_BONE", "muz_smg", superGuy.p, 0.08, 0.05, 0.0, 90.0, 0, 0, Bone.LeftFoot, 0.5)
  3697.                             Native.Function.Call(Of Int32)("trigger_PTFX_ON_PED_BONE", "muz_smg", superGuy.p, 0.08, 0.05, 0.0, 90.0, 0, 0, Bone.RightFoot, 0.5)
  3698.                         Else
  3699.                             Native.Function.Call(Of Int32)("trigger_PTFX_ON_PED", "muz_smg", superGuy.p, 0.5, 0, 0.5, 0, 90.0, 0, 0.5)
  3700.                             Native.Function.Call(Of Int32)("trigger_PTFX_ON_PED", "muz_smg", superGuy.p, -0.5, 0, 0.5, 0, 90.0, 0, 0.5)
  3701.                         End If
  3702.                     Else
  3703.                         If (superGuy.heli <> superGuy.p.CurrentVehicle) Then
  3704.                             superGuy.heli.NoLongerNeeded()
  3705.                             superGuy.heli = Nothing
  3706.                             superGuy.p.Die()
  3707.                         End If
  3708.                     End If
  3709.  
  3710.                     If superGuy.heliPassenger AndAlso Not bArmorON Then Continue For
  3711.  
  3712.                     If Exists(superGuy.p.CurrentVehicle) AndAlso superGuy.heliPassenger AndAlso (superGuy.p.CurrentVehicle <> superGuy.heli) Then
  3713.                         superGuy.p = Nothing
  3714.                         Continue For
  3715.                     End If
  3716.  
  3717.                     If superGuy.heliPassenger AndAlso Not Exists(superGuy.p.CurrentVehicle) Then
  3718.                         superGuy.p = Nothing
  3719.                         Continue For
  3720.                     End If
  3721.  
  3722.                     superGuy.p.CancelAmbientSpeech()
  3723.  
  3724.                     If Not Exists(superGuy.p.CurrentVehicle) Then
  3725.                         If Not superGuy.p.isRagdoll Then
  3726.                             If superGuy.explosionEffectTIme > 0 Then
  3727.                                 superGuy.explosionEffectTIme -= intervalFix()
  3728.  
  3729.                                 If superGuy.explosionEffectTIme <= 0 Then superGuy.p.PreventRagdoll = True
  3730.  
  3731.                                 Continue For
  3732.                             End If
  3733.  
  3734.                             Dim tmpVel As Vector3 = superGuy.p.Velocity
  3735.                             Dim superGuyDist As Double
  3736.                             Dim tmpTarget As Ped = superGuy.targetPed
  3737.                             Dim tmpSpeed As Double = superGuy.p.Velocity.DistanceTo(Vector3.Zero)
  3738.  
  3739.                             tmpVel.Z = 0
  3740.  
  3741.                             If (superGuyDist > 10) AndAlso (tmpVel.DistanceTo(Vector3.Zero) < 1) Then tmpVel = superGuy.p.Direction
  3742.  
  3743.                             superGuy.p.Velocity = tmpVel
  3744.  
  3745.                             If Not Exists(tmpTarget) Then tmpTarget = Player.Character
  3746.  
  3747.                             superGuyDist = superGuy.p.Position.DistanceTo(tmpTarget.Position)
  3748.  
  3749.                             If superGuyDist > 30 Then
  3750.                                 If tmpSpeed < 6 Then
  3751.                                     If superGuy.stuckTime < 1500 Then superGuy.stuckTime += intervalFix()
  3752.                                 Else
  3753.                                     superGuy.stuckTime -= intervalFix()
  3754.                                 End If
  3755.                             Else
  3756.                                 superGuy.stuckTime = 0
  3757.                             End If
  3758.  
  3759.                             If superGuy.stuckTime > 1000 Then
  3760.                                 superGuy.collision(False)
  3761.                             Else
  3762.                                 superGuy.collision(True)
  3763.                             End If
  3764.  
  3765.                             If (superGuyDist > 30) AndAlso (((World.GetGroundPosition(superGuy.p.Position + superGuy.p.Direction * 15, GroundType.Highest).Z + 5) > superGuy.p.Position.Z) OrElse _
  3766.                                ((World.GetGroundPosition(superGuy.p.Position, GroundType.Highest).Z + 5) > superGuy.p.Position.Z)) Then
  3767.                                 If tmpSpeed < 2 Then
  3768.                                     superGuy.p.ApplyForce(Vector3.WorldUp * 5 - superGuy.p.Direction * 4)
  3769.                                 Else
  3770.                                     superGuy.p.ApplyForce(Vector3.WorldUp * 5 + superGuy.p.Direction * 4)
  3771.                                 End If
  3772.                             Else
  3773.                                 If Exists(superGuy.targetPed) AndAlso superGuy.targetPed.isSittingInVehicle Then
  3774.                                     superGuy.p.ApplyForce(Vector3.WorldUp * (superGuy.targetPed.Position.Z - superGuy.p.Position.Z) * 0.2)
  3775.                                 Else
  3776.                                     superGuy.p.ApplyForce(Vector3.WorldUp * (Player.Character.Position.Z - superGuy.p.Position.Z))
  3777.                                 End If
  3778.  
  3779.                                 If superGuy.timeToReact > 0 Then
  3780.                                     superGuy.timeToReact -= intervalFix()
  3781.  
  3782.                                     If superGuy.timeToReact <= 0 Then
  3783.                                         superGuy.timeReacting = 500
  3784.  
  3785.                                         If TRandom.Next(1, 20) Mod 2 = 0 Then
  3786.                                             superGuy.reactDir = Vector3.RelativeLeft
  3787.                                         Else
  3788.                                             superGuy.reactDir = Vector3.RelativeRight
  3789.                                         End If
  3790.                                     End If
  3791.                                 Else
  3792.                                     If superGuy.enemy Then
  3793.                                         If superGuyDist > 180 Then
  3794.                                             superGuy.p.Position = superGuy.p.Position + superGuy.p.Direction * (superGuyDist - 180 + 10)
  3795.                                             superGuy.moveForce = 1
  3796.                                         ElseIf ((superGuy.targetPed <> Player.Character) AndAlso superGuyDist > 20) OrElse _
  3797.                                                ((superGuy.targetPed = Player.Character) AndAlso superGuyDist > 30) Then
  3798.                                             superGuy.p.ApplyForce(Vector3.Normalize(tmpTarget.Position - superGuy.p.Position) * superGuy.moveForce)
  3799.                                             superGuy.moveForce += 0.01
  3800.                                         ElseIf ((superGuy.targetPed <> Player.Character) AndAlso superGuyDist < 10) OrElse _
  3801.                                                ((superGuy.targetPed = Player.Character) AndAlso superGuyDist < 20) Then
  3802.                                             superGuy.p.ApplyForce(Vector3.Normalize(superGuy.p.Position - tmpTarget.Position) * 3)
  3803.                                             superGuy.moveForce = 1
  3804.                                         End If
  3805.                                     Else
  3806.                                         If superGuyDist > 180 Then superGuy.p.Position = superGuy.p.Position + superGuy.p.Direction * (superGuyDist - 180 + 10)
  3807.  
  3808.                                         If Exists(superGuy.targetPed) Then
  3809.                                             If superGuyDist > 20 Then
  3810.                                                 superGuy.p.ApplyForce(Vector3.Normalize(tmpTarget.Position - superGuy.p.Position) * superGuy.moveForce)
  3811.                                                 superGuy.moveForce += 0.01
  3812.                                             ElseIf superGuyDist < 10 Then
  3813.                                                 superGuy.p.ApplyForce(Vector3.Normalize(superGuy.p.Position - tmpTarget.Position) * 3)
  3814.                                                 superGuy.moveForce = 1
  3815.                                             End If
  3816.                                         ElseIf superGuyDist > 10 Then
  3817.                                             superGuy.p.ApplyForce(Vector3.Normalize(tmpTarget.Position - superGuy.p.Position) * superGuy.moveForce)
  3818.                                             superGuy.moveForce += 0.01
  3819.                                         ElseIf superGuyDist < 8 Then
  3820.                                             tmpVel = (Vector3.Normalize(superGuy.p.Position - tmpTarget.Position))
  3821.                                             tmpVel.Z = 0
  3822.  
  3823.                                             superGuy.p.Velocity = tmpVel
  3824.  
  3825.                                             'superGuy.p.ApplyForce(Vector3.Normalize(superGuy.p.Position - tmpTarget.Position) * superGuy.p.Velocity.DistanceTo(Vector3.Zero))
  3826.  
  3827.                                             superGuy.moveForce = 1
  3828.                                         End If
  3829.                                     End If
  3830.                                 End If
  3831.  
  3832.                                 If superGuy.timeReacting > 0 Then
  3833.                                     superGuy.timeReacting -= intervalFix()
  3834.  
  3835.                                     superGuy.p.ApplyForceRelative(superGuy.reactDir * 0.5)
  3836.                                 End If
  3837.  
  3838.                                 If superGuy.lifeChanged Then
  3839.                                     stopPTFX(superGuy.ptfxDamage)
  3840.  
  3841.                                     If Not superGuy.armor.AIM_Robot Then
  3842.                                         If TRandom.NextDouble < 0.5 Then
  3843.                                             superGuy.ptfxDamage = Native.Function.Call(Of Int32)("START_PTFX_ON_ped_bone", "break_electrical", superGuy.p,
  3844.                                                 0, 0, 0, 0, 0, 0, Bone.Head, 0.5)
  3845.                                         Else
  3846.                                             superGuy.ptfxDamage = Native.Function.Call(Of Int32)("START_PTFX_ON_ped_bone", "break_electrical", superGuy.p,
  3847.                                                 0, 0, 0, 0, 0, 0, Bone.LeftHand, 0.2)
  3848.                                         End If
  3849.                                     Else
  3850.                                         'superGuy.ptfxDamage = Native.Function.Call(Of Int32)("START_PTFX_ON_ped", "break_electrical", superGuy.p,
  3851.                                         '    0, 0, 0.5, 0, 0, 0, 1.0)
  3852.                                         superGuy.ptfxDamage = Native.Function.Call(Of Int32)("START_PTFX_ON_ped_bone", "break_electrical", superGuy.p,
  3853.                                             0, 0, 0, 0, 0, 0, Bone.Head, 0.5)
  3854.                                     End If
  3855.                                 End If
  3856.  
  3857.                                 If superGuy.p.Position.Z - World.GetGroundPosition(superGuy.p.Position, GroundType.Highest).Z < 10 Then _
  3858.                                     superGuy.p.ApplyForce(Vector3.WorldUp)
  3859.                             End If
  3860.  
  3861.                             If superGuy.moveForce > 10 Then superGuy.moveForce = 10
  3862.  
  3863.                             If Not superGuy.armor.AIM_Robot Then
  3864.                                 If (tmpSpeed <= speedSlow * 1.2) OrElse _
  3865.                                    ((superGuy.p.Position + Vector3.Normalize(superGuy.p.Velocity)).DistanceTo(superGuy.p.Position + superGuy.p.Direction) > 1) Then
  3866.                                     If animSetFlight.isInMemory AndAlso Not superGuy.p.Animation.isPlaying(animSetFlight, "full_brake_for_landing") Then _
  3867.                                         superGuy.p.Animation.Play(animSetFlight, "full_brake_for_landing", 5.0, AnimationFlags.Unknown05)
  3868.                                 ElseIf tmpSpeed > speedFast * 0.8 Then
  3869.                                     If animSetFlight.isInMemory AndAlso Not superGuy.p.Animation.isPlaying(animSetFlight, "free_fall_fast") Then _
  3870.                                         superGuy.p.Animation.Play(animSetFlight, "free_fall_fast", 3.0, AnimationFlags.Unknown05)
  3871.                                 ElseIf tmpSpeed > speedSlow * 1.2 Then
  3872.                                     If animSetFlight.isInMemory AndAlso Not superGuy.p.Animation.isPlaying(animSetFlight, "free_fall_deccelerate") Then _
  3873.                                         superGuy.p.Animation.Play(animSetFlight, "free_fall_deccelerate", 3.0, AnimationFlags.Unknown05)
  3874.                                 End If
  3875.                             ElseIf animSetFlight.isInMemory AndAlso Not superGuy.p.Animation.isPlaying(animSetFlight, "full_brake_for_landing") Then
  3876.                                 superGuy.p.Animation.Play(animSetFlight, "full_brake_for_landing", 5.0, AnimationFlags.Unknown05)
  3877.                             End If
  3878.  
  3879.                             If Exists(superGuy.targetPed) Then
  3880.                                 superGuy.p.Heading = Helper.DirectionToHeading(Vector3.Normalize(superGuy.targetPed.Position - superGuy.p.Position))
  3881.                             ElseIf Exists(superGuy.targetPedSecondary) Then
  3882.                                 superGuy.p.Heading = Helper.DirectionToHeading(Vector3.Normalize(superGuy.targetPedSecondary.Position - superGuy.p.Position))
  3883.                             Else
  3884.                                 superGuy.p.Heading = Helper.DirectionToHeading(Vector3.Normalize(Player.Character.Position - superGuy.p.Position))
  3885.                             End If
  3886.                         End If
  3887.  
  3888.                         If superGuy.p.isRagdoll AndAlso Not superGuy.isRagDoll Then
  3889.                             superGuy.isRagDoll = True
  3890.                             superGuy.unstableTime = 500
  3891.                         End If
  3892.  
  3893.                         If superGuy.unstableTime > 0 Then
  3894.                             superGuy.unstableTime -= intervalFix()
  3895.  
  3896.                             If superGuy.unstableTime <= 0 Then
  3897.                                 superGuy.isRagDoll = False
  3898.                                 superGuy.p.isRagdoll = False
  3899.                                 superGuy.p.Task.ClearAllImmediately()
  3900.                                 superGuy.p.Animation.Play(animSetFlight, "full_brake_for_landing", 10.0, AnimationFlags.Unknown05)
  3901.                             End If
  3902.                         End If
  3903.                    End If
  3904.  
  3905.                    If Exists(superGuy.targetPed) Then
  3906.                         If Not superGuy.bLaunched AndAlso (superGuy.targetPed.Health > 0) Then
  3907.                             If superGuy.AimCoolDown > 0 Then
  3908.                                 superGuy.AimCoolDown -= intervalFix()
  3909.  
  3910.                                 If (superGuy.AimCoolDown < 200) Then
  3911.                                     superGuy.shootCannonTick()
  3912.                                 End If
  3913.  
  3914.                                 superGuy.AimingTime = 0
  3915.                             ElseIf superGuy.AimingTime < 500 Then
  3916.                                 bAiming = superGuy.enemy AndAlso (superGuy.targetPed = Player.Character) AndAlso (superGuy.AimingTime > 100)
  3917.  
  3918.                                 If Exists(superGuy.heli) AndAlso (superGuy.p.CurrentVehicle = superGuy.heli) Then
  3919.                                     If (Math.Abs(superGuy.heli.GetOffsetPosition(Vector3.RelativeLeft).DistanceTo(superGuy.targetPed.Position) - superGuy.heli.Position.DistanceTo(superGuy.targetPed.Position)) < 0.2) OrElse _
  3920.                                         (Math.Abs(superGuy.heli.GetOffsetPosition(Vector3.RelativeRight).DistanceTo(superGuy.targetPed.Position) - superGuy.heli.Position.DistanceTo(superGuy.targetPed.Position)) < 0.2) Then _
  3921.                                     superGuy.AimingTime = 0
  3922.                                 Else
  3923.                                     If Exists(superGuy.targetPed) AndAlso (superGuy.p.GetOffsetPosition(Vector3.RelativeFront).DistanceTo(superGuy.targetPed.Position) > superGuy.p.Position.DistanceTo(superGuy.targetPed.Position)) Then _
  3924.                                     superGuy.AimingTime = 0
  3925.                                 End If
  3926.  
  3927.                                 If superGuy.p.Position.DistanceTo(superGuy.targetPed.Position) > 200 Then superGuy.AimingTime = 0
  3928.  
  3929.                                 If Not superGuy.p.isGettingUp AndAlso Not superGuy.p.isGettingIntoAVehicle AndAlso Not superGuy.p.isRagdoll Then
  3930.                                     If Not Exists(superGuy.p.CurrentVehicle) AndAlso (superGuy.p.Position.DistanceTo(superGuy.targetPed.Position) > 70) Then
  3931.                                         'If superGuy.followTime > 500 Then
  3932.                                         '    superGuy.p.Task.ClearAll()
  3933.                                         '    superGuy.p.Task.RunTo(superGuy.targetPed.Position.Around(10).ToGround, True)
  3934.                                         '    superGuy.followTime = 0
  3935.                                         'Else
  3936.                                         '    superGuy.followTime += intervalFix()
  3937.                                         'End If
  3938.  
  3939.                                         superGuy.AimingTime = 0
  3940.                                     ElseIf Not Exists(superGuy.p.CurrentVehicle) AndAlso (superGuy.p.Position.DistanceTo(superGuy.targetPed.Position) < 10) Then
  3941.                                         'If superGuy.followTime > 500 Then
  3942.                                         '    superGuy.p.Task.ClearAll()
  3943.                                         '    superGuy.p.Task.FleeFromChar(superGuy.targetPed, False, 5000)
  3944.                                         '    superGuy.followTime = 0
  3945.                                         'Else
  3946.                                         '    superGuy.followTime += intervalFix()
  3947.                                         'End If
  3948.  
  3949.                                         superGuy.AimingTime = 0
  3950.                                     Else
  3951.                                         'If Not Exists(superGuy.p.CurrentVehicle) Then
  3952.                                         '    superGuy.p.Task.ClearAll()
  3953.                                         '    superGuy.p.Task.AimAt(superGuy.targetPed.Position, 1500)
  3954.                                         'End If
  3955.  
  3956.                                         superGuy.AimingTime += intervalFix()
  3957.  
  3958.                                         'superGuy.followTime = 0
  3959.                                     End If
  3960.                                 End If
  3961.  
  3962.                                 If (superGuy.AimingTime < 450) Then superGuy.shootCannonTick()
  3963.                             Else
  3964.                                 superGuy.bLocked = True
  3965.                                 superGuy.bLaunched = True
  3966.                                 superGuy.AimingTime = 0
  3967.                                 superGuy.timeOut = 0
  3968.                                 superGuy.bReadyToBlowUp = False
  3969.                                 superGuy.r.FreezePosition = False
  3970.                                 superGuy.p.Velocity = Vector3.Zero
  3971.                                 superGuy.r.Detach()
  3972.                                 superGuy.flightDir = Vector3.Normalize(superGuy.targetPed.Position - superGuy.r.Position)
  3973.                                 superGuy.r.Velocity = superGuy.flightDir
  3974.                                 superGuy.r.ApplyForce(superGuy.flightDir * 15)
  3975.                                 superGuy.r.Visible = True
  3976.  
  3977.                                 superGuy.targetPed.Velocity = Vector3.Zero
  3978.  
  3979.                                 'If getGameSoundID(superGuy.IDLaunchSound) Then _
  3980.                                     Native.Function.Call("play_sound_from_object", -1, "rocket_launch", superGuy.r)
  3981.                                     'Native.Function.Call("play_sound_from_object", superGuy.IDLaunchSound, "rocket_launch", superGuy.r)
  3982.  
  3983.                                 If getGameSoundID(superGuy.IDMoveSound) Then _
  3984.                                     Native.Function.Call("play_sound_from_object", superGuy.IDMoveSound, "GENERAL_WEAPONS_ROCKET_LOOP", superGuy.r)
  3985.  
  3986.                                 'Native.Function.Call("play_sound_from_object", superGuy.IDLaunchSound, "general_explosions_lows_grenade_explosion_r", superGuy.r)
  3987.  
  3988.                                 stopPTFX(superGuy.PTFXMove)
  3989.                                 superGuy.PTFXMove = Native.Function.Call(Of Int32)("START_PTFX_ON_OBJ", "weap_rocket_player", _
  3990.                                     superGuy.r, 0, 0, 0, 0, 0, 0, 1.0)
  3991.  
  3992.                                 superGuy.AimCoolDown = 500
  3993.  
  3994.                                 For Each s As TSuperGuy In TSuperGuyList
  3995.                                     If s.p = superGuy.p Then
  3996.                                         s.timeToReact = 500 * TRandom.NextDouble
  3997.                                         Exit For
  3998.                                     End If
  3999.                                 Next
  4000.                             End If
  4001.                         Else
  4002.                             If Not superGuy.enemy Then
  4003.                                 For Each s As TSuperGuy In TSuperGuyList
  4004.                                     If s.p = superGuy.targetPed Then
  4005.                                         s.targetPed = superGuy.p
  4006.                                         Exit For
  4007.                                     End If
  4008.                                 Next
  4009.                             End If
  4010.  
  4011.                             If superGuy.bLocked Then
  4012.                                 superGuy.flightDir = Vector3.Normalize(superGuy.targetPed.Position - superGuy.r.Position)
  4013.  
  4014.                                 If superGuy.r.Position.DistanceTo(superGuy.p.Position) > (superGuy.targetPed.Position + superGuy.targetPed.Direction).DistanceTo(superGuy.p.Position) Then superGuy.bLocked = False
  4015.                             End If
  4016.  
  4017.                             If superGuy.r.Position.DistanceTo(superGuy.p.Position) < 10 Then
  4018.                                 superGuy.r.Velocity = (superGuy.flightDir * 40 + Vector3.WorldUp * 0.5)
  4019.                             Else
  4020.                                 superGuy.r.ApplyForce(superGuy.flightDir * 15 + Vector3.WorldUp * 0.5)
  4021.                             End If
  4022.  
  4023.                             If superGuy.bLocked Then
  4024.                                 Dim tmpRot As Vector3 = Helper.DirectionToRotation(superGuy.flightDir, 0)
  4025.                                 tmpRot.Y += 90
  4026.                                 tmpRot.Z -= 90
  4027.                                 superGuy.r.Rotation = tmpRot
  4028.                             End If
  4029.  
  4030.                             If Not superGuy.bReadyToBlowUp AndAlso ((superGuy.r.Position.DistanceTo(superGuy.p.Position) > 10) OrElse (superGuy.r.Position.DistanceTo(superGuy.targetPed.Position) < 2)) Then
  4031.                                 superGuy.bReadyToBlowUp = True
  4032.                                 Native.Function.Call("SET_OBJECT_RECORDS_COLLISIONS", superGuy.r, True)
  4033.                             End If
  4034.  
  4035.                             If superGuy.bLocked AndAlso Not bBeeped AndAlso (superGuy.targetPed = Player.Character) Then
  4036.                                 If timeWaitBeep <= 0 Then
  4037.                                     timeWaitBeep = 10
  4038.                                     bBeeped = True
  4039.  
  4040.                                     If bSoundOK AndAlso bArmorON Then sndBeep.Play()
  4041.                                 Else
  4042.                                     timeWaitBeep -= intervalFix()
  4043.                                 End If
  4044.  
  4045.                                 bMissileAlarm = True
  4046.                             End If
  4047.  
  4048.                             If (superGuy.timeOut > 1000) OrElse Native.Function.Call(Of Boolean)("has_object_collided_with_anything", superGuy.r) Then
  4049.                                 'Native.Function.Call("stop_sound", superGuy.IDLaunchSound)
  4050.                                 Native.Function.Call("stop_sound", superGuy.IDMoveSound)
  4051.  
  4052.                                 stopPTFX(superGuy.PTFXMove)
  4053.  
  4054.                                 World.AddExplosion(superGuy.r.Position)
  4055.  
  4056.                                 If superGuy.targetPed.Position.DistanceTo(superGuy.r.Position) < 5 Then
  4057.                                     For Each p As Ped In World.GetPeds(superGuy.r.Position, 5.0)
  4058.                                         If Exists(p) Then
  4059.                                             p.PreventRagdoll = False
  4060.  
  4061.                                             If p = Player.Character Then
  4062.                                                 If Not bGodMode Then
  4063.                                                     explosionEffectTIme = 500
  4064.  
  4065.                                                     If flying Then
  4066.                                                         switchFlight(True)
  4067.                                                         superGuy.targetPed.Euphoria.BodyBalance.Start(2000)
  4068.                                                     Else
  4069.                                                         superGuy.targetPed.Euphoria.BodyBalance.Start(1000)
  4070.                                                     End If
  4071.  
  4072.                                                     timePlayJarvisWarn = TRandom.Next(200, 400)
  4073.                                                 End If
  4074.                                             Else
  4075.                                                 For Each s As TSuperGuy In TSuperGuyList
  4076.                                                     If s.p = p Then s.explosionEffectTIme = 250
  4077.                                                 Next
  4078.  
  4079.                                                 p.ForceRagdoll(5000, False)
  4080.                                             End If
  4081.  
  4082.                                             p.ApplyForce(Vector3.Normalize(superGuy.flightDir) * 3, Vector3.WorldNorth * 0.5)
  4083.                                             'p.Health -= (20 + (5 * TRandom.NextDouble()))
  4084.  
  4085.                                             If (p = Player.Character) AndAlso Not bGodMode Then
  4086.                                                 damageTime = 0
  4087.  
  4088.                                                 'p.Health -= (40 + (5 * TRandom.NextDouble()))
  4089.                                             End If
  4090.                                         End If
  4091.                                     Next
  4092.                                 End If
  4093.  
  4094.                                 Native.Function.Call("SET_OBJECT_RECORDS_COLLISIONS", superGuy.r, False)
  4095.  
  4096.                                 superGuy.r.Visible = False
  4097.  
  4098.                                 getGameSoundID(superGuy.IDMoveSound)
  4099.  
  4100.                                 superGuy.r.AttachToPed(superGuy.p, Bone.LeftArmRoll, Vector3.Zero, Vector3.Zero)
  4101.  
  4102.                                 superGuy.bLaunched = False
  4103.                             Else
  4104.                                 superGuy.timeOut += intervalFix()
  4105.                             End If
  4106.                         End If
  4107.  
  4108.                         If superGuy.targetPed.Health <= 0 Then superGuy.targetPed = Nothing
  4109.                     Else
  4110.                         If superGuy.enemy Then
  4111.                             superGuy.targetPed = Player.Character
  4112.                         Else
  4113.                             Dim tmpTarget As TSuperGuy = Nothing
  4114.                             Dim tmpPossibleTarget As Ped = Nothing
  4115.  
  4116.                             For Each s As TSuperGuy In TSuperGuyList
  4117.                                 If Exists(s.p) AndAlso s.enemy AndAlso (s.p.Health > 0) AndAlso (s.p.Position.DistanceTo(superGuy.p.Position) < 100) Then
  4118.                                     tmpTarget = s
  4119.  
  4120.                                     For Each s2 As TSuperGuy In TSuperGuyList
  4121.                                         If Not s2.enemy AndAlso (s2.targetPed = s.p) Then
  4122.                                             tmpTarget = Nothing
  4123.                                             tmpPossibleTarget = s.p
  4124.                                             Exit For
  4125.                                         End If
  4126.                                     Next
  4127.  
  4128.                                     If Exists(tmpTarget) Then
  4129.                                         superGuy.targetPed = tmpTarget.p
  4130.  
  4131.                                         Exit For
  4132.                                     End If
  4133.                                 End If
  4134.                             Next
  4135.  
  4136.                             If Not Exists(superGuy.targetPed) AndAlso Exists(tmpPossibleTarget) Then superGuy.targetPed = tmpPossibleTarget
  4137.  
  4138.                             If Not Exists(superGuy.targetPed) AndAlso Not Exists(superGuy.targetPedSecondary) Then
  4139.                                 For Each en As TEnemyBlip In TEnemyBlipList
  4140.                                     If Exists(en.p) AndAlso (en.p.Health > 0) AndAlso (en.p.Position.DistanceTo(Player.Character.Position) < 60) Then
  4141.                                         superGuy.targetPedSecondary = en.p
  4142.  
  4143.                                         Exit For
  4144.                                     End If
  4145.                                 Next
  4146.                             End If
  4147.                         End If
  4148.                     End If
  4149.  
  4150.                     If Not Exists(superGuy.targetPed) AndAlso Exists(superGuy.targetPedSecondary) Then
  4151.                         If superGuy.targetPedSecondary.Health <= 0 Then
  4152.                             superGuy.targetPedSecondary = Nothing
  4153.                         Else
  4154.                             superGuy.shootCannonTick()
  4155.                         End If
  4156.                     End If
  4157.                 ElseIf superGuy.removeTime = -666 Then
  4158.                     superGuy.removeTime = 1000
  4159.  
  4160.                     If Exists(superGuy.p) Then
  4161.                         If Not Exists(superGuy.p.CurrentVehicle) Then superGuy.p.Task.ClearAllImmediately()
  4162.                         superGuy.p.Die()
  4163.                         superGuy.p.ForceRagdoll(50000, False)
  4164.                     End If
  4165.  
  4166.                     If superGuy.enemy AndAlso (superGuy.targetPed = Player.Character) AndAlso Not superGuy.heliPassenger Then
  4167.                         timePlayJarvisCongrats = TRandom.Next(200, 400)
  4168.                     End If
  4169.                 ElseIf superGuy.removeTime > 0 Then
  4170.                     superGuy.removeTime -= intervalFix()
  4171.  
  4172.                     If superGuy.removeTime <= 0 Then removeSuperGuy(superGuy)
  4173.                 End If
  4174.             Else
  4175.                 If Exists(superGuy.p) Then
  4176.                     If Not Exists(superGuy.p.CurrentVehicle) Then superGuy.p.Task.ClearAllImmediately()
  4177.                     superGuy.p.Die()
  4178.                     superGuy.p.ForceRagdoll(50000, False)
  4179.                 End If
  4180.  
  4181.                 removeSuperGuy(superGuy)
  4182.             End If
  4183.         Next
  4184.  
  4185.         If bAiming Then
  4186.             If timeWaitBeep <= 0 Then
  4187.                 timeWaitBeep = 100
  4188.                 If bSoundOK AndAlso bArmorON Then sndBeep.Play()
  4189.  
  4190.                 bMissileAlarm = True
  4191.             Else
  4192.                 timeWaitBeep -= intervalFix()
  4193.             End If
  4194.         End If
  4195.  
  4196.         For c As Int16 = TSuperGuyExplodeList.Count - 1 To 0 Step -1
  4197.             superGuy = TSuperGuyExplodeList(c)
  4198.  
  4199.             If superGuy.timeToExplode > 0 Then
  4200.                 superGuy.timeToExplode -= intervalFix()
  4201.  
  4202.                 If (superGuy.timeToExplode <= 1000) AndAlso Exists(superGuy.p) Then
  4203.                     Dim tmpPos As Vector3 = superGuy.p.GetBonePosition(Bone.Head)
  4204.  
  4205.                     Native.Function.Call("draw_corona", tmpPos.X, tmpPos.Y, tmpPos.Z, (1000 - superGuy.timeToExplode) * 0.2, 0, 0, 200, 200, 255)
  4206.                 End If
  4207.  
  4208.                 If superGuy.timeToExplode <= 0 Then
  4209.                     If Exists(superGuy.p) Then
  4210.                         Native.Function.Call("stop_ptfx", superGuy.ptfxDamage)
  4211.  
  4212.                         World.AddExplosion(superGuy.p.GetBonePosition(Bone.Head), ExplosionType.Rocket, 1000, True, True, 1.5)
  4213.  
  4214.                         superGuy.ptfxDamage = Native.Function.Call(Of Int32)("START_PTFX_ON_ped", "exp_ship_destroy", superGuy.p, 0, 0, 0, 0, 0, 0, 0.2)
  4215.                     End If
  4216.  
  4217.                     TSuperGuyExplodeList.RemoveAt(c)
  4218.                 End If
  4219.             End If
  4220.         Next
  4221.     End Sub
  4222.  
  4223.     Private Sub removeSuperGuy(superGuy As TSuperGuy)
  4224.         If superGuy.heliPassenger Then createNewTSuperGuy(Nothing)
  4225.  
  4226.         If Exists(superGuy.p) Then
  4227.             If Not superGuy.heliPassenger AndAlso (TSuperGuyExplodeList.IndexOf(superGuy) < 0) Then TSuperGuyExplodeList.Add(superGuy)
  4228.  
  4229.             If superGuy.p.Health > 0 Then
  4230.                 superGuy.p.Task.ClearAllImmediately()
  4231.                 superGuy.p.Animation.Play(animSetFlight, "", 10)
  4232.                 superGuy.p.isRagdoll = True
  4233.             End If
  4234.  
  4235.             superGuy.p.NoLongerNeeded()
  4236.         End If
  4237.  
  4238.         superGuy.removeTime = -666
  4239.  
  4240.         If Exists(superGuy.heli) Then superGuy.heli.NoLongerNeeded()
  4241.  
  4242.         'getGameSoundID(superGuy.IDLaunchSound)
  4243.         getGameSoundID(superGuy.IDMoveSound)
  4244.  
  4245.         stopPTFX(superGuy.PTFXMove)
  4246.  
  4247.         superGuy.r.Detach()
  4248.         superGuy.r.FreezePosition = True
  4249.         superGuy.r.Visible = False
  4250.         Native.Function.Call("set_object_collision", superGuy.r, False)
  4251.  
  4252.         freeRocketList.Add(superGuy.r)
  4253.  
  4254.         superGuy.blip.Delete()
  4255.  
  4256.         Dim c As Int16 = TSuperGuyList.IndexOf(superGuy)
  4257.  
  4258.         If c >= 0 Then TSuperGuyList.RemoveAt(c)
  4259.     End Sub
  4260.  
  4261.     Private Sub gunsTick()
  4262.         If timeShooting > 0 Then
  4263.             timeShooting -= intervalFix()
  4264.  
  4265.             If timeShooting <= 0 Then
  4266.                 If Not bNoWanted Then
  4267.                     If timeSetWanted <= 0 Then
  4268.                         timeSetWanted = 1000
  4269.  
  4270.                         For Each p As Ped In World.GetPeds(Player.Character.Position, 100)
  4271.                             If Exists(p) AndAlso (p.PedType = PedType.Cop) Then
  4272.                                 Native.Function.Call("SET_MAX_WANTED_LEVEL", 6)
  4273.                                 Native.Function.Call("ALTER_WANTED_LEVEL_NO_DROP", Player, 2)
  4274.                                 Native.Function.Call("APPLY_WANTED_LEVEL_CHANGE_NOW", Player)
  4275.  
  4276.                                 Exit For
  4277.                             End If
  4278.                         Next
  4279.                     Else
  4280.                         timeSetWanted -= intervalFix()
  4281.                     End If
  4282.                 End If
  4283.             End If
  4284.         End If
  4285.  
  4286.         For Each d As TDarts In DartsList
  4287.             If Exists(d.dart) Then
  4288.                 If Not d.launched Then
  4289.                     If bAimDown Then
  4290.                         d.attach(Player.Character)
  4291.                     Else
  4292.                         d.Hide()
  4293.                     End If
  4294.                 End If
  4295.             Else
  4296.                 createObject("cj_dart_6", Vector3.Zero + Vector3.WorldUp * 9, d.dart, 10)
  4297.  
  4298.                 If Exists(d.dart) Then d.Hide()
  4299.             End If
  4300.         Next
  4301.  
  4302.         If bAimDown AndAlso (gunMode = 0) AndAlso (playerArmor.weaponSet = 1) Then
  4303.             Native.Function.Call("stop_sound", IDsndCannonRotate)
  4304.             Native.Function.Call("PLAY_SOUND_FROM_ped", IDsndCannonRotate, "general_weapons_minigun_loop", Player.Character)
  4305.         Else
  4306.             Native.Function.Call("stop_sound", IDsndCannonRotate)
  4307.         End If
  4308.  
  4309.         If bAimDown AndAlso ((gunMode = 0) OrElse (gunMode = 2) OrElse (gunMode = 3)) AndAlso bAttackDown AndAlso (myFlyHabs.Speed <= speedSlow) Then
  4310.             If gunMode <> 3 Then
  4311.                 timeKeeArmAnim = 200
  4312.             Else
  4313.                 timeKeeArmAnim = 400
  4314.             End If
  4315.  
  4316.             'If (playerArmor.weaponSet = 0) Then
  4317.             '    If Not Player.Character.Animation.isPlaying(animSetPointArm, "dir_traffic_idle") Then _
  4318.             '        Player.Character.Animation.Play(animSetPointArm, "dir_traffic_idle", 3.5, AnimationFlags.Unknown06)
  4319.             'End If
  4320.  
  4321.             If ((gunMode = 0) AndAlso playerArmor.handCannon) OrElse (gunMode = 3) OrElse ((gunMode = 2) AndAlso playerArmor.weaponSet = 0) Then
  4322.                 If Not Player.Character.Animation.isPlaying(animSetPointArm, "dir_traffic_idle") Then
  4323.                     Player.Character.Animation.Play(animSetPointArm, "dir_traffic_idle", 3.5, AnimationFlags.Unknown06)
  4324.  
  4325.                     timeWaitStartCannonShoot = 20
  4326.                 End If
  4327.             End If
  4328.         ElseIf timeKeeArmAnim > 0 Then
  4329.             timeKeeArmAnim -= intervalFix()
  4330.  
  4331.             'If (playerArmor.weaponSet = 1) Then Native.Function.Call("stop_sound", IDsndCannonRotate)
  4332.         Else
  4333.             If Player.Character.Animation.isPlaying(animSetPointArm, "dir_traffic_idle") Then
  4334.                 If Not flying Then
  4335.                     Player.Character.Animation.Play(animSetPointArm, "", 1)
  4336.                 Else
  4337.                     Player.Character.Animation.Play(animSetFlight, "full_brake_for_landing", 5.0, AnimationFlags.Unknown05)
  4338.                 End If
  4339.             End If
  4340.         End If
  4341.  
  4342.         If (gunMode = 1) OrElse (gunMode = 2) Then
  4343.             If bAimDown Then
  4344.                 'targetObejctAux.Position = Game.CurrentCamera.Position
  4345.  
  4346.                 If Exists(targetObejctAux) Then
  4347.                     targetObejctAux.Position = Player.Character.Position
  4348.  
  4349.                     Dim tmpRot As Vector3 = Game.CurrentCamera.Rotation
  4350.                     tmpRot.Y = targetHUDRotation
  4351.                     targetObejctAux.Rotation = tmpRot
  4352.                     targetHUDRotation += 10
  4353.  
  4354.                     If targetHUDRotation > 360 Then targetHUDRotation = 0
  4355.                 Else
  4356.                     createObject("cj_dart_6", Vector3.Zero + Vector3.WorldUp * 6, targetObejctAux, 0)
  4357.                 End If
  4358.             End If
  4359.  
  4360.             searchDartsTargets()
  4361.  
  4362.             DrawDartTargets()
  4363.  
  4364.             If timeWaitLaunchDarts > 0 Then
  4365.                 If myRealSpeed <= speedSlow Then
  4366.                     timeWaitLaunchDarts -= intervalFix()
  4367.                 Else
  4368.                     timeWaitLaunchDarts = 0
  4369.                 End If
  4370.             Else
  4371.                 launchDarts()
  4372.             End If
  4373.  
  4374.             checkDartsCollision()
  4375.  
  4376.             'msg("time " & timeWaitLaunchDarts.ToString & "    index " & indexCheckDartShoot.ToString & "   launched count " & LaunchedDartsList.Count.ToString, 1000)
  4377.         End If
  4378.  
  4379.         If timeShootSuperCannon > 0 Then timeShootSuperCannon -= intervalFix()
  4380.  
  4381.         If (gunMode = 0) AndAlso (myRealSpeed < speedSlow) Then
  4382.             If bAimDown Then
  4383.                 If Not flying AndAlso Not bLandAnim Then
  4384.                     If playerArmor.shoulderCannon OrElse playerArmor.superCannon Then
  4385.                         If Not Player.Character.Animation.isPlaying(animSetFlight, "full_brake_for_landing") Then _
  4386.                             Player.Character.Animation.Play(animSetFlight, "full_brake_for_landing", 8, AnimationFlags.Unknown05)
  4387.                     Else
  4388.                         If Player.Character.Animation.isPlaying(animSetFlight, "full_brake_for_landing") Then _
  4389.                             Player.Character.Animation.Play(animSetFlight, "", 8)
  4390.                     End If
  4391.                 End If
  4392.  
  4393.                 If bAttackDown Then
  4394.                     If (weaponHeat0 + 8) < 100 Then
  4395.                         If timeShootCannon <= 0 Then
  4396.                             If playerArmor.weaponSet = 0 Then
  4397.                                 timeShootCannon = 20
  4398.                             Else
  4399.                                 timeShootCannon = 10
  4400.                             End If
  4401.  
  4402.                             Dim tmpPosIni As GTA.Vector3
  4403.  
  4404.                             If camMode = 0 Then
  4405.                                 If flying OrElse (Player.Character.Velocity.DistanceTo(Vector3.Zero) > 1) Then
  4406.                                     tmpPosIni = Game.CurrentCamera.Position + Game.CurrentCamera.Direction * (Game.CurrentCamera.Position.DistanceTo(Player.Character.Position) + 2.5)
  4407.                                 Else
  4408.                                     tmpPosIni = Game.CurrentCamera.Position + Game.CurrentCamera.Direction * (Game.CurrentCamera.Position.DistanceTo(Player.Character.Position))
  4409.                                 End If
  4410.                             Else
  4411.                                 tmpPosIni = Game.CurrentCamera.Position + Game.CurrentCamera.Direction
  4412.                             End If
  4413.  
  4414.                             Dim tmpDir As GTA.Vector3
  4415.  
  4416.                             If Not flying AndAlso (Player.Character.Direction.DistanceTo2D(Game.CurrentCamera.Direction) > 1) Then
  4417.                                 tmpDir = Player.Character.Direction
  4418.                                 tmpDir.Z = Game.CurrentCamera.Direction.Z
  4419.                             Else
  4420.                                 tmpDir = Game.CurrentCamera.Direction
  4421.                             End If
  4422.  
  4423.                             Dim tmpPosFin As GTA.Vector3
  4424.  
  4425.                             If Exists(AutoAimedPed) Then
  4426.                                 tmpPosFin = AutoAimedPed.Position + Game.CurrentCamera.Direction * 2
  4427.                             ElseIf Exists(Player.GetTargetedPed) Then
  4428.                                 tmpPosFin = Player.GetTargetedPed.Position + Game.CurrentCamera.Direction * 2
  4429.                             Else
  4430.                                 tmpPosFin = (tmpPosIni + tmpDir * 300).Around(2)
  4431.                             End If
  4432.  
  4433.                             If (camMode = 0) Then
  4434.                                 If playerArmor.handCannon Then
  4435.                                     If Player.Character.Animation.isPlaying(animSetPointArm, "dir_traffic_idle") Then
  4436.                                         If timeWaitStartCannonShoot <= 0 Then
  4437.                                             Native.Function.Call(Of Int32)("trigger_PTFX_ON_ped_bone", "muz_machine", Player.Character,
  4438.                                                 playerArmor.cannonHandOffset.X, playerArmor.cannonHandOffset.Y, playerArmor.cannonHandOffset.Z, 0, 0, 45.0, Bone.LeftHand, 0.7)
  4439.  
  4440.                                             If Not flying Then
  4441.                                                 Native.Function.Call(Of Int32)("trigger_PTFX_ON_ped", "wpn_bullet_trace", Player.Character,
  4442.                                                     playerArmor.cannonHandOffset.X, playerArmor.cannonHandOffset.Y + 1, playerArmor.cannonHandOffset.Z + 0.35, -90.0 + Game.CurrentCamera.Rotation.X, 0, 0, 1.0)
  4443.                                             End If
  4444.  
  4445.                                             Native.Function.Call("FIRE_SINGLE_BULLET", tmpPosIni.X, tmpPosIni.Y, tmpPosIni.Z, tmpPosFin.X, tmpPosFin.Y, tmpPosFin.Z, playerArmor.handCannon_Damage)
  4446.                                             Native.Function.Call("PLAY_SOUND_FROM_position", -1, "eagle_shot_1", tmpPosIni.X, tmpPosIni.Y, tmpPosIni.Z)
  4447.                                             weaponHeat0 += 2
  4448.                                         Else
  4449.                                             timeWaitStartCannonShoot -= intervalFix()
  4450.                                         End If
  4451.                                     Else
  4452.                                         Player.Character.Animation.Play(animSetPointArm, "dir_traffic_idle", 8, AnimationFlags.Unknown06)
  4453.                                     End If
  4454.                                 End If
  4455.  
  4456.                                 If playerArmor.shoulderCannon Then
  4457.                                     Native.Function.Call(Of Int32)("trigger_PTFX_ON_ped", "muz_machine", Player.Character,
  4458.                                         playerArmor.cannonShoulderOffset.X, playerArmor.cannonShoulderOffset.Y, playerArmor.cannonShoulderOffset.Z, 0, 0, 90.0, 0.7)
  4459.  
  4460.                                     If Not flying Then _
  4461.                                         Native.Function.Call(Of Int32)("trigger_PTFX_ON_ped", "wpn_bullet_trace", Player.Character,
  4462.                                             playerArmor.cannonShoulderOffset.X, playerArmor.cannonShoulderOffset.Y + 1, playerArmor.cannonShoulderOffset.Z, -90.0 + Game.CurrentCamera.Rotation.X, 0, 0, 1.0)
  4463.  
  4464.                                     Native.Function.Call("FIRE_SINGLE_BULLET", tmpPosIni.X, tmpPosIni.Y, tmpPosIni.Z, tmpPosFin.X, tmpPosFin.Y, tmpPosFin.Z, playerArmor.shoulderCannon_Damage)
  4465.                                     Native.Function.Call("PLAY_SOUND_FROM_position", -1, "shotgun_fire", tmpPosIni.X, tmpPosIni.Y, tmpPosIni.Z)
  4466.                                     weaponHeat0 += 1
  4467.                                 End If
  4468.  
  4469.                                 If playerArmor.superCannon AndAlso (timeShootSuperCannon <= 0) Then
  4470.                                     timeShootSuperCannon = 50
  4471.  
  4472.                                     Native.Function.Call(Of Int32)("trigger_PTFX_ON_ped_bone", "muz_machine", Player.Character,
  4473.                                         playerArmor.superCannonShoulderOffset.X, playerArmor.superCannonShoulderOffset.Y, playerArmor.superCannonShoulderOffset.Z, _
  4474.                                             15.0, 13.0, 109.0, Bone.LeftUpperarmRoll, 1.0)
  4475.  
  4476.                                     Native.Function.Call("PLAY_SOUND_FROM_position", -1, "shotgun_fire", tmpPosIni.X, tmpPosIni.Y, tmpPosIni.Z)
  4477.  
  4478.                                     Native.Function.Call("FIRE_SINGLE_BULLET", tmpPosIni.X, tmpPosIni.Y, tmpPosIni.Z, tmpPosFin.X, tmpPosFin.Y, tmpPosFin.Z, playerArmor.superCannon_Power)
  4479.                                     Native.Function.Call("FIRE_SINGLE_BULLET", tmpPosIni.X, tmpPosIni.Y, tmpPosIni.Z, tmpPosFin.X, tmpPosFin.Y, tmpPosFin.Z, playerArmor.superCannon_Power)
  4480.                                     Native.Function.Call("FIRE_SINGLE_BULLET", tmpPosIni.X, tmpPosIni.Y, tmpPosIni.Z, tmpPosFin.X, tmpPosFin.Y, tmpPosFin.Z, playerArmor.superCannon_Power)
  4481.                                     Native.Function.Call("FIRE_SINGLE_BULLET", tmpPosIni.X, tmpPosIni.Y, tmpPosIni.Z, tmpPosFin.X, tmpPosFin.Y, tmpPosFin.Z, playerArmor.superCannon_Power)
  4482.                                     Native.Function.Call("FIRE_SINGLE_BULLET", tmpPosIni.X, tmpPosIni.Y, tmpPosIni.Z, tmpPosFin.X, tmpPosFin.Y, tmpPosFin.Z, playerArmor.superCannon_Power)
  4483.  
  4484.                                     weaponHeat0 += 1
  4485.                                 End If
  4486.                             End If
  4487.  
  4488.                             If timeShooting <= 0 Then
  4489.                                 timeShooting = 100
  4490.                                 timeSetWanted = 0
  4491.                             End If
  4492.                         Else
  4493.                             timeShootCannon -= intervalFix()
  4494.                         End If
  4495.                     End If
  4496.                 End If
  4497.             Else
  4498.                 If Not flying AndAlso Not bLandAnim AndAlso Player.Character.Animation.isPlaying(animSetFlight, "full_brake_for_landing") Then _
  4499.                     Player.Character.Animation.Play(animSetFlight, "", 8)
  4500.             End If
  4501.         End If
  4502.  
  4503.         ' repulsor beam
  4504.         If (gunMode = 3) OrElse (gunMode = 4) Then
  4505.             If bAimDown AndAlso (timeWaitShootRepulsor > 0) Then
  4506.                 timeWaitShootRepulsor -= intervalFix()
  4507.  
  4508.                 If timeWaitShootRepulsor <= 0 Then
  4509.                     repulsorLight.Enabled = True
  4510.  
  4511.                     timeRepulsorBeamON = 200
  4512.                     timeKeepRepulsorSound = 1000
  4513.  
  4514.                     If bSoundOK Then sndRepulsorBlast.Play()
  4515.  
  4516.                     If gunMode = 3 Then
  4517.                         weaponHeat3 += 20
  4518.                     Else
  4519.                         weaponHeat4 += 35
  4520.                     End If
  4521.  
  4522.                     If timeShooting <= 0 Then
  4523.                         timeShooting = 100
  4524.                         timeSetWanted = 0
  4525.                     End If
  4526.                 End If
  4527.             End If
  4528.  
  4529.             If timeWaitRepulsorSound > 0 Then
  4530.                 timeWaitRepulsorSound -= intervalFix()
  4531.  
  4532.                 If timeWaitRepulsorSound <= 0 Then
  4533.                 End If
  4534.             End If
  4535.  
  4536.             If Not bAimDown Then
  4537.                 timeWaitShootRepulsor = 0
  4538.                 timeRepulsorBeamON = 0
  4539.  
  4540.                 If flying Then myFlyHabs.FreezePosition = False
  4541.                 Player.Character.FreezePosition = False
  4542.  
  4543.                 repulsorLight.Enabled = False
  4544.  
  4545.                 If Not flying AndAlso Player.Character.Animation.isPlaying(animSetFlight, "full_brake_for_landing") AndAlso Not bLandAnim Then _
  4546.                     Player.Character.Animation.Play(animSetFlight, "", 10)
  4547.             End If
  4548.  
  4549.             If timeRepulsorBeamON > 0 Then
  4550.                 myFlyHabs.FreezePosition = True
  4551.                 Player.Character.FreezePosition = True
  4552.  
  4553.                 Dim iniPos As Vector3
  4554.                 Dim iniPosShoot As Vector3
  4555.                 Dim iniDirection, tmpiniDirection As Vector3
  4556.                 Dim tmpPos As Vector3
  4557.  
  4558.                 If gunMode = 3 Then
  4559.                     iniPos = Player.Character.GetBonePosition(Bone.LeftHand)
  4560.                 ElseIf gunMode = 4 Then
  4561.                     iniPos = Player.Character.Position + Vector3.WorldUp * 0.35
  4562.                 End If
  4563.  
  4564.                 iniPosShoot = iniPos + Game.CurrentCamera.Direction * 0.2
  4565.                 tmpPos = iniPos
  4566.  
  4567.                 If bAimDown Then
  4568.                     If Not Exists(AutoAimedPed) Then
  4569.                         iniDirection = Game.CurrentCamera.Direction
  4570.                     Else
  4571.                         iniDirection = Vector3.Normalize(AutoAimedPed.Position + Vector3.WorldUp * 0.25 - Game.CurrentCamera.Position)
  4572.                     End If
  4573.                 Else
  4574.                     iniDirection = Player.Character.Direction
  4575.  
  4576.                     iniDirection.Z = Game.CurrentCamera.Direction.Z
  4577.                 End If
  4578.  
  4579.                 If Not repulsorChest Then
  4580.                     tmpPos += iniDirection * 0.5
  4581.                 Else
  4582.                     tmpPos += iniDirection * 0.8
  4583.  
  4584.                     If flying Then tmpPos.Z += 0.15
  4585.                     'If myFlyHabs.Rotation.X < 0 Then tmpPos.Z = Player.Character.Position.Z + 0.2
  4586.                 End If
  4587.  
  4588.                 If Not flying Then
  4589.                     If iniDirection.Z > 0.45 Then iniDirection.Z = 0.45
  4590.                     If iniDirection.Z < -0.45 Then iniDirection.Z = -0.45
  4591.                 End If
  4592.  
  4593.                 Dim tmpSpace As Double = 0.2
  4594.                 Dim shake As Double
  4595.                 Dim tmpDiameter As Double = repulsorDiameter * 0.2
  4596.  
  4597.                 'If camMode = 1 Then tmpDiameter *= 0.2
  4598.  
  4599.                 While tmpPos.DistanceTo(Player.Character.Position) < 50
  4600.                     shake = 0.05 * TRandom.NextDouble()
  4601.  
  4602.                     If tmpDiameter < repulsorDiameter Then
  4603.                         tmpDiameter += 10
  4604.  
  4605.                         If tmpDiameter > repulsorDiameter Then tmpDiameter = repulsorDiameter
  4606.                     End If
  4607.  
  4608.                     If Not repulsorChest Then
  4609.                         Native.Function.Call("draw_corona", tmpPos.X, tmpPos.Y, tmpPos.Z + shake, tmpDiameter, 0, 0, 255, 100, 51)
  4610.                     Else
  4611.                         Native.Function.Call("draw_corona", tmpPos.X, tmpPos.Y, tmpPos.Z + shake, tmpDiameter, 0, 0, 122, 215, 242)
  4612.                     End If
  4613.  
  4614.                     tmpiniDirection = iniDirection * tmpSpace
  4615.  
  4616.                     If Not flying Then
  4617.                         If tmpiniDirection.Z > 0.45 Then tmpiniDirection.Z = 0.45
  4618.                         If tmpiniDirection.Z < -0.45 Then tmpiniDirection.Z = -0.45
  4619.                     End If
  4620.  
  4621.                     tmpPos += tmpiniDirection
  4622.  
  4623.                     If tmpSpace < 1 Then tmpSpace += 0.01
  4624.                 End While
  4625.  
  4626.                 tmpPos = iniPosShoot + iniDirection * 50
  4627.  
  4628.                 If Not repulsorChest Then
  4629.                     repulsorLight.Color = Color.FromArgb(255, 200, 180, 100)
  4630.                 Else
  4631.                     repulsorLight.Color = Color.FromArgb(255, 122, 215, 242)
  4632.                 End If
  4633.  
  4634.                 repulsorLight.Position = iniPos + iniDirection
  4635.                 repulsorLight.Intensity = 50 + 50 * TRandom.NextDouble()
  4636.  
  4637.                 Dim tmpDist As Double
  4638.                 Dim tmpPosCompare As Vector3
  4639.  
  4640.                 For Each p As Ped In pedsRepulsorHit
  4641.                     If Exists(p) AndAlso (p <> Player.Character) AndAlso Not Exists(p.CurrentVehicle) Then
  4642.                         'If (p.Position.DistanceTo(tmpPos) <= 1) Then
  4643.                         tmpDist = p.Position.DistanceTo(Player.Character.Position)
  4644.                         tmpPosCompare = Player.Character.Position + iniDirection * tmpDist
  4645.  
  4646.                         If (p.Position.DistanceTo(tmpPosCompare) <= 1) OrElse _
  4647.                            ((AutoAimedPed = p) AndAlso (p.Position.DistanceTo(tmpPosCompare) < 2)) Then
  4648.                             If Not p.isRagdoll Then
  4649.                                 p.PreventRagdoll = False
  4650.                                 p.ForceRagdoll(1000, True)
  4651.                             End If
  4652.  
  4653.                             If Not repulsorChest Then
  4654.                                 p.ApplyForce(iniDirection * 0.6, Vector3.WorldNorth * 0.5)
  4655.                             Else
  4656.                                 p.ApplyForce(iniDirection * 1.2 + Vector3.WorldUp * 0.5, Vector3.WorldNorth * 0.5)
  4657.  
  4658.                                 World.AddExplosion(p.Position, ExplosionType.Default, 0.5, False, True, 0)
  4659.                             End If
  4660.  
  4661.                             If Not p.isOnFire Then
  4662.                                 p.isOnFire = True
  4663.                             End If
  4664.  
  4665.                             If Not repulsorChest Then
  4666.                                 Native.Function.Call("draw_corona", tmpPosCompare.X, tmpPosCompare.Y, tmpPosCompare.Z, tmpDiameter * (55 - tmpDist) * 0.2, 0, 0, 255, 100, 51)
  4667.                             Else
  4668.                                 Native.Function.Call("draw_corona", tmpPosCompare.X, tmpPosCompare.Y, tmpPosCompare.Z, tmpDiameter * (55 - tmpDist) * 0.2, 0, 0, 122, 215, 242)
  4669.                             End If
  4670.                         End If
  4671.                     End If
  4672.                 Next
  4673.  
  4674.                 For Each v As Vehicle In vehRepulsorHit
  4675.                     If Exists(v) AndAlso (v <> myFlyHabs) Then
  4676.                         tmpDist = v.Position.DistanceTo(Player.Character.Position)
  4677.                         tmpPosCompare = Player.Character.Position + iniDirection * tmpDist
  4678.  
  4679.                         If v.Position.DistanceTo(tmpPosCompare) <= 2 Then
  4680.                             If repulsorChest Then
  4681.                                 v.ApplyForce(iniDirection * 0.4 + Vector3.WorldUp * 0.05)
  4682.  
  4683.                                 If Not v.Metadata.chestExp Then
  4684.                                     v.Metadata.chestExp = True
  4685.                                     World.AddExplosion(v.Position - iniDirection * 3, ExplosionType.Default, 1.0, False, True, 0)
  4686.                                     v.ApplyForce(Vector3.WorldUp, Vector3.WorldNorth)
  4687.                                 End If
  4688.                             Else
  4689.                                 v.ApplyForce(iniDirection * 0.8 + Vector3.WorldUp * 0.05)
  4690.                             End If
  4691.  
  4692.                             v.PetrolTankHealth = -1
  4693.  
  4694.                             If Not repulsorChest Then
  4695.                                 Native.Function.Call("draw_corona", tmpPosCompare.X, tmpPosCompare.Y, tmpPosCompare.Z, tmpDiameter * (75 - tmpDist) * 0.5, 0, 0, 255, 100, 51)
  4696.                             Else
  4697.                                 Native.Function.Call("draw_corona", tmpPosCompare.X, tmpPosCompare.Y, tmpPosCompare.Z, tmpDiameter * (75 - tmpDist) * 0.5, 0, 0, 122, 215, 242)
  4698.                             End If
  4699.                         End If
  4700.                     End If
  4701.                 Next
  4702.  
  4703.                 Native.Function.Call("FIRE_SINGLE_BULLET", iniPosShoot.X, iniPosShoot.Y, iniPosShoot.Z, tmpPos.X, tmpPos.Y, tmpPos.Z, 1)
  4704.                 tmpPos = tmpPos.Around(0.2)
  4705.                 Native.Function.Call("FIRE_SINGLE_BULLET", iniPosShoot.X, iniPosShoot.Y, iniPosShoot.Z, tmpPos.X, tmpPos.Y, tmpPos.Z, 1)
  4706.                 tmpPos = tmpPos.Around(0.2)
  4707.                 Native.Function.Call("FIRE_SINGLE_BULLET", iniPosShoot.X, iniPosShoot.Y, iniPosShoot.Z, tmpPos.X, tmpPos.Y, tmpPos.Z, 1)
  4708.  
  4709.                 If repulsorChest Then
  4710.                     Native.Function.Call("FIRE_SINGLE_BULLET", iniPosShoot.X, iniPosShoot.Y, iniPosShoot.Z, tmpPos.X, tmpPos.Y, tmpPos.Z, 1)
  4711.                     tmpPos = tmpPos.Around(0.2)
  4712.                     Native.Function.Call("FIRE_SINGLE_BULLET", iniPosShoot.X, iniPosShoot.Y, iniPosShoot.Z, tmpPos.X, tmpPos.Y, tmpPos.Z, 1)
  4713.                     tmpPos = tmpPos.Around(0.2)
  4714.                     Native.Function.Call("FIRE_SINGLE_BULLET", iniPosShoot.X, iniPosShoot.Y, iniPosShoot.Z, tmpPos.X, tmpPos.Y, tmpPos.Z, 1)
  4715.                 End If
  4716.  
  4717.                 stopPTFX(PTFXRepulsor)
  4718.  
  4719.                 If Not repulsorChest Then
  4720.                     PTFXRepulsor = Native.Function.Call(Of Int32)("START_PTFX_ON_PED_BONE", "break_sparks", Player.Character, 0, 0, 0, 0.0, 45.0, 0, Bone.LeftHand, 0.2)
  4721.                 Else
  4722.                     PTFXRepulsor = Native.Function.Call(Of Int32)("START_PTFX_ON_PED_BONE", "break_sparks", Player.Character, 0, 0.5, 0.3, -45.0, 0, 0, Bone.Root, 0.2)
  4723.                 End If
  4724.  
  4725.                 timeRepulsorBeamON -= intervalFix()
  4726.  
  4727.                 If timeRepulsorBeamON <= 0 Then
  4728.                     timeWaitShootRepulsor = 0
  4729.  
  4730.                     repulsorLight.Enabled = False
  4731.  
  4732.                     If flying Then myFlyHabs.FreezePosition = False
  4733.                     Player.Character.FreezePosition = False
  4734.  
  4735.                     If Not flying AndAlso Player.Character.Animation.isPlaying(animSetFlight, "full_brake_for_landing") Then Player.Character.Animation.Play(animSetFlight, "", 10)
  4736.                 End If
  4737.             End If
  4738.         End If
  4739.     End Sub
  4740.  
  4741.     Private Sub searchDartsTargets()
  4742.         If (timeSearchForPedTargets <= 0) Then
  4743.             timeSearchForPedTargets = 125
  4744.  
  4745.             If LaunchedDartsList.Count = DartsList.Count Then Exit Sub
  4746.  
  4747.             If bAimDown Then
  4748.                 Dim tmpDist As Double
  4749.                 Dim tmpPos As Vector3
  4750.  
  4751.                 If gunMode = 1 Then
  4752.                     For c As Int16 = pedTargets.Count - 1 To 0 Step -1
  4753.                         If Not Exists(pedTargets(c)) OrElse Not pedTargets(c).isOnScreen OrElse pedTargets(c).isDead Then
  4754.                             pedTargets.RemoveAt(c)
  4755.                         End If
  4756.                     Next
  4757.  
  4758.                     pedTargets.AddRange(World.GetPeds(Player.Character.Position + Game.CurrentCamera.Direction * 50, 100))
  4759.  
  4760.                     Try
  4761.                         pedTargets.RemoveDead()
  4762.                         pedTargets.OrderByDistanceTo(Player.Character.Position)
  4763.                     Catch
  4764.                     End Try
  4765.  
  4766.                     For c As Int16 = 0 To pedTargets.Count - 1
  4767.                         If Exists(pedTargets(c)) AndAlso Exists(pedTargets(c)) AndAlso pedTargets(c).isAlive AndAlso (pedTargets(c) <> Player.Character) AndAlso pedTargets(c).isOnScreen Then
  4768.                             Dim bExists As Boolean = False
  4769.  
  4770.                             For Each d As TDarts In DartsList
  4771.                                 If (d.target = pedTargets(c)) Then
  4772.                                     bExists = True
  4773.  
  4774.                                     Exit For
  4775.                                 End If
  4776.                             Next
  4777.  
  4778.                             If bExists Then Continue For
  4779.  
  4780.                             tmpDist = pedTargets(c).Position.DistanceTo(Game.CurrentCamera.Position) ' *** testar mira
  4781.                             tmpPos = Game.CurrentCamera.Position + Game.CurrentCamera.Direction * tmpDist
  4782.  
  4783.                             If pedTargets(c).Position.DistanceTo(tmpPos) <= 1 Then
  4784.                                 For Each d As TDarts In DartsList
  4785.                                     If Not d.launched AndAlso Not Exists(d.target) AndAlso (LaunchedDartsList.IndexOf(d) < 0) Then
  4786.                                         d.targetVeh = Nothing
  4787.                                         d.target = pedTargets(c)
  4788.                                         d.targetSuperGuy = Nothing
  4789.                                         d.targetReady = True
  4790.                                         bAnTargetLocked = True
  4791.                                         d.diameterMulti = 1
  4792.  
  4793.                                         If (timeKeepRepulsorSound <= 0) AndAlso bSoundOK Then sndTargetSet.Play()
  4794.  
  4795.                                         Exit For
  4796.                                     End If
  4797.  
  4798.                                     If DartsList.IndexOf(d) = DartsList.Count - 1 Then Exit For
  4799.                                 Next
  4800.                             End If
  4801.                         End If
  4802.                     Next
  4803.                 ElseIf gunMode = 2 Then
  4804.                     vehTargets = World.GetVehicles(Player.Character.Position + Game.CurrentCamera.Direction * 100, 200)
  4805.  
  4806.                     Dim bExists As Boolean = False
  4807.  
  4808.                     For Each v As Vehicle In vehTargets
  4809.                         If Exists(v) AndAlso (v <> myFlyHabs) AndAlso v.isOnScreen Then
  4810.                             bExists = False
  4811.  
  4812.                             For Each d As TDarts In DartsList
  4813.                                 If (d.targetVeh = v) Then
  4814.                                     bExists = True
  4815.  
  4816.                                     Exit For
  4817.                                 End If
  4818.                             Next
  4819.  
  4820.                             If bExists Then Continue For
  4821.  
  4822.                             tmpDist = v.Position.DistanceTo(Player.Character.Position)
  4823.                             tmpPos = Player.Character.Position + Game.CurrentCamera.Direction * tmpDist
  4824.  
  4825.                             Native.Function.Call("DRAW_CHECKPOINT", tmpPos.X, tmpPos.Y, tmpPos.Z, 5, 0, 255, 0)
  4826.  
  4827.                             If v.Position.DistanceTo(tmpPos) < 3 Then
  4828.                                 For Each d As TDarts In DartsList
  4829.                                     If Not Exists(d.targetVeh) AndAlso (LaunchedDartsList.IndexOf(d) < 0) Then
  4830.                                         d.target = Nothing
  4831.                                         d.targetVeh = v
  4832.                                         d.targetSuperGuy = Nothing
  4833.                                         d.targetReady = True
  4834.                                         bAnTargetLocked = True
  4835.                                         d.diameterMulti = v.Model.GetDimensions.Y / 3
  4836.  
  4837.                                         If (timeKeepRepulsorSound <= 0) AndAlso bSoundOK Then sndTargetSet.Play()
  4838.  
  4839.                                         Exit For
  4840.                                     End If
  4841.                                 Next
  4842.                             End If
  4843.                         End If
  4844.                     Next
  4845.  
  4846.                     For Each s As TSuperGuy In TSuperGuyList
  4847.                         If Exists(s.p) Then
  4848.                             tmpDist = s.p.Position.DistanceTo(Game.CurrentCamera.Position)
  4849.                             tmpPos = Game.CurrentCamera.Position + Game.CurrentCamera.Direction * tmpDist
  4850.  
  4851.                             If s.p.Position.DistanceTo(tmpPos) < 2 Then
  4852.                                 bExists = False
  4853.  
  4854.                                 For Each d As TDarts In DartsList
  4855.                                     If d.targetSuperGuy = s.p Then
  4856.                                         bExists = True
  4857.                                         Exit For
  4858.                                     End If
  4859.                                 Next
  4860.  
  4861.                                 If bExists Then Continue For
  4862.  
  4863.                                 For Each d As TDarts In DartsList
  4864.                                     If Not Exists(d.targetSuperGuy) AndAlso (LaunchedDartsList.IndexOf(d) < 0) Then
  4865.                                         d.target = Nothing
  4866.                                         d.targetVeh = Nothing
  4867.                                         d.targetSuperGuy = s.p
  4868.                                         d.targetReady = True
  4869.                                         bAnTargetLocked = True
  4870.                                         d.diameterMulti = 1
  4871.  
  4872.                                         If (timeKeepRepulsorSound <= 0) AndAlso bSoundOK Then sndTargetSet.Play()
  4873.  
  4874.                                         Exit For
  4875.                                     End If
  4876.                                 Next
  4877.                             End If
  4878.                         End If
  4879.                     Next
  4880.                 End If
  4881.             Else
  4882.                 For Each d As TDarts In DartsList
  4883.                     If Not d.launched Then
  4884.                         d.target = Nothing
  4885.                         d.targetVeh = Nothing
  4886.                         d.targetSuperGuy = Nothing
  4887.                         d.targetReady = False
  4888.                         d.diameterMulti = 1
  4889.                     End If
  4890.                 Next
  4891.             End If
  4892.         Else
  4893.             timeSearchForPedTargets -= intervalFix()
  4894.         End If
  4895.     End Sub
  4896.  
  4897.     Private Sub keepArmorConfig()
  4898.         Try
  4899.             If timeKeepArmorConfig <= 0 Then
  4900.                 timeKeepArmorConfig = 1000
  4901.  
  4902.                 If bArmorON Then Player.Character.MakeProofTo(False, True, False, bNoFlightCollisionDetection OrElse bPlayerFallingDamageProof, True)
  4903.  
  4904.                 If Exists(myFlyHabs) Then
  4905.                     myFlyHabs.Visible = False
  4906.                     myFlyHabs.MakeProofTo(True, True, True, False, True)
  4907.                     myFlyHabs.CanBeDamaged = False
  4908.                     myFlyHabs.CanBeVisiblyDamaged = False
  4909.                 End If
  4910.             Else
  4911.                 timeKeepArmorConfig -= intervalFix()
  4912.             End If
  4913.         Catch
  4914.         End Try
  4915.     End Sub
  4916.  
  4917.     Private Sub DrawDartTargets()
  4918.         For Each d As TDarts In DartsList
  4919.             If Not bAimDown AndAlso Not d.launched Then
  4920.                 d.target = Nothing
  4921.                 d.targetVeh = Nothing
  4922.                 d.targetSuperGuy = Nothing
  4923.  
  4924.                 timeSearchForPedTargets = 0
  4925.             End If
  4926.  
  4927.             If Not d.launched AndAlso (Exists(d.target) OrElse Exists(d.targetVeh) OrElse Exists(d.targetSuperGuy)) Then
  4928.                 If (Exists(d.target) AndAlso (Not d.target.isOnScreen OrElse d.target.isDead)) OrElse _
  4929.                    (Exists(d.targetVeh) AndAlso (Not d.targetVeh.isOnScreen)) OrElse _
  4930.                    (Exists(d.targetSuperGuy) AndAlso (Not d.targetSuperGuy.isOnScreen OrElse d.targetSuperGuy.isDead)) Then
  4931.                     If Exists(d.target) Then d.target = Nothing
  4932.                     If Exists(d.targetVeh) Then d.targetVeh = Nothing
  4933.                     If Exists(d.targetSuperGuy) Then d.targetSuperGuy = Nothing
  4934.                     d.targetReady = False
  4935.                 Else
  4936.                     If Exists(targetObejctAux) Then
  4937.                         Dim tmpDist As Double
  4938.                         Dim tmpPosHead As Vector3
  4939.                         Dim tmpPos As Vector3
  4940.                         Dim tmpXOff, tmpYOff As Double
  4941.  
  4942.                         If Exists(d.target) Then
  4943.                             tmpDist = d.target.Position.DistanceTo(Player.Character.Position) * 0.01
  4944.                             tmpPosHead = d.target.GetBonePosition(Bone.Head)
  4945.                             tmpXOff = 0.25
  4946.                             tmpYOff = 0.25
  4947.  
  4948.                             tmpPos = tmpPosHead + targetObejctAux.Position - targetObejctAux.GetOffsetPosition(Vector3.RelativeRight * tmpXOff)
  4949.                         ElseIf Exists(d.targetVeh) Then
  4950.                             tmpDist = d.targetVeh.Position.DistanceTo(Player.Character.Position) * 0.01
  4951.                             tmpPosHead = d.targetVeh.Position
  4952.                             tmpXOff = 1
  4953.                             tmpYOff = 1
  4954.                             tmpPos = tmpPosHead + targetObejctAux.Position - targetObejctAux.GetOffsetPosition(Vector3.RelativeRight * tmpXOff * d.diameterMulti)
  4955.  
  4956.                             Native.Function.Call("draw_corona", tmpPosHead.X, tmpPosHead.Y, tmpPosHead.Z, tmpDist * 100 * 0.8, 0, 0, 255, 0, 0)
  4957.                             Native.Function.Call("DRAW_CHECKPOINT", tmpPosHead.X, tmpPosHead.Y, tmpPosHead.Z, tmpDist * 0.8, 255, 0, 0)
  4958.                         ElseIf Exists(d.targetSuperGuy) Then
  4959.                             tmpDist = d.targetSuperGuy.Position.DistanceTo(Player.Character.Position) * 0.01
  4960.                             tmpPosHead = d.targetSuperGuy.Position + Vector3.WorldUp * 0.2
  4961.                             tmpXOff = 0.5
  4962.                             tmpYOff = 0.5
  4963.                             tmpPos = tmpPosHead + targetObejctAux.Position - targetObejctAux.GetOffsetPosition(Vector3.RelativeRight * tmpXOff)
  4964.                         Else
  4965.                             Exit Sub
  4966.                         End If
  4967.  
  4968.                         Native.Function.Call("draw_corona", tmpPos.X, tmpPos.Y, tmpPos.Z, tmpDist * 100, 0, 0, 255, 0, 0)
  4969.                         Native.Function.Call("DRAW_CHECKPOINT", tmpPos.X, tmpPos.Y, tmpPos.Z, tmpDist, 255, 0, 0)
  4970.                         tmpPos = tmpPosHead + targetObejctAux.Position - targetObejctAux.GetOffsetPosition(Vector3.RelativeLeft * tmpXOff * d.diameterMulti)
  4971.                         Native.Function.Call("draw_corona", tmpPos.X, tmpPos.Y, tmpPos.Z, tmpDist * 100, 0, 0, 255, 0, 0)
  4972.                         Native.Function.Call("DRAW_CHECKPOINT", tmpPos.X, tmpPos.Y, tmpPos.Z, tmpDist, 255, 0, 0)
  4973.                         tmpPos = tmpPosHead + targetObejctAux.Position - targetObejctAux.GetOffsetPosition(Vector3.RelativeBottom * tmpYOff * d.diameterMulti)
  4974.                         Native.Function.Call("draw_corona", tmpPos.X, tmpPos.Y, tmpPos.Z, tmpDist * 100, 0, 0, 255, 0, 0)
  4975.                         Native.Function.Call("DRAW_CHECKPOINT", tmpPos.X, tmpPos.Y, tmpPos.Z, tmpDist, 255, 0, 0)
  4976.                         tmpPos = tmpPosHead + targetObejctAux.Position - targetObejctAux.GetOffsetPosition(Vector3.RelativeTop * tmpYOff * d.diameterMulti)
  4977.                         Native.Function.Call("draw_corona", tmpPos.X, tmpPos.Y, tmpPos.Z, tmpDist * 100, 0, 0, 255, 0, 0)
  4978.                         Native.Function.Call("DRAW_CHECKPOINT", tmpPos.X, tmpPos.Y, tmpPos.Z, tmpDist, 255, 0, 0)
  4979.                     End If
  4980.                 End If
  4981.             End If
  4982.         Next
  4983.     End Sub
  4984.  
  4985.     Private Sub launchDarts()
  4986.         If ((gunMode = 1) AndAlso ((weaponHeat1 + 20) > 100)) OrElse ((gunMode = 2) AndAlso ((weaponHeat2 + 10) > 100)) Then indexCheckDartShoot = -1
  4987.  
  4988.         If indexCheckDartShoot > -1 Then
  4989.             If indexCheckDartShoot > DartsList.Count - 1 Then
  4990.                 indexCheckDartShoot = -1
  4991.             Else
  4992.                 If Not DartsList(indexCheckDartShoot).launched AndAlso DartsList(indexCheckDartShoot).targetReady Then
  4993.                     If Exists(DartsList(indexCheckDartShoot).target) Then
  4994.                         weaponHeat1 += 10
  4995.                         DartsList(indexCheckDartShoot).initial_direction = Vector3.Normalize(DartsList(indexCheckDartShoot).target.GetBonePosition(Bone.Head) - DartsList(indexCheckDartShoot).dart.Position)
  4996.                     ElseIf Exists(DartsList(indexCheckDartShoot).targetVeh) Then
  4997.                         If timeShooting <= 0 Then
  4998.                             timeShooting = 100
  4999.                             timeSetWanted = 0
  5000.                         End If
  5001.                         weaponHeat2 += 10
  5002.                         DartsList(indexCheckDartShoot).initial_direction = Vector3.Normalize(DartsList(indexCheckDartShoot).targetVeh.Position - DartsList(indexCheckDartShoot).dart.Position)
  5003.                     ElseIf Exists(DartsList(indexCheckDartShoot).targetSuperGuy) Then
  5004.                         If timeShooting <= 0 Then
  5005.                             timeShooting = 100
  5006.                             timeSetWanted = 0
  5007.                         End If
  5008.                         weaponHeat2 += 10
  5009.                         DartsList(indexCheckDartShoot).initial_direction = Vector3.Normalize(DartsList(indexCheckDartShoot).targetSuperGuy.Position - DartsList(indexCheckDartShoot).dart.Position)
  5010.                     Else
  5011.                         DartsList(indexCheckDartShoot).target = Nothing
  5012.                         DartsList(indexCheckDartShoot).targetVeh = Nothing
  5013.                         DartsList(indexCheckDartShoot).targetSuperGuy = Nothing
  5014.                         Exit Sub
  5015.                     End If
  5016.  
  5017.                     DartsList(indexCheckDartShoot).launched = True
  5018.                     DartsList(indexCheckDartShoot).timeOut = 0
  5019.  
  5020.                     stopPTFX(DartsList(indexCheckDartShoot).PTFXFlight)
  5021.  
  5022.                     'Native.Function.Call("stop_sound", )
  5023.                     'Native.Function.Call("stop_sound", DartsList(indexCheckDartShoot).IDsndMove)
  5024.  
  5025.                     If Exists(DartsList(indexCheckDartShoot).target) Then
  5026.                         DartsList(indexCheckDartShoot).PTFXFlight = Native.Function.Call(Of Int32)("START_PTFX_ON_OBJ", "shot_directed_steam", _
  5027.                             DartsList(indexCheckDartShoot).dart, 0, 0, 0.1, 0, 0, 0, 0.3)
  5028.  
  5029.                         'Native.Function.Call("play_sound_from_object", IDsndLaunchDarts, "silenced_pistol_fire", DartsList(indexCheckDartShoot).dart)
  5030.                         Native.Function.Call("play_sound_from_object", -1, "silenced_pistol_fire", DartsList(indexCheckDartShoot).dart)
  5031.                     ElseIf Exists(DartsList(indexCheckDartShoot).targetVeh) Then
  5032.                         DartsList(indexCheckDartShoot).PTFXFlight = Native.Function.Call(Of Int32)("START_PTFX_ON_OBJ", "weap_rocket_player", _
  5033.                             DartsList(indexCheckDartShoot).dart, 0, 0, 0.1, 0, 0, 0, 0.5)
  5034.  
  5035.                         'Native.Function.Call("play_sound_from_object", DartsList(indexCheckDartShoot).IDsndMove, "GENERAL_WEAPONS_ROCKET_LOOP", DartsList(indexCheckDartShoot).dart)
  5036.                         'Native.Function.Call("play_sound_from_ped", IDsndLaunchDarts, "general_explosions_lows_grenade_explosion_r", Player.Character)
  5037.                         Native.Function.Call("play_sound_from_ped", -1, "general_explosions_lows_grenade_explosion_r", Player.Character)
  5038.                     ElseIf Exists(DartsList(indexCheckDartShoot).targetSuperGuy) Then
  5039.                         DartsList(indexCheckDartShoot).PTFXFlight = Native.Function.Call(Of Int32)("START_PTFX_ON_OBJ", "weap_rocket_player", _
  5040.                             DartsList(indexCheckDartShoot).dart, 0, 0, 0.1, 0, 0, 0, 0.5)
  5041.  
  5042.                         'Native.Function.Call("play_sound_from_object", DartsList(indexCheckDartShoot).IDsndMove, "GENERAL_WEAPONS_ROCKET_LOOP", DartsList(indexCheckDartShoot).dart)
  5043.                         'Native.Function.Call("play_sound_from_ped", IDsndLaunchDarts, "general_explosions_lows_grenade_explosion_r", Player.Character)
  5044.                         Native.Function.Call("play_sound_from_ped", -1, "general_explosions_lows_grenade_explosion_r", Player.Character)
  5045.                     End If
  5046.  
  5047.                     DartsList(indexCheckDartShoot).dart.Detach()
  5048.                     DartsList(indexCheckDartShoot).readyToBlowUp = False
  5049.                     DartsList(indexCheckDartShoot).dart.Visible = True
  5050.  
  5051.                     LaunchedDartsList.Add(DartsList(indexCheckDartShoot))
  5052.                 End If
  5053.  
  5054.                 indexCheckDartShoot += 1
  5055.  
  5056.                 If indexCheckDartShoot > DartsList.Count - 1 Then indexCheckDartShoot = -1
  5057.             End If
  5058.         End If
  5059.     End Sub
  5060.  
  5061.     Private Sub checkDartsCollision()
  5062.         Dim d As TDarts
  5063.  
  5064.         For c As Int16 = LaunchedDartsList.Count - 1 To 0 Step -1
  5065.             d = LaunchedDartsList(c)
  5066.  
  5067.             If d.launched Then
  5068.                 Dim tmpRot As Vector3
  5069.  
  5070.                 If Not Exists(d.target) AndAlso Not Exists(d.targetVeh) AndAlso Not Exists(d.targetSuperGuy) Then
  5071.                     d.dart.ApplyForce(d.initial_direction * 15)
  5072.                     tmpRot = Helper.DirectionToRotation(d.initial_direction, 0)
  5073.                     tmpRot.Y += 90
  5074.                     tmpRot.Z -= 90
  5075.                     d.dart.Rotation = tmpRot
  5076.                 Else
  5077.                     If Exists(d.target) Then
  5078.                         d.initial_direction = Vector3.Normalize(d.target.GetBonePosition(Bone.Head) - d.dart.Position)
  5079.                     ElseIf Exists(d.targetVeh) AndAlso (d.dart.Position.DistanceTo(Player.Character.Position) < d.targetVeh.Position.DistanceTo(Player.Character.Position)) Then
  5080.                         d.initial_direction = Vector3.Normalize(d.targetVeh.Position - d.dart.Position)
  5081.                     ElseIf Exists(d.targetSuperGuy) AndAlso (d.dart.Position.DistanceTo(Player.Character.Position) < d.targetSuperGuy.Position.DistanceTo(Player.Character.Position)) Then
  5082.                         d.initial_direction = Vector3.Normalize(d.targetSuperGuy.Position - d.dart.Position)
  5083.                     End If
  5084.  
  5085.                     If Exists(d.target) AndAlso (d.dart.Position.DistanceTo(d.target.Position) > 5) Then
  5086.                         d.dart.ApplyForce(d.initial_direction * 15 + Vector3.WorldUp * 0.5)
  5087.                     ElseIf (Exists(d.targetVeh) AndAlso (d.dart.Position.DistanceTo(d.targetVeh.Position) > 5)) Then
  5088.                         If d.targetVeh.Model.isHelicopter Then
  5089.                             d.dart.ApplyForce(d.initial_direction * 25 + Vector3.WorldUp)
  5090.                         Else
  5091.                             If d.dart.Position.DistanceTo(d.targetVeh.Position) > 20 Then
  5092.                                 d.dart.ApplyForce(d.initial_direction * 25 + Vector3.WorldUp)
  5093.  
  5094.                                 If myRealSpeed > speedSlow Then _
  5095.                                 d.dart.ApplyForce(d.initial_direction * 25 + Vector3.WorldUp)
  5096.                             Else
  5097.                                 d.dart.ApplyForce(d.initial_direction * 25)
  5098.                             End If
  5099.                         End If
  5100.                     ElseIf (Exists(d.targetSuperGuy) AndAlso (d.dart.Position.DistanceTo(d.targetSuperGuy.Position) > 5)) Then
  5101.                         d.dart.ApplyForce(d.initial_direction * 25 + Vector3.WorldUp)
  5102.                     Else
  5103.                         d.dart.Velocity = (d.initial_direction * 25)
  5104.                     End If
  5105.  
  5106.                     tmpRot = Helper.DirectionToRotation(d.initial_direction, 0)
  5107.                     tmpRot.Y += 90
  5108.                     tmpRot.Z -= 90
  5109.                     d.dart.Rotation = tmpRot
  5110.                 End If
  5111.  
  5112.                 If Not d.readyToBlowUp AndAlso (d.dart.Position.DistanceTo(Player.Character.Position) > 2) Then
  5113.                     Native.Function.Call("SET_OBJECT_RECORDS_COLLISIONS", d.dart, True)
  5114.                     d.readyToBlowUp = True
  5115.                 ElseIf d.readyToBlowUp Then
  5116.                     If Native.Function.Call(Of Boolean)("HAS_OBJECT_COLLIDED_WITH_ANYTHING", d.dart) OrElse (d.timeOut >= 2000) Then
  5117.                         Native.Function.Call("SET_OBJECT_RECORDS_COLLISIONS", d.dart, False)
  5118.                         d.dart.FreezePosition = True
  5119.  
  5120.                         stopPTFX(d.PTFXFlight)
  5121.  
  5122.                         If Exists(d.target) Then
  5123.                             stopPTFX(d.PTFXHit)
  5124.  
  5125.                             'd.PTFXHit = Native.Function.Call(Of Int32)("START_PTFX", "muz_pistol_large", _
  5126.                             '    d.dart.Position.X, d.dart.Position.Y, d.dart.Position.Z, 0, 0, 90.0, 0.5)
  5127.                             Native.Function.Call("trigger_PTFX", "muz_pistol_large", _
  5128.                                 d.dart.Position.X, d.dart.Position.Y, d.dart.Position.Z, 0, 0, 90.0, 0.5)
  5129.  
  5130.                             Dim tmpPosIni, tmpPosFin As Vector3
  5131.  
  5132.                             For Each p As Ped In World.GetPeds(d.dart.Position, 1.5)
  5133.                                 If Exists(p) AndAlso Not p.isDead Then
  5134.                                     Dim bSuperGuy As Boolean = False
  5135.  
  5136.                                     For Each s As TSuperGuy In TSuperGuyList
  5137.                                         If s.p = p Then
  5138.                                             bSuperGuy = True
  5139.                                             p.Health -= 50
  5140.                                         End If
  5141.                                     Next
  5142.  
  5143.                                     If Not bSuperGuy Then
  5144.                                         tmpPosIni = p.GetBonePosition(Bone.Head) - p.Direction * 1
  5145.                                         tmpPosFin = p.GetBonePosition(Bone.Head) + p.Direction * 2
  5146.  
  5147.                                         p.PreventRagdoll = False
  5148.  
  5149.                                         Native.Function.Call("FIRE_SINGLE_BULLET", tmpPosIni.X, tmpPosIni.Y, tmpPosIni.Z, tmpPosFin.X, tmpPosFin.Y, tmpPosFin.Z, 1000)
  5150.  
  5151.                                         If Not bNoWanted AndAlso p.PedType = PedType.Cop Then
  5152.                                             Native.Function.Call("SET_MAX_WANTED_LEVEL", 6)
  5153.                                             Native.Function.Call("ALTER_WANTED_LEVEL_NO_DROP", Player, 2)
  5154.                                             Native.Function.Call("APPLY_WANTED_LEVEL_CHANGE_NOW", Player)
  5155.                                         End If
  5156.                                     End If
  5157.  
  5158.                                     Exit For
  5159.                                 End If
  5160.                             Next
  5161.                         ElseIf Exists(d.targetVeh) OrElse Exists(d.targetSuperGuy) Then
  5162.                             If Not bNoWanted Then
  5163.                                 For Each p As Ped In World.GetPeds(d.dart.Position, 6.0)
  5164.                                     If p.PedType = PedType.Cop Then
  5165.                                         Native.Function.Call("SET_MAX_WANTED_LEVEL", 6)
  5166.                                         Native.Function.Call("ALTER_WANTED_LEVEL_NO_DROP", Player, 2)
  5167.                                         Native.Function.Call("APPLY_WANTED_LEVEL_CHANGE_NOW", Player)
  5168.                                     End If
  5169.                                 Next
  5170.                             End If
  5171.  
  5172.                             World.AddExplosion(d.dart.Position, ExplosionType.Rocket, 100)
  5173.  
  5174.                             If Exists(d.targetSuperGuy) Then
  5175.                                 Dim bHitSG As Boolean = False
  5176.  
  5177.                                 For Each s As TSuperGuy In TSuperGuyList
  5178.                                     bHitSG = (s.p = d.targetSuperGuy) AndAlso (s.p.Position.DistanceTo(d.dart.Position) <= 5)
  5179.  
  5180.                                     If bHitSG Then
  5181.                                         s.explosionEffectTIme = 250
  5182.  
  5183.                                         Exit For
  5184.                                     End If
  5185.                                 Next
  5186.  
  5187.                                 If bHitSG Then
  5188.                                     d.targetSuperGuy.PreventRagdoll = False
  5189.                                     d.targetSuperGuy.ForceRagdoll(5000, False)
  5190.                                     d.targetSuperGuy.ApplyForce(d.initial_direction * 3, Vector3.WorldNorth)
  5191.                                     d.targetSuperGuy.Health -= (20 + (5 * TRandom.NextDouble()))
  5192.                                 End If
  5193.                             End If
  5194.                         End If
  5195.  
  5196.                         d.target = Nothing
  5197.                         d.targetVeh = Nothing
  5198.                         d.targetSuperGuy = Nothing
  5199.  
  5200.                         Native.Function.Call("SET_OBJECT_RECORDS_COLLISIONS", d.dart, True)
  5201.                         d.dart.FreezePosition = False
  5202.  
  5203.                         d.Hide()
  5204.  
  5205.                         LaunchedDartsList.RemoveAt(c)
  5206.                     Else
  5207.                         d.timeOut += intervalFix()
  5208.                     End If
  5209.                 End If
  5210.             Else
  5211.                 d.dart.Visible = False
  5212.             End If
  5213.         Next
  5214.     End Sub
  5215.  
  5216.     Private Sub checkKeys()
  5217.         'bMoveFDown, bMoveBDown, bMoveLDown, bMoveRDown, bJumpDown, bAttackDown, bAimDown, bActionDown, bCrouchDown, bEnterCarDown, _
  5218.         'bEscDown, bPhoneDown, bRadarZoomDown, bReloadDown, bSeekCoverDown, bSoundHornDown, bSprintDown As Boolean
  5219.  
  5220.         'padState = Microsoft.Xna.Framework.Input.GamePad.GetState(Microsoft.Xna.Framework.PlayerIndex.One)
  5221.         'padStateOld = Microsoft.Xna.Framework.Input.GamePad.GetState(Microsoft.Xna.Framework.PlayerIndex.One)
  5222.  
  5223.         bMoveFDown = Game.isGameKeyPressed(GameKey.MoveForward)
  5224.         bMoveBDown = Game.isGameKeyPressed(GameKey.MoveBackward)
  5225.         bMoveLDown = Game.isGameKeyPressed(GameKey.MoveLeft)
  5226.         bMoveRDown = Game.isGameKeyPressed(GameKey.MoveRight)
  5227.         bJumpDown = Game.isGameKeyPressed(GameKey.Jump)
  5228.         bAimDown = Game.isGameKeyPressed(GameKey.Aim) OrElse (controllerConnected() AndAlso controllerState.Triggers.Left)
  5229.         'bAimDown = Game.isGameKeyPressed(GameKey.Aim) OrElse (XControl.IsConnected AndAlso XControl.GetState.Gamepad.LeftTrigger)
  5230.         bSprintDown = Game.isGameKeyPressed(GameKey.Sprint)
  5231.         bActionDown = Game.isGameKeyPressed(GameKey.Action)
  5232.         bAttackDown = Game.isGameKeyPressed(GameKey.Attack) OrElse (controllerConnected() AndAlso controllerState.Triggers.Right)
  5233.         'bAttackDown = Game.isGameKeyPressed(GameKey.Attack) OrElse (XControl.IsConnected AndAlso XControl.GetState.Gamepad.RightTrigger)
  5234.         bSeekCoverDown = Game.isGameKeyPressed(GameKey.SeekCover)
  5235.         bCrouchDown = Game.isGameKeyPressed(GameKey.Crouch)
  5236.         bEnterCarDown = Game.isGameKeyPressed(GameKey.EnterCar)
  5237.         bEscDown = Game.isGameKeyPressed(GameKey.Esc)
  5238.         bPhoneDown = Game.isGameKeyPressed(GameKey.Phone)
  5239.         bRadarZoomDown = Game.isGameKeyPressed(GameKey.RadarZoom)
  5240.         bReloadDown = Game.isGameKeyPressed(GameKey.Reload)
  5241.         bSoundHornDown = Game.isGameKeyPressed(GameKey.SoundHorn)
  5242.         bSoundHornDown = Game.isGameKeyPressed(GameKey.SoundHorn)
  5243.     End Sub
  5244.  
  5245.     Shared Function intervalFix()
  5246.         Return myInterval * (25 / Game.FPS)
  5247.     End Function
  5248.  
  5249.     Private Sub console_CMD(ByVal sender As Object, ByVal e As ConsoleEventArgs) Handles MyBase.ConsoleCommand
  5250.     End Sub
  5251.  
  5252.     Private Function rotateVec(ByVal vec As GTA.Vector3, ByVal angle As Double)
  5253.         angle = angle * (3.1415 / 180)
  5254.  
  5255.         Dim s As Double = System.Math.Sin(angle)
  5256.         Dim c As Double = System.Math.Cos(angle)
  5257.  
  5258.         vec.X = vec.X * c - vec.Y * s
  5259.         vec.Y = vec.X * s + vec.Y * c
  5260.  
  5261.         Return vec
  5262.     End Function
  5263.  
  5264.     Shared Function getGameSoundID(ByRef id As Int32) As Boolean
  5265.         Native.Function.Call("stop_sound", id)
  5266.  
  5267.         If id <> 0 Then
  5268.             Native.Function.Call("release_sound_id", id)
  5269.         End If
  5270.  
  5271.         id = Native.Function.Call(Of Int32)("get_sound_id")
  5272.  
  5273.         Return id > 0
  5274.         'msg(id.ToString, 1000)
  5275.     End Function
  5276.  
  5277.     Private Sub taskResetSoundID(id As Int32)
  5278.         For Each s As TGameSounds In TGameSoundsList
  5279.             If s.id = id Then
  5280.                 s.timeWait = 5000
  5281.  
  5282.                 Exit For
  5283.             End If
  5284.         Next
  5285.     End Sub
  5286.  
  5287.     Shared Sub stopPTFX(ByRef PTFX As Int32)
  5288.         If PTFX <> 0 Then
  5289.             Native.Function.Call("stop_ptfx", PTFX)
  5290.             PTFX = 0
  5291.         End If
  5292.     End Sub
  5293.  
  5294.     ' draw the textures adapting the position, width and height to the user resolution
  5295.     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, _
  5296.        ByVal rot As Double, ByVal col As Drawing.Color, Optional ByVal square As Boolean = False)
  5297.         If square Then
  5298.             e.Graphics.DrawSprite(tex, x * width_Coef, y * height_Coef, w * width_Coef, h * width_Coef, rot, col)
  5299.         Else
  5300.             e.Graphics.DrawSprite(tex, x * width_Coef, y * height_Coef, w * width_Coef, w * height_Coef, rot, col)
  5301.         End If
  5302.     End Sub
  5303.     Private Sub drawSpriteAux2(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, _
  5304.        ByVal rot As Double, ByVal col As Drawing.Color, Optional ByVal square As Boolean = False)
  5305.        If square Then
  5306.           e.Graphics.DrawSprite(tex, x * height_Coef, y * height_Coef, w * height_Coef, w * height_Coef, rot, col)
  5307.        Else
  5308.           e.Graphics.DrawSprite(tex, x * height_Coef, y * height_Coef, w * height_Coef, h * height_Coef, rot, col)
  5309.        End If
  5310.     End Sub
  5311.  
  5312.     Private Sub drawLineAux(ByVal e As GTA.GraphicsEventArgs, ByVal xIni As Double, ByVal yIni As Double, ByVal xFin As Double, ByVal yFin As Double, _
  5313.        ByVal w As Double, ByVal col As Drawing.Color)
  5314.         e.Graphics.DrawLine(xIni * width_Coef, yIni * height_Coef, xFin * width_Coef, yFin * height_Coef, w * width_Coef, col)
  5315.     End Sub
  5316.  
  5317.     Private Sub drawTextAux(ByVal e As GTA.GraphicsEventArgs, ByVal text As String, ByVal x As Double, ByVal y As Double, ByVal col As Drawing.Color)
  5318.         e.Graphics.DrawText(text, x * width_Coef, y * height_Coef, col)
  5319.     End Sub
  5320.  
  5321.     Private Sub drawTextAuxEffect(ByVal e As GTA.GraphicsEventArgs, ByVal text As String, ByVal x As Double, ByVal y As Double, ByVal col As Drawing.Color)
  5322.         e.Graphics.DrawRectangle((x + 148) * width_Coef, (y + 11) * height_Coef, 400 * width_Coef, 29 * height_Coef, Color.FromArgb(100, 0, 0, 0))
  5323.         e.Graphics.DrawText(text, (x + 2) * width_Coef, (y + 2) * height_Coef, Color.Blue)
  5324.         e.Graphics.DrawText(text, x * width_Coef, y * height_Coef, col)
  5325.     End Sub
  5326.  
  5327.     Shared Sub drawTextAuxEffect2(ByVal e As GTA.GraphicsEventArgs, ByVal text As String, ByVal x As Double, ByVal y As Double, ByVal col As Drawing.Color)
  5328.         e.Graphics.DrawRectangle(840, (y + 11) * height_Coef, 1680 * width_Coef, 29 * height_Coef, Color.FromArgb(100, 0, 0, 0))
  5329.         e.Graphics.DrawText(text, (x + 2) * width_Coef, (y + 2) * height_Coef, Color.Blue)
  5330.         e.Graphics.DrawText(text, x * width_Coef, y * height_Coef, col)
  5331.     End Sub
  5332.  
  5333.     Private Sub drawSpriteNumber(ByVal e As GTA.GraphicsEventArgs, ByVal number As Double, ByVal x As Double, ByVal y As Double, ByVal rot As Double, _
  5334.        ByVal scale As Double, ByVal col As Color, disabledColor As Color)
  5335.         Dim int As Int64
  5336.         Dim unit, dozen, hundred, thousand As Int64
  5337.         Dim tColor As Color = col
  5338.         Dim hColor As Color = col
  5339.         Dim dColor As Color = col
  5340.         Dim uColor As Color = col
  5341.  
  5342.         int = Math.Truncate(number)
  5343.  
  5344.         unit = 0
  5345.         dozen = 0
  5346.         hundred = 0
  5347.         thousand = 0
  5348.  
  5349.         If int > 999 Then
  5350.             thousand = Math.Truncate(int / 1000)
  5351.             int -= thousand * 1000
  5352.         Else
  5353.             tColor = disabledColor
  5354.         End If
  5355.  
  5356.         If int > 99 Then
  5357.             hundred = Math.Truncate(int / 100)
  5358.             int -= hundred * 100
  5359.         ElseIf thousand = 0 Then
  5360.             hColor = disabledColor
  5361.         End If
  5362.  
  5363.         If int > 9 Then
  5364.             dozen = Math.Truncate(int / 10)
  5365.             int -= dozen * 10
  5366.         ElseIf hundred + thousand = 0 Then
  5367.             dColor = disabledColor
  5368.         End If
  5369.  
  5370.         If int > 0 Then
  5371.             unit = int
  5372.         End If
  5373.  
  5374.         Dim rotCoef As Double = rot * 12 / 45
  5375.  
  5376.         If tColor <> disabledColor Then drawSpriteAux2(e, texNumbers(thousand).tex, x, y, 20 * scale, 20 * scale, Helper.DegreeToRadian(rot), tColor)
  5377.         If hColor <> disabledColor Then drawSpriteAux2(e, texNumbers(hundred).tex, x + 12, y + rotCoef, 20 * scale, 20 * scale, Helper.DegreeToRadian(rot), hColor)
  5378.         If dColor <> disabledColor Then drawSpriteAux2(e, texNumbers(dozen).tex, x + 24, y + rotCoef * 2, 20 * scale, 20 * scale, Helper.DegreeToRadian(rot), dColor)
  5379.         drawSpriteAux2(e, texNumbers(unit).tex, x + 36, y + rotCoef * 3, 20 * scale, 20 * scale, Helper.DegreeToRadian(rot), uColor)
  5380.     End Sub
  5381.  
  5382.     Private Sub drawFrameAux(ByVal e As GTA.GraphicsEventArgs, x As Double, y As Double, w As Double, h As Double, lw As Double, col As Color)
  5383.         drawLineAux(e, x - (w / 2), y - (h / 2), x + (w / 2), y - (h / 2), 2, Color.FromArgb(150, 255, 255, 255))
  5384.         drawLineAux(e, x - (w / 2), y + (h / 2), x + (w / 2), y + (h / 2), 2, Color.FromArgb(150, 255, 255, 255))
  5385.         drawLineAux(e, x - (w / 2), y - (h / 2), x - (w / 2), y + (h / 2), 2, Color.FromArgb(150, 255, 255, 255))
  5386.         drawLineAux(e, x + (w / 2), y - (h / 2), x + (w / 2), y + (h / 2), 2, Color.FromArgb(150, 255, 255, 255))
  5387.     End Sub
  5388.  
  5389.     Private Sub firstDraw(ByVal e As GTA.GraphicsEventArgs, tex As Texture)
  5390.         Try
  5391.             e.Graphics.DrawSprite(tex, 0, 0, 2, 2, 0)
  5392.         Catch
  5393.         End Try
  5394.     End Sub
  5395.  
  5396.     Private Sub GraphicsEventHandler(ByVal sender As Object, ByVal e As GTA.GraphicsEventArgs) Handles MyBase.PerFrameDrawing
  5397.         If bArmorON AndAlso bFirstDraw Then
  5398.             bFirstDraw = False
  5399.  
  5400.             firstDraw(e, texCannon)
  5401.             firstDraw(e, texChestRep)
  5402.             firstDraw(e, texCrossHair)
  5403.             firstDraw(e, texDarts)
  5404.             firstDraw(e, texHandRep)
  5405.             firstDraw(e, texHUD)
  5406.             firstDraw(e, texHUD_ThrusterBar)
  5407.             firstDraw(e, texHUDBottom)
  5408.             firstDraw(e, texHUDBottonIcon1)
  5409.             firstDraw(e, texHUDBottonIcon1_2)
  5410.             firstDraw(e, texHUDBottonIcon2)
  5411.             firstDraw(e, texHUDBottonIcon2_2)
  5412.             firstDraw(e, texHUDBottonIcon3)
  5413.             firstDraw(e, texHUDBottonIcon3_2)
  5414.             firstDraw(e, texHUDBottonIcon3_3)
  5415.             firstDraw(e, texHUDBottonIcon3_4)
  5416.             firstDraw(e, texHUDBottonIcon4)
  5417.             firstDraw(e, texHUDBottonIcon4_2)
  5418.             firstDraw(e, texHUDBottonIcon5)
  5419.             firstDraw(e, texHUDBottonIcon5_2)
  5420.             firstDraw(e, texHUDHearthIndicator)
  5421.             firstDraw(e, texHUDLeft)
  5422.             firstDraw(e, texHUDLEFT_FlightMode)
  5423.             firstDraw(e, texHUDLEFT_MissileAlarm)
  5424.             firstDraw(e, texHUDRight)
  5425.             firstDraw(e, texHUDRIGHT_Damage)
  5426.             firstDraw(e, texHUDRight_FlightMode)
  5427.             firstDraw(e, texHudRing)
  5428.             firstDraw(e, texHUDTop)
  5429.             firstDraw(e, texRockets)
  5430.  
  5431.             For Each t As TTexNumber In texNumbers
  5432.                 firstDraw(e, t.tex)
  5433.             Next
  5434.  
  5435.             For Each a As TArmor In TArmorList
  5436.                 If a.drawTexture Then drawSpriteAux2(e, a.texMenu, 0, 0, 2, 2, 0, Color.White, True)
  5437.             Next
  5438.         End If
  5439.  
  5440.         If bArmorON AndAlso Not bDrawTextures AndAlso bAimDown AndAlso (Player.Character.Health > 0) Then
  5441.             drawLineAux(e, 825, 524, 855, 524, 2, Color.FromArgb(100, 150, 200, 255))
  5442.             drawLineAux(e, 825, 525, 855, 525, 2, Color.FromArgb(100, 0, 0, 200))
  5443.  
  5444.             drawLineAux(e, 839, 517, 839, 533, 2, Color.FromArgb(100, 150, 200, 255))
  5445.             drawLineAux(e, 840, 517, 840, 533, 2, Color.FromArgb(100, 0, 0, 200))
  5446.  
  5447.             drawLineAux(e, 837, 525, 843, 525, 2, Color.FromArgb(100, 255, 0, 0))
  5448.         End If
  5449.  
  5450.         If bArmorON AndAlso bDrawTextures AndAlso (Player.Character.Health > 0) Then
  5451.             ' For Each s As TSuperGuy In TSuperGuyList
  5452.             '     If Not Exists(s.p) Then Continue For
  5453.  
  5454.             '     If s.enemy Then
  5455.             '         drawSpriteNumber(e, s.p.Health, 20, 50 + 25 * TSuperGuyList.IndexOf(s), 0, 1, Color.Red, Color.FromArgb(255, 255, 150, 150))
  5456.             '     Else
  5457.             '         drawSpriteNumber(e, s.p.Health, 20, 50 + 25 * TSuperGuyList.IndexOf(s), 0, 1, Color.White, Color.LightGray)
  5458.             '     End If
  5459.             ' Next
  5460.  
  5461.             If HUDIndex <> 4 Then
  5462.                 Dim statusColor As Color = Color.White
  5463.                 Dim statusColorHelthBar As Color = Color.White
  5464.  
  5465.                 If damageTime < 255 Then
  5466.                     damageTime += 10
  5467.  
  5468.                     If damageTime > 255 Then damageTime = 255
  5469.  
  5470.                     statusColor = Color.FromArgb(255, 255, damageTime, damageTime)
  5471.                     statusColorHelthBar = Color.FromArgb(255, 255, damageTime, damageTime)
  5472.                 End If
  5473.  
  5474.                 e.Graphics.DrawSprite(texHUDLeft, 120 * width_Coef, 520 * height_Coef, 300 * height_Coef, 1060 * height_Coef, 0, statusColor)
  5475.                 If (HUDIndex = 2) OrElse (HUDIndex = 3) Then
  5476.                     If flying Then e.Graphics.DrawSprite(texHUDLEFT_FlightMode, 150 * width_Coef, 520 * height_Coef, 400 * height_Coef, 1060 * height_Coef, 0, statusColor)
  5477.                     If bMissileAlarm Then e.Graphics.DrawSprite(texHUDLEFT_MissileAlarm, 150 * width_Coef, 520 * height_Coef, 500 * height_Coef, 1060 * height_Coef, 0, statusColor)
  5478.                     bMissileAlarm = False
  5479.                 End If
  5480.  
  5481.                 If HUDIndex = 1 Then
  5482.                     e.Graphics.DrawSprite(texHUDRight, 1550 * width_Coef, 520 * height_Coef, 400 * height_Coef, 1060 * height_Coef, 0, statusColor)
  5483.                 ElseIf HUDIndex = 2 Then
  5484.                     e.Graphics.DrawSprite(texHUDRight, 1550 * width_Coef, 570 * height_Coef, 400 * height_Coef, 1060 * height_Coef, 0, statusColor)
  5485.  
  5486.                     If (Player.Character.Health < 500) Then
  5487.                         If bDrawDamageIndicator Then e.Graphics.DrawSprite(texHUDRIGHT_Damage, 1550 * width_Coef, 570 * height_Coef, 400 * height_Coef, 1060 * height_Coef, 0, statusColor)
  5488.  
  5489.                         bDrawDamageIndicator = Not bDrawDamageIndicator
  5490.                     End If
  5491.                 ElseIf HUDIndex = 3 Then
  5492.                     e.Graphics.DrawSprite(texHUDRight, 1300 * width_Coef, 800 * height_Coef, 800 * height_Coef, 1000 * height_Coef, 0, statusColor)
  5493.  
  5494.                     If (Player.Character.Health < 500) Then
  5495.                         If bDrawDamageIndicator Then e.Graphics.DrawSprite(texHUDRIGHT_Damage, 1301 * width_Coef, 800 * height_Coef, 810 * height_Coef, 1010 * height_Coef, 0, statusColor)
  5496.  
  5497.                         bDrawDamageIndicator = Not bDrawDamageIndicator
  5498.                     End If
  5499.                 End If
  5500.  
  5501.                 e.Graphics.DrawSprite(texHUDTop, 840 * width_Coef, 70 * height_Coef, 1680 * height_Coef, 100 * height_Coef, 0, statusColor)
  5502.  
  5503.                 '*** bottom area start ***
  5504.                 If HUDIndex = 1 Then
  5505.                     e.Graphics.DrawSprite(texHUDBottom, 960 * width_Coef, 970 * height_Coef, 1400 * height_Coef, 100 * height_Coef, 0, statusColor)
  5506.                 Else
  5507.                     If Not bAimDown Then
  5508.                         e.Graphics.DrawSprite(texHUDBottonIcon1, 960 * width_Coef, 970 * height_Coef, 1300 * height_Coef, 130 * height_Coef, 0, statusColor)
  5509.                     Else
  5510.                         e.Graphics.DrawSprite(texHUDBottonIcon1_2, 960 * width_Coef, 970 * height_Coef, 1300 * height_Coef, 130 * height_Coef, 0, statusColor)
  5511.                     End If
  5512.  
  5513.                     If bAnTargetLocked Then
  5514.                         e.Graphics.DrawSprite(texHUDBottonIcon2_2, 960 * width_Coef, 970 * height_Coef, 1400 * height_Coef, 130 * height_Coef, 0, statusColor)
  5515.                     Else
  5516.                         e.Graphics.DrawSprite(texHUDBottonIcon2, 960 * width_Coef, 970 * height_Coef, 1400 * height_Coef, 130 * height_Coef, 0, statusColor)
  5517.                     End If
  5518.  
  5519.                     If Not flying Then
  5520.                         e.Graphics.DrawSprite(texHUDBottonIcon3, 960 * width_Coef, 970 * height_Coef, 1400 * height_Coef, 130 * height_Coef, 0, statusColor)
  5521.                     Else
  5522.                         If myRealSpeed <= speedSlow Then
  5523.                             e.Graphics.DrawSprite(texHUDBottonIcon3_2, 960 * width_Coef, 970 * height_Coef, 1400 * height_Coef, 130 * height_Coef, 0, statusColor)
  5524.                         ElseIf mySpeed < speedFast Then
  5525.                             e.Graphics.DrawSprite(texHUDBottonIcon3_3, 960 * width_Coef, 970 * height_Coef, 1400 * height_Coef, 130 * height_Coef, 0, statusColor)
  5526.                         Else
  5527.                             e.Graphics.DrawSprite(texHUDBottonIcon3_4, 960 * width_Coef, 970 * height_Coef, 1400 * height_Coef, 130 * height_Coef, 0, statusColor)
  5528.                         End If
  5529.  
  5530.                         If HUDIndex = 3 Then
  5531.                             e.Graphics.DrawSprite(texHUDRight_FlightMode, 1300 * width_Coef, 800 * height_Coef, 800 * height_Coef, 1000 * height_Coef, 0, statusColor)
  5532.  
  5533.                             e.Graphics.DrawSprite(texHUD_ThrusterBar, 115 * width_Coef, 485 * height_Coef, 25 * height_Coef, 50 * height_Coef, 0, statusColor)
  5534.                             e.Graphics.DrawSprite(texHUD_ThrusterBar, 115 * width_Coef, 545 * height_Coef, 25 * height_Coef, 50 * height_Coef, 0, statusColor)
  5535.                             e.Graphics.DrawSprite(texHUD_ThrusterBar, 115 * width_Coef, 605 * height_Coef, 25 * height_Coef, 50 * height_Coef, 0, statusColor)
  5536.                             e.Graphics.DrawSprite(texHUD_ThrusterBar, 115 * width_Coef, 665 * height_Coef, 25 * height_Coef, 50 * height_Coef, 0, statusColor)
  5537.  
  5538.                             If bSprintDown OrElse (myRealSpeed > speedSlow) Then
  5539.                                 e.Graphics.DrawSprite(texHUD_ThrusterBar, 130 * width_Coef, 485 * height_Coef, 25 * height_Coef, 50 * height_Coef, 0, statusColor)
  5540.                                 e.Graphics.DrawSprite(texHUD_ThrusterBar, 130 * width_Coef, 545 * height_Coef, 25 * height_Coef, 50 * height_Coef, 0, statusColor)
  5541.                                 e.Graphics.DrawSprite(texHUD_ThrusterBar, 130 * width_Coef, 605 * height_Coef, 25 * height_Coef, 50 * height_Coef, 0, statusColor)
  5542.                                 e.Graphics.DrawSprite(texHUD_ThrusterBar, 130 * width_Coef, 665 * height_Coef, 25 * height_Coef, 50 * height_Coef, 0, statusColor)
  5543.                             End If
  5544.  
  5545.                             If (myRealSpeed > speedFast * 0.8) Then
  5546.                                 e.Graphics.DrawSprite(texHUD_ThrusterBar, 145 * width_Coef, 485 * height_Coef, 25 * height_Coef, 50 * height_Coef, 0, statusColor)
  5547.                                 e.Graphics.DrawSprite(texHUD_ThrusterBar, 145 * width_Coef, 545 * height_Coef, 25 * height_Coef, 50 * height_Coef, 0, statusColor)
  5548.                                 e.Graphics.DrawSprite(texHUD_ThrusterBar, 145 * width_Coef, 605 * height_Coef, 25 * height_Coef, 50 * height_Coef, 0, statusColor)
  5549.                                 e.Graphics.DrawSprite(texHUD_ThrusterBar, 145 * width_Coef, 665 * height_Coef, 25 * height_Coef, 50 * height_Coef, 0, statusColor)
  5550.                             End If
  5551.                             If myRealSpeed >= speedFast Then
  5552.                                 e.Graphics.DrawSprite(texHUD_ThrusterBar, 160 * width_Coef, 485 * height_Coef, 25 * height_Coef, 50 * height_Coef, 0, statusColor)
  5553.                                 e.Graphics.DrawSprite(texHUD_ThrusterBar, 160 * width_Coef, 545 * height_Coef, 25 * height_Coef, 50 * height_Coef, 0, statusColor)
  5554.                                 e.Graphics.DrawSprite(texHUD_ThrusterBar, 160 * width_Coef, 605 * height_Coef, 25 * height_Coef, 50 * height_Coef, 0, statusColor)
  5555.                                 e.Graphics.DrawSprite(texHUD_ThrusterBar, 160 * width_Coef, 665 * height_Coef, 25 * height_Coef, 50 * height_Coef, 0, statusColor)
  5556.  
  5557.                                 If myRealSpeed > speedFast * 2 Then
  5558.                                     e.Graphics.DrawSprite(texHUD_ThrusterBar, 175 * width_Coef, 485 * height_Coef, 25 * height_Coef, 50 * height_Coef, 0, statusColor)
  5559.                                     e.Graphics.DrawSprite(texHUD_ThrusterBar, 175 * width_Coef, 545 * height_Coef, 25 * height_Coef, 50 * height_Coef, 0, statusColor)
  5560.                                     e.Graphics.DrawSprite(texHUD_ThrusterBar, 175 * width_Coef, 605 * height_Coef, 25 * height_Coef, 50 * height_Coef, 0, statusColor)
  5561.                                     e.Graphics.DrawSprite(texHUD_ThrusterBar, 175 * width_Coef, 665 * height_Coef, 25 * height_Coef, 50 * height_Coef, 0, statusColor)
  5562.                                 End If
  5563.                             End If
  5564.                         End If
  5565.                     End If
  5566.  
  5567.                     If bShowMenu OrElse bShowArmorMenu OrElse bShowArmorOptionsMenu Then
  5568.                         e.Graphics.DrawSprite(texHUDBottonIcon4_2, 960 * width_Coef, 970 * height_Coef, 1400 * height_Coef, 130 * height_Coef, 0, statusColor)
  5569.                     Else
  5570.                         e.Graphics.DrawSprite(texHUDBottonIcon4, 960 * width_Coef, 970 * height_Coef, 1400 * height_Coef, 130 * height_Coef, 0, statusColor)
  5571.                     End If
  5572.  
  5573.                     If bDrawDamageIndicator AndAlso (Player.Character.Health < 500) Then
  5574.                         e.Graphics.DrawSprite(texHUDBottonIcon5_2, 960 * width_Coef, 970 * height_Coef, 1400 * height_Coef, 130 * height_Coef, 0, statusColor)
  5575.                     Else
  5576.                         e.Graphics.DrawSprite(texHUDBottonIcon5, 960 * width_Coef, 970 * height_Coef, 1400 * height_Coef, 130 * height_Coef, 0, statusColor)
  5577.                     End If
  5578.                 End If
  5579.                 '*** bottom area end ***
  5580.  
  5581.                 If bShowingWeaponSelector Then
  5582.                     drawSpriteAux2(e, texWSelect, 1680 / 2, 1050 / 2, 300, 300, 0, statusColor)
  5583.  
  5584.                     If gunMode = 0 Then drawSpriteAux2(e, texCannon, (1680 / 2), (1050 / 2) - 115, 80, 80, 0, statusColor) Else drawSpriteAux2(e, texCannon, (1680 / 2), (1050 / 2) - 115, 60, 60, 0, Color.FromArgb(255, 100, 100, 100))
  5585.                     If gunMode = 1 Then drawSpriteAux2(e, texDarts, (1680 / 2) + 110, (1050 / 2) - 35, 80, 80, 0, statusColor) Else drawSpriteAux2(e, texDarts, (1680 / 2) + 110, (1050 / 2) - 35, 50, 50, 0, Color.FromArgb(255, 100, 100, 100))
  5586.                     If gunMode = 2 Then drawSpriteAux2(e, texRockets, (1680 / 2) + 70, (1050 / 2) + 87, 70, 70, 0, statusColor, True) Else drawSpriteAux2(e, texRockets, (1680 / 2) + 70, (1050 / 2) + 87, 50, 50, 0, Color.FromArgb(255, 100, 100, 100))
  5587.                     If gunMode = 3 Then drawSpriteAux2(e, texHandRep, (1680 / 2) - 65, (1050 / 2) + 87, 80, 80, 0, statusColor) Else drawSpriteAux2(e, texHandRep, (1680 / 2) - 65, (1050 / 2) + 87, 50, 50, 0, Color.FromArgb(255, 100, 100, 100))
  5588.                     If gunMode = 4 Then drawSpriteAux2(e, texChestRep, (1680 / 2) - 110, (1050 / 2) - 30, 80, 80, 0, statusColor) Else drawSpriteAux2(e, texChestRep, (1680 / 2) - 110, (1050 / 2) - 30, 50, 50, 0, Color.FromArgb(255, 100, 100, 100))
  5589.                 End If
  5590.  
  5591.                 drawSpriteAux2(e, texHudRing, 200, 880, 334, 334, hudRotation, statusColor)
  5592.  
  5593.                 hudRotation += 0.01 + (1 * myRealSpeed / 500)
  5594.  
  5595.                 If hudRotation > 360 Then hudRotation = 0
  5596.  
  5597.                 If Player.Character.Health < (35 * Player.Character.Health / 100) Then
  5598.                     drawSpriteAux2(e, texHUD, 200, 864, 367, 325, 0, Color.Red)
  5599.                     statusColorHelthBar = Color.Red
  5600.                 Else
  5601.                     drawSpriteAux2(e, texHUD, 200, 864, 367, 325, 0, statusColor)
  5602.                 End If
  5603.  
  5604.                 Dim tmpH As Int16 = (Player.Character.Health * 100 / 1000)
  5605.  
  5606.                 If tmpH > 1 Then drawSpriteAux2(e, texBar, 139, 767, 10, 59, Helper.DegreeToRadian(-29), statusColorHelthBar)
  5607.                 If tmpH > 5 Then drawSpriteAux2(e, texBar, 149, 762, 10, 58, Helper.DegreeToRadian(-23), statusColorHelthBar)
  5608.                 If tmpH > 10 Then drawSpriteAux2(e, texBar, 161, 758, 10, 57, Helper.DegreeToRadian(-15), statusColorHelthBar)
  5609.                 If tmpH > 15 Then drawSpriteAux2(e, texBar, 173, 756, 10, 56, Helper.DegreeToRadian(-10), statusColorHelthBar)
  5610.                 If tmpH > 20 Then drawSpriteAux2(e, texBar, 185, 755, 10, 55, Helper.DegreeToRadian(-3), statusColorHelthBar)
  5611.                 If tmpH > 25 Then drawSpriteAux2(e, texBar, 195, 755, 10, 54, Helper.DegreeToRadian(-1), statusColorHelthBar)
  5612.                 If tmpH > 30 Then drawSpriteAux2(e, texBar, 206, 756, 10, 53, Helper.DegreeToRadian(3), statusColorHelthBar)
  5613.                 If tmpH > 35 Then drawSpriteAux2(e, texBar, 217, 758, 10, 52, Helper.DegreeToRadian(7), statusColorHelthBar)
  5614.                 If tmpH > 40 Then drawSpriteAux2(e, texBar, 228, 760, 10, 51, Helper.DegreeToRadian(13), statusColorHelthBar)
  5615.                 If tmpH > 45 Then drawSpriteAux2(e, texBar, 238, 764, 10, 50, Helper.DegreeToRadian(16), statusColorHelthBar)
  5616.                 If tmpH > 50 Then drawSpriteAux2(e, texBar, 248, 768, 10, 49, Helper.DegreeToRadian(21), statusColorHelthBar)
  5617.                 If tmpH > 55 Then drawSpriteAux2(e, texBar, 258, 773, 10, 48, Helper.DegreeToRadian(27), statusColorHelthBar)
  5618.                 If tmpH > 60 Then drawSpriteAux2(e, texBar, 268, 779, 10, 47, Helper.DegreeToRadian(33), statusColorHelthBar)
  5619.                 If tmpH > 65 Then drawSpriteAux2(e, texBar, 277, 786, 10, 46, Helper.DegreeToRadian(39), statusColorHelthBar)
  5620.                 If tmpH > 70 Then drawSpriteAux2(e, texBar, 285, 793, 10, 45, Helper.DegreeToRadian(42), statusColorHelthBar)
  5621.                 If tmpH > 75 Then drawSpriteAux2(e, texBar, 293, 801, 10, 44, Helper.DegreeToRadian(47), statusColorHelthBar)
  5622.                 If tmpH > 80 Then drawSpriteAux2(e, texBar, 300, 810, 10, 43, Helper.DegreeToRadian(53), statusColorHelthBar)
  5623.                 If tmpH > 85 Then drawSpriteAux2(e, texBar, 305, 820, 10, 42, Helper.DegreeToRadian(58), statusColorHelthBar)
  5624.                 If tmpH > 90 Then drawSpriteAux2(e, texBar, 310, 829, 10, 41, Helper.DegreeToRadian(62), statusColorHelthBar)
  5625.                 If tmpH > 95 Then drawSpriteAux2(e, texBar, 315, 839, 10, 40, Helper.DegreeToRadian(66), statusColorHelthBar)
  5626.  
  5627.                 drawSpriteNumber(e, Player.Character.Health, 205, 715, 8, 1, statusColorHelthBar, Color.LightGray)
  5628.  
  5629.                 'For c As Int16 = 1 To Player.Character.Health / 1.1 Step 3
  5630.                 '    drawSpriteAux2(e, texBar, 172, 897, 20, 341, Helper.DegreeToRadian(c - 25), statusColor)
  5631.                 'Next
  5632.  
  5633.                 ' weapon indicator
  5634.                 Dim wHeat As Int16
  5635.                 Dim wBarColor As Color = statusColor
  5636.  
  5637.                 If gunMode = 0 Then
  5638.                     wHeat = Math.Round(weaponHeat0)
  5639.                     If weaponHeat0 + 16 > 100 Then wBarColor = Color.Red
  5640.                 End If
  5641.                 If gunMode = 1 Then
  5642.                     wHeat = Math.Round(weaponHeat1)
  5643.                     If weaponHeat1 + 20 > 100 Then wBarColor = Color.Red
  5644.                 End If
  5645.                 If gunMode = 2 Then
  5646.                     wHeat = Math.Round(weaponHeat2)
  5647.                     If weaponHeat2 + 10 > 100 Then wBarColor = Color.Red
  5648.                 End If
  5649.                 If gunMode = 3 Then
  5650.                     wHeat = Math.Round(weaponHeat3)
  5651.                     If weaponHeat3 + 40 > 100 Then wBarColor = Color.Red
  5652.                 End If
  5653.                 If gunMode = 4 Then
  5654.                     wHeat = Math.Round(weaponHeat4)
  5655.                     If weaponHeat4 + 55 > 100 Then wBarColor = Color.Red
  5656.                 End If
  5657.  
  5658.                 If bBlinkWeaponHeat Then
  5659.                     If 100 - wHeat > 15 Then drawSpriteAux2(e, texBar, 60, 880, 10, 71, Helper.DegreeToRadian(-87), wBarColor)
  5660.                     If 100 - wHeat > 28 Then drawSpriteAux2(e, texBar, 60, 891, 10, 72, Helper.DegreeToRadian(-92), wBarColor)
  5661.                     If 100 - wHeat > 32 Then drawSpriteAux2(e, texBar, 60, 902, 10, 73, Helper.DegreeToRadian(-96), wBarColor)
  5662.                     If 100 - wHeat > 46 Then drawSpriteAux2(e, texBar, 61, 912, 10, 73, Helper.DegreeToRadian(-100), wBarColor)
  5663.                     If 100 - wHeat > 60 Then drawSpriteAux2(e, texBar, 63, 921, 10, 73, Helper.DegreeToRadian(-104), wBarColor)
  5664.                     If 100 - wHeat > 74 Then drawSpriteAux2(e, texBar, 65, 930, 10, 73, Helper.DegreeToRadian(-109), wBarColor)
  5665.                     If 100 - wHeat > 88 Then drawSpriteAux2(e, texBar, 68, 938, 10, 73, Helper.DegreeToRadian(-112), wBarColor)
  5666.                 Else
  5667.                     If 100 - wHeat > 15 Then drawSpriteAux2(e, texBar, 60, 880, 10, 71, Helper.DegreeToRadian(-87), Color.White)
  5668.                     If 100 - wHeat > 28 Then drawSpriteAux2(e, texBar, 60, 891, 10, 72, Helper.DegreeToRadian(-92), Color.White)
  5669.                     If 100 - wHeat > 32 Then drawSpriteAux2(e, texBar, 60, 902, 10, 73, Helper.DegreeToRadian(-96), Color.White)
  5670.                     If 100 - wHeat > 46 Then drawSpriteAux2(e, texBar, 61, 912, 10, 73, Helper.DegreeToRadian(-100), Color.White)
  5671.                     If 100 - wHeat > 60 Then drawSpriteAux2(e, texBar, 63, 921, 10, 73, Helper.DegreeToRadian(-104), Color.White)
  5672.                     If 100 - wHeat > 74 Then drawSpriteAux2(e, texBar, 65, 930, 10, 73, Helper.DegreeToRadian(-109), Color.White)
  5673.                     If 100 - wHeat > 88 Then drawSpriteAux2(e, texBar, 68, 938, 10, 73, Helper.DegreeToRadian(-112), Color.White)
  5674.                 End If
  5675.  
  5676.                 bBlinkWeaponHeat = Not bBlinkWeaponHeat
  5677.  
  5678.                 'For c As Int16 = 1 To (100 - wHeat) / 3 Step 3
  5679.                 '    drawSpriteAux2(e, texBar, 176, 890, 20, 345, Helper.DegreeToRadian(c - 115), statusColor)
  5680.                 'Next
  5681.  
  5682.                 ' weapon icon
  5683.                 If gunMode = 0 Then
  5684.                     drawSpriteAux2(e, texCannon, 65, 837, 70, 70, 0, statusColor)
  5685.                 ElseIf gunMode = 1 Then
  5686.                     drawSpriteAux2(e, texDarts, 65, 837, 60, 60, 0, statusColor)
  5687.                 ElseIf gunMode = 2 Then
  5688.                     drawSpriteAux2(e, texRockets, 65, 837, 60, 60, 0, statusColor)
  5689.                 ElseIf gunMode = 3 Then
  5690.                     drawSpriteAux2(e, texHandRep, 65, 837, 90, 90, 0, statusColor)
  5691.                 ElseIf gunMode = 4 Then
  5692.                     drawSpriteAux2(e, texChestRep, 65, 837, 80, 80, 0, statusColor, True)
  5693.                 End If
  5694.  
  5695.                 Try
  5696.                     If Player.Character.Position.Z < 10 Then
  5697.                         drawSpriteNumber(e, Player.Character.Position.Z.ToString, 295, 930, 10, 1, statusColor, Color.LightGray)
  5698.                     ElseIf Player.Character.Position.Z < 100 Then
  5699.                         drawSpriteNumber(e, Player.Character.Position.Z.ToString, 300, 932, 10, 1, statusColor, Color.LightGray)
  5700.                     ElseIf Player.Character.Position.Z < 1000 Then
  5701.                         drawSpriteNumber(e, Player.Character.Position.Z.ToString, 305, 935, 10, 1, statusColor, Color.LightGray)
  5702.                     Else
  5703.                         drawSpriteNumber(e, Player.Character.Position.Z.ToString, 310, 937, 10, 1, statusColor, Color.LightGray)
  5704.                     End If
  5705.                 Catch
  5706.                 End Try
  5707.  
  5708.                 If myRealSpeed < 10 Then
  5709.                     drawSpriteNumber(e, myRealSpeed, 277, 962, 25, 1, statusColor, Color.LightGray)
  5710.                 ElseIf myRealSpeed < 100 Then
  5711.                     drawSpriteNumber(e, myRealSpeed, 285, 965, 25, 1, statusColor, Color.LightGray)
  5712.                 Else
  5713.                     drawSpriteNumber(e, myRealSpeed, 289, 968, 25, 1, statusColor, Color.LightGray)
  5714.                 End If
  5715.  
  5716.                 'For Each l As tline In tlineList
  5717.                     'drawSpriteAux(e, texBar, l.x, l.y, 10, l.h, Helper.DegreeToRadian(l.r), statusColor)
  5718.                 'Next
  5719.  
  5720.                 'drawSpriteAux(e, texBar, offx, offy, 10, offH, Helper.DegreeToRadian(offR), statusColor)
  5721.  
  5722.                 'drawTextAux(e, offx.ToString & "  " & offy.ToString & "  " & offR.ToString & "  ", 10, 500, statusColor)
  5723.             End If
  5724.  
  5725.             If bAimDown Then drawSpriteAux(e, texCrossHair, 840, 525, 75, 75, 0, Color.White, True)
  5726.         End If
  5727.  
  5728.         Dim YOffset As Int16 = 0
  5729.  
  5730.         If bShowMenu Then
  5731.             If timeWaitLoad > 0 Then
  5732.                 'drawTextAuxEffect(e, "Loading Iron Man IV files, please wait...", 50, 70, Color.White)
  5733.                 e.Graphics.DrawText("Loading Iron Man IV files, please wait...", 30, 30, Color.White)
  5734.                 Exit Sub
  5735.             Else
  5736.                 e.Graphics.DrawRectangle((178) * width_Coef, ((61 + 30 * menuIndex)) * height_Coef, 400 * width_Coef, 29 * height_Coef, Color.FromArgb(200, 0, 200, 255))
  5737.  
  5738.                 drawTextAuxEffect(e, "Armors", 30, 50, Color.LightBlue)
  5739.                 If Not bGodMode Then drawTextAuxEffect(e, "Invincible Iron Man: Off", 30, 80, Color.LightBlue) Else drawTextAuxEffect(e, "Invincible Iron Man: On", 30, 80, Color.LightBlue)
  5740.                 If Not bNoWanted Then drawTextAuxEffect(e, "Never wanted mode: Off", 30, 110, Color.LightBlue) Else drawTextAuxEffect(e, "Never wanted mode: On", 30, 110, Color.LightBlue)
  5741.                 drawTextAuxEffect(e, "Spawn ally", 30, 140, Color.LightBlue)
  5742.                 drawTextAuxEffect(e, "Spawn enemy", 30, 170, Color.LightBlue)
  5743.                 drawTextAuxEffect(e, "Actual HUD: " + HUDName, 30, 200, Color.LightBlue)
  5744.                 drawTextAuxEffect(e, "Flight collision: " + (Not bNoFlightCollisionDetection).ToString, 30, 230, Color.LightBlue)
  5745.                 drawTextAuxEffect(e, "J.A.R.V.I.S. volume: " + Math.Round(jarvisVolume, 1).ToString, 30, 260, Color.LightBlue)
  5746.                 drawTextAuxEffect(e, "Current armor config", 30, 290, Color.LightBlue)
  5747.                 drawTextAuxEffect(e, "Close", 30, 320, Color.LightBlue)
  5748.  
  5749.                 'drawLineAux(e, 30, 74 + 30 * menuIndex, 300, 75 + 30 * menuIndex, 3, Color.Blue)
  5750.                 'drawLineAux(e, 30, 72 + 30 * menuIndex, 300, 72 + 30 * menuIndex, 3, Color.LightBlue)
  5751.  
  5752.                 YOffset = 320
  5753.             End If
  5754.         ElseIf bShowArmorMenu Then
  5755.             If (Player.Character.Health <= 0) Then
  5756.                 bShowArmorMenu = False
  5757.  
  5758.                 Exit Sub
  5759.             End If
  5760.  
  5761.             Dim tmpStart As Int16 = armorMenuIndex - 15
  5762.  
  5763.             If tmpStart < 0 Then tmpStart = 0
  5764.  
  5765.             For c As Int16 = tmpStart To tmpStart + 15
  5766.                 If (c < TArmorList.Count) Then
  5767.                     If c = armorMenuIndex Then
  5768.                         'drawLineAux(e, 30, 64 + YOffset, 270, 64 + YOffset, 3, Color.Blue)
  5769.                         'drawLineAux(e, 30, 62 + YOffset, 270, 62 + YOffset, 3, Color.LightBlue)
  5770.                         e.Graphics.DrawRectangle((178) * width_Coef, (51 + YOffset) * height_Coef, 400 * width_Coef, 29 * height_Coef, Color.FromArgb(200, 0, 200, 255))
  5771.  
  5772.                         If TArmorList(c).drawTexture Then drawSpriteAux2(e, TArmorList(c).texMenu, 600, 262 + YOffset, 400, 400, 0, Color.White, True)
  5773.                     End If
  5774.  
  5775.                     drawTextAuxEffect(e, TArmorList(c).name, 30, 40 + YOffset, Color.LightBlue)
  5776.                 End If
  5777.  
  5778.                 YOffset += 30
  5779.             Next
  5780.  
  5781.             If armorMenuIndex = TArmorList.Count Then
  5782.                 drawLineAux(e, 30, 62 + YOffset, 270, 64 + YOffset, 3, Color.Blue)
  5783.                 drawLineAux(e, 30, 62 + YOffset, 270, 62 + YOffset, 3, Color.LightBlue)
  5784.             End If
  5785.         ElseIf bShowArmorOptionsMenu Then
  5786.             If bArmorON AndAlso Exists(playerArmor) Then
  5787.                 If armorOptionsMenuIndex < 12 Then
  5788.                     If armorOptionsMenuIndex < 6 Then
  5789.                         'drawLineAux(e, 30, 70 + 30 * armorOptionsMenuIndex, 300, 70 + 30 * armorOptionsMenuIndex, 3, Color.Blue)
  5790.                         'drawLineAux(e, 30, 68 + 30 * armorOptionsMenuIndex, 300, 68 + 30 * armorOptionsMenuIndex, 3, Color.LightBlue)
  5791.                         e.Graphics.DrawRectangle((178) * width_Coef, (51 + 30 * armorOptionsMenuIndex) * height_Coef, 400 * width_Coef, 29 * height_Coef, Color.FromArgb(200, 0, 200, 255))
  5792.                     Else
  5793.                         'drawLineAux(e, 30, 94 + 30 * armorOptionsMenuIndex, 300, 94 + 30 * armorOptionsMenuIndex, 3, Color.Blue)
  5794.                         'drawLineAux(e, 30, 92 + 30 * armorOptionsMenuIndex, 300, 92 + 30 * armorOptionsMenuIndex, 3, Color.LightBlue)
  5795.                         e.Graphics.DrawRectangle((178) * width_Coef, (81 + 30 * armorOptionsMenuIndex) * height_Coef, 400 * width_Coef, 29 * height_Coef, Color.FromArgb(200, 0, 200, 255))
  5796.                     End If
  5797.                 End If
  5798.  
  5799.                 drawTextAuxEffect(e, "Hand cannon: " & playerArmor.handCannon.ToString, 30, 40 + YOffset, Color.LightBlue)
  5800.                 YOffset += 30
  5801.                 drawTextAuxEffect(e, "Shoulder cannon: " & playerArmor.shoulderCannon.ToString, 30, 40 + YOffset, Color.LightBlue)
  5802.                 YOffset += 30
  5803.                 drawTextAuxEffect(e, "Super cannon: " & playerArmor.superCannon.ToString, 30, 40 + YOffset, Color.LightBlue)
  5804.                 YOffset += 30
  5805.                 drawTextAuxEffect(e, "Hand thrusters: " & playerArmor.bHandThrusters.ToString, 30, 40 + YOffset, Color.LightBlue)
  5806.                 YOffset += 30
  5807.                 drawTextAuxEffect(e, "Foot thrusters: " & playerArmor.bFootThrusters.ToString, 30, 40 + YOffset, Color.LightBlue)
  5808.                 YOffset += 30
  5809.                 drawTextAuxEffect(e, "Back thrusters: " & playerArmor.bBackThrusters.ToString, 30, 40 + YOffset, Color.LightBlue)
  5810.                 YOffset += 30
  5811.  
  5812.                 drawTextAuxEffect(e, "  Back thrusters config:", 30, 40 + YOffset, Color.LightBlue)
  5813.                 YOffset += 30
  5814.  
  5815.                 drawTextAuxEffect(e, "   X offset: " & playerArmor.back_rep_x_off.ToString, 30, 40 + YOffset, Color.LightBlue)
  5816.                 YOffset += 30
  5817.                 drawTextAuxEffect(e, "   Y offset: " & playerArmor.back_rep_y_off.ToString, 30, 40 + YOffset, Color.LightBlue)
  5818.                 YOffset += 30
  5819.                 drawTextAuxEffect(e, "   Z offset: " & playerArmor.back_rep_z_off.ToString, 30, 40 + YOffset, Color.LightBlue)
  5820.                 YOffset += 30
  5821.  
  5822.                 drawTextAuxEffect(e, "   X rot.: " & playerArmor.back_rep_x_rot_off.ToString, 30, 40 + YOffset, Color.LightBlue)
  5823.                 YOffset += 30
  5824.                 drawTextAuxEffect(e, "   Y rot.: " & playerArmor.back_rep_y_rot_off.ToString, 30, 40 + YOffset, Color.LightBlue)
  5825.                 YOffset += 30
  5826.                 drawTextAuxEffect(e, "   Z rot.: " & playerArmor.back_rep_z_rot_off.ToString, 30, 40 + YOffset, Color.LightBlue)
  5827.                 YOffset += 40
  5828.  
  5829.                 If armorOptionsMenuIndex = 12 Then
  5830.                     'drawLineAux(e, 30, 68 + YOffset, 300, 68 + YOffset, 3, Color.Blue)
  5831.                     'drawLineAux(e, 30, 70 + YOffset, 300, 70 + YOffset, 3, Color.LightBlue)
  5832.                     e.Graphics.DrawRectangle((178) * width_Coef, (51 + YOffset) * height_Coef, 400 * width_Coef, 29 * height_Coef, Color.FromArgb(200, 0, 200, 255))
  5833.                 End If
  5834.  
  5835.                 drawTextAuxEffect(e, "Done!", 30, 40 + YOffset, Color.LightBlue)
  5836.             Else
  5837.                 drawTextAuxEffect(e, "Error reading player armor data", 30, 40 + YOffset, Color.LightBlue)
  5838.             End If
  5839.         End If
  5840.  
  5841.         If bShowMenu OrElse bShowArmorMenu OrElse bShowArmorOptionsMenu Then
  5842.             YOffset += 50
  5843.             drawTextAuxEffect(e, "Controls:", 30, 40 + YOffset, Color.LightBlue)
  5844.             YOffset += 30
  5845.             drawTextAuxEffect(e, "   Left/Right - Select armor", 30, 40 + YOffset, Color.LightBlue)
  5846.             YOffset += 30
  5847.             drawTextAuxEffect(e, "   Enter - Switch to selected item", 30, 40 + YOffset, Color.LightBlue)
  5848.             YOffset += 30
  5849.             drawTextAuxEffect(e, "XBox 360 Controls:", 30, 40 + YOffset, Color.LightBlue)
  5850.             YOffset += 30
  5851.             drawTextAuxEffect(e, "   D-Pad Left/Right - Select armor", 30, 40 + YOffset, Color.LightBlue)
  5852.             YOffset += 30
  5853.             drawTextAuxEffect(e, "   A - Switch to selected item", 30, 40 + YOffset, Color.LightBlue)
  5854.         End If
  5855.  
  5856.         If Exists(DisplayMessage) Then DisplayMessage.Tick(e)
  5857.     End Sub
  5858.  
  5859.     Public Sub loadArmors()
  5860.         If Not Directory.Exists(".\Scripts\Iron Man Files\Armors\") Then Directory.CreateDirectory(".\Scripts\Iron Man Files\Armors\")
  5861.  
  5862.         Dim dirInfo As New IO.DirectoryInfo(".\Scripts\Iron Man Files\Armors\")
  5863.         Dim fileList As IO.FileInfo() = dirInfo.GetFiles("armor_*.ini")
  5864.         Dim f As IO.FileInfo
  5865.  
  5866.         For Each f In fileList
  5867.             iniFile = f.FullName
  5868.  
  5869.             checkIniExists()
  5870.  
  5871.             tmpTArmor = New TArmor
  5872.             tmpTArmor.file_name = f.FullName
  5873.             tmpTArmor.name = Read_INI_String("name", "general", "")
  5874.             tmpTArmor.model = Read_INI_String("model", "general", "")
  5875.             tmpTArmor.anim_group = Read_INI_String("anim_group", "general", "move_player")
  5876.             tmpTArmor.removeHead = Read_INI_String("removeHead", "general", "0") = "1"
  5877.             tmpTArmor.removeHair = Read_INI_String("removeHair", "general", "0") = "1"
  5878.             tmpTArmor.component_0_Var = Int16.Parse(Read_INI_String("component_0_Var", "general", "0"))
  5879.             tmpTArmor.component_1_Var = Int16.Parse(Read_INI_String("component_1_Var", "general", "15"))
  5880.             tmpTArmor.component_2_Var = Int16.Parse(Read_INI_String("component_2_Var", "general", "7"))
  5881.             tmpTArmor.component_3_Var = Int16.Parse(Read_INI_String("component_3_Var", "general", "0"))
  5882.             tmpTArmor.component_4_Var = Int16.Parse(Read_INI_String("component_4_Var", "general", "1"))
  5883.             tmpTArmor.component_5_Var = Int16.Parse(Read_INI_String("component_5_Var", "general", "5"))
  5884.             tmpTArmor.component_6_Var = Int16.Parse(Read_INI_String("component_6_Var", "general", "0"))
  5885.             tmpTArmor.component_7_Var = Int16.Parse(Read_INI_String("component_7_Var", "general", "0"))
  5886.             tmpTArmor.component_8_Var = Int16.Parse(Read_INI_String("component_8_Var", "general", "1"))
  5887.             tmpTArmor.component_9_Var = Int16.Parse(Read_INI_String("component_9_Var", "general", "0"))
  5888.             tmpTArmor.enemy = Read_INI_String("enemy", "general", "1") = "1"
  5889.             tmpTArmor.ally = Read_INI_String("ally", "general", "1") = "1"
  5890.             tmpTArmor.weaponSet = Read_INI_String("weaponSet", "general", "0")
  5891.             tmpTArmor.img_preview = Read_INI_String("img_preview", "general", "")
  5892.             tmpTArmor.drawTexture = File.Exists(".\Scripts\Iron Man Files\Armors\" & tmpTArmor.img_preview)
  5893.             tmpTArmor.AIM_Robot = Read_INI_String("AIM_Robot", "general", "0") = "1"
  5894.             tmpTArmor.superCannon = Read_INI_String("superCannon", "general", "0") = "1"
  5895.             'hand cannon
  5896.             tmpTArmor.handCannon = Read_INI_String("handCannon", "Guns", "1") = "1"
  5897.             tmpTArmor.cannonHandOffset.X = Double.Parse(Read_INI_String("cannonHandOffset_x", "Guns", "0"))
  5898.             tmpTArmor.cannonHandOffset.Y = Double.Parse(Read_INI_String("cannonHandOffset_y", "Guns", "0"))
  5899.             tmpTArmor.cannonHandOffset.Z = Double.Parse(Read_INI_String("cannonHandOffset_z", "Guns", "0"))
  5900.             tmpTArmor.handCannon_ShootInterval = Double.Parse(Read_INI_String("handCannon_ShootInterval", "Guns", "20"))
  5901.             tmpTArmor.handCannon_Damage = Int16.Parse(Read_INI_String("handCannon_Damage", "Guns", "100"))
  5902.             'shoulder cannon - warmachine
  5903.             tmpTArmor.shoulderCannon = Read_INI_String("shoulderCannon", "Guns", "0") = "1"
  5904.             tmpTArmor.cannonShoulderOffset.X = Double.Parse(Read_INI_String("cannonShoulderOffset_x", "Guns", "-0.15"))
  5905.             tmpTArmor.cannonShoulderOffset.Y = Double.Parse(Read_INI_String("cannonShoulderOffset_y", "Guns", "0.5"))
  5906.             tmpTArmor.cannonShoulderOffset.Z = Double.Parse(Read_INI_String("cannonShoulderOffset_z", "Guns", "0.85"))
  5907.             tmpTArmor.shoulderCannon_ShootInterval = Double.Parse(Read_INI_String("shoulderCannon_ShootInterval", "Guns", "10"))
  5908.             tmpTArmor.shoulderCannon_Damage = Int16.Parse(Read_INI_String("shoulderCannon_Damage", "Guns", "100"))
  5909.             'super cannon - hammer drone
  5910.             tmpTArmor.superCannon = Read_INI_String("superCannon", "Guns", "0") = "1"
  5911.             tmpTArmor.superCannonShoulderOffset.X = Double.Parse(Read_INI_String("superCannonShoulderOffset_x", "Guns", "0.1"))
  5912.             tmpTArmor.superCannonShoulderOffset.Y = Double.Parse(Read_INI_String("superCannonShoulderOffset_y", "Guns", "0.7"))
  5913.             tmpTArmor.superCannonShoulderOffset.Z = Double.Parse(Read_INI_String("superCannonShoulderOffset_z", "Guns", "-0.3"))
  5914.             tmpTArmor.superCannon_ShootInterval = Double.Parse(Read_INI_String("superCannon_ShootInterval", "Guns", "100"))
  5915.             tmpTArmor.superCannon_Power = Int16.Parse(Read_INI_String("superCannon_Power", "Guns", "100"))
  5916.             'thrusters config
  5917.             tmpTArmor.bHandThrusters = Read_INI_String("bHandThrusters", "Thrusters", "1") = "1"
  5918.             tmpTArmor.bFootThrusters = Read_INI_String("bFootThrusters", "Thrusters", "1") = "1"
  5919.             tmpTArmor.bBackThrusters = Read_INI_String("bBackThrusters", "Thrusters", "0") = "1"
  5920.             tmpTArmor.back_rep_x_off = Double.Parse(Read_INI_String("back_rep_x_off", "Thrusters", "0.15"))
  5921.             tmpTArmor.back_rep_y_off = Double.Parse(Read_INI_String("back_rep_y_off", "Thrusters", "-0.2"))
  5922.             tmpTArmor.back_rep_z_off = Double.Parse(Read_INI_String("back_rep_z_off", "Thrusters", "-0.16"))
  5923.             tmpTArmor.back_rep_x_rot_off = Double.Parse(Read_INI_String("back_rep_x_rot_off", "Thrusters", "0"))
  5924.             tmpTArmor.back_rep_y_rot_off = Double.Parse(Read_INI_String("back_rep_y_rot_off", "Thrusters", "0"))
  5925.             tmpTArmor.back_rep_z_rot_off = Double.Parse(Read_INI_String("back_rep_z_rot_off", "Thrusters", "192.0"))
  5926.  
  5927.             Try
  5928.                 If tmpTArmor.drawTexture Then tmpTArmor.texMenu = New Texture(File.ReadAllBytes(".\Scripts\Iron Man Files\Armors\" & tmpTArmor.img_preview))
  5929.             Catch
  5930.             End Try
  5931.  
  5932.             If Not tmpTArmor.AIM_Robot Then _
  5933.                 TArmorList.Add(tmpTArmor)
  5934.  
  5935.             TEnemyAllyArmorList.Add(tmpTArmor)
  5936.         Next
  5937.  
  5938.         If TArmorList.Count = 0 Then
  5939.             iniFile = ".\Scripts\Iron Man Files\Armors\armor_1.ini"
  5940.  
  5941.             checkIniExists()
  5942.  
  5943.             WriteINI("name", "general", "MK III")
  5944.             WriteINI("model", "general", "player")
  5945.             WriteINI("removeHead", "general", "1")
  5946.             WriteINI("removeHair", "general", "1")
  5947.             WriteINI("component_0_Var", "general", "0")
  5948.             WriteINI("component_1_Var", "general", "15")
  5949.             WriteINI("component_2_Var", "general", "7")
  5950.             WriteINI("component_3_Var", "general", "0")
  5951.             WriteINI("component_4_Var", "general", "1")
  5952.             WriteINI("component_5_Var", "general", "5")
  5953.             WriteINI("component_6_Var", "general", "0")
  5954.             WriteINI("component_7_Var", "general", "0")
  5955.             WriteINI("component_8_Var", "general", "1")
  5956.             WriteINI("component_9_Var", "general", "0")
  5957.             WriteINI("enemy", "general", "0")
  5958.             WriteINI("ally", "general", "0")
  5959.             WriteINI("weaponSet", "general", "0")
  5960.             WriteINI("img_preview", "general", "")
  5961.             WriteINI("AIM_Robot", "general", "0")
  5962.  
  5963.             playerArmor = New TArmor
  5964.             playerArmor.name = ReadINI("name", "general", "")
  5965.             playerArmor.model = ReadINI("model", "general", "player")
  5966.             playerArmor.removeHead = ReadINI("removeHead", "general", "0") = "1"
  5967.             playerArmor.removeHair = ReadINI("removeHair", "general", "1") = "1"
  5968.             playerArmor.component_0_Var = Int16.Parse(ReadINI("component_0_Var", "general", "0"))
  5969.             playerArmor.component_1_Var = Int16.Parse(ReadINI("component_1_Var", "general", "0"))
  5970.             playerArmor.component_2_Var = Int16.Parse(ReadINI("component_2_Var", "general", "0"))
  5971.             playerArmor.component_3_Var = Int16.Parse(ReadINI("component_3_Var", "general", "0"))
  5972.             playerArmor.component_4_Var = Int16.Parse(ReadINI("component_4_Var", "general", "0"))
  5973.             playerArmor.component_5_Var = Int16.Parse(ReadINI("component_5_Var", "general", "0"))
  5974.             playerArmor.component_6_Var = Int16.Parse(ReadINI("component_6_Var", "general", "0"))
  5975.             playerArmor.component_7_Var = Int16.Parse(ReadINI("component_7_Var", "general", "0"))
  5976.             playerArmor.component_8_Var = Int16.Parse(ReadINI("component_8_Var", "general", "0"))
  5977.             playerArmor.component_9_Var = Int16.Parse(ReadINI("component_9_Var", "general", "0"))
  5978.             playerArmor.enemy = ReadINI("enemy", "general", "1") = "1"
  5979.             playerArmor.ally = ReadINI("ally", "general", "0") = "1"
  5980.             playerArmor.weaponSet = ReadINI("weaponSet", "general", "0")
  5981.             playerArmor.img_preview = ReadINI("img_preview", "general", "mkiii.png")
  5982.             playerArmor.drawTexture = File.Exists(".\Scripts\Iron Man Files\Armors\" & playerArmor.img_preview)
  5983.             playerArmor.AIM_Robot = ReadINI("AIM_Robot", "general", "") = "1"
  5984.  
  5985.             Try
  5986.                 If playerArmor.drawTexture Then playerArmor.texMenu = New Texture(File.ReadAllBytes(".\Scripts\Iron Man Files\Armors\" & playerArmor.img_preview))
  5987.             Catch
  5988.             End Try
  5989.  
  5990.             TArmorList.Add(playerArmor)
  5991.         End If
  5992.  
  5993.         tmpTArmor = New TArmor
  5994.         tmpTArmor.name = "No armor, no powers"
  5995.         TArmorList.Add(tmpTArmor)
  5996.     End Sub
  5997.  
  5998.     Private Sub saveArmorCFG(armor As TArmor)
  5999.         iniFile = armor.file_name
  6000.  
  6001.         If armor.handCannon Then WriteINI("handCannon", "Guns", "1") Else WriteINI("handCannon", "Guns", "0")
  6002.         If armor.shoulderCannon Then WriteINI("shoulderCannon", "Guns", "1") Else WriteINI("shoulderCannon", "Guns", "0")
  6003.         If armor.superCannon Then WriteINI("superCannon", "Guns", "1") Else WriteINI("superCannon", "Guns", "0")
  6004.  
  6005.         If armor.bHandThrusters Then WriteINI("bHandThrusters", "Thrusters", "1") Else WriteINI("bHandThrusters", "Thrusters", "0")
  6006.         If armor.bFootThrusters Then WriteINI("bFootThrusters", "Thrusters", "1") Else WriteINI("bFootThrusters", "Thrusters", "0")
  6007.         If armor.bBackThrusters Then WriteINI("bBackThrusters", "Thrusters", "1") Else WriteINI("bBackThrusters", "Thrusters", "0")
  6008.  
  6009.         WriteINI("back_rep_x_off", "Thrusters", armor.back_rep_x_off.ToString)
  6010.         WriteINI("back_rep_y_off", "Thrusters", armor.back_rep_y_off.ToString)
  6011.         WriteINI("back_rep_z_off", "Thrusters", armor.back_rep_z_off.ToString)
  6012.         WriteINI("back_rep_x_rot_off", "Thrusters", armor.back_rep_x_rot_off.ToString)
  6013.         WriteINI("back_rep_y_rot_off", "Thrusters", armor.back_rep_y_rot_off.ToString)
  6014.         WriteINI("back_rep_z_rot_off", "Thrusters", armor.back_rep_z_rot_off.ToString)
  6015.     End Sub
  6016.  
  6017.     Private Declare Auto Function GetPrivateProfileString Lib "Kernel32" _
  6018.         (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
  6019.  
  6020.     Private Declare Auto Function WritePrivateProfileString Lib "Kernel32" _
  6021.         (ByVal lpAppName As String, ByVal lpKeyName As String, ByVal lpString As String, ByVal lpFileName As String) As Integer
  6022.  
  6023.     Private Function ReadINI(ByVal key_name As String, ByVal section_name As String, ByVal default_value As String) As String
  6024.         Const MAX_LENGTH As Integer = 500
  6025.         Dim string_builder As New StringBuilder(MAX_LENGTH)
  6026.  
  6027.         GetPrivateProfileString(section_name, key_name, default_value, string_builder, MAX_LENGTH, iniFile)
  6028.  
  6029.         Return string_builder.ToString()
  6030.     End Function
  6031.  
  6032.     Private Sub WriteINI(ByVal key_name As String, ByVal section_name As String, ByVal value As String)
  6033.         WritePrivateProfileString(section_name, key_name, value, iniFile)
  6034.     End Sub
  6035.  
  6036.     Private Sub checkIniExists()
  6037.         If Not File.Exists(iniFile) Then
  6038.             File.CreateText(iniFile).Dispose()
  6039.  
  6040.             Wait(100)
  6041.         End If
  6042.     End Sub
  6043.  
  6044.     Private Function Read_INI_String(opt As String, categoy As String, def As String) As String
  6045.         If ReadINI(opt, categoy, "") = "" Then WriteINI(opt, categoy, def)
  6046.  
  6047.         Return ReadINI(opt, categoy, def)
  6048.     End Function
  6049. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement