Advertisement
julioCCs

[GTA iV] Ghost rider script Source code

Jan 27th, 2013
4,128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 153.67 KB | None | 0 0
  1. 'http://gtaxscripting.blogspot.com/
  2. 'http://www.facebook.com/GtaIVScripting
  3. 'https://www.youtube.com/user/GTAScripting
  4.  
  5. ' sorry people, i have no time now to comment and explain this mess :(
  6. ' this is not the best way to do the effects but works almost as expected
  7. ' this is my second script for GTA IV :)
  8.  
  9. ' by JulioNIB
  10.  
  11. Imports System
  12. Imports System.Drawing
  13. Imports System.Windows.Forms
  14. Imports System.IO
  15. Imports GTA
  16.  
  17. Public Class GhostRider
  18.     Inherits Script
  19.     private depMsg as string = ""
  20.     Private bWaitLoad As Boolean = True
  21.     Private WaitLoadCount As Int16 = 500
  22.     Private l1, l2, l3, PSLight, carLight As light
  23.     Private timer1, timeScript As int32
  24.     Private vecL As vector3
  25.     Private mGR, mPL As model
  26.     Private isGhostRider As Boolean = False
  27.     Private launchControl As int32 = 1
  28.     Private speedToThrowEffect As Double
  29.     Private hkActivate, hkSpawnBike, hkThrowFlames, hkBikeNitro, hkControlKey, hkSpitBullets, hkPenanceStare, hkAccelKey, hkAimKey, hkShootKey, hkEnterVehicleKey As int32
  30.     Private hkChainAttack1, hkChainAttackGrab, hkTurnVehicleLeft, hkTurnVehicleRight, hkEquipChain, hkChainClimb As int32
  31.     Private throwEffectRoundForVehicles, throwEffectRoundForPeds As Double
  32.     Private sGRmodel As String
  33.     Private throwTimeout As int16 = 0
  34.     Private GRBike As String = ""
  35.     Private bPrintSign As Boolean = True
  36.     Private flameW1, flameW2, flameW3, flameW4, flameH1, flame1, flame2, flame3, flame4, effectThrow1, effectThrow2, flameCar1, flameCar2, flameCar3, flameCar4, flameCar5, flameCar6, flameCar7 As int32
  37.     private flameOffSetX, flameOffSetY, flameOffSetZ, flameSizeMuliplier as double
  38.     private BikeFlameOffSetX, BikeFlameOffSetY, BikeFlameOffSetZ, BikeFlameSizeMuliplier as double
  39.     private flameLightMultiplier as double
  40.     Private onAllWheelsCont, fallCont, timeHealth As Int16
  41.     Private penanceStaretArr(20) As ped
  42.     Private penanceStaretArrCount As int16 = 1
  43.     Private penanceStareTime As int16 = 3000
  44.     Private PenanceStareMod As int16 = 0
  45.     Private PenanceStarePedTmp As ped = Nothing
  46.     Private PenanceStareCP As checkpoint
  47.     Private aSetPenanceStare As animationset
  48.     Private aSetPenanceStarePed, aSetPenanceStarePedIni As animationset
  49.     Private PenanceStareSpeechAux As int16 = 0
  50.     Private PSBoneAttach As int32
  51.     Private PSAnimName As String
  52.     private PreviousWeapon as int32
  53.     Private BeingArrestedCount As int16 = 0    
  54.     Private bIconThrowFlames, bIconSpitbullets, bIconSpitbulletsLoop, bIconShotgun, bIconSpeedKills, bIconChains As Boolean
  55.     Private iIconPenanceStare As int16 = 0
  56.     Private IconThrowFlames As Texture
  57.     Private IconPenanceStare1, IconPenanceStare2, IconPenanceStare3, IconPenanceStare4 As Texture
  58.     Private IconSpitbullets As Texture
  59.     Private IconShotgun As Texture
  60.     Private IconSpeedKills As Texture
  61.     Private IconChains As Texture
  62.     Private SpitBulletBulCount As int32 = 0
  63.     Private SpitBulletBulCountFont As gta.font
  64.     Private bInfiniteSpitBullets, bShowMsgs, bPlaySounds, bShowIcons As Boolean
  65.     Private UpForceWallRide As Double = 0.25
  66.     private TimeEffectForHit as double = 0.3
  67.     private bTimeEffectForHit as boolean
  68.     private bBulletTimeWhenAim as boolean
  69.     private HeadEffectScale as double = 1.0
  70.     private PlMaxHealth as int16 = 100
  71.     private wasGROnceCont as double = 0
  72.     private wasGROnce as boolean = false
  73.     private HitForce as double = 1.0
  74.     private ShotgunForce as double = 1.0
  75.     private hkcontrolkeyDownTime as int16 = 0
  76.     private bSpawnBike as boolean = false
  77.     Private bAutoSpawnBike As Boolean = False
  78.     Private vecVelocityGeneral As Vector3
  79.     private collisionProof as boolean = false
  80.     private bTransformVehicle as boolean = false
  81.     private currVehDim as vector3
  82.     private vehLastVehicle as vehicle = nothing
  83.    
  84.     Private objChain(10) as gta.object
  85.     private maxChainObj as int16 = 10
  86.     private pChainTarget as ped = nothing
  87.     private pChainTargetGrab as ped = nothing
  88.     private vChainTarget as vehicle = nothing
  89.     private vChainTargetGrab as vehicle = nothing
  90.     private chainAttackMode as int16 = 0
  91.     private vecChainDimIni, vecChainDim as vector3
  92.     private timeOutMoveChain as int16 = 0
  93.     private aSetChainAttack as animationset
  94.     private aSetChainGrab as animationset
  95.     private vecChainVelocity as vector3
  96.     private timeRestoreChain as int16 = 0
  97.     Private grabTargetPos As Vector3
  98.  
  99.     private TargetCheckpoint as checkpoint
  100.     private TargetLight as light
  101.     private RequipChainCounter as int16 = 0
  102.     private aSetChainClimb as animationset
  103.     private ChainTargetVeh as vehicle = nothing
  104.        
  105.     private FPS as double = 0
  106.    
  107.     Private sVersion As String = "2.4"
  108.  
  109.     Private pedsTarget As Ped() = Nothing
  110.     Private vehsTarget As Vehicle() = Nothing
  111.     Private pedTargeted As Ped = Nothing
  112.     Private vehTargeted As Vehicle = Nothing
  113.     Private targetObjectAux As GTA.Object = Nothing
  114.     Private targetObjectRotation As Double = 0
  115.     Private timeCheckTargets As Double = 0
  116.  
  117.     Public Sub New()
  118.         me.interval = 10
  119.     End Sub
  120.  
  121.     Private Sub LoadSettingsAux()
  122.         If WaitLoadCount > 0 Then
  123.             WaitLoadCount -= getInterval
  124.         Else
  125.             bWaitLoad = False
  126.            
  127.             If Settings.GetValueKey("speedToThrowEffect", "GENERAL", -1) = -1 Then Settings.SetValue("speedToThrowEffect", "GENERAL", 25)
  128.             If Settings.GetValueKey("throwEffectRoundForVehicles", "GENERAL", -1) = -1 Then Settings.SetValue("throwEffectRoundForVehicles", "GENERAL", 12)
  129.             If Settings.GetValueKey("throwEffectRoundForPeds", "GENERAL", -1) = -1 Then Settings.SetValue("throwEffectRoundForPeds", "GENERAL", 20)
  130.             If Settings.GetValueFloat("flameOffSetX", "GENERAL", -1) = -1 Then Settings.SetValue("flameOffSetX", "GENERAL", "0")
  131.             If Settings.GetValueFloat("flameOffSetY", "GENERAL", -1) = -1 Then Settings.SetValue("flameOffSetY", "GENERAL", "0")
  132.             If Settings.GetValueFloat("flameOffSetZ", "GENERAL", -1) = -1 Then Settings.SetValue("flameOffSetZ", "GENERAL", "0")
  133.             If Settings.GetValueFloat("flameSizeMuliplier", "GENERAL", -1) = -1 Then Settings.SetValue("flameSizeMuliplier", "GENERAL", "1")
  134.             If Settings.GetValueFloat("flameLightMultiplier", "GENERAL", -1) = -1 Then Settings.SetValue("flameLightMultiplier", "GENERAL", "1")
  135.             If Settings.GetValueFloat("BikeFlameOffSetX", "GENERAL", -1) = -1 Then Settings.SetValue("BikeFlameOffSetX", "GENERAL", "0")
  136.             If Settings.GetValueFloat("BikeFlameOffSetY", "GENERAL", -1) = -1 Then Settings.SetValue("BikeFlameOffSetY", "GENERAL", "0")
  137.             If Settings.GetValueFloat("BikeFlameOffSetZ", "GENERAL", -1) = -1 Then Settings.SetValue("BikeFlameOffSetZ", "GENERAL", "0")
  138.             If Settings.GetValueFloat("BikeFlameSizeMuliplier", "GENERAL", -1) = -1 Then Settings.SetValue("BikeFlameSizeMuliplier", "GENERAL", "1")
  139.             If Settings.GetValueFloat("UpForceWallRide", "GENERAL", -1) = -1 Then Settings.SetValue("UpForceWallRide", "GENERAL", Convert.ToString(UpForceWallRide))
  140.             If Settings.GetValueFloat("HitForce", "GENERAL", -1) = -1 Then Settings.SetValue("HitForce", "GENERAL", Convert.ToString(HitForce))
  141.             If Settings.GetValueFloat("ShotgunForce", "GENERAL", -1) = -1 Then Settings.SetValue("ShotgunForce", "GENERAL", Convert.ToString(ShotgunForce))
  142.             If Settings.GetValueKey("UseTimeEffectForHit", "GENERAL", -1) = -1 Then Settings.SetValue("UseTimeEffectForHit", "GENERAL", 0)
  143.             If Settings.GetValueFloat("TimeEffectForHit", "GENERAL", -1) = -1 Then Settings.SetValue("TimeEffectForHit", "GENERAL", Convert.ToString(TimeEffectForHit))
  144.             If Settings.GetValueKey("bBulletTimeWhenAim", "GENERAL", -1) = -1 Then Settings.SetValue("bBulletTimeWhenAim", "GENERAL", 1)
  145.             If Settings.GetValueFloat("PlMaxHealth", "GENERAL", -1) = -1 Then Settings.SetValue("PlMaxHealth", "GENERAL", Convert.ToString(PlMaxHealth))
  146.             If Settings.GetValueKey("penanceStareTime", "GENERAL", -1) = -1 Then Settings.SetValue("penanceStareTime", "GENERAL", 3000)
  147.             If Settings.GetValueKey("InfiniteSpitBullets", "GENERAL", -1) = -1 Then Settings.SetValue("InfiniteSpitBullets", "GENERAL", 0)
  148.             If Settings.GetValueKey("ShowMsgs", "GENERAL", -1) = -1 Then Settings.SetValue("ShowMsgs", "GENERAL", 1)
  149.             If Settings.GetValueKey("PlaySounds", "GENERAL", -1) = -1 Then Settings.SetValue("PlaySounds", "GENERAL", 1)
  150.             If Settings.GetValueKey("ShowIcons", "GENERAL", -1) = -1 Then Settings.SetValue("ShowIcons", "GENERAL", 1)
  151.             If Settings.GetValueKey("bAutoSpawnBike", "GENERAL", -1) = -1 Then Settings.SetValue("bAutoSpawnBike", "GENERAL", 0)
  152.             If Settings.GetValueKey("maxChainObj", "GENERAL", -1) = -1 Then Settings.SetValue("maxChainObj", "GENERAL", 15)
  153.             If Settings.GetValueKey("collisionProof", "GENERAL", -1) = -1 Then Settings.SetValue("collisionProof", "GENERAL", 1)
  154.             If Settings.GetValueKey("bTransformVehicle", "GENERAL", -1) = -1 Then Settings.SetValue("bTransformVehicle", "GENERAL", 0)
  155.             If Settings.GetValueKey("ActivateScript", "HotKeys", -1) = -1 Then Settings.SetValue("ActivateScript", "HotKeys", Keys.F4)
  156.             If Settings.GetValueKey("SpawnBike", "HotKeys", -1) = -1 Then Settings.SetValue("SpawnBike", "HotKeys", Keys.F5)
  157.             If Settings.GetValueKey("ThrowFlames", "HotKeys", -1) = -1 Then Settings.SetValue("ThrowFlames", "HotKeys", Keys.D1)
  158.             If Settings.GetValueKey("hkChainAttack1", "HotKeys", -1) = -1 Then Settings.SetValue("hkChainAttack1", "HotKeys", Keys.D1)
  159.             If Settings.GetValueKey("hkChainAttackGrab", "HotKeys", -1) = -1 Then Settings.SetValue("hkChainAttackGrab", "HotKeys", Keys.D3)
  160.             If Settings.GetValueKey("hkTurnVehicleLeft", "HotKeys", -1) = -1 Then Settings.SetValue("hkTurnVehicleLeft", "HotKeys", Keys.A)
  161.             If Settings.GetValueKey("hkTurnVehicleRight", "HotKeys", -1) = -1 Then Settings.SetValue("hkTurnVehicleRight", "HotKeys", Keys.D)
  162.             If Settings.GetValueKey("hkEquipChain", "HotKeys", -1) = -1 Then Settings.SetValue("hkEquipChain", "HotKeys", Keys.d0)
  163.             If Settings.GetValueKey("BikeNitro", "HotKeys", -1) = -1 Then Settings.SetValue("BikeNitro", "HotKeys", Keys.ShiftKey)
  164.             If Settings.GetValueKey("ControlKey", "HotKeys", -1) = -1 Then Settings.SetValue("ControlKey", "HotKeys", Keys.ControlKey)
  165.             If Settings.GetValueKey("hkSpitBullets", "HotKeys", -1) = -1 Then Settings.SetValue("hkSpitBullets", "HotKeys", Keys.D3)
  166.             If Settings.GetValueKey("hkPenanceStare", "HotKeys", -1) = -1 Then Settings.SetValue("hkPenanceStare", "HotKeys", Keys.D2)
  167.             If Settings.GetValueKey("hkAccelKey", "HotKeys", -1) = -1 Then Settings.SetValue("hkAccelKey", "HotKeys", Keys.W)
  168.             If Settings.GetValueKey("hkAimKey", "HotKeys", -1) = -1 Then Settings.SetValue("hkAimKey", "HotKeys", Keys.RButton)
  169.             If Settings.GetValueKey("hkShootKey", "HotKeys", -1) = -1 Then Settings.SetValue("hkShootKey", "HotKeys", Keys.LButton)
  170.             If Settings.GetValueKey("hkEnterVehicleKey", "HotKeys", -1) = -1 Then Settings.SetValue("hkEnterVehicleKey", "HotKeys", Keys.F)
  171.             If Settings.GetValueKey("hkChainClimb", "HotKeys", -1) = -1 Then Settings.SetValue("hkChainClimb", "HotKeys", Keys.d4)
  172.             If Settings.GetValueString("GhostRider_Replaced_model_name", "GENERAL", "") = "" Then Settings.SetValue("GhostRider_Replaced_model_name", "GENERAL", "m_y_multiplayer")
  173.             If Settings.GetValueString("GhostRider_Replaced_Bike_name", "GENERAL", "") = "" Then Settings.SetValue("GhostRider_Replaced_Bike_name", "GENERAL", "ZOMBIEB")
  174.  
  175.             Settings.Save()
  176.  
  177.             speedToThrowEffect = Settings.GetValueKey("speedToThrowEffect", "GENERAL", 25)
  178.             penanceStareTime = Settings.GetValueKey("penanceStareTime", "GENERAL", 3000)
  179.             bInfiniteSpitBullets = Settings.GetValueKey("InfiniteSpitBullets", "GENERAL", 0) = 1
  180.             bShowMsgs = Settings.GetValueKey("ShowMsgs", "GENERAL", 1) = 1
  181.             bPlaySounds = Settings.GetValueKey("PlaySounds", "GENERAL", 1) = 1
  182.             bShowIcons = Settings.GetValueKey("ShowIcons", "GENERAL", 1) = 1
  183.             bAutoSpawnBike = Settings.GetValueKey("bAutoSpawnBike", "GENERAL", 1) = 1
  184.             maxChainObj = Settings.GetValueKey("maxChainObj", "GENERAL", 15)
  185.             collisionProof = Settings.GetValueKey("collisionProof", "GENERAL", 1) = 1
  186.             bTransformVehicle = Settings.GetValueKey("bTransformVehicle", "GENERAL", 0) = 1
  187.             bTimeEffectForHit = Settings.GetValueKey("UseTimeEffectForHit", "GENERAL", 1) = 1
  188.             bBulletTimeWhenAim = Settings.GetValueKey("bBulletTimeWhenAim", "GENERAL", 1) = 1
  189.             hkActivate = Settings.GetValueKey("ActivateScript", "HotKeys", Keys.F4)
  190.             hkSpawnBike = Settings.GetValueKey("SpawnBike", "HotKeys", Keys.F5)
  191.             hkThrowFlames = Settings.GetValueKey("ThrowFlames", "HotKeys", Keys.D1)
  192.             hkChainAttack1 = Settings.GetValueKey("hkChainAttack1", "HotKeys", Keys.D1)
  193.             hkChainAttackGrab = Settings.GetValueKey("hkChainAttackGrab", "HotKeys", Keys.D3)
  194.             hkTurnVehicleLeft = Settings.GetValueKey("hkTurnVehicleLeft", "HotKeys", Keys.A)
  195.             hkTurnVehicleRight = Settings.GetValueKey("hkTurnVehicleRight", "HotKeys", Keys.D)
  196.             hkEquipChain = Settings.GetValueKey("hkEquipChain", "HotKeys", Keys.d0)
  197.             hkBikeNitro = Settings.GetValueKey("BikeNitro", "HotKeys", Keys.ShiftKey)
  198.             hkControlKey = Settings.GetValueKey("ControlKey", "HotKeys", Keys.ControlKey)
  199.             hkSpitBullets = Settings.GetValueKey("hkSpitBullets", "HotKeys", Keys.D3)
  200.             hkPenanceStare = Settings.GetValueKey("hkPenanceStare", "HotKeys", Keys.D2)
  201.             hkAccelKey = Settings.GetValueKey("hkAccelKey", "HotKeys", Keys.W)
  202.             hkAimKey = Settings.GetValueKey("hkAimKey", "HotKeys", Keys.RButton)
  203.             hkShootKey = Settings.GetValueKey("hkShootKey", "HotKeys", Keys.LButton)
  204.             hkEnterVehicleKey = Settings.GetValueKey("hkEnterVehicleKey", "HotKeys", Keys.F)
  205.             hkChainClimb = Settings.GetValueKey("hkChainClimb", "HotKeys", Keys.D4)
  206.             throwEffectRoundForVehicles = Settings.GetValueKey("throwEffectRoundForVehicles", "GENERAL", 12)
  207.             throwEffectRoundForPeds = Settings.GetValueKey("throwEffectRoundForPeds", "GENERAL", 20)
  208.             flameOffSetX = Settings.GetValueFloat("flameOffSetX", "GENERAL", 0)
  209.             flameOffSetY = Settings.GetValueFloat("flameOffSetY", "GENERAL", 0)
  210.             flameOffSetZ = Settings.GetValueFloat("flameOffSetZ", "GENERAL", 0)
  211.             flameSizeMuliplier = Settings.GetValueFloat("flameSizeMuliplier", "GENERAL", 1)
  212.             flameLightMultiplier = Settings.GetValueFloat("flameLightMultiplier", "GENERAL", 1)
  213.             BikeFlameOffSetX = Settings.GetValueFloat("BikeFlameOffSetX", "GENERAL", 0)
  214.             BikeFlameOffSetY = Settings.GetValueFloat("BikeFlameOffSetY", "GENERAL", 0)
  215.             BikeFlameOffSetZ = Settings.GetValueFloat("BikeFlameOffSetZ", "GENERAL", 0)
  216.             BikeFlameSizeMuliplier = Settings.GetValueFloat("BikeFlameSizeMuliplier", "GENERAL", 1)
  217.             UpForceWallRide = Settings.GetValueFloat("UpForceWallRide", "GENERAL", 0.25)
  218.             HitForce = Settings.GetValueFloat("HitForce", "GENERAL", 1.0)
  219.             ShotgunForce = Settings.GetValueFloat("ShotgunForce", "GENERAL", 1.0)
  220.             TimeEffectForHit = Settings.GetValueFloat("TimeEffectForHit", "GENERAL", 0.1)
  221.             PlMaxHealth = Settings.GetValueFloat("PlMaxHealth", "GENERAL", 100)
  222.             sGRmodel = Settings.GetValueString("GhostRider_Replaced_model_name", "GENERAL", "m_y_multiplayer")
  223.             GRBike = Settings.GetValueString("GhostRider_Replaced_Bike_name", "GENERAL", "ZOMBIEB")
  224.  
  225.             If throwEffectRoundForPeds > 200 Then throwEffectRoundForPeds = 200
  226.  
  227.             l1 = New Light
  228.             l1.Color = System.Drawing.Color.Goldenrod
  229.             l1.Position = Player.Character.GetBonePosition(Bone.Head) + Vector3.WorldUp / 2
  230.             l1.Intensity = 15
  231.             l1.Range = 3
  232.             l1.Enabled = False
  233.  
  234.             l2 = New Light
  235.             l2.Color = l1.Color
  236.             l2.Position = Player.Character.GetBonePosition(Bone.Head) + Vector3.WorldUp / 2
  237.             l2.Intensity = 15
  238.             l2.Range = 3
  239.             l2.Enabled = False
  240.  
  241.             l3 = New Light
  242.             l3.Color = System.Drawing.Color.Orange
  243.             l3.Position = Player.Character.GetBonePosition(Bone.Head) + Vector3.WorldUp / 2
  244.             l3.Intensity = 15
  245.             l3.Range = 3
  246.             l3.Enabled = False
  247.  
  248.             PSLight = New Light
  249.             PSLight.Color = System.Drawing.Color.White
  250.             PSLight.Enabled = False
  251.             PSLight.Intensity = 20
  252.             PSLight.Position = Player.Character.GetBonePosition(Bone.Head) + Vector3.WorldUp / 2
  253.            
  254.             carLight = New Light
  255.             carLight.Color = System.Drawing.Color.orangered
  256.             carLight.Enabled = False
  257.             carLight.Intensity = 50
  258.             carLight.Position = Player.Character.GetBonePosition(Bone.Head) + Vector3.WorldUp / 2
  259.            
  260.             PenanceStareCP = New Checkpoint
  261.             PenanceStareCP.Visible = False
  262.             PenanceStareCP.Color = System.Drawing.Color.FromArgb(100, System.Drawing.Color.White)
  263.             PenanceStareCP.Diameter = 1.0
  264.  
  265.             aSetPenanceStare = New AnimationSet("missfaustin3")
  266.             aSetPenanceStarePed = New AnimationSet("missfrancis2")
  267.             aSetPenanceStarePedIni = New AnimationSet("amb@brazier")
  268.  
  269.             PSAnimName = "point_fwd"
  270.  
  271.             PSBoneAttach = Bone.RightHand
  272.  
  273.             timer1 = 0
  274.  
  275.             timeScript = 0
  276.  
  277.             if sGRmodel <> "none" then
  278.                 mGR = New Model(sGRmodel)
  279.             else
  280.                 mGR = nothing
  281.             end if
  282.            
  283.             mPL = New Model("player")
  284.            
  285.             Player.Character.Metadata.isGhostRider = False
  286.             Player.Character.Metadata.resetModel = False
  287.  
  288.             Try
  289.                 If bShowIcons Then
  290.                     IconThrowFlames = New GTA.Texture(File.ReadAllBytes(".\scripts\GRIcons\THF.png"))
  291.                     IconPenanceStare1 = New GTA.Texture(File.ReadAllBytes(".\scripts\GRIcons\PS1.png"))
  292.                     IconPenanceStare2 = New GTA.Texture(File.ReadAllBytes(".\scripts\GRIcons\PS2.png"))
  293.                     IconPenanceStare3 = New GTA.Texture(File.ReadAllBytes(".\scripts\GRIcons\PS3.png"))
  294.                     IconPenanceStare4 = New GTA.Texture(File.ReadAllBytes(".\scripts\GRIcons\PS4.png"))
  295.                     IconSpitbullets = New GTA.Texture(File.ReadAllBytes(".\scripts\GRIcons\SB.png"))
  296.                     IconShotgun = New GTA.Texture(File.ReadAllBytes(".\scripts\GRIcons\SG.png"))
  297.                     IconSpeedKills = New GTA.Texture(File.ReadAllBytes(".\scripts\GRIcons\SK.png"))
  298.                     IconChains = New GTA.Texture(File.ReadAllBytes(".\scripts\GRIcons\CH.png"))
  299.                 End If
  300.             Catch
  301.                 IconThrowFlames = Nothing
  302.                 IconPenanceStare1 = Nothing
  303.                 IconPenanceStare2 = Nothing
  304.                 IconPenanceStare3 = Nothing
  305.                 IconPenanceStare4 = Nothing
  306.                 IconSpitbullets = Nothing
  307.                 IconShotgun = Nothing
  308.                 IconSpeedKills = Nothing
  309.                 IconChains = Nothing
  310.             End Try
  311.  
  312.             bIconThrowFlames = False
  313.             iIconPenanceStare = 0
  314.             bIconSpitbullets = False
  315.             bIconSpitbulletsLoop = False
  316.             bIconShotgun = False
  317.             bIconSpeedKills = False
  318.             bIconChains = False
  319.  
  320.             SpitBulletBulCountFont = New GTA.Font
  321.             SpitBulletBulCountFont.Color = System.Drawing.Color.DarkGray
  322.  
  323.             timeHealth = 0
  324.  
  325.             aSetChainAttack = New AnimationSet("amb@garbage")
  326.             aSetChainGrab = New AnimationSet("melee_counters")
  327.  
  328.             ReDim objChain(maxChainObj)
  329.  
  330.             Dim chainModel As Model = New Model("cj_proc_brick")
  331.  
  332.             vecChainDim = chainModel.GetDimensions
  333.             vecChainDimIni = chainModel.GetDimensions
  334.            
  335.             player.character.metadata.isInWater = false
  336.            
  337.             TargetCheckpoint = new Checkpoint
  338.             TargetCheckpoint.color = System.Drawing.Color.FromArgb(100, System.Drawing.Color.red)
  339.             TargetCheckpoint.diameter = 2.0
  340.            
  341.             TargetLight = New Light
  342.             TargetLight.Color = System.Drawing.Color.Red
  343.             TargetLight.Enabled = False
  344.             TargetLight.Intensity = 50
  345.             TargetLight.Position = Player.Character.GetBonePosition(Bone.Head) + Vector3.WorldUp / 2
  346.            
  347.             aSetChainClimb = New AnimationSet("jump_std")
  348.  
  349.             targetObjectAux = World.CreateObject("cj_proc_brick", Vector3.Zero.Around(300))
  350.             targetObjectAux.FreezePosition = True
  351.             targetObjectAux.Visible = False
  352.             targetObjectAux.Collision = False
  353.         End If
  354.     End Sub
  355.  
  356.     Private Sub GraphicsEventHandler(ByVal sender As Object, ByVal e As GTA.GraphicsEventArgs) Handles mybase.PerFrameDrawing
  357.         FPS = e.graphics.FrameTime
  358.        
  359.         If isGhostRider AndAlso bShowIcons Then
  360.             If bIconThrowFlames Then
  361.                 If Exists(IconThrowFlames) Then e.Graphics.DrawSprite(IconThrowFlames, 35, 35, 100, 80, 0)
  362.             Else
  363.                 If Exists(IconThrowFlames) Then e.Graphics.DrawSprite(IconThrowFlames, 35, 35, 65, 50, 0, System.Drawing.Color.SlateGray)
  364.             End If
  365.  
  366.             If iIconPenanceStare = 1 Then
  367.                 If Exists(IconPenanceStare1) Then e.Graphics.DrawSprite(IconPenanceStare1, 105, 35, 100, 80, 0)
  368.             ElseIf iIconPenanceStare = 2 Then
  369.                 If Exists(IconPenanceStare2) Then e.Graphics.DrawSprite(IconPenanceStare2, 105, 35, 100, 80, 0)
  370.             ElseIf iIconPenanceStare = 3 Then
  371.                 If Exists(IconPenanceStare3) Then e.Graphics.DrawSprite(IconPenanceStare3, 105, 35, 100, 80, 0)
  372.             ElseIf iIconPenanceStare = 4 Then
  373.                 If Exists(IconPenanceStare4) Then e.Graphics.DrawSprite(IconPenanceStare4, 105, 35, 100, 80, 0)
  374.             Else
  375.                 If Exists(IconPenanceStare1) Then e.Graphics.DrawSprite(IconPenanceStare1, 105, 35, 65, 50, 0, System.Drawing.Color.SlateGray)
  376.             End If
  377.  
  378.             If bIconSpitbullets OrElse bIconSpitbulletsLoop Then
  379.                 If Exists(IconSpitbullets) Then e.Graphics.DrawSprite(IconSpitbullets, 175, 35, 100, 80, 0)
  380.             Else
  381.                 If Exists(IconSpitbullets) Then e.Graphics.DrawSprite(IconSpitbullets, 175, 35, 65, 50, 0, System.Drawing.Color.SlateGray)
  382.             End If
  383.  
  384.             If bIconShotgun Then
  385.                 If Exists(IconShotgun) Then e.Graphics.DrawSprite(IconShotgun, 245, 35, 100, 80, 0)
  386.             Else
  387.                 If Exists(IconShotgun) Then e.Graphics.DrawSprite(IconShotgun, 245, 35, 65, 50, 0, System.Drawing.Color.SlateGray)
  388.             End If
  389.  
  390.             If bIconSpeedKills Then
  391.                 If Exists(IconSpeedKills) Then e.Graphics.DrawSprite(IconSpeedKills, 315, 35, 100, 80, 0)
  392.             Else
  393.                 If Exists(IconSpeedKills) Then e.Graphics.DrawSprite(IconSpeedKills, 315, 35, 65, 50, 0, System.Drawing.Color.SlateGray)
  394.             End If
  395.  
  396.             If bIconChains Then
  397.                 If Exists(IconChains) Then e.Graphics.DrawSprite(IconChains, 385, 35, 100, 80, 0)
  398.             Else
  399.                 If Exists(IconChains) Then e.Graphics.DrawSprite(IconChains, 385, 35, 65, 50, 0, System.Drawing.Color.SlateGray)
  400.             End If
  401.  
  402.             If Not bInfiniteSpitBullets Then e.Graphics.DrawText(SpitBulletBulCount.ToString, 145, 10, SpitBulletBulCountFont)
  403.         End If
  404.        
  405.         if depMsg <> "" then e.graphics.drawtext(depMsg, 10, 10)
  406.     End Sub
  407.    
  408.     private function getInterval
  409.         Return Me.Interval * (25 / Game.FPS)
  410.     end function
  411.  
  412.     Private Sub PlaySound(ByVal sFile)
  413.         Try
  414.             If bPlaySounds Then
  415.                 Dim Sound As New System.Media.SoundPlayer()
  416.  
  417.                 Sound.SoundLocation = sFile
  418.                 Sound.Load()
  419.                 Sound.Play()
  420.             End If
  421.         Catch
  422.         End Try
  423.     End Sub
  424.  
  425.     Private Sub msg(ByVal smsg As String, ByVal duracao As int32)
  426.         If bShowMsgs Then _
  427.             Native.Function.Call("PRINT_STRING_WITH_LITERAL_STRING_NOW", "STRING", smsg, duracao, 1)
  428.     End Sub
  429.  
  430.     Private Function random(ByVal min As int32, ByVal max As int32)
  431.         Dim rnd As random = New random(System.DateTime.Now.Millisecond)
  432.         random = rnd.next(min, max)
  433.     End Function
  434.  
  435.     Private Sub console_CMD(ByVal sender As Object, ByVal e As ConsoleEventArgs) Handles MyBase.ConsoleCommand
  436.     End Sub
  437.  
  438.     Private Sub waitEx(ByVal time As int32)
  439.         Dim c As Double = 0
  440.  
  441.         While c < time
  442.             c += getInterval
  443.             wait(getInterval)
  444.         End While
  445.     End Sub
  446.  
  447.     Shadows Sub keyDown(ByVal sender As Object, ByVal e As GTA.KeyEventArgs) Handles MyBase.KeyDown    
  448.         If bWaitLoad Then Exit Sub
  449.  
  450.         If e.Key = hkActivate Then
  451.             wasGROnceCont = 4000
  452.             wasGROnce = True
  453.  
  454.             isGhostRider = Not isGhostRider
  455.  
  456.             If isGhostRider Then
  457.                 Player.Character.MakeProofTo(False, True, True, collisionProof, True)
  458.  
  459.                 World.AddExplosion(Player.Character.Position.ToGround, ExplosionType.Molotov, 1.0, True, False, 0.0F)
  460.  
  461.                 bSpawnBike = bAutoSpawnBike
  462.             Else
  463.                 targetObjectAux.FreezePosition = True
  464.                 leaveChains()
  465.             End If
  466.         End If
  467.        
  468.         if isGhostRider andalso (e.key = hkChainClimb) andalso game.iskeypressed(hkAimKey) andalso isChainOn then
  469.             TargetCheckpoint.visible = true    
  470.             TargetLight.enabled = true
  471.         end if
  472.        
  473.         If isGhostRider AndAlso Not isChainOn() AndAlso ((e.Key = hkThrowFlames) OrElse (e.Key = hkSpitBullets) OrElse (e.Key = hkPenanceStare)) Then _    
  474.             PreviousWeapon = Player.Character.Weapons.Current
  475.            
  476.         If isGhostRider AndAlso Not isChainOn() AndAlso (e.Key = hkThrowFlames) Then _
  477.             throwFlames
  478.  
  479.         If isGhostRider AndAlso (e.Key = hkSpawnBike) Then _
  480.             spawnBike()
  481.  
  482.         If isGhostRider AndAlso Not isChainOn() AndAlso (e.Key = hkSpitBullets) AndAlso Game.isKeyPressed(hkAimKey) Then
  483.             If Not Player.Character.Weapons.inSlot(WeaponSlot.Thrown).isPresent Then
  484.                 Native.Function.Call("GIVE_WEAPON_TO_CHAR", Player.Character, 4, 1, 1)
  485.                
  486.                 if (player.character.weapons.current <> WeaponSlot.Thrown) then Player.Character.Weapons.inSlot(WeaponSlot.Thrown).Select
  487.             End If
  488.         End If
  489.  
  490.         If isGhostRider AndAlso (e.Key = hkBikeNitro) AndAlso Player.Character.Metadata.DidWallRide Then _
  491.             World.AddExplosion(Player.Character.Position, ExplosionType.Molotov, 1.0, True, False, 5.0F)
  492.  
  493.         If isGhostRider AndAlso (e.Key = hkEnterVehicleKey) Then
  494.             If Exists(Player.Character.CurrentVehicle) Then
  495.                 currVehDim = Player.Character.CurrentVehicle.model.getdimensions
  496.                
  497.                 Native.Function.Call("SET_CAR_WATERTIGHT", Player.Character.CurrentVehicle, True)
  498.             end if
  499.            
  500.             If Native.Function.Call(Of Boolean)("IS_CHAR_IN_WATER", Player.Character) AndAlso Not Exists(Player.Character.CurrentVehicle) Then
  501.                 Dim vAux As Vehicle
  502.  
  503.                 vAux = World.GetClosestVehicle(Player.Character.Position, 3.0F)
  504.  
  505.                 If Exists(vAux) AndAlso vAux.Model.isBike Then
  506.                     Player.Character.Task.ClearAllImmediately()
  507.                     Player.Character.Task.GoTo(vAux.Position, False)
  508.                     vAux.ApplyForce(Vector3.WorldUp * 5)
  509.                     Wait(500)
  510.                     Player.Character.Task.ClearAllImmediately()
  511.                     Player.Character.Task.WarpIntoVehicle(vAux, VehicleSeat.Driver)
  512.                 End If
  513.             End If
  514.         End If
  515.  
  516.         If isGhostRider AndAlso (e.Key = hkPenanceStare) Then
  517.             pChainTargetGrab = Nothing
  518.             vChainTargetGrab = Nothing
  519.  
  520.             PenanceStareFindPed()
  521.  
  522.             If Exists(PenanceStarePedTmp) AndAlso (PenanceStarePedTmp.Health > 0) Then
  523.                 PenanceStareMod = 0
  524.  
  525.                 PenanceStareCP.Position = PenanceStarePedTmp.Position.ToGround
  526.                 PenanceStareCP.Visible = True
  527.                 PSLight.Position = PenanceStareCP.Position + Vector3.WorldUp / 2
  528.                 PSLight.Enabled = True
  529.  
  530.                 If Exists(PenanceStarePedTmp.CurrentVehicle) Then
  531.                     PenanceStarePedTmp.CurrentVehicle.EngineHealth = 0
  532.                     PenanceStarePedTmp.CurrentVehicle.EngineRunning = False
  533.                 End If
  534.             Else
  535.                 If PenanceStareCP.Visible Then PenanceStareCP.Visible = False
  536.                 If PSLight.Enabled Then PSLight.Enabled = False
  537.  
  538.                 iIconPenanceStare = 0
  539.             End If
  540.         End If
  541.  
  542.         If isGhostRider AndAlso (e.Key = hkEquipChain) Then _
  543.             spawnChain
  544.  
  545.         If isGhostRider AndAlso isChainOn() AndAlso (e.Key = hkChainAttack1) AndAlso Game.isKeyPressed(hkAimKey) Then
  546.             pChainTarget = Nothing
  547.             vChainTarget = Nothing
  548.  
  549.             chainAttackMode = 1
  550.  
  551.             If Not chainFindTarget() Then
  552.                 chainAttackMode = 0
  553.             Else
  554.                 timeOutMoveChain = 0
  555.  
  556.                 If Exists(pChainTarget) AndAlso Exists(pChainTarget.CurrentVehicle) Then
  557.                     pChainTarget.CurrentVehicle.EngineHealth = 1
  558.                     pChainTarget.CurrentVehicle.EngineRunning = False
  559.                 End If
  560.  
  561.                 If Exists(vChainTargetGrab) AndAlso vChainTargetGrab.Model.isHelicopter Then vChainTargetGrab.EngineHealth = -1
  562.  
  563.                 If Exists(vChainTarget) Then vChainTarget.EngineHealth = 0
  564.  
  565.                 PlaySound(".\scripts\GRSounds\ChainDrag.wav")
  566.  
  567.                 chainThrowAnim()
  568.  
  569.                 Try
  570.                     If Not Exists(vChainTargetGrab) Then
  571.                         While (Exists(vChainTarget) OrElse Exists(pChainTarget)) AndAlso _
  572.                            Not moveChainToVec(Player.Character.Position + (Player.Character.Direction * 2) + Vector3.WorldUp * 4, 1, 200)
  573.                             Wait(getInterval)
  574.  
  575.                             Player.Character.Heading = Game.CurrentCamera.Heading
  576.                         End While
  577.                     Else
  578.                         vChainTargetGrab.FreezePosition = True
  579.                         vChainTargetGrab.FreezePosition = False
  580.  
  581.                         Dim vecAux As Vector3 = vChainTargetGrab.Position + Player.Character.Direction + Vector3.WorldUp * 9
  582.  
  583.                         While (Exists(vChainTarget) OrElse Exists(pChainTarget)) AndAlso Not moveChainToVec(vecAux, 1, 50)
  584.                             Wait(getInterval)
  585.  
  586.                             Player.Character.Heading = Game.CurrentCamera.Heading
  587.                         End While
  588.  
  589.                         'vChainTargetGrab.FreezePosition = True
  590.                         'vChainTargetGrab.FreezePosition = False
  591.  
  592.                         If Exists(pChainTarget) Then
  593.                             'vChainTargetGrab.Metadata.ChainTargetPos = pChainTarget.Position + Vector3.WorldDown
  594.                             If Exists(pChainTarget.CurrentVehicle) Then
  595.                                 vChainTarget = pChainTarget.CurrentVehicle
  596.                                 pChainTarget = Nothing
  597.                                 grabTargetPos = vChainTarget.Position + Vector3.WorldDown
  598.                             Else
  599.                                 grabTargetPos = pChainTarget.Position + Vector3.WorldDown
  600.                             End If
  601.                         Else
  602.                             'vChainTargetGrab.Metadata.ChainTargetPos = vChainTarget.Position + Vector3.WorldDown
  603.                             grabTargetPos = vChainTarget.Position + Vector3.WorldDown
  604.                         End If
  605.                     End If
  606.  
  607.                     PlaySound(".\scripts\GRSounds\ChainStart.wav")
  608.  
  609.                     If Exists(pChainTargetGrab) Then
  610.                         pChainTargetGrab.FreezePosition = True
  611.                         pChainTargetGrab.FreezePosition = False
  612.  
  613.                         pChainTargetGrab.isOnFire = True
  614.                         pChainTargetGrab.isRagdoll = True
  615.  
  616.                         timeOutMoveChain = 0
  617.                     End If
  618.  
  619.                     If Exists(vChainTargetGrab) Then vChainTargetGrab.CanBeDamaged = True
  620.                 Catch
  621.                     chainAttackMode = 0
  622.                     vChainTarget = Nothing
  623.                     pChainTarget = Nothing
  624.                     vChainTargetGrab = Nothing
  625.                     pChainTargetGrab = Nothing
  626.                 End Try
  627.             End If
  628.         End If
  629.  
  630.         If isGhostRider AndAlso isChainOn() AndAlso (e.Key = hkChainAttackGrab) AndAlso Game.isKeyPressed(hkAimKey) Then
  631.             pChainTarget = Nothing
  632.             pChainTargetGrab = Nothing
  633.             vChainTarget = Nothing
  634.             vChainTargetGrab = Nothing
  635.  
  636.             chainAttackMode = 2
  637.  
  638.             If Not chainFindTarget() Then
  639.                 chainAttackMode = 0
  640.                 pChainTarget = Nothing
  641.                 pChainTargetGrab = Nothing
  642.                 vChainTarget = Nothing
  643.                 vChainTargetGrab = Nothing
  644.             Else
  645.                 If Exists(pChainTargetGrab) AndAlso Exists(pChainTargetGrab.CurrentVehicle) Then
  646.                     pChainTargetGrab.CurrentVehicle.EngineHealth = 1
  647.                     pChainTargetGrab.CurrentVehicle.EngineRunning = False
  648.                 End If
  649.  
  650.                 Dim pAux As Ped = pChainTargetGrab
  651.                 pChainTargetGrab = Nothing
  652.  
  653.                 Player.Character.Heading = Game.CurrentCamera.Heading
  654.  
  655.                 PlaySound(".\scripts\GRSounds\ChainDrag.wav")
  656.  
  657.                 chainGrabAnim()
  658.  
  659.                 If Not Exists(vChainTargetGrab) Then
  660.                     While Not moveChainToVec(Player.Character.Position + (Player.Character.Direction * 2) + Vector3.WorldUp * 4, 1, 50)
  661.                         Wait(getInterval)
  662.  
  663.                         Player.Character.Heading = Game.CurrentCamera.Heading
  664.                     End While
  665.                 Else
  666.                     If Not vChainTargetGrab.Model.isHelicopter Then vChainTargetGrab.EngineHealth = 0
  667.                 End If
  668.  
  669.                 Player.Character.Heading = Game.CurrentCamera.Heading
  670.  
  671.                 pChainTargetGrab = pAux
  672.  
  673.                 If Exists(vChainTargetGrab) Then vChainTargetGrab.CanBeDamaged = True
  674.             End If
  675.         End If
  676.  
  677.         If isGhostRider AndAlso (e.Key = hkSpitBullets) AndAlso isChainOn() Then
  678.             if (player.character.weapons.current <> weapon.Misc_Object) then Player.Character.Weapons.inSlot(Weapon.Misc_Object).Select
  679.         End If
  680.  
  681.         If isGhostRider AndAlso (e.Key = hkControlKey) Then
  682.             hkcontrolkeyDownTime = 0
  683.         End If
  684.     End Sub
  685.     shadows Sub keyUp(ByVal sender As Object, ByVal e As GTA.KeyEventArgs) Handles MyBase.KeyUp    
  686.         if isGhostRider andalso (e.key = hkChainClimb) andalso game.iskeypressed(hkAimKey) andalso isChainOn then
  687.             TargetCheckpoint.visible = false
  688.             TargetLight.enabled = false
  689.             ChainWarpToPos
  690.         elseif (e.key = hkChainClimb) orelse (e.key = hkAimKey) then
  691.             TargetCheckpoint.visible = false
  692.             TargetLight.enabled = false
  693.         end if
  694.        
  695.         If isGhostRider AndAlso (e.key = hkPenanceStare) Then
  696.             chainAttackMode = 2
  697.            
  698.             PenanceStareCatchPed
  699.            
  700.             if exists(PenanceStarePedTmp) andalso exists(PenanceStarePedTmp.currentvehicle) then
  701.                 PenanceStarePedTmp.currentvehicle.enginehealth = 1
  702.                 PenanceStarePedTmp.currentvehicle.EngineRunning = false
  703.             end if
  704.            
  705.             chainAttackMode = 0
  706.         End If
  707.        
  708.         'if isGhostRider AndAlso (e.key = hkSpitBullets) andalso isChainOn andalso (player.character.weapons.current <> WeaponSlot.Thrown) Then
  709.             'player.character.weapons.inslot(WeaponSlot.Thrown).select
  710.         'end if
  711.     End Sub
  712.    
  713.     private sub wheelieJump
  714.         If exists(player.character.currentvehicle) AndAlso ((Player.Character.CurrentVehicle.Model.isBike orelse player.character.currentvehicle.metadata.isGRTransformed)) Then
  715.             Dim vecAux, vecAux2 As vector3
  716.            
  717.             if (hkcontrolkeyDownTime <= 200) andalso ((world.GetGroundPosition(player.character.position, GroundType.Lowest).distanceto(player.character.position) < 1.1) orelse _
  718.                 player.character.currentvehicle.isonallwheels orelse ((onAllWheelsCont > 500) andalso native.function.call(Of Boolean)("IS_CAR_IN_WATER", player.character.currentvehicle))) then
  719.                 world.addexplosion(player.character.currentvehicle.position.toground, explosionType.molotov, 1.0, True, False, 0.0F)
  720.                 vecAux.z = 8
  721.                
  722.                 if not game.iskeypressed(hkAimKey) then
  723.                     vecAux2.y = 0.13
  724.                     onAllWheelsCont = 1000
  725.                 else
  726.                     vecAux2.y = -0.2
  727.                 end if
  728.                
  729.                 if player.character.currentvehicle.metadata.isGRTransformed then
  730.                     if currVehDim.y > 8 then
  731.                         vecAux.z = 10
  732.                        
  733.                         if currVehDim.y > 10 then
  734.                             vecAux2.y = 1.2
  735.                         else
  736.                             vecAux2.y = 1
  737.                         end if
  738.                     else
  739.                         vecAux2.y = 0.3
  740.                     end if
  741.                 end if
  742.             else
  743.                 vecAux.z = 0.3
  744.                 vecAux2.y = 1
  745.             end if
  746.  
  747.             hkcontrolkeyDownTime = 0
  748.            
  749.             player.character.currentvehicle.applyforce(vecAux, vecAux2)        
  750.         End If
  751.     end sub
  752.    
  753.     private sub HitEffect
  754.         if player.character.isInMeleeCombat then
  755.             Dim bSlowed As Boolean = False
  756.             Dim vecAux As Vector3
  757.            
  758.             For Each p As ped In world.getpeds(player.character.position, 2.0)
  759.                 If native.function.call(Of Boolean)("HAS_CHAR_BEEN_DAMAGED_BY_CHAR", p, player.character) Then
  760.                     p.isragdoll = true
  761.                     p.isonfire = true
  762.                    
  763.                     if bTimeEffectForHit then
  764.                         game.timescale = TimeEffectForHit
  765.                         bSlowed = true
  766.                     end if
  767.  
  768.                     vecAux = Player.Character.Direction
  769.                     vecAux.Z = Game.CurrentCamera.Direction.Z
  770.                     p.Velocity = vecAux * 15 * HitForce
  771.                     native.function.call("CLEAR_CHAR_LAST_DAMAGE_ENTITY", p)
  772.                     native.function.call("CLEAR_CHAR_LAST_WEAPON_DAMAGE", p)
  773.                 End If
  774.             Next
  775.            
  776.             For Each v As vehicle In world.getvehicles(player.character.position, 7.0)
  777.                 If native.function.call(Of Boolean)("HAS_CAR_BEEN_DAMAGED_BY_CHAR", v, player.character) Then
  778.                     if bTimeEffectForHit then
  779.                         game.timescale = TimeEffectForHit
  780.                         bSlowed = true
  781.                     end if
  782.  
  783.                     vecAux = Player.Character.Direction
  784.                     vecAux.Z = Game.CurrentCamera.Direction.Z
  785.                    
  786.                     playsound(".\scripts\GRSounds\CarHit1.wav")
  787.                    
  788.                     v.ApplyForce((vecAux + Vector3.WorldUp / 2) * 10 * HitForce)
  789.                     native.function.call("CLEAR_CAR_LAST_DAMAGE_ENTITY", v)
  790.                     native.function.call("CLEAR_CAR_LAST_WEAPON_DAMAGE", v)
  791.                 End If
  792.             Next
  793.            
  794.             if bSlowed then
  795.                 player.character.health += 33
  796.                
  797.                 wait(2000)
  798.                
  799.                 game.timescale = 1.0
  800.             end if
  801.         end if
  802.     end sub
  803.  
  804.     Private Sub throwFlames
  805.         Dim timeOut As int16 = 0
  806.         Dim aSet As animationset = New animationset("melee_counters")
  807.  
  808.         bIconThrowFlames = True
  809.  
  810.         'PlaySound(".\scripts\GRSounds\burn.wav")
  811.        
  812.         While timeOut < 5000
  813.             If (Not player.character.animation.isplaying(aSet, "dodge_back")) Then
  814.                 Native.Function.Call("STOP_PTFX", effectThrow1)
  815.                 Native.Function.Call("STOP_PTFX", effectThrow2)
  816.  
  817.                 wait(getInterval)
  818.  
  819.                 player.character.health += 3
  820.  
  821.                 effectThrow1 = Native.Function.Call(Of int32)("START_PTFX_ON_PED_BONE", "exp_fireball", Player.Character, 0, 0.15, 0, 0, 0, 0, Bone.head, 0.01) ' this makes the noise, basically
  822.                 effectThrow2 = Native.Function.Call(Of int32)("START_PTFX_ON_PED_BONE", "shot_directed_flame", Player.Character, 0, 0.25, 0, -90.0F, 0, 0, Bone.head, 1.5) ' one more falme, 2x bigger             
  823.  
  824.                 If Not game.iskeypressed(hkAccelKey) AndAlso (player.character.velocity.distanceto(vector3.zero) < 1) AndAlso Not exists(player.character.currentvehicle) Then _
  825.                  player.character.animation.play(aSet, "dodge_back", 1.0, animationflags.unknown01)
  826.             End If
  827.  
  828.             timeOut += Me.Interval * 4
  829.  
  830.             wait(getInterval)
  831.  
  832.             updateLightPos
  833.  
  834.             findPedVehAndBurnHim() ' ...search for peds/vehicles in the way an burn them
  835.  
  836.             If game.iskeypressed(hkAccelKey) AndAlso Not exists(player.character.currentvehicle) AndAlso (player.character.velocity.distanceto(vector3.zero) < 1) Then _
  837.                 player.character.heading = game.currentcamera.heading
  838.  
  839.             If (player.character.velocity.distanceto(vector3.zero) > 1) AndAlso player.character.animation.isplaying(aSet, "dodge_back") Then _
  840.                 player.character.task.clearallimmediately()
  841.  
  842.             flames()
  843.             flamesBike()
  844.  
  845.             player.character.health += 1
  846.         End While
  847.  
  848.         bIconThrowFlames = False
  849.  
  850.         Native.Function.Call("STOP_PTFX", effectThrow1)
  851.         Native.Function.Call("STOP_PTFX", effectThrow2)
  852.  
  853.         flames()
  854.         flamesBike()
  855.     End Sub
  856.  
  857.     Private Sub spawnBike
  858.         If player.character.isinvehicle orelse player.character.isragdoll orelse player.character.isgettingup Then Exit Sub
  859.        
  860.         Dim vTmp As vehicle
  861.         dim vecAux, vecRot as vector3
  862.         dim pAux as ped = nothing
  863.         dim TimeOut as int16 = 0
  864.         dim GRBikeModel as model = nothing
  865.        
  866.         for each v as vehicle in world.getallvehicles
  867.             if exists(v) then
  868.                 v.metadata.launchControl = 0
  869.                
  870.                 if v.model = GRBike then v.delete
  871.             end if
  872.         next
  873.        
  874.         GRBikeModel = new model(GRBike)
  875.        
  876.         vecAux = (player.Character.position + (player.Character.direction * 20))
  877.         'vecAux.z = world.GetGroundPosition(vecAux, GroundType.Lowest).z + 1
  878.        
  879.         If Not native.function.call(Of Boolean)("IS_CHAR_IN_WATER", player.character) Then
  880.         '   if (player.character.position.z - world.GetNextPositionOnPavement(player.character.position).z > 3) orelse _
  881.         '      ((world.GetNextPositionOnStreet(player.character.position).distanceto(player.character.position) > 7) andalso _
  882.         '       (world.GetNextPositionOnPavement(player.character.position).distanceto(player.character.position) > 7)) then
  883.         '       vecAux = player.Character.position + (player.Character.direction * 2)          
  884.         '       'vecAux.z = world.GetGroundPosition(vecAux, GroundType.Lowest).z + 1
  885.         '      
  886.         '       vTmp = world.createvehicle(GRBikeModel, vecAux)
  887.         '   else
  888.                 PlaySound(".\scripts\GRSounds\whistle.wav")
  889.                
  890.                 'vecAux = world.GetNextPositionOnStreet(vecAux)
  891.                
  892.                 'if vecAux.distanceto(player.character.position) > world.GetNextPositionOnPavement(player.character.position).distanceto(player.character.position) then _
  893.                 '   vecAux = world.GetNextPositionOnPavement(player.character.position)
  894.                
  895.                 world.addexplosion(vecAux, explosionType.molotov, 1.0, True, False, 0.0F)
  896.                 vTmp = world.createvehicle(GRBikeModel.hash, vecAux)
  897.                
  898.                 while not exists(vTmp) andalso (timeOut < 500)
  899.                     wait(me.interval)
  900.                    
  901.                     timeOut += me.interval
  902.                 end while
  903.                
  904.                 if not exists(vTmp) then
  905.                     msg("There is something wrong...", 5000)
  906.                    
  907.                     exit sub
  908.                 end if
  909.                
  910.                 vTmp.metadata.GRprop = true
  911.                 native.function.call("DETACH_CAR", vTmp)
  912.                 vTmp.heading = player.character.heading - 180
  913.                 vTmp.cantiresburst = False
  914.                 vTmp.makeproofto(True, True, True, True, True)
  915.                 vTmp.freezeposition = False    
  916.                
  917.                 timeOut = 0
  918.                
  919.                 paux = vTmp.CreatePedOnSeat(vehicleseat.driver)
  920.                
  921.                 while not exists(pAux) andalso (timeOut < 500)
  922.                     wait(me.interval)
  923.                    
  924.                     timeOut += me.interval
  925.                 end while
  926.                
  927.                 if exists(paux) then
  928.                     pAux.visible = false
  929.                     pAux.MakeProofTo(True, True, True, True, True)
  930.                 end if
  931.            
  932.                 vTmp.applyforce(vector3.worldup * 7)               
  933.                
  934.                 wait(1000)
  935.                
  936.                 if not exists(vTmp) then
  937.                     msg("There is something wrong...", 3000)
  938.                    
  939.                     exit sub
  940.                 end if
  941.                
  942.                 vecAux = vTmp.position
  943.                
  944.                 if exists(paux) then pAux.task.DriveTo(player.character.position + player.character.direction / 2, 100, true, true)
  945.                
  946.                 Player.Character.MakeProofTo(False, True, True, collisionProof, True)
  947.                
  948.                 TimeOut = 0
  949.                 while (vTmp.position.distanceto((player.character.position + player.character.direction)) > 3) andalso (TimeOut < 3500)                
  950.                     TimeOut += me.interval
  951.                    
  952.                     general_tick(nothing, nothing)
  953.                    
  954.                     vTmp.applyforce((player.character.position - vTmp.position) / 30)
  955.                    
  956.                     throwCars(vTmp)
  957.                    
  958.                     player.character.health += 1
  959.                    
  960.                     wait(me.interval)
  961.                    
  962.                     if vTmp.speed < 1.5 then vTmp.applyforce((player.character.position - vTmp.position) / 2)
  963.                    
  964.                     if vTmp.position.z < player.character.getboneposition(bone.rightfoot).z then vTmp.applyforce(vector3.worldup)
  965.                    
  966.                     'vTmp.applyforce((player.character.position - vTmp.position) / 30, vector3.worlddown)
  967.                    
  968.                     if vTmp.position.toground.distanceto(vTmp.position) < 1 then world.startfire(vTmp.position.toground)
  969.                    
  970.                     if (TimeOut > 500) andalso (vecAux.distanceto2d(vTmp.position) < 1) then TimeOut = 3500
  971.                    
  972.                     vecRot = vTmp.rotation
  973.                     if vecRot.x > 65 then
  974.                         vecRot.x = 65
  975.                         vTmp.rotation = vecRot
  976.                     elseif vecRot.x < 55 then  
  977.                         vTmp.applyforce((player.character.position - vTmp.position) / 30, vector3.worlddown)
  978.                     end if
  979.                    
  980.                     if game.iskeypressed(hkSpawnBike) then TimeOut = 3500
  981.                 end while
  982.                
  983.                 vTmp.metadata.isGRBike = true
  984.                
  985.                 if TimeOut >= 3500 then
  986.                     if exists(paux) then pAux.delete
  987.                    
  988.                     msg("There is something wrong...", 3000)
  989.                    
  990.                     vTmp.makeproofto(False, True, False, collisionProof, False)
  991.                    
  992.                     exit sub
  993.                 end if
  994.                
  995.                 vTmp.freezeposition = true
  996.                 wait(50)
  997.                 vTmp.freezeposition = false
  998.                 vTmp.applyforce(vector3.worlddown * 2)
  999.                
  1000.                 world.addexplosion(vTmp.position, explosionType.molotov, 1.0, True, False, 0.0F)
  1001.                
  1002.                 if exists(paux) then pAux.task.leavevehicle
  1003.                
  1004.                 TimeOut = 0
  1005.                 while exists(paux) andalso pAux.isinvehicle andalso (TimeOut < 500)
  1006.                     wait(me.interval)
  1007.                    
  1008.                     TimeOut += me.interval
  1009.                    
  1010.                     player.character.health += 1
  1011.                 end while
  1012.                
  1013.                 if exists(pAux) then pAux.delete
  1014.                
  1015.                 if TimeOut >= 500 then
  1016.                     'msg("There is something wrong...", 3000)
  1017.                    
  1018.                     vTmp.makeproofto(False, True, False, collisionProof, False)
  1019.                    
  1020.                     exit sub
  1021.                 end if
  1022.                
  1023.                 vTmp.makeproofto(False, True, False, collisionProof, false)
  1024.                
  1025.                 vTmp = nothing
  1026.             'end if
  1027.         Else
  1028.             vTmp = world.createvehicle(GRBikeModel.hash, (player.Character.position + (player.Character.direction * 2)))
  1029.         End If
  1030.  
  1031.         If exists(vTmp) Then
  1032.             vTmp.metadata.GRprop = true
  1033.             native.function.call("DETACH_CAR", vTmp)
  1034.             vTmp.cantiresburst = False
  1035.             vTmp.makeproofto(False, True, False, collisionProof, False)
  1036.             vTmp.freezeposition = False
  1037.             world.addexplosion(vTmp.position.toground, explosionType.molotov, 1.0, True, False, 0.0F)
  1038.         End If
  1039.  
  1040.         Player.Character.MakeProofTo(False, True, True, collisionProof, True)
  1041.     End Sub
  1042.  
  1043.     Private Sub findPedVehAndBurnHim() ' search for peds/vehicles in the way an burn them      
  1044.         Dim vec As vector3 = player.character.position + (player.character.direction / 4) ' take the initial vector
  1045.  
  1046.         While vec.distanceto(player.character.position) <= 8 ' while the distance is less than 8.x, increment the vector with the direction of the player
  1047.             vec += player.character.direction ' it will result in steps of 1 distance
  1048.  
  1049.             For Each p As ped In world.getpeds(vec, 1.5) ' get peds that are close to the vector           
  1050.                 If exists(p) AndAlso (p <> player.character) Then
  1051.                     If Not p.isonfire Then p.isonfire = True ' burn it
  1052.                     p.applyforce(player.character.direction / 8.5)
  1053.                 End If
  1054.             Next
  1055.  
  1056.             For Each v As vehicle In world.getvehicles(vec, 1.5) ' get vehicles that are close to the vector           
  1057.                 If exists(v) AndAlso (v <> player.character.currentvehicle) Then
  1058.                     v.petroltankhealth = -1 ' set the petroltank on fire                   
  1059.                     v.applyforce(player.character.direction / 5.8)
  1060.                 End If
  1061.             Next
  1062.         End While
  1063.     End Sub
  1064.  
  1065.     Private Sub CheckArrest
  1066.         If Native.Function.Call(Of Boolean)("IS_PLAYER_BEING_ARRESTED") AndAlso (BeingArrestedCount < 5000) Then
  1067.             BeingArrestedCount += 300
  1068.         end if
  1069.     End Sub
  1070.  
  1071.     Private Sub general_tick(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Tick     
  1072.         If bWaitLoad Then
  1073.             LoadSettingsAux
  1074.            
  1075.             exit sub
  1076.         end if     
  1077.        
  1078.         If bPrintSign Then
  1079.             bPrintSign = False
  1080.  
  1081.             Game.Console.Print("Ghost Rider Script Mod by JulioNIB v" & sVersion)
  1082.         End If
  1083.  
  1084.         If Not Player.Character.isAlive OrElse (BeingArrestedCount > 1200) Then
  1085.             isGhostRider = False
  1086.         End If
  1087.  
  1088.         If isGhostRider And Not Player.Character.Metadata.isGhostRider Then
  1089.             Player.Character.Metadata.isGhostRider = True
  1090.             l1.Enabled = True
  1091.             l2.Enabled = True
  1092.             l3.Enabled = True
  1093.             If mGR <> Nothing Then Player.Model = mGR
  1094.             Player.Character.Metadata.resetModel = True
  1095.             Player.Character.MakeProofTo(False, True, True, collisionProof, True)
  1096.             Player.NeverGetsTired = True
  1097.  
  1098.             If bSpawnBike Then
  1099.                 bSpawnBike = False
  1100.  
  1101.                 spawnBike()
  1102.             End If
  1103.  
  1104.             targetObjectAux.FreezePosition = False
  1105.         End If
  1106.  
  1107.         If isGhostRider Then
  1108.             If timeScript < 10000 Then
  1109.                 timeScript += Me.Interval
  1110.             Else
  1111.                 timeScript = 0
  1112.             End If
  1113.  
  1114.             If Game.isGameKeyPressed(GameKey.Aim) Then
  1115.                 targetObjectAux.Velocity = (Player.Character.Position - targetObjectAux.Position) * 2
  1116.                 targetObjectAux.Rotation = Game.CurrentCamera.Rotation
  1117.  
  1118.                 DrawTargetHUD()
  1119.             End If
  1120.  
  1121.             If (timeScript Mod 5000 = 0) AndAlso isChainOn() Then
  1122.                 stopChainFire()
  1123.                 startChainFire()
  1124.             End If
  1125.  
  1126.             If timeScript Mod 200 = 0 Then
  1127.                 HeadEffectScale = Player.Character.Health / PlMaxHealth
  1128.             End If
  1129.  
  1130.             If (timeScript Mod 500 = 0) Then
  1131.                 If Exists(Player.Character.CurrentVehicle) AndAlso (Player.Character.CurrentVehicle.Model.isBike) Then Player.Character.CurrentVehicle.Repair()
  1132.  
  1133.                 If RequipChainCounter > 0 Then
  1134.                     RequipChainCounter = 0
  1135.  
  1136.                     spawnChain(True)
  1137.                 End If
  1138.             End If
  1139.  
  1140.             If timeScript Mod 50 = 0 Then
  1141.                 If Exists(Player.Character.CurrentVehicle) AndAlso Exists(Player.Character.CurrentVehicle.GetPedOnSeat(VehicleSeat.Driver)) Then Player.Character.CurrentVehicle.DoorLock = DoorLock.None
  1142.  
  1143.                 If Game.isKeyPressed(hkChainClimb) AndAlso Game.isKeyPressed(hkAimKey) AndAlso isChainOn() Then
  1144.                     TargetCheckpoint.Position = targetedGround(200)
  1145.                     TargetLight.Position = TargetCheckpoint.Position + Vector3.WorldUp / 2
  1146.  
  1147.                     If Exists(ChainTargetVeh) Then
  1148.                         TargetCheckpoint.Position = ChainTargetVeh.Position + Vector3.WorldDown
  1149.                         TargetLight.Position = TargetCheckpoint.Position + Vector3.WorldUp * 1.5
  1150.                     End If
  1151.                 End If
  1152.             End If
  1153.  
  1154.             If Game.isGameKeyPressed(GameKey.Aim) AndAlso ((Player.Character.Weapons.Current = Weapon.Shotgun_Basic) OrElse (Player.Character.Weapons.Current = Weapon.Shotgun_Baretta)) _
  1155.                AndAlso Not Player.Character.isInAir Then
  1156.                 Native.Function.Call("SET_CHAR_ALL_ANIMS_SPEED", Player.Character, 5.0)
  1157.                 Game.TimeScale = 0.2
  1158.             Else
  1159.                 Native.Function.Call("SET_CHAR_ALL_ANIMS_SPEED", Player.Character, 1.0)
  1160.                 Game.TimeScale = 1.0
  1161.             End If
  1162.  
  1163.             If Game.isKeyPressed(hkControlKey) AndAlso (hkcontrolkeyDownTime < 1000) Then
  1164.                 If Player.Character.isSittingInVehicle Then
  1165.                     hkcontrolkeyDownTime += Me.Interval
  1166.                 Else
  1167.                     hkcontrolkeyDownTime = 0
  1168.                 End If
  1169.             End If
  1170.  
  1171.             If Not Game.isKeyPressed(hkControlKey) AndAlso (hkcontrolkeyDownTime < 200) AndAlso (hkcontrolkeyDownTime > 0) Then
  1172.                 wheelieJump()
  1173.             End If
  1174.  
  1175.             If timeScript Mod 300 = 0 Then
  1176.                 If Not Player.Character.Weapons.inSlot(WeaponSlot.Shotgun).isPresent AndAlso Not Native.Function.Call(Of Boolean)("IS_PLAYER_BEING_ARRESTED") Then _
  1177.                     Native.Function.Call("GIVE_WEAPON_TO_CHAR", Player.Character, Weapon.Shotgun_Basic, 500, 1)
  1178.  
  1179.                 CheckArrest()
  1180.             End If
  1181.  
  1182.             TransformVehicle()
  1183.  
  1184.             HitEffect()
  1185.  
  1186.             updateLightPos()
  1187.  
  1188.             shotgunEffect()
  1189.  
  1190.             chainTick()
  1191.  
  1192.             If timer1 = Me.Interval Then Flames()
  1193.  
  1194.             timer1 += Me.Interval
  1195.  
  1196.             If timer1 >= Me.Interval * 5 Then timer1 = Me.Interval
  1197.  
  1198.             flamesBike()
  1199.  
  1200.             If Exists(Player.Character.CurrentVehicle) Then
  1201.                 If (timeScript Mod 500 = 0) Then
  1202.                     Player.Character.CurrentVehicle.MakeProofTo(False, True, True, collisionProof, True)
  1203.                 End If
  1204.  
  1205.                 If vehLastVehicle = Nothing Then vehLastVehicle = Player.Character.CurrentVehicle
  1206.             ElseIf Exists(vehLastVehicle) Then
  1207.                 vehLastVehicle.MakeProofTo(False, True, False, False, False)
  1208.                 vehLastVehicle.CanBeDamaged = True
  1209.                 vehLastVehicle.CanBeVisiblyDamaged = True
  1210.  
  1211.                 vehLastVehicle = Nothing
  1212.             End If
  1213.  
  1214.             throwCars()
  1215.  
  1216.             wallRide()
  1217.  
  1218.             If Exists(sender) AndAlso Game.isKeyPressed(hkSpitBullets) AndAlso Not isChainOn() AndAlso _
  1219.                (Player.Character.Weapons.inSlot(WeaponSlot.Thrown).isPresent OrElse Not Game.isKeyPressed(hkAimKey)) Then
  1220.                If (Player.Character.Weapons.Current <> WeaponSlot.Thrown) Then Player.Character.Weapons.inSlot(WeaponSlot.Thrown).Select()
  1221.  
  1222.                spitBulletsAux()
  1223.             Else
  1224.                 bIconSpitbullets = False
  1225.             End If
  1226.  
  1227.             If timeHealth >= 100 Then
  1228.                 timeHealth = 0
  1229.                 Player.Character.Health += 5
  1230.             Else
  1231.                 timeHealth += 10
  1232.             End If
  1233.  
  1234.             WaterRide()
  1235.  
  1236.             If Game.isKeyPressed(hkPenanceStare) AndAlso Exists(PenanceStarePedTmp) Then
  1237.                 If PenanceStareSpeechAux < 1000 Then PenanceStareSpeechAux += Me.Interval
  1238.  
  1239.                 If PenanceStareMod < 10000 Then
  1240.                     PenanceStareMod += Me.Interval * 2
  1241.                 End If
  1242.  
  1243.                 PenanceStareCP.Position = PenanceStarePedTmp.Position.ToGround
  1244.                 PSLight.Position = PenanceStareCP.Position + Vector3.WorldUp / 2
  1245.  
  1246.                 Dim effAux As Int32
  1247.  
  1248.                 If PenanceStareMod < 1000 Then
  1249.                     PenanceStareCP.Color = System.Drawing.Color.FromArgb(100, System.Drawing.Color.White)
  1250.                     PSLight.Intensity = 20
  1251.                     iIconPenanceStare = 1
  1252.                 ElseIf PenanceStareMod < 2000 Then
  1253.                     PenanceStareCP.Color = System.Drawing.Color.FromArgb(100, System.Drawing.Color.Yellow)
  1254.                     PSLight.Intensity = 35
  1255.  
  1256.                     If PenanceStareMod Mod 100 = 0 Then
  1257.                         effAux = Player.Character.Metadata.PSEffect1
  1258.                         Native.Function.Call("STOP_PTFX", effAux)
  1259.                         Player.Character.Metadata.PSEffect1 = _
  1260.                          Native.Function.Call(Of Int32)("START_PTFX_ON_PED_BONE", "exp_fireball", Player.Character, 0.1, 0, 0, 0, 0, 0, PSBoneAttach, 0.03)
  1261.                     End If
  1262.                     iIconPenanceStare = 2
  1263.                 ElseIf PenanceStareMod < 3000 Then
  1264.                     PenanceStareCP.Color = System.Drawing.Color.FromArgb(100, System.Drawing.Color.Orange)
  1265.                     PSLight.Intensity = 65
  1266.  
  1267.                     If PenanceStareMod Mod 50 = 0 Then
  1268.                         effAux = Player.Character.Metadata.PSEffect1
  1269.                         Native.Function.Call("STOP_PTFX", effAux)
  1270.                         Player.Character.Metadata.PSEffect1 = _
  1271.                          Native.Function.Call(Of Int32)("START_PTFX_ON_PED_BONE", "exp_fireball", Player.Character, 0.1, 0, 0, 0, 0, 0, PSBoneAttach, 0.03)
  1272.                     End If
  1273.                     If PenanceStareMod Mod 100 = 0 Then
  1274.                         effAux = Player.Character.Metadata.PSEffect3
  1275.                         Native.Function.Call("STOP_PTFX", effAux)
  1276.                         Player.Character.Metadata.PSEffect3 = _
  1277.                          Native.Function.Call(Of Int32)("START_PTFX_ON_PED_BONE", "ambient_fire_generic", Player.Character, 0.1, 0, 0, 0, 0, 0, PSBoneAttach, 1.2)
  1278.                     End If
  1279.                     iIconPenanceStare = 3
  1280.                 Else
  1281.                     PenanceStareCP.Color = System.Drawing.Color.FromArgb(100, System.Drawing.Color.Red)
  1282.                     PSLight.Intensity = 75
  1283.  
  1284.                     If PenanceStareMod Mod 50 = 0 Then
  1285.                         effAux = Player.Character.Metadata.PSEffect1
  1286.                         Native.Function.Call("STOP_PTFX", effAux)
  1287.                         Player.Character.Metadata.PSEffect1 = _
  1288.                          Native.Function.Call(Of Int32)("START_PTFX_ON_PED_BONE", "exp_fireball", Player.Character, 0.1, 0, 0, 0, 0, 0, PSBoneAttach, 0.03)
  1289.                     End If
  1290.                     If PenanceStareMod Mod 100 = 0 Then
  1291.                         effAux = Player.Character.Metadata.PSEffect3
  1292.                         Native.Function.Call("STOP_PTFX", effAux)
  1293.                         Player.Character.Metadata.PSEffect3 = _
  1294.                          Native.Function.Call(Of Int32)("START_PTFX_ON_PED_BONE", "ambient_fire_generic", Player.Character, 0.1, 0, 0, 0, 0, 0, PSBoneAttach, 1.2)
  1295.                     End If
  1296.                     iIconPenanceStare = 4
  1297.                 End If
  1298.  
  1299.                 PSLight.Color = PenanceStareCP.Color
  1300.             End If
  1301.  
  1302.             PenanceStare()
  1303.  
  1304.             If Not bInfiniteSpitBullets AndAlso (timeScript Mod 500 = 0) Then
  1305.                 For Each p As Ped In World.GetPeds(Player.Character.Position, 50.0F)
  1306.                     If Native.Function.Call(Of Boolean)("HAS_CHAR_BEEN_DAMAGED_BY_CHAR", Player.Character, p) AndAlso _
  1307.                        (p.Weapons.Current <> Weapon.Unarmed) AndAlso (p.Weapons.Current <> Weapon.Melee_Knife) AndAlso (p.Weapons.Current <> Weapon.Melee_PoolCue) AndAlso _
  1308.                        (p.Weapons.Current <> Weapon.Melee_BaseballBat) Then
  1309.  
  1310.                         SpitBulletBulCount += 10
  1311.  
  1312.                         If SpitBulletBulCount > 1000 Then SpitBulletBulCount = 1000
  1313.                     End If
  1314.                 Next
  1315.  
  1316.                 Native.Function.Call("CLEAR_CHAR_LAST_DAMAGE_ENTITY", Player.Character)
  1317.             End If
  1318.  
  1319.             If Player.Character.Metadata.invincible AndAlso Not Exists(Player.Character.CurrentVehicle) Then
  1320.                 Player.Character.Invincible = False
  1321.                 Player.Character.Metadata.invincible = False
  1322.             End If
  1323.         Else
  1324.             timeScript = 0
  1325.  
  1326.             SpitBulletBulCount = 0
  1327.  
  1328.             BeingArrestedCount = 0
  1329.  
  1330.             If Player.Character.Metadata.resetModel Then
  1331.                 Player.Character.Metadata.resetModel = False
  1332.  
  1333.                 l1.Enabled = False
  1334.                 l2.Enabled = False
  1335.                 l3.Enabled = False
  1336.  
  1337.                 Native.Function.Call("STOP_PTFX", flameW1)
  1338.                 Native.Function.Call("STOP_PTFX", flameW2)
  1339.                 Native.Function.Call("STOP_PTFX", flameW3)
  1340.                 Native.Function.Call("STOP_PTFX", flameW4)
  1341.                 Native.Function.Call("STOP_PTFX", flameH1)
  1342.                 Native.Function.Call("STOP_PTFX", flame1)
  1343.                 Native.Function.Call("STOP_PTFX", flame2)
  1344.                 Native.Function.Call("STOP_PTFX", flame3)
  1345.                 Native.Function.Call("STOP_PTFX", flame4)
  1346.                 Native.Function.Call("STOP_PTFX", effectThrow1)
  1347.                 Native.Function.Call("STOP_PTFX", effectThrow2)
  1348.  
  1349.                 World.ExtinguishFire(Player.Character.Position, 5.0)
  1350.                 Wait(1000)
  1351.  
  1352.                 Player.Character.MakeProofTo(False, False, False, False, False)
  1353.  
  1354.                 If Exists(Player.Character.CurrentVehicle) Then Player.Character.CurrentVehicle.MakeProofTo(False, False, False, False, False)
  1355.  
  1356.                 If mGR <> Nothing Then Player.Model = mPL
  1357.  
  1358.                 Native.Function.Call("SET_CHAR_DEFAULT_COMPONENT_VARIATION", Player.Character, True)
  1359.             End If
  1360.         End If
  1361.  
  1362.         Try
  1363.             If (wasGROnceCont > 0) AndAlso Exists(Player.Character.CurrentVehicle) AndAlso Player.Character.CurrentVehicle.Model.isBike Then
  1364.                 Player.Character.ForceHelmet(False)
  1365.                 wasGROnceCont -= getInterval()
  1366.             End If
  1367.  
  1368.             If wasGROnce AndAlso ((Exists(Player.Character.CurrentVehicle) AndAlso Not Player.Character.CurrentVehicle.Model.isBike) OrElse Not Exists(Player.Character.CurrentVehicle)) Then _
  1369.                 wasGROnceCont = 4000
  1370.         Catch
  1371.         End Try
  1372.     End Sub
  1373.  
  1374.     Private Sub DrawTargetHUD()
  1375.         If timeCheckTargets <= 0 Then
  1376.             timeCheckTargets = 250
  1377.  
  1378.             pedsTarget = World.GetAllPeds
  1379.             vehsTarget = World.GetAllVehicles
  1380.         Else
  1381.             timeCheckTargets -= getInterval()
  1382.         End If
  1383.  
  1384.         pedTargeted = Nothing
  1385.         vehTargeted = Nothing
  1386.  
  1387.         Dim tmpDist As Double
  1388.         Dim tmpPosCompare As Vector3
  1389.  
  1390.         If Exists(pedsTarget) Then
  1391.             For Each p As Ped In pedsTarget
  1392.                 If Exists(p) AndAlso (p.Health > 0) AndAlso (p <> Player.Character) Then
  1393.                     tmpDist = p.Position.DistanceTo(Game.CurrentCamera.Position)
  1394.                     tmpPosCompare = Game.CurrentCamera.Position + Game.CurrentCamera.Direction * tmpDist
  1395.  
  1396.                     If (p.Position.DistanceTo(tmpPosCompare) < 0.5) OrElse (p.GetBonePosition(Bone.Head).DistanceTo(tmpPosCompare) < 0.3) _
  1397.                        OrElse (p.GetBonePosition(Bone.LeftFoot).DistanceTo(tmpPosCompare) < 0.5) Then
  1398.                         pedTargeted = p
  1399.                         Exit For
  1400.                     End If
  1401.                 End If
  1402.             Next
  1403.         End If
  1404.  
  1405.         If Not Exists(pedTargeted) AndAlso Exists(vehsTarget) Then
  1406.             For Each v As Vehicle In vehsTarget
  1407.                 If Exists(v) AndAlso (v <> Player.Character.CurrentVehicle) Then
  1408.                     tmpDist = v.Position.DistanceTo(Game.CurrentCamera.Position)
  1409.                     tmpPosCompare = Game.CurrentCamera.Position + Game.CurrentCamera.Direction * tmpDist
  1410.  
  1411.                     If (v.Position.DistanceTo(tmpPosCompare) < 1.2) OrElse (v.GetOffsetPosition(Vector3.RelativeFront * 1.3).DistanceTo(tmpPosCompare) < 1.2) OrElse _
  1412.                        (v.GetOffsetPosition(Vector3.RelativeBack * 1.3).DistanceTo(tmpPosCompare) < 1.2) Then
  1413.                         vehTargeted = v
  1414.                         Exit For
  1415.                     End If
  1416.                 End If
  1417.             Next
  1418.         End If
  1419.  
  1420.         If Exists(vehTargeted) OrElse Exists(pedTargeted) Then
  1421.             Dim tmpPosHead As Vector3
  1422.             Dim tmpPos As Vector3
  1423.             Dim tmpXOff, tmpYOff As Double
  1424.             Dim diameterMulti As Double = 1
  1425.  
  1426.             targetObjectRotation += 5
  1427.  
  1428.             If targetObjectRotation > 360 Then targetObjectRotation = 0
  1429.  
  1430.             tmpPos = targetObjectAux.Rotation
  1431.             tmpPos.Y = targetObjectRotation
  1432.  
  1433.             targetObjectAux.Rotation = tmpPos
  1434.  
  1435.             If Exists(pedTargeted) Then
  1436.                 tmpDist = pedTargeted.Position.DistanceTo(Player.Character.Position) * 0.01
  1437.                 tmpPosHead = pedTargeted.GetBonePosition(Bone.Head)
  1438.                 tmpXOff = 0.25
  1439.                 tmpYOff = 0.25
  1440.                 tmpPos = tmpPosHead + targetObjectAux.Position - targetObjectAux.GetOffsetPosition(Vector3.RelativeRight * tmpXOff)
  1441.             ElseIf Exists(vehTargeted) Then
  1442.                 diameterMulti = 1.5
  1443.  
  1444.                 tmpDist = vehTargeted.Position.DistanceTo(Player.Character.Position) * 0.01
  1445.                 tmpPosHead = vehTargeted.Position - Game.CurrentCamera.Direction * 2
  1446.                 tmpXOff = 1
  1447.                 tmpYOff = 1
  1448.                 tmpPos = tmpPosHead + targetObjectAux.Position - targetObjectAux.GetOffsetPosition(Vector3.RelativeRight * tmpXOff * diameterMulti)
  1449.  
  1450.                 Native.Function.Call("draw_corona", tmpPosHead.X, tmpPosHead.Y, tmpPosHead.Z, tmpDist * 100 * 0.8, 0, 0, 255, 0, 0)
  1451.                 Native.Function.Call("DRAW_CHECKPOINT", tmpPosHead.X, tmpPosHead.Y, tmpPosHead.Z, tmpDist * 0.8, 255, 0, 0)
  1452.             End If
  1453.  
  1454.             Native.Function.Call("draw_corona", tmpPos.X, tmpPos.Y, tmpPos.Z, tmpDist * 100, 0, 0, 255, 0, 0)
  1455.             Native.Function.Call("DRAW_CHECKPOINT", tmpPos.X, tmpPos.Y, tmpPos.Z, tmpDist, 255, 0, 0)
  1456.             tmpPos = tmpPosHead + targetObjectAux.Position - targetObjectAux.GetOffsetPosition(Vector3.RelativeLeft * tmpXOff * diameterMulti)
  1457.             Native.Function.Call("draw_corona", tmpPos.X, tmpPos.Y, tmpPos.Z, tmpDist * 100, 0, 0, 255, 0, 0)
  1458.             Native.Function.Call("DRAW_CHECKPOINT", tmpPos.X, tmpPos.Y, tmpPos.Z, tmpDist, 255, 0, 0)
  1459.             tmpPos = tmpPosHead + targetObjectAux.Position - targetObjectAux.GetOffsetPosition(Vector3.RelativeBottom * tmpYOff * diameterMulti)
  1460.             Native.Function.Call("draw_corona", tmpPos.X, tmpPos.Y, tmpPos.Z, tmpDist * 100, 0, 0, 255, 0, 0)
  1461.             Native.Function.Call("DRAW_CHECKPOINT", tmpPos.X, tmpPos.Y, tmpPos.Z, tmpDist, 255, 0, 0)
  1462.             tmpPos = tmpPosHead + targetObjectAux.Position - targetObjectAux.GetOffsetPosition(Vector3.RelativeTop * tmpYOff * diameterMulti)
  1463.             Native.Function.Call("draw_corona", tmpPos.X, tmpPos.Y, tmpPos.Z, tmpDist * 100, 0, 0, 255, 0, 0)
  1464.             Native.Function.Call("DRAW_CHECKPOINT", tmpPos.X, tmpPos.Y, tmpPos.Z, tmpDist, 255, 0, 0)
  1465.         End If
  1466.     End Sub
  1467.    
  1468.     private sub TransformVehicle
  1469.         if not bTransformVehicle then exit sub
  1470.        
  1471.         if player.character.issittinginvehicle andalso exists(player.character.currentvehicle) andalso not player.character.currentvehicle.model.isbike andalso _
  1472.            not native.function.call(Of Boolean)("IS_CAR_IN_WATER", player.character.currentvehicle) then
  1473.             if currVehDim = vector3.zero then currVehDim = player.character.currentvehicle.model.getdimensions
  1474.            
  1475.             dim vecDim as vector3 = currVehDim
  1476.             dim bTruck as boolean
  1477.            
  1478.             if not player.character.currentvehicle.metadata.isGRTransformed then
  1479.                 player.character.currentvehicle.metadata.isGRTransformed = true
  1480.  
  1481.                 If Player.Character.CurrentVehicle.Model.isHelicopter orelse Player.Character.CurrentVehicle.Model.isPlane orelse _
  1482.                    Player.Character.CurrentVehicle.Model.isBoat orelse Player.Character.CurrentVehicle.Model.isTrain then Exit sub
  1483.                    
  1484.                 native.function.call("BREAK_CAR_DOOR", Player.Character.currentvehicle, 4, false)
  1485.                
  1486.                 player.character.currentvehicle.CanTiresBurst = false
  1487.                 player.character.currentvehicle.Dirtyness  = 0
  1488.                 player.character.currentvehicle.makeproofto(false, true, true, false, false)
  1489.                
  1490.                 world.addexplosion(player.character.currentvehicle.position.toground, explosionType.molotov, 6.0, True, False, 0.0F)
  1491.                 player.character.currentvehicle.applyforce(vector3.worldup * 5)
  1492.                
  1493.                 player.character.currentvehicle.color = colorindex.black
  1494.                 player.character.currentvehicle.FeatureColor1 = colorindex.BlazeRed
  1495.                 player.character.currentvehicle.FeatureColor2 = colorindex.BlazeRed
  1496.                 player.character.currentvehicle.SpecularColor = colorindex.black
  1497.             end if
  1498.            
  1499.             If Player.Character.CurrentVehicle.Model.isHelicopter orelse Player.Character.CurrentVehicle.Model.isPlane orelse _
  1500.                Player.Character.CurrentVehicle.Model.isBoat orelse Player.Character.CurrentVehicle.Model.isTrain then Exit sub
  1501.  
  1502.             if (timeScript mod 200 = 0) andalso (player.character.currentvehicle.isonallwheels) andalso (player.character.currentvehicle.rotation.x > -10) _
  1503.                andalso (player.character.currentvehicle.rotation.x < 10) then
  1504.             'if (timeScript mod 200 = 0) then
  1505.                 dim zPos as double = (Player.Character.currentvehicle.position.distanceto(Player.Character.currentvehicle.position.toground)) * -1
  1506.                 'dim zPos as double = (vecDim.z / 2.2) * -1
  1507.                
  1508.                 native.function.call("stop_ptfx", flameCar1)
  1509.                 native.function.call("stop_ptfx", flameCar2)
  1510.                 native.function.call("stop_ptfx", flameCar3)
  1511.                 native.function.call("stop_ptfx", flameCar4)
  1512.                 native.function.call("stop_ptfx", flameCar5)
  1513.                 native.function.call("stop_ptfx", flameCar6)
  1514.                 native.function.call("stop_ptfx", flameCar7)
  1515.                
  1516.                 bTruck = (vecDim.y < 10) andalso (vecDim.y > 8) andalso (vecDim.z > 3)
  1517.                
  1518.                 if vecDim.z > 2 then vecDim.z  = 2
  1519.                
  1520.                 if bTruck then
  1521.                     flameCar1 = Native.Function.Call(Of int32)("START_PTFX_ON_VEH", "ambient_fire_generic", Player.Character.currentvehicle, vecdim.x / 2.3, vecdim.y / 2.5, zPos, 0, 0, 0, 1.5 * (vecDim.z / 1.36))
  1522.                     flameCar2 = Native.Function.Call(Of int32)("START_PTFX_ON_VEH", "ambient_fire_generic", Player.Character.currentvehicle, (vecdim.x / 2.3) * -1, vecdim.y / 2.5, zPos, 0, 0, 0, 1.5 * (vecDim.z / 1.36))
  1523.                     flameCar6 = Native.Function.Call(Of int32)("START_PTFX_ON_VEH", "ambient_fire_generic", Player.Character.currentvehicle, vecdim.x / 2.3, (vecdim.y / 2.5) * -1, zPos, 0, 0, 0, 1.5 * (vecDim.z / 1.36))
  1524.                     flameCar7 = Native.Function.Call(Of int32)("START_PTFX_ON_VEH", "ambient_fire_generic", Player.Character.currentvehicle, (vecdim.x / 2.3) * -1, (vecdim.y / 2.5) * -1, zPos, 0, 0, 0, 1.5 * (vecDim.z / 1.36))
  1525.                     flameCar5 = Native.Function.Call(Of int32)("START_PTFX_ON_VEH", "ambient_fire_generic", Player.Character.currentvehicle, 0, vecdim.y / 2.8, 0.3, 0, 0, 0, 1.5 * (vecDim.z / 1.36))
  1526.                 else
  1527.                     flameCar1 = Native.Function.Call(Of int32)("START_PTFX_ON_VEH", "ambient_fire_generic", Player.Character.currentvehicle, vecdim.x / 2.3, vecdim.y / 3.8, zPos, 0, 0, 0, 1.5 * (vecDim.z / 1.36))
  1528.                     flameCar2 = Native.Function.Call(Of int32)("START_PTFX_ON_VEH", "ambient_fire_generic", Player.Character.currentvehicle, (vecdim.x / 2.3) * -1, vecdim.y / 3.8, zPos, 0, 0, 0, 1.5 * (vecDim.z / 1.36))
  1529.                     flameCar5 = Native.Function.Call(Of int32)("START_PTFX_ON_VEH", "ambient_fire_generic", Player.Character.currentvehicle, 0, vecdim.y / 3.8, zPos + 0.5, 0, 0, 0, 1.5 * (vecDim.z / 1.36))
  1530.                 end if
  1531.                
  1532.                 flameCar3 = Native.Function.Call(Of int32)("START_PTFX_ON_VEH", "ambient_fire_generic", Player.Character.currentvehicle, vecdim.x / 2.3, (vecdim.y / 3.8) * -1, zPos, 0, 0, 0, 1.5 * (vecDim.z / 1.36))
  1533.                 flameCar4 = Native.Function.Call(Of int32)("START_PTFX_ON_VEH", "ambient_fire_generic", Player.Character.currentvehicle, (vecdim.x / 2.3) * -1, (vecdim.y / 3.8) * -1, zPos, 0, 0, 0, 1.5 * (vecDim.z / 1.36))             
  1534.             end if
  1535.            
  1536.             carLight.enabled = true
  1537.            
  1538.             vecDim = currVehDim
  1539.            
  1540.             bTruck = (vecDim.y < 10) andalso (vecDim.y > 8) andalso (vecDim.z > 3)
  1541.            
  1542.             vecDim.x = 0
  1543.             vecDim.z /= 2
  1544.             vecDim.y = 0
  1545.                
  1546.             if not bTruck then
  1547.                 carLight.position = Player.Character.currentvehicle.position + (Player.Character.currentvehicle.direction * 1.5) + vecDim
  1548.             else
  1549.                 carLight.position = Player.Character.currentvehicle.position + (Player.Character.currentvehicle.direction * 4) + vecDim
  1550.             end if
  1551.            
  1552.             if player.character.currentvehicle.isonfire then player.character.currentvehicle.repair
  1553.         end if
  1554.        
  1555.         If not Exists(Player.Character.CurrentVehicle) Then carLight.enabled = false
  1556.     end sub
  1557.  
  1558.     Private Sub shotgunEffect
  1559.         Try
  1560.             If (player.character.weapons.current = weapon.Shotgun_Basic) orelse (player.character.weapons.current = weapon.Shotgun_Baretta) Then
  1561.                 bIconShotGun = True
  1562.  
  1563.                 'If native.function.call(Of Boolean)("IS_CHAR_SHOOTING", player.character) Then
  1564.                 if player.character.isShooting then
  1565.                     Dim force As Double
  1566.  
  1567.                     For Each p As ped In world.getpeds(player.character.position + player.character.direction * 20, 45.0)
  1568.                         If exists(p) AndAlso native.function.call(Of Boolean)("HAS_CHAR_BEEN_DAMAGED_BY_CHAR", p, player.character) Then
  1569.                             p.isonfire = True
  1570.  
  1571.                             force = 20 - p.position.distanceto(player.character.position)
  1572.                             If force <= 5 Then force = 5
  1573.  
  1574.                             p.velocity = (game.currentcamera.direction + vector3.worldup / 2) * force * ShotgunForce
  1575.                             p.die()
  1576.                            
  1577.                             native.function.call("CLEAR_CHAR_LAST_DAMAGE_ENTITY", p)
  1578.                         End If
  1579.                     Next
  1580.  
  1581.                     For Each v As vehicle In world.getvehicles(player.character.position + player.character.direction * 20, 45.0)
  1582.                         If exists(v) AndAlso native.function.call(Of Boolean)("HAS_CAR_BEEN_DAMAGED_BY_CHAR", v, player.character) Then
  1583.                             force = 15 - v.position.distanceto(player.character.position)
  1584.                             If force <= 0 Then force = 1
  1585.                             v.applyforce((game.currentcamera.direction + vector3.worldup / 2) * force * ShotgunForce)
  1586.  
  1587.                             native.function.call("CLEAR_CAR_LAST_DAMAGE_ENTITY", v)
  1588.                         End If
  1589.                     Next
  1590.                    
  1591.                     playsound(".\scripts\GRSounds\shotgun.wav")
  1592.                 End If
  1593.             Else
  1594.                 bIconShotGun = False
  1595.             End If
  1596.         Catch
  1597.         End Try
  1598.     End Sub
  1599.  
  1600.     Private Sub updateLightPos
  1601.         if flameLightMultiplier = 0 then exit sub
  1602.        
  1603.         vecL = Player.Character.GetBonePosition(Bone.Head)
  1604.        
  1605.         l1.Position = vecL + (Player.Character.Direction / 3)
  1606.         l2.Position = vecL - (Player.Character.Direction / 3)
  1607.         vecL.z += 0.5
  1608.         l3.Position = vecL
  1609.         l1.Intensity = random(14, 17) * flameLightMultiplier       
  1610.         l2.Intensity = random(14, 17) * flameLightMultiplier
  1611.         l3.Intensity = random(15, 17) * flameLightMultiplier
  1612.     End Sub
  1613.  
  1614.     Private Sub PenanceStareFindPed()
  1615.         Try
  1616.             Dim vecAux As vector3 = player.character.position
  1617.             dim maxDist as int16 = 20
  1618.  
  1619.             PenanceStarePedTmp = pedTargeted
  1620.  
  1621.             If Not Exists(PenanceStarePedTmp) Then Exit Sub
  1622.  
  1623.             FleePeds(PenanceStarePedTmp.Position, 10, PenanceStarePedTmp)
  1624.            
  1625.             If exists(PenanceStarePedTmp) AndAlso exists(PenanceStarePedTmp.currentvehicle) andalso not isChainOn Then
  1626.                 msg("YOU...", 2000)
  1627.                 PlaySound(".\scripts\GRSounds\you.wav")
  1628.  
  1629.                 PenanceStarePedTmp.currentvehicle.applyforce(vector3.worldup * 2)
  1630.                 world.addexplosion(PenanceStarePedTmp.currentvehicle.position.toground, explosionType.molotov, 5.0, True, False, 0)
  1631.  
  1632.                 PenanceStarePedTmp.task.leavevehicle()
  1633.                 PenanceStarePedTmp.task.FleeFromChar(player.character, False, 5000)
  1634.                 PenanceStarePedTmp = Nothing
  1635.  
  1636.                 iIconPenanceStare = 0
  1637.             End If
  1638.  
  1639.             If exists(PenanceStarePedTmp) Then
  1640.                 msg("YOU...", 2000)
  1641.                 PlaySound(".\scripts\GRSounds\you.wav")
  1642.                 PenanceStareSpeechAux = 0
  1643.  
  1644.                 player.character.heading = game.currentcamera.heading
  1645.                 Dim aSet As animationset = New animationset("missfaustin3")
  1646.                 player.character.animation.play(aSet, "point_fwd", 5.0)
  1647.  
  1648.                 PenanceStarePedTmp.makeproofto(False, True, False, False, False)
  1649.  
  1650.                 PenanceStarePedTmp.metadata.PSEffect1 = _
  1651.                  Native.Function.Call(Of int32)("START_PTFX_ON_PED_BONE", "ambient_fire_generic", PenanceStarePedTmp, 0, 0, 0, 90.0, 0, 90.0, Bone.HDFacerighteyeball, 0.3)
  1652.                 PenanceStarePedTmp.metadata.PSEffect2 = _
  1653.                  Native.Function.Call(Of int32)("START_PTFX_ON_PED_BONE", "ambient_fire_generic", PenanceStarePedTmp, 0, 0, 0, 90.0, 0, 90.0, Bone.HDFacelefteyeball, 0.3)
  1654.  
  1655.                 PenanceStarePedTmp.metadata.PSEffect3 = _
  1656.                  Native.Function.Call(Of int32)("START_PTFX_ON_PED_BONE", "ambient_steam_vent_oblong", PenanceStarePedTmp, 0, 0, 0, 90.0, 0, 90.0, Bone.head, 0.5)
  1657.  
  1658.                 native.function.call("ON_FIRE_SCREAM", PenanceStarePedTmp)
  1659.  
  1660.                 if exists(PenanceStarePedTmp.currentvehicle) then
  1661.                     PenanceStarePedTmp.currentvehicle.EngineRunning = false
  1662.                 elseif Not PenanceStarePedTmp.animation.isplaying(aSetPenanceStarePed, "drop_tray_scream") Then
  1663.                     PenanceStarePedTmp.animation.play(aSetPenanceStarePed, "drop_tray_scream", 10.0, animationflags.Unknown05)
  1664.                 End If
  1665.             End If
  1666.         Catch
  1667.         End Try
  1668.     End Sub
  1669.  
  1670.     Private Sub PenanceStareCatchPed()
  1671.         Try
  1672.             PenanceStareCP.visible = False
  1673.             PSLight.enabled = False
  1674.  
  1675.             If exists(PenanceStarePedTmp) Then
  1676.                 If PenanceStareMod > 1000 Then 
  1677.                     Dim timeOut As double = 0
  1678.                    
  1679.                     if not exists(PenanceStarePedTmp.currentvehicle) then
  1680.                         PenanceStarePedTmp.task.turnto(player.character)
  1681.                     end if
  1682.                    
  1683.                     If Not exists(PenanceStarePedTmp) Then
  1684.                         iIconPenanceStare = 0
  1685.                         Exit Sub
  1686.                     End If
  1687.  
  1688.                     native.function.call("ON_FIRE_SCREAM", PenanceStarePedTmp)
  1689.  
  1690.                     If (PenanceStareMod > 3000) AndAlso Not bInfiniteSpitBullets And (SpitBulletBulCount < 3) Then
  1691.                         PenanceStarePedTmp.task.FightAgainst(player.character)
  1692.                        
  1693.                         Dim aSet As animationset = New animationset("amb@bottle_create")
  1694.                         player.character.task.clearallimmediately()
  1695.                         player.character.animation.play(aSet, "stand_create", 10.0)
  1696.                         wait(2500)
  1697.                         SpitBulletBulCount = 15
  1698.                     End If
  1699.  
  1700.                     player.character.task.turnto(PenanceStarePedTmp)
  1701.                    
  1702.                     PenanceStarePedTmp.makeproofto(false, true, false, true, false)
  1703.                    
  1704.                     if isChainOn then                      
  1705.                         timeOut = 0
  1706.                        
  1707.                         PlaySound(".\scripts\GRSounds\ChainDrag.wav")
  1708.                        
  1709.                         chainGrabAnim
  1710.                        
  1711.                         timeOutMoveChain = 0
  1712.                        
  1713.                         while not moveChainToVec(player.character.position + (player.character.direction * 2) + vector3.worldup * 4, 1, 150)
  1714.                             wait(getInterval)
  1715.                            
  1716.                             chainTick
  1717.                            
  1718.                             player.character.health += 1
  1719.                         end while
  1720.                        
  1721.                         timeOut = 0
  1722.                         timeOutMoveChain = 0
  1723.                        
  1724.                         while (timeOut < 1000) andalso not moveChainToVec(PenanceStarePedTmp.position, 1, 0)
  1725.                             wait(me.interval)
  1726.                            
  1727.                             timeOut += me.interval
  1728.                            
  1729.                             player.character.health += 1
  1730.                         end while
  1731.                        
  1732.                         pChainTargetGrab = PenanceStarePedTmp
  1733.                        
  1734.                         if not ChainGrabFlyFromVeh then
  1735.                             PenanceStarePedTmp = nothing
  1736.                             exit sub
  1737.                         end if
  1738.                        
  1739.                         pChainTargetGrab = nothing
  1740.                     end if
  1741.                    
  1742.                     timeOut = 0
  1743.                    
  1744.                     While exists(PenanceStarePedTmp) AndAlso _
  1745.                      (Not PenanceStarePedTmp.isTouching(player.character) AndAlso (PenanceStarePedTmp.position.distanceto(player.character.position) > 2.5)) AndAlso _
  1746.                      (timeOut < 2500)
  1747.                         If exists(PenanceStarePedTmp) Then
  1748.                             PenanceStarePedTmp.isragdoll = true
  1749.  
  1750.                             If Not isChainOn() Then
  1751.                                 vecVelocityGeneral = (Player.Character.Position + (Vector3.WorldDown / 2) - PenanceStarePedTmp.Position) * 2
  1752.                                 PenanceStarePedTmp.Velocity = ControlVelocity(vecVelocityGeneral, 50.0)
  1753.                             Else
  1754.                                 vecVelocityGeneral = (Player.Character.Position + (Vector3.WorldUp) - PenanceStarePedTmp.Position) * 2
  1755.                                 PenanceStarePedTmp.Velocity = ControlVelocity(vecVelocityGeneral, 50.0)
  1756.                                 'moveChainToVec(player.character.getboneposition(bone.head) + player.character.direction, 0.3, 0)
  1757.                                 timeOutMoveChain = 0
  1758.                                 moveChainToVec(PenanceStarePedTmp.GetBonePosition(Bone.Head), 1, 0)
  1759.                             End If
  1760.                            
  1761.                             PenanceStarePedTmp.isonfire = False
  1762.                             PenanceStarePedTmp.heading = player.character.heading + 180
  1763.  
  1764.                             If PenanceStarePedTmp.health <= 0 Then
  1765.                                 PenanceStareClearPTFX(PenanceStarePedTmp)
  1766.                                 PenanceStarePedTmp.die
  1767.                                 PenanceStarePedTmp = Nothing
  1768.                             End If
  1769.                         End If
  1770.  
  1771.                         wait(10)
  1772.  
  1773.                         timeOut += 10
  1774.  
  1775.                         player.character.health += 1
  1776.                     End While
  1777.  
  1778.                     timeOut = 0
  1779.                    
  1780.                     pChainTargetGrab = nothing
  1781.                    
  1782.                     PenanceStarePedTmp.isRagDoll = false
  1783.                    
  1784.                     if exists(PenanceStarePedTmp) then
  1785.                         If Not PenanceStarePedTmp.animation.isplaying(aSetPenanceStarePed, "drop_tray_scream") Then
  1786.                             PenanceStarePedTmp.isragdoll = false
  1787.                             PenanceStarePedTmp.task.clearallimmediately
  1788.                             PenanceStarePedTmp.animation.play(aSetPenanceStarePed, "drop_tray_scream", 10.0, animationflags.Unknown05)
  1789.                         End If
  1790.  
  1791.                         player.character.task.turnto(PenanceStarePedTmp)
  1792.  
  1793.                         player.character.animation.play(aSetPenanceStare, PSAnimName, 10.0)
  1794.                         native.function.call("ON_FIRE_SCREAM", PenanceStarePedTmp)
  1795.                     End If
  1796.                 End If
  1797.  
  1798.                 If exists(PenanceStarePedTmp) Then
  1799.                     PenanceStarePedTmp.metadata.PenanceStareMod = PenanceStareMod
  1800.  
  1801.                     PenanceStareExec()
  1802.                 End If
  1803.             End If
  1804.         Catch
  1805.         End Try
  1806.     End Sub
  1807.  
  1808.     Private Sub PenanceStareExec()
  1809.         Try
  1810.             If exists(PenanceStarePedTmp) Then
  1811.             '    If exists(PenanceStarePedTmp.currentvehicle) Then
  1812.             '        PenanceStarePedTmp.task.leavevehicle()
  1813.             '        Exit Sub
  1814.             '    End If
  1815.  
  1816.                 If Not PenanceStarePedTmp.isalive Then Exit Sub
  1817.  
  1818.                 penanceStaretArrCount += 1
  1819.  
  1820.                 If penanceStaretArrCount > 20 Then penanceStaretArrCount = 1
  1821.  
  1822.                 penanceStaretArr(penanceStaretArrCount) = PenanceStarePedTmp
  1823.  
  1824.                 penanceStaretArr(penanceStaretArrCount).metadata.PSTime = 0
  1825.  
  1826.                 penanceStaretArr(penanceStaretArrCount).metadata.PSspitBulletsCont = 0
  1827.  
  1828.                 If PenanceStareSpeechAux < 1000 Then wait(1000 - PenanceStareSpeechAux)
  1829.  
  1830.                 msg("guilty...", 2000)
  1831.                 PlaySound(".\scripts\GRSounds\guilty.wav")
  1832.  
  1833.                 If Not exists(penanceStaretArr(penanceStaretArrCount).currentvehicle) AndAlso (penanceStaretArr(penanceStaretArrCount).metadata.PenanceStareMod <= 1000) Then
  1834.                     penanceStaretArr(penanceStaretArrCount).task.clearallimmediately()
  1835.                     penanceStaretArr(penanceStaretArrCount).task.turnto(player.character)
  1836.                     wait(500)
  1837.                     penanceStaretArr(penanceStaretArrCount).task.clearallimmediately()
  1838.  
  1839.                     If Not penanceStaretArr(penanceStaretArrCount).animation.isplaying(aSetPenanceStarePed, "drop_tray_scream") Then
  1840.                         penanceStaretArr(penanceStaretArrCount).animation.play(aSetPenanceStarePed, "drop_tray_scream", 10.0, animationflags.Unknown05)
  1841.                     End If
  1842.                 End If
  1843.             Else
  1844.                 iIconPenanceStare = 0
  1845.             End If
  1846.         Catch
  1847.         End Try
  1848.     End Sub
  1849.  
  1850.     Private Sub PenanceStare()
  1851.         Try
  1852.             For c As int16 = 1 To penanceStaretArrCount
  1853.                 If exists(penanceStaretArr(c)) Then
  1854.                     if timeScript mod 1000 = 0 then fleePeds(penanceStaretArr(c).position, 5, penanceStaretArr(c))
  1855.                    
  1856.                     If PenanceStareMod <= 1000 Then iIconPenanceStare = 0
  1857.  
  1858.                     If (penanceStaretArr(c).metadata.PSTime < 500) AndAlso Not penanceStaretArr(c).isalive Then
  1859.                         msg("no... died too soon...", 2000)
  1860.                         penanceStaretArr(c) = Nothing
  1861.  
  1862.                         Continue For
  1863.                     End If
  1864.  
  1865.                     Dim effAux As int32
  1866.  
  1867.                     If (penanceStaretArr(c).metadata.PenanceStareMod > 1000) AndAlso (penanceStaretArr(c).metadata.PSTime = 350) Then
  1868.                         msg("look into my eyes...", 2000)
  1869.                         PlaySound(".\scripts\GRSounds\lookIntoMyEyes.wav")
  1870.                     End If
  1871.  
  1872.                     If ((penanceStaretArr(c).metadata.PSTime < penanceStareTime) AndAlso (penanceStaretArr(c).metadata.PenanceStareMod <= 1000)) OrElse _
  1873.                        ((penanceStaretArr(c).metadata.PenanceStareMod > 2000) andalso (penanceStaretArr(c).metadata.PenanceStareMod <= 3000) AndAlso (player.character.animation.GetCurrentAnimationTime(aSetPenanceStare, PSAnimName) < 0.5)) orelse _
  1874.                        ((penanceStaretArr(c).metadata.PSTime < 1470)) Then
  1875.                        penanceStaretArr(c).metadata.PSTime += me.interval
  1876.                        
  1877.                         If penanceStaretArr(c).metadata.PenanceStareMod <= 1000 Then
  1878.                             If exists(penanceStaretArr(c).currentvehicle) Then
  1879.                                 penanceStaretArr(c).task.leavevehicleimmediately(penanceStaretArr(c).currentvehicle)
  1880.                             else
  1881.                                 If Not penanceStaretArr(c).animation.isplaying(aSetPenanceStarePed, "drop_tray_scream") Then
  1882.                                     penanceStaretArr(c).animation.play(aSetPenanceStarePed, "drop_tray_scream", 10.0, animationflags.Unknown05)
  1883.                                 End If
  1884.                             End If
  1885.                         end if
  1886.                        
  1887.                         If penanceStaretArr(c).metadata.PenanceStareMod > 1000 Then
  1888.                             If ((penanceStaretArr(c).metadata.PenanceStareMod - 1999 <= 0)) OrElse _
  1889.                                ((penanceStaretArr(c).metadata.PenanceStareMod > 2000) AndAlso (penanceStaretArr(c).metadata.PSTime > 100)) Then
  1890.                                 If penanceStaretArr(c).Metadata.PSspitBulletsCont = 0 Then
  1891.                                     vecVelocityGeneral = (Player.Character.GetBonePosition(PSBoneAttach) - penanceStaretArr(c).GetBonePosition(Bone.Neck) - _
  1892.                                        (penanceStaretArr(c).Direction / 8)) * 5
  1893.                                     penanceStaretArr(c).Velocity = ControlVelocity(vecVelocityGeneral, 50.0)
  1894.                                 Else
  1895.                                     vecVelocityGeneral = penanceStaretArr(c).Velocity + Vector3.WorldUp + Player.Character.Direction / 2
  1896.                                     penanceStaretArr(c).Velocity = ControlVelocity(vecVelocityGeneral, 50.0)
  1897.                                 End If
  1898.                             End If
  1899.                            
  1900.                             if player.character.animation.GetCurrentAnimationTime(aSetPenanceStare, PSAnimName) > 0.2 then
  1901.                                 native.function.call("SET_CHAR_ALL_ANIMS_SPEED", player.character, 0.05)
  1902.                             elseif player.character.animation.GetCurrentAnimationTime(aSetPenanceStare, PSAnimName) > 0.4 then
  1903.                                 native.function.call("SET_CHAR_ALL_ANIMS_SPEED", player.character, 1.0)
  1904.                             end if
  1905.                            
  1906.                             penanceStaretArr(c).heading = player.character.heading + 180
  1907.  
  1908.                             If not exists(penanceStaretArr(c).currentvehicle) andalso Not penanceStaretArr(c).animation.isplaying(aSetPenanceStarePed, "drop_tray_scream") Then
  1909.                                 penanceStaretArr(c).task.playanimation(aSetPenanceStarePed, "drop_tray_scream", 10.0, animationflags.Unknown05 Or animationflags.Unknown09)
  1910.                             End If
  1911.                            
  1912.                             if isChainOn then
  1913.                                 timeOutMoveChain = 0
  1914.                                 moveChainToVec(player.character.position.toground + player.character.direction * 5, 1, 0)
  1915.                             end if
  1916.                         End If
  1917.  
  1918.                         If ((penanceStaretArr(c).metadata.PenanceStareMod > 2000) AndAlso (penanceStaretArr(c).metadata.PSTime >= 500)) Then
  1919.                             If penanceStaretArr(c).metadata.PenanceStareMod <= 3000 Then
  1920.                                 penanceStaretArr(c).makeproofto(False, False, False, False, False)
  1921.                                 penanceStaretArr(c).isonfire = True
  1922.                             End If
  1923.  
  1924.                             If penanceStaretArr(c).metadata.PenanceStareMod <= 3000 Then
  1925.                                 effAux = player.character.metadata.PSEffect3
  1926.                                 Native.Function.Call("STOP_PTFX", effAux)
  1927.                                 If random(1, 10) < 3 Then
  1928.                                     player.character.metadata.PSEffect3 = _
  1929.                                      Native.Function.Call(Of int32)("START_PTFX_ON_PED_BONE", "shot_directed_flame", player.character, 0, 0.1, 0, -90.0F, 90.0F, 0, Bone.head, 0.4)
  1930.                                 ElseIf random(1, 10) < 6 Then
  1931.                                     player.character.metadata.PSEffect3 = _
  1932.                                      Native.Function.Call(Of int32)("START_PTFX_ON_PED_BONE", "shot_directed_flame", player.character, 0, 0.1, 0, -100.0F, 90.0F, 0, Bone.head, 0.4)
  1933.                                 Else
  1934.                                     player.character.metadata.PSEffect3 = _
  1935.                                      Native.Function.Call(Of int32)("START_PTFX_ON_PED_BONE", "shot_directed_flame", player.character, 0, 0.1, 0, -110.0F, 90.0F, 0, Bone.head, 0.4)
  1936.                                 End If
  1937.                             ElseIf penanceStaretArr(c).metadata.PSTime >= 1200 Then
  1938.                                 If penanceStaretArr(c).metadata.PSspitBulletsCont < 10 Then
  1939.                                     penanceStaretArr(c).metadata.PSspitBulletsCont += 1
  1940.                                     penanceStaretArr(c).metadata.PSTime += me.interval * 2
  1941.                                     native.function.call("SET_CHAR_ALL_ANIMS_SPEED", player.character, 0.5)
  1942.                                     player.character.invincible = True
  1943.                                     player.character.task.turnto(penanceStaretArr(c))
  1944.                                     spitBullets(False, penanceStaretArr(c))
  1945.                                     player.character.invincible = False
  1946.                                 Else
  1947.                                     penanceStaretArr(c).metadata.PSTime = 5000
  1948.                                 End If
  1949.                             End If
  1950.                         Else
  1951.                             penanceStaretArr(c).isonfire = False
  1952.                         End If
  1953.  
  1954.                         player.character.health += 1
  1955.  
  1956.                         If penanceStaretArr(c).metadata.PSTime Mod 500 = 0 Then
  1957.                             native.function.call("ON_FIRE_SCREAM", penanceStaretArr(c))
  1958.  
  1959.                             effAux = PenanceStarePedTmp.metadata.PSEffect1
  1960.                             Native.Function.Call("STOP_PTFX", effAux)
  1961.                             PenanceStarePedTmp.metadata.PSEffect1 = _
  1962.                              Native.Function.Call(Of int32)("START_PTFX_ON_PED_BONE", "ambient_fire_generic", PenanceStarePedTmp, 0, 0, 0, 90.0, 0, 90.0, Bone.HDFacerighteyeball, 0.3)
  1963.                             effAux = PenanceStarePedTmp.metadata.PSEffect2
  1964.                             Native.Function.Call("STOP_PTFX", effAux)
  1965.                             PenanceStarePedTmp.metadata.PSEffect2 = _
  1966.                              Native.Function.Call(Of int32)("START_PTFX_ON_PED_BONE", "ambient_fire_generic", PenanceStarePedTmp, 0, 0, 0, 90.0, 0, 90.0, Bone.HDFacelefteyeball, 0.3)
  1967.                             effAux = PenanceStarePedTmp.metadata.PSEffect3
  1968.                             Native.Function.Call("STOP_PTFX", effAux)
  1969.                             PenanceStarePedTmp.metadata.PSEffect3 = _
  1970.                              Native.Function.Call(Of int32)("START_PTFX_ON_PED_BONE", "ambient_steam_vent_oblong", PenanceStarePedTmp, -0.5, 0, 0, 90.0, 0, 90.0, Bone.head, 0.5)
  1971.                         ElseIf penanceStaretArr(c).metadata.PSTime Mod 100 = 0 Then
  1972.                             If penanceStaretArr(c).metadata.PenanceStareMod > 1000 Then
  1973.                                 effAux = player.character.metadata.PSEffect1
  1974.                                 Native.Function.Call("STOP_PTFX", effAux)
  1975.                                 player.character.metadata.PSEffect1 = _
  1976.                                  Native.Function.Call(Of int32)("START_PTFX_ON_PED_BONE", "exp_fireball", player.character, 0.1, 0, -0.1, 0, 0, 0, PSBoneAttach, 0.03)
  1977.                             End If
  1978.                         End If
  1979.                     Else
  1980.                         If penanceStaretArr(c).metadata.PenanceStareMod > 1000 Then
  1981.                             native.function.call("SET_CHAR_ALL_ANIMS_SPEED", player.character, 1.0)
  1982.                             iIconPenanceStare = 0
  1983.                         elseif isChainOn then
  1984.                             if (player.character.weapons.current <> weapon.Misc_Object) then player.character.weapons.inslot(Weapon.Misc_Object).select
  1985.                         End If
  1986.  
  1987.                         penanceStaretArr(c).task.clearallimmediately()
  1988.  
  1989.                         PenanceStareClearPTFX(penanceStaretArr(c))
  1990.  
  1991.                         effAux = player.character.metadata.PSEffect
  1992.                         Native.Function.Call("STOP_PTFX", effAux)
  1993.                         effAux = player.character.metadata.PSEffect1
  1994.                         Native.Function.Call("STOP_PTFX", effAux)
  1995.                         effAux = player.character.metadata.PSEffect2
  1996.                         Native.Function.Call("STOP_PTFX", effAux)
  1997.                         effAux = player.character.metadata.PSEffect3
  1998.                         Native.Function.Call("STOP_PTFX", effAux)
  1999.  
  2000.                         penanceStaretArr(c).makeproofto(False, False, False, False, False)
  2001.  
  2002.                         penanceStaretArr(c).die()
  2003.                         penanceStaretArr(c).isonfire = False
  2004.  
  2005.                         If penanceStaretArr(c).metadata.PenanceStareMod <= 1000 Then
  2006.                             penanceStaretArr(c).velocity = vector3.worlddown * 10
  2007.                         Else
  2008.                             If penanceStaretArr(c).metadata.PenanceStareMod > 2000 Then penanceStaretArr(c).isonfire = True
  2009.  
  2010.                             penanceStaretArr(c).isragdoll = True
  2011.                             penanceStaretArr(c).velocity = (player.character.direction * 3)
  2012.                            
  2013.                             'If penanceStaretArr(c).metadata.PenanceStareMod > 1000 Then
  2014.                                 'if not isChainOn then player.character.weapons.select(PreviousWeapon)
  2015.                             'end if
  2016.                         End If
  2017.  
  2018.                         penanceStaretArr(c) = Nothing
  2019.                     End If
  2020.                 End If
  2021.             Next
  2022.         Catch
  2023.         End Try
  2024.     End Sub
  2025.  
  2026.     Private Sub PenanceStareClearPTFX(ByVal p As ped)
  2027.         Try
  2028.             Dim effAux As int32
  2029.  
  2030.             effAux = p.metadata.PSEffect1
  2031.             Native.Function.Call("STOP_PTFX", effAux)
  2032.             effAux = p.metadata.PSEffect2
  2033.             Native.Function.Call("STOP_PTFX", effAux)
  2034.             effAux = p.metadata.PSEffect3
  2035.             Native.Function.Call("STOP_PTFX", effAux)
  2036.         Catch
  2037.         End Try
  2038.     End Sub
  2039.  
  2040.     Private Sub WaterRide
  2041.         If exists(player.character.currentvehicle) AndAlso (player.character.currentvehicle.model.isbike orelse player.character.currentvehicle.metadata.isGRTransformed) AndAlso player.character.issittinginvehicle Then
  2042.             If (native.function.call(Of Boolean)("IS_CAR_IN_WATER", player.character.currentvehicle)) Then
  2043.                 if player.character.currentvehicle.isupsidedown then
  2044.                     player.character.currentvehicle.applyforce(vector3.worldup / 6, vector3.worldup / 2)
  2045.                 else
  2046.                     player.character.currentvehicle.EngineRunning = True
  2047.                     Dim vecAux, vecAux2 As vector3
  2048.  
  2049.                     vecAux = vector3.zero
  2050.                     vecAux2 = vecAux
  2051.                    
  2052.                     'if player.character.currentvehicle.model.isbike then
  2053.                         vecAux.z = 0.2
  2054.                     'else
  2055.                     '   vecAux.z = 0.3
  2056.                     'end if
  2057.                    
  2058.                     If Not game.iskeypressed(hkControlKey) Then
  2059.                         If player.character.currentvehicle.speed < 2 Then
  2060.                             If player.character.currentvehicle.rotation.x > 3 Then
  2061.                                 vecAux2.y = -0.1
  2062.                             ElseIf player.character.currentvehicle.rotation.x < 3 Then
  2063.                                 vecAux2.y = 0.1
  2064.                             End If
  2065.                         Else
  2066.                             If player.character.currentvehicle.rotation.x > 7 Then
  2067.                                 vecAux2.y = -0.3
  2068.                             ElseIf player.character.currentvehicle.rotation.x < 7 Then
  2069.                                 vecAux2.y = 0.3
  2070.                             End If
  2071.                         End If
  2072.                     End If
  2073.                    
  2074.                     if player.character.currentvehicle.metadata.isGRTransformed then
  2075.                         if player.character.currentvehicle.speed > 10 then
  2076.                             vecAux2.y = 0.6
  2077.                         elseif game.iskeypressed(hkAccelKey) andalso (player.character.currentvehicle.speed > 6) then
  2078.                             vecAux2.y = 0.3
  2079.                         end if
  2080.                     end if
  2081.                    
  2082.                     player.character.currentvehicle.applyforce(vecAux, vecAux2)
  2083.  
  2084.                     If game.iskeypressed(hkAccelKey) Then
  2085.                         If Not game.iskeypressed(hkBikeNitro) Then
  2086.                             player.character.currentvehicle.applyforce(player.character.direction / 1.5)
  2087.                         Else
  2088.                             vecAux2.y = 1
  2089.                             player.character.currentvehicle.applyforce(player.character.direction * 4, vecAux2)
  2090.                         End If
  2091.                     End If
  2092.                    
  2093.                     if not player.character.currentvehicle.model.isbike andalso (player.character.currentvehicle.speed < 10) then
  2094.                         If game.iskeypressed(hkTurnVehicleLeft) Then
  2095.                             player.character.currentvehicle.applyforce(player.character.direction / 3.5, vector3.worldeast / 3.5 + vector3.worldnorth / 3.5)
  2096.                         ElseIf game.iskeypressed(hkTurnVehicleRight) Then
  2097.                             player.character.currentvehicle.applyforce(player.character.direction / 3.5, vector3.worldwest / 3.5 + vector3.worldsouth / 3.5)
  2098.                         End If
  2099.                     end if
  2100.                 end if
  2101.                
  2102.                 player.character.currentvehicle.metadata.isInWater = True
  2103.                 player.character.metadata.dir = player.character.currentvehicle.direction
  2104.             Else
  2105.                 If player.character.currentvehicle.metadata.isInWater Then player.character.currentvehicle.metadata.isInWater = False
  2106.             End If
  2107.         End If
  2108.     End Sub
  2109.  
  2110.     Private Sub spitBulletsAux()
  2111.         If Not bInfiniteSpitBullets AndAlso (SpitBulletBulCount <= 0) Then Exit Sub
  2112.  
  2113.         bIconSpitbullets = True
  2114.  
  2115.         If Not Game.isKeyPressed(hkAimKey) Then
  2116.             Try
  2117.                 Dim vecAux As Vector3
  2118.  
  2119.                 vecAux = Player.Character.GetBonePosition(Bone.RightArmRoll) - Player.Character.Direction / 3
  2120.                 vecAux.Z += 0.3
  2121.  
  2122.                 Dim a As AnimationSet = New AnimationSet("melee_counters")
  2123.  
  2124.                 Player.Character.Invincible = True
  2125.                 If Exists(Player.Character.CurrentVehicle) Then Player.Character.CurrentVehicle.CanBeDamaged = False
  2126.  
  2127.                 For c As Int16 = 1 To 7
  2128.                     WaitAndspitBulletsAux(300, 3)
  2129.  
  2130.                     If Not bInfiniteSpitBullets AndAlso (SpitBulletBulCount <= 0) Then Exit For
  2131.  
  2132.                     Player.Character.Task.PlayAnimation(a, "dodge_back", 0.5, AnimationFlags.Unknown09)
  2133.                 Next
  2134.  
  2135.                 If Not isGhostRider Then
  2136.                     Player.Character.Invincible = False
  2137.                     If Exists(Player.Character.CurrentVehicle) Then Player.Character.CurrentVehicle.CanBeDamaged = True
  2138.                     Exit Sub
  2139.                 End If
  2140.  
  2141.                 For c As Int16 = 1 To 14
  2142.                     WaitAndspitBulletsAux(300, -3)
  2143.  
  2144.                     If Not bInfiniteSpitBullets AndAlso (SpitBulletBulCount <= 0) Then Exit For
  2145.  
  2146.                     Player.Character.Task.PlayAnimation(a, "dodge_back", 0.2, AnimationFlags.Unknown09)
  2147.                 Next
  2148.  
  2149.                 If Not isGhostRider Then
  2150.                     Player.Character.Invincible = False
  2151.                     If Exists(Player.Character.CurrentVehicle) Then Player.Character.CurrentVehicle.CanBeDamaged = True
  2152.                     Exit Sub
  2153.                 End If
  2154.  
  2155.                 For c As Int16 = 1 To 7
  2156.                     WaitAndspitBulletsAux(300, 3)
  2157.  
  2158.                     If Not bInfiniteSpitBullets AndAlso (SpitBulletBulCount <= 0) Then Exit For
  2159.  
  2160.                     Player.Character.Task.PlayAnimation(a, "dodge_back", 0.2, AnimationFlags.Unknown09)
  2161.                 Next
  2162.  
  2163.                 Player.Character.Invincible = False
  2164.  
  2165.                 If Not bInfiniteSpitBullets AndAlso (SpitBulletBulCount <= 0) Then Exit Sub
  2166.  
  2167.                 Player.Character.Task.ClearAll()
  2168.  
  2169.                 If Exists(Player.Character.CurrentVehicle) Then Player.Character.CurrentVehicle.CanBeDamaged = True
  2170.  
  2171.                 If Not isGhostRider Then Exit Sub
  2172.             Catch
  2173.             End Try
  2174.         Else
  2175.             spitBullets()
  2176.         End If
  2177.     End Sub
  2178.  
  2179.     Private Sub WaitAndspitBulletsAux(ByVal time As int32, ByVal pos As int16)
  2180.         While (time > 0) AndAlso isGhostRider
  2181.             If Not bInfiniteSpitBullets AndAlso (SpitBulletBulCount <= 0) Then
  2182.                 SpitBulletBulCount = 0
  2183.                 Exit While
  2184.             End If
  2185.  
  2186.             bIconSpitbulletsLoop = True
  2187.  
  2188.             If Not exists(player.character.currentvehicle) Then
  2189.                 If Not game.iskeypressed(hkAccelKey) Then
  2190.                     player.character.heading += pos
  2191.                 Else
  2192.                     player.character.heading = game.currentcamera.heading
  2193.                 End If
  2194.             End If
  2195.  
  2196.             wait(getInterval)
  2197.            
  2198.             general_tick(Nothing, Nothing)
  2199.            
  2200.             If Not game.iskeypressed(hkAccelKey) Then time -= getInterval * 15
  2201.            
  2202.             spitBullets(True)
  2203.  
  2204.             bIconSpitbulletsLoop = False
  2205.         End While
  2206.     End Sub
  2207.  
  2208.     Private Sub spitBullets(Optional ByVal bAuto As Boolean = False, Optional ByVal PSPed As ped = Nothing)
  2209.         If Not bInfiniteSpitBullets AndAlso (SpitBulletBulCount <= 0) Then
  2210.             SpitBulletBulCount = 0
  2211.             Exit Sub
  2212.         End If
  2213.  
  2214.         If Not bInfiniteSpitBullets Then SpitBulletBulCount -= 1
  2215.  
  2216.         Dim vec, vecIni As vector3
  2217.  
  2218.         player.character.health += 1
  2219.  
  2220.         If Not Exists(PSPed) Then
  2221.             vecIni = Player.Character.Position + Vector3.WorldUp * 0.4
  2222.             vecIni += Game.CurrentCamera.Direction + Player.Character.Velocity
  2223.  
  2224.             'If Not Game.isGameKeyPressed(GameKey.Aim) Then
  2225.                 vec = vecIni + Player.Character.Direction * 300
  2226.             'Else
  2227.                 vec.Z = (vecIni + Game.CurrentCamera.Direction * 300).Z
  2228.             'End If
  2229.         Else
  2230.             vec = PSPed.Position
  2231.  
  2232.             vecIni = Player.Character.GetBonePosition(Bone.Head) + Player.Character.Direction / 4
  2233.         End If
  2234.  
  2235.         vecIni.Z += 5
  2236.         World.AddExplosion(vecIni, ExplosionType.Default, 0.001, True, True, 0.02)
  2237.         vecIni.Z -= 5
  2238.  
  2239.         Dim tmpDist As Double
  2240.         Dim tmpPosCompare As Vector3
  2241.         Dim tmpDirVector As Vector3
  2242.  
  2243.         If bAuto Then
  2244.             tmpDirVector = Player.Character.Direction
  2245.             tmpDirVector.Z = Game.CurrentCamera.Direction.Z
  2246.         Else
  2247.             tmpDirVector = Game.CurrentCamera.Direction
  2248.         End If
  2249.  
  2250.         If Not Exists(PSPed) Then
  2251.             For Each p As Ped In pedsTarget
  2252.                 If Exists(p) AndAlso (p <> Player.Character) Then
  2253.                     tmpDist = p.Position.DistanceTo(Player.Character.Position)
  2254.                     tmpPosCompare = Player.Character.Position + tmpDirVector * tmpDist
  2255.  
  2256.                     If p.Position.DistanceTo(tmpPosCompare) < 1 Then
  2257.                         If Not p.isOnFire Then
  2258.                             p.isOnFire = True
  2259.                             p.isRagdoll = True
  2260.                             p.Die()
  2261.                         End If
  2262.  
  2263.                         If Not bAuto Then
  2264.                             p.Velocity = Game.CurrentCamera.Direction * 10
  2265.                         Else
  2266.                             p.Velocity = Player.Character.Direction * 10
  2267.                         End If
  2268.                     End If
  2269.                 End If
  2270.             Next
  2271.         End If
  2272.  
  2273.         Native.Function.Call(Of Int32)("trigger_PTFX_ON_PED_BONE", "muz_minigun", Player.Character, 0, 0, 0, 0, 0, 0, Bone.Head, 0.2)
  2274.         Native.Function.Call(Of Int32)("trigger_PTFX_ON_PED_BONE", "wpn_bullet_trace", Player.Character, 0, 0, 0.55, _
  2275.             (90 - Helper.RadianToDegree(Game.CurrentCamera.Direction.Z)), 0, 180.0F, Bone.Root, 1.0)
  2276.  
  2277.         Native.Function.Call("FIRE_SINGLE_BULLET", vecIni.X, vecIni.Y, vecIni.Z, vec.X, vec.Y, vec.Z, 1000)
  2278.         Native.Function.Call("FIRE_SINGLE_BULLET", vecIni.X, vecIni.Y, vecIni.Z, vec.X, vec.Y, vec.Z + 0.1, 1000)
  2279.  
  2280.         If Not bAuto Then
  2281.             Wait(150)
  2282.         Else
  2283.             Wait(25)
  2284.         End If
  2285.  
  2286.         Native.Function.Call("FIRE_SINGLE_BULLET", vecIni.X, vecIni.Y, vecIni.Z, vec.X, vec.Y, vec.Z - 0.1, 1000)
  2287.     End Sub
  2288.  
  2289.     Private Sub wallRide
  2290.         If exists(player.character.currentvehicle) AndAlso (Player.Character.CurrentVehicle.Model.isBike orelse player.character.currentvehicle.metadata.isGRTransformed) Then
  2291.             Dim bResetDir As int16 = 2
  2292.             Dim bApplyForce As Boolean = False
  2293.            
  2294.             If player.character.currentvehicle.isonallwheels OrElse player.character.metadata.isInWater Then
  2295.                 onAllWheelsCont = 600
  2296.                
  2297.                 fallCont = 0
  2298.             Else
  2299.                 If onAllWheelsCont > 0 Then
  2300.                     onAllWheelsCont -= getInterval
  2301.                 Else
  2302.                     onAllWheelsCont = 0
  2303.                 End If
  2304.  
  2305.                 If fallCont < 1000 Then fallCont += Me.Interval
  2306.             End If
  2307.  
  2308.             Dim vecAux As vector3
  2309.            
  2310.             If player.character.currentvehicle.enginerunning AndAlso (onAllWheelsCont > 0) Then
  2311.                 If (player.character.currentvehicle.rotation.x > 70) AndAlso (player.character.currentvehicle.rotation.x < 110) Then
  2312.                     If game.iskeypressed(hkAccelKey) Then
  2313.                         If player.character.metadata.isInWater Then player.character.currentvehicle.metadata.inWater = 0
  2314.  
  2315.                         player.character.currentvehicle.metadata.blockNitro = True
  2316.  
  2317.                         if not player.character.currentvehicle.metadata.isGRTransformed then
  2318.                             vecAux = player.character.currentvehicle.rotation
  2319.                             If onAllWheelsCont > 200 Then
  2320.                                 vecAux.x = 90
  2321.                                 player.character.currentvehicle.rotation = vecAux
  2322.                             End If
  2323.                         end if
  2324.                        
  2325.                         if not player.character.currentvehicle.metadata.isGRTransformed orelse not player.character.currentvehicle.isonallwheels then
  2326.                             vecAux = player.character.metadata.dir / 3
  2327.                         else
  2328.                             vecAux = player.character.metadata.dir / 4
  2329.                         end if
  2330.  
  2331.                         If player.character.currentvehicle.speed > 5 Then
  2332.                             vecAux.z = UpForceWallRide
  2333.                         Else
  2334.                             vecAux.z = UpForceWallRide + UpForceWallRide / 5
  2335.                         End If
  2336.                        
  2337.                         if player.character.currentvehicle.metadata.isGRTransformed then vecAux.z *= 1.2
  2338.  
  2339.                         If game.iskeypressed(hkBikeNitro) Then vecAux.z = UpForceWallRide * 2
  2340.  
  2341.                         bApplyForce = True
  2342.                     End If
  2343.                 Else
  2344.                     bResetDir -= 1
  2345.                 End If
  2346.  
  2347.                 If (player.character.currentvehicle.rotation.x < -40) AndAlso (player.character.currentvehicle.rotation.x > -100) Then
  2348.                     If (game.iskeypressed(hkAimKey)) Then
  2349.                         player.character.currentvehicle.metadata.blockNitro = True
  2350.  
  2351.                         vecAux = player.character.currentvehicle.rotation
  2352.                         vecAux.x = -90
  2353.                         player.character.currentvehicle.rotation = vecAux
  2354.  
  2355.                         vecAux = (player.character.metadata.dir) * -1
  2356.                         vecAux.z = 1.0
  2357.  
  2358.                         If game.iskeypressed(hkBikeNitro) Then vecAux.z = UpForceWallRide / 5
  2359.  
  2360.                         bApplyForce = True
  2361.                     End If
  2362.                 Else
  2363.                     bResetDir -= 1
  2364.                 End If
  2365.  
  2366.                 If bApplyForce Then
  2367.                     player.character.currentvehicle.applyforce(vecAux)
  2368.  
  2369.                     player.character.metadata.DidWallRide = True
  2370.                 End If
  2371.  
  2372.                 If bResetDir = 0 Then
  2373.                     player.character.currentvehicle.metadata.blockNitro = False
  2374.  
  2375.                     If player.character.currentvehicle.isonallwheels OrElse player.character.metadata.isInWater Then
  2376.                         player.character.metadata.dir = player.character.currentvehicle.direction
  2377.                     End If
  2378.                 End If
  2379.             End If
  2380.            
  2381.             If Not game.iskeypressed(hkcontrolkey) AndAlso Not game.iskeypressed(hkAccelKey) AndAlso player.character.metadata.DidWallRide Then
  2382.                 player.character.metadata.DidWallRide = False
  2383.  
  2384.                 native.function.call("apply_force_to_car", player.character.currentvehicle, True, 0, 0, -1.0, 0, 0, -1.0, True, False, True, True)
  2385.             End If
  2386.            
  2387.             If fallCont >= 600 Then
  2388.                 If not player.character.currentvehicle.metadata.isGRTransformed andalso _
  2389.                    player.character.currentvehicle.isupsidedown AndAlso _
  2390.                    (player.character.currentvehicle.speed < 2) AndAlso _
  2391.                    (player.character.currentvehicle.position.distanceto(player.character.currentvehicle.position.toground) < 2) Then
  2392.                     player.character.task.LeaveVehicleImmediately(player.character.currentvehicle)
  2393.                     Player.Character.invincible = False
  2394.                     Player.Character.metadata.invincible = False
  2395.                     fallCont = 0
  2396.                    
  2397.                     Exit Sub                   
  2398.                 End If
  2399.  
  2400.                 Player.Character.invincible = True
  2401.                 Player.Character.metadata.invincible = True
  2402.             Else
  2403.                 If Player.Character.metadata.invincible Then
  2404.                     Player.Character.invincible = False
  2405.                     Player.Character.metadata.invincible = False
  2406.                 End If
  2407.             End If
  2408.         Else
  2409.             If player.character.metadata.DidWallRide Then player.character.metadata.DidWallRide = False
  2410.         End If
  2411.     End Sub
  2412.  
  2413.     Private Sub Flames
  2414.         if flameSizeMuliplier = 0 then exit sub
  2415.        
  2416.         Native.Function.Call("STOP_PTFX", flame1)
  2417.         Native.Function.Call("STOP_PTFX", flame2)
  2418.         Native.Function.Call("STOP_PTFX", flame3)
  2419.         Native.Function.Call("STOP_PTFX", flame4)
  2420.         Native.Function.Call("STOP_PTFX", flameH1)
  2421.  
  2422.         flame1 = Native.Function.Call(Of int32)("START_PTFX_ON_PED_BONE", "shot_directed_flame", Player.Character, -0.3 + flameOffSetZ, 0 + flameOffSetY, 0 + flameOffSetX, 90.0F, 0, 105.0F, Bone.head, 0.15 * HeadEffectScale * flameSizeMuliplier)
  2423.         flame2 = Native.Function.Call(Of int32)("START_PTFX_ON_PED_BONE", "shot_directed_flame", Player.Character, -0.3 + flameOffSetZ, 0 + flameOffSetY, 0 + flameOffSetX, 90.0F, 0, 95.0F, Bone.head, 0.15 * HeadEffectScale * flameSizeMuliplier)
  2424.         flame3 = Native.Function.Call(Of int32)("START_PTFX_ON_PED_BONE", "shot_directed_flame", Player.Character, -0.3 + flameOffSetZ, 0 + flameOffSetY, 0 + flameOffSetX, 90.0F, 0, 90.0F, Bone.head, 0.15 * HeadEffectScale * flameSizeMuliplier)
  2425.         flame4 = Native.Function.Call(Of int32)("START_PTFX_ON_PED_BONE", "shot_directed_flame", Player.Character, -0.3 + flameOffSetZ, 0 + flameOffSetY, 0 + flameOffSetX, 90.0F, 0, 85.0F, Bone.head, 0.15 * HeadEffectScale * flameSizeMuliplier)
  2426.         flameH1 = Native.Function.Call(Of int32)("START_PTFX_ON_PED_BONE", "ambient_fire_generic", Player.Character, 0.05 + flameOffSetZ, 0 + flameOffSetY, 0 + flameOffSetX, 90.0F, 0, 90.0F, Bone.head, 0.5 * flameSizeMuliplier)
  2427.     End Sub
  2428.  
  2429.     Private Sub flamesBike
  2430.         if BikeFlameSizeMuliplier = 0 then exit sub
  2431.        
  2432.         If exists(player.character.currentvehicle) AndAlso player.character.currentvehicle.model.isbike Then            
  2433.             if timeScript mod 20 = 0 then
  2434.                 If (player.character.currentvehicle.position.distanceto(player.character.currentvehicle.position.toground) < 1) Then
  2435.                     If (throwTimeOut > 0) Then
  2436.                         world.startfire((player.character.currentvehicle.position + player.character.currentvehicle.direction).toground)
  2437.                         world.startfire((player.character.currentvehicle.position - player.character.currentvehicle.direction).toground)
  2438.                     Else
  2439.                         world.startfire((player.character.currentvehicle.position + player.character.currentvehicle.direction).toground - (vector3.worldup) / 6)
  2440.                         world.startfire((player.character.currentvehicle.position - player.character.currentvehicle.direction).toground - (vector3.worldup) / 6)
  2441.                     End If
  2442.  
  2443.                     world.extinguishfire(player.character.currentvehicle.position - (player.character.currentvehicle.direction * 15), 3.0F)
  2444.                 End If
  2445.             End If
  2446.  
  2447.             if timeScript mod 200 = 0 then
  2448.                 Native.Function.Call("STOP_PTFX", flameW1)
  2449.                 Native.Function.Call("STOP_PTFX", flameW2)
  2450.  
  2451.                 flameW1 = Native.Function.Call(Of int32)("START_PTFX_ON_VEH", "ambient_fire_generic", Player.Character.currentvehicle, 0 + BikeFlameOffSetX, 1.1 + BikeFlameOffSetY, -0.4 + BikeFlameOffSetZ, 0, 0, 0, 1.5 * BikeFlameSizeMuliplier)
  2452.                 flameW2 = Native.Function.Call(Of int32)("START_PTFX_ON_VEH", "ambient_fire_generic", Player.Character.currentvehicle, 0 + BikeFlameOffSetX, -0.9 + BikeFlameOffSetY, -0.35 + BikeFlameOffSetZ, 0, 0, 0, 1.5 * BikeFlameSizeMuliplier)
  2453.             end if
  2454.            
  2455.             Player.Character.Health += 1
  2456.         End If
  2457.     End Sub
  2458.  
  2459.     Private Sub throwCars(Optional ByVal vehJustDoIt As Vehicle = Nothing) ' throw cars, like in the first movie when he becomes ghost rider
  2460.         If Exists(vehJustDoIt) OrElse (Exists(Player.Character.CurrentVehicle) AndAlso (Player.Character.CurrentVehicle.Model.isBike orelse player.character.currentvehicle.metadata.isGRTransformed)) Then
  2461.             Dim vec As Vector3
  2462.             Dim vAux As Vehicle = Nothing
  2463.             Dim throwEffectRoundForVehiclesAux As Double = throwEffectRoundForVehicles
  2464.  
  2465.             If Exists(vehJustDoIt) Then
  2466.                 vAux = vehJustDoIt
  2467.                 throwEffectRoundForVehiclesAux = 5
  2468.             Else
  2469.                 vAux = Player.Character.CurrentVehicle
  2470.             End If
  2471.  
  2472.             If Not Exists(vehJustDoIt) AndAlso Not vAux.Metadata.blockNitro AndAlso Game.isKeyPressed(hkBikeNitro) AndAlso (vAux.isOnAllWheels) AndAlso (vAux.Speed > 1) Then _
  2473.                 vAux.ApplyForce(Player.Character.Direction / 4)
  2474.  
  2475.             If Not Exists(vehJustDoIt) Then
  2476.                 vAux.CanTiresBurst = False
  2477.                 Player.Character.CanBeKnockedOffBike = False
  2478.                 Player.Character.CanBeDraggedOutOfVehicle = False
  2479.             End If
  2480.  
  2481.             If Exists(vehJustDoIt) Then
  2482.                 throwTimeout = 1000
  2483.             Else
  2484.                 If vAux.Speed >= speedToThrowEffect Then ' only in high speed
  2485.                     throwTimeout = 1000
  2486.                 ElseIf vAux.Speed < 10 Then
  2487.                     throwTimeout = 0
  2488.                 End If
  2489.             End If
  2490.  
  2491.             If throwTimeout > 0 Then
  2492.                 throwTimeout -= getInterval()
  2493.  
  2494.                 If Not Exists(vehJustDoIt) Then vAux.PetrolTankHealth = 1000
  2495.  
  2496.                 ' get the vehicles that are max throwEffectRoundForVehiclesAux distance to an position some steps behind player to make them be affected when the player pass
  2497.                 For Each v As Vehicle In World.GetVehicles(vAux.Position + vAux.Direction * throwEffectRoundForVehiclesAux * 0.5, throwEffectRoundForVehiclesAux)
  2498.                     If Exists(v) AndAlso (v <> vAux) AndAlso (v.Metadata.launchControl <> launchControl) Then
  2499.                         v.Metadata.launchControl = launchControl ' this makes the effect occur one time
  2500.  
  2501.                         If Exists(vehJustDoIt) Then
  2502.                             vec.X = 0
  2503.                             vec.Y = 0
  2504.                             vec.Z = 10
  2505.                         Else
  2506.                             vec = (v.Position - vAux.Position)
  2507.                             vec.Z = 10 * (vAux.Speed / 20)
  2508.                         End If
  2509.  
  2510.                         Native.Function.Call("APPLY_FORCE_TO_CAR", v, True, vec.X, vec.Y, vec.Z, 0.5, 0.5, 0.5, True, False, True, True)
  2511.  
  2512.                         World.AddExplosion(v.Position.ToGround, ExplosionType.Molotov, 5.0, True, False, 0.0F)
  2513.  
  2514.                         If Not Exists(vehJustDoIt) Then v.PetrolTankHealth = -1
  2515.                     End If
  2516.                 Next
  2517.  
  2518.                 If Not Exists(vehJustDoIt) Then
  2519.                     For Each p As Ped In World.GetPeds(vAux.Position - (vAux.Direction * 4), throwEffectRoundForPeds)
  2520.                         If Exists(p) AndAlso (p <> Player.Character) AndAlso (p.Metadata.launchControl <> launchControl) Then
  2521.                             p.Metadata.launchControl = launchControl
  2522.  
  2523.                             World.AddExplosion(p.Position.ToGround, ExplosionType.Molotov, 1.0, True, False, 0.0F)
  2524.  
  2525.                             p.isOnFire = True
  2526.                         End If
  2527.                     Next
  2528.  
  2529.                     msg("Speed kills...", 100)
  2530.  
  2531.                     bIconSpeedKills = True
  2532.                 End If
  2533.             Else
  2534.                 If vAux.Speed < 15 Then launchControl += 1
  2535.  
  2536.                 bIconSpeedKills = False
  2537.             End If
  2538.         Else
  2539.             launchControl = 1
  2540.  
  2541.             throwTimeout = 0
  2542.  
  2543.             bIconSpeedKills = False
  2544.         End If
  2545.  
  2546.         If launchControl > 9999999999999999 Then launchControl = 1 ' this will never happen, but is better prevent
  2547.     End Sub
  2548.    
  2549.     private sub spawnChain(optional bDontAnim as boolean = false)
  2550.         If player.character.isinvehicle orelse isChainOn orelse player.character.isragdoll orelse player.character.isgettingup Then Exit Sub
  2551.        
  2552.         dim chainModel as model = nothing
  2553.        
  2554.         chainAttackMode = 0
  2555.            
  2556.         pChainTargetGrab = nothing
  2557.         vChainTargetGrab = nothing
  2558.            
  2559.         dim aSet as animationset = nothing
  2560.         dim anim as string = "rifle_out"
  2561.        
  2562.         if not bDontAnim then aSet = new animationset("config_screen_m")
  2563.        
  2564.         Dim iCont As Int16 = 0
  2565.  
  2566.         if exists(objChain(1)) andalso objChain(1).metadata.isAttToPl then         
  2567.             for c as int16 = 1 to maxChainObj
  2568.                 if exists(objChain(c)) then
  2569.                     objChain(c).visible = false
  2570.                     objChain(c).detach
  2571.                     objChain(c).collision = true
  2572.                     objChain(c).metadata.isAttToPl = true
  2573.                 end if
  2574.             next
  2575.            
  2576.             if not bDontAnim then
  2577.             Player.Character.Task.PlayAnimation(aSet, anim, 10.0)
  2578.                 While Not Player.Character.Animation.isPlaying(aSet, anim) AndAlso (iCont < 500)
  2579.                     iCont += Me.Interval
  2580.  
  2581.                     Wait(Me.Interval)
  2582.                 End While
  2583.             end if
  2584.            
  2585.             Native.Function.Call("GIVE_PED_PICKUP_OBJECT", Player.Character, objChain(1))
  2586.            
  2587.             while not objChain(1).isAttachedSomewhere
  2588.                 wait(getInterval)
  2589.                
  2590.                 player.character.health += 1
  2591.             End While
  2592.        
  2593.             wait(250)
  2594.        
  2595.             attachChains
  2596.  
  2597.             exit sub
  2598.         end if
  2599.        
  2600.         if (player.character.weapons.current <> weapon.unarmed) then player.character.weapons.inslot(WeaponSlot.unarmed).select
  2601.        
  2602.         dim vecAux as vector3 = player.character.position + (vector3.worldup) * 2
  2603.         dim vecAttach as vector3
  2604.         vecAttach.y = 0.07
  2605.         vecAttach.z = 0.15
  2606.         dim vecSum as vector3
  2607.  
  2608.         iCont = 0
  2609.         if not bDontAnim then
  2610.             Player.Character.Task.PlayAnimation(aSet, anim, 10.0)
  2611.             While Not Player.Character.Animation.isPlaying(aSet, anim) AndAlso (iCont < 500)
  2612.                 iCont += Me.Interval
  2613.  
  2614.                 Wait(Me.Interval)
  2615.             End While
  2616.         end if
  2617.        
  2618.         vecSum = vecChainDim * 2
  2619.         vecSum.x = 0
  2620.         vecSum.y = 0
  2621.        
  2622.         for c as int16 = 1 to maxChainObj
  2623.             objChain(c) = nothing          
  2624.         next
  2625.        
  2626.         chainModel = New Model("cj_proc_brick")
  2627.         wait(10)
  2628.        
  2629.         objChain(1) = World.CreateObject(chainModel, vecAux)
  2630.        
  2631.         while not exists(objChain(1)) andalso (iCont < 250)
  2632.             wait(getInterval)
  2633.            
  2634.             iCont += Me.Interval
  2635.            
  2636.             player.character.health += 1
  2637.         end while
  2638.        
  2639.         if not exists(objChain(1)) then
  2640.             msg("There is something wrong...", 2000)
  2641.            
  2642.             exit sub
  2643.         end if
  2644.        
  2645.         objChain(1).visible = false
  2646.         objChain(1).metadata.isAttToPl = false
  2647.         objChain(1).collision = true
  2648.            
  2649.     '   Native.Function.Call("SET_OBJECT_AS_STEALABLE", objChain(1), 1)
  2650.     '   Native.Function.Call("SET_OBJECT_DYNAMIC", objChain(1), 1)
  2651.     '   Native.Function.Call("MARK_OBJECT_AS_NO_LONGER_NEEDED", objChain(1))   
  2652.        
  2653.         Native.Function.Call("GIVE_PED_PICKUP_OBJECT", Player.Character, objChain(1))
  2654.        
  2655.         while not objChain(1).isAttachedSomewhere
  2656.             wait(getInterval)
  2657.            
  2658.             player.character.health += 1
  2659.         End While
  2660.        
  2661.         objChain(1).visible = true
  2662.        
  2663.         for c as int16 = 2 to maxChainObj
  2664.             chainModel = New Model("cj_proc_brick")
  2665.             wait(10)
  2666.        
  2667.             objChain(c) = World.CreateObject(chainModel, vecAux)
  2668.            
  2669.             iCont = 0
  2670.            
  2671.             while not exists(objChain(c)) andalso (iCont < 250)
  2672.                 wait(getInterval)
  2673.                
  2674.                 iCont += Me.Interval
  2675.                
  2676.                 player.character.health += 1
  2677.             end while
  2678.            
  2679.             if not exists(objChain(c)) then
  2680.                 msg("There is something wrong...", 2000)
  2681.                
  2682.                 exit sub
  2683.             end if
  2684.            
  2685.             objChain(c).visible = false
  2686.             objChain(c).metadata.isAttToPl = true
  2687.             objChain(c).collision = true
  2688.            
  2689.         '   Native.Function.Call("SET_OBJECT_DYNAMIC", objChain(c), 1)
  2690.         '   Native.Function.Call("SET_OBJECT_AS_STEALABLE", objChain(c), 1)
  2691.         '   Native.Function.Call("MARK_OBJECT_AS_NO_LONGER_NEEDED", objChain(c))
  2692.            
  2693.             objChain(c).detach
  2694.             objChain(c).attachtoped(player.character, bone.spine, vecAttach, vector3.zero)
  2695.            
  2696.             vecAux += vecSum
  2697.         next
  2698.        
  2699.         wait(250)
  2700.        
  2701.         attachChains
  2702.        
  2703.         startChainFire()
  2704.     end sub
  2705.    
  2706.     private sub AttachChains       
  2707.         if player.character.isragdoll orelse player.character.isGettingUp then exit sub
  2708.        
  2709.         dim bShow as boolean = false
  2710.        
  2711.         for c as int16 = 2 to maxChainObj
  2712.             if exists(objChain(c)) then
  2713.                 if objChain(c).metadata.isAttToPl then
  2714.                     objChain(c).detach
  2715.                     objChain(c).metadata.isAttToPl = false
  2716.                 end if
  2717.                
  2718.                 if not objChain(c).isAttachedSomewhere then
  2719.                     bShow = true
  2720.                    
  2721.                     chainAttackMode = 0                
  2722.                     pChainTargetGrab = nothing
  2723.                     vChainTargetGrab = nothing
  2724.                    
  2725.                     native.function.call("ATTACH_OBJECT_TO_OBJECT_PHYSICALLY", objChain(c), objChain(c - 1), false, 0, _
  2726.                         vecChainDim.x / 2, vecChainDim.y / 2, vecChainDim.z / 2,  0.05, 0.05, 0.05, 0, 0)
  2727.                 end if
  2728.             end if
  2729.         next
  2730.        
  2731.         if bShow then          
  2732.             for c as int16 = 2 to maxChainObj
  2733.                 if exists(objChain(c)) then objChain(c).visible = true
  2734.             next
  2735.         end if
  2736.     end sub
  2737.        
  2738.     Private Function chainFindTarget()
  2739.         Try
  2740.             If (chainAttackMode = 2) AndAlso Not Exists(pChainTargetGrab) Then
  2741.                 pChainTargetGrab = pedTargeted
  2742.             Else
  2743.                 pChainTarget = pedTargeted
  2744.             End If
  2745.  
  2746.             If (chainAttackMode = 2) AndAlso Not Exists(vChainTargetGrab) Then
  2747.                 vChainTargetGrab = vehTargeted
  2748.             Else
  2749.                 vChainTarget = vehTargeted
  2750.             End If
  2751.  
  2752.             If chainAttackMode <> 2 Then
  2753.                 Return Exists(pChainTarget) OrElse Exists(vChainTarget)
  2754.             Else
  2755.                 Return Exists(pChainTargetGrab) OrElse Exists(vChainTargetGrab)
  2756.             End If
  2757.  
  2758.             If (pedTargeted <> pChainTargetGrab) Then
  2759.                 If chainAttackMode <> 2 Then
  2760.                     If Exists(pedTargeted.CurrentVehicle) Then
  2761.                         vChainTarget = pedTargeted.CurrentVehicle
  2762.  
  2763.                         Return True
  2764.                     Else
  2765.                         pChainTarget = pedTargeted
  2766.  
  2767.                         Return True
  2768.                     End If
  2769.                 Else
  2770.                     pChainTargetGrab = pedTargeted
  2771.  
  2772.                     Return True
  2773.                 End If
  2774.             End If
  2775.  
  2776.             If Not Exists(pChainTarget) AndAlso Not Exists(vChainTarget) Then
  2777.                 vChainTarget = vehTargeted
  2778.  
  2779.                 If chainAttackMode = 1 Then
  2780.                     If vChainTarget <> vChainTargetGrab Then
  2781.                         Return True
  2782.                     End If
  2783.                 Else
  2784.                     If vChainTarget <> vChainTargetGrab Then
  2785.                         vChainTargetGrab.CanBeDamaged = False
  2786.                         vChainTargetGrab.MakeProofTo(False, True, False, False, False)
  2787.                         vChainTargetGrab.PetrolTankHealth = 1
  2788.  
  2789.                         If vChainTargetGrab.Speed > 5 Then vChainTargetGrab.ApplyForce(vChainTargetGrab.Velocity * -1)
  2790.  
  2791.                         Return True
  2792.                     End If
  2793.                 End If
  2794.             End If
  2795.  
  2796.             Return False
  2797.         Catch
  2798.             Return False
  2799.         End Try
  2800.     End Function
  2801.    
  2802.     Private Sub chainThrowAnim()
  2803.         Dim icont As Int16 = 0
  2804.  
  2805.         Player.Character.Animation.Play(aSetChainAttack, "throwrubbish", 10.0, AnimationFlags.Unknown01)
  2806.  
  2807.         While Not Player.Character.Animation.isPlaying(aSetChainAttack, "throwrubbish") AndAlso (icont < 500)
  2808.             icont += Me.Interval
  2809.  
  2810.             Wait(Me.Interval)
  2811.         End While
  2812.     End Sub
  2813.    
  2814.     Private Sub chainGrabAnim()
  2815.         Dim icont As Int16 = 0
  2816.  
  2817.         Player.Character.Animation.Play(aSetChainGrab, "disarm_knife_r", 10.0, AnimationFlags.Unknown01)
  2818.  
  2819.         While Not Player.Character.Animation.isPlaying(aSetChainGrab, "disarm_knife_r") AndAlso (icont < 500)
  2820.             icont += Me.Interval
  2821.  
  2822.             Wait(Me.Interval)
  2823.         End While
  2824.     End Sub
  2825.    
  2826.     private sub chainAttack1
  2827.         if chainAttackMode <> 1 then exit sub
  2828.        
  2829.         if exists(pChainTarget) andalso exists(objChain(maxChainObj)) then         
  2830.             timeOutMoveChain = 0
  2831.            
  2832.             If (Not Exists(vChainTargetGrab) AndAlso moveChaintoPed(pChainTarget, 0)) OrElse (Exists(vChainTargetGrab) AndAlso moveChainToVec(grabTargetPos, 1, 0)) Then 'moveChaintoVec(vChainTargetGrab.metadata.ChainTargetPos, 1, 0)) then
  2833.                 If Exists(vChainTargetGrab) Then vChainTargetGrab.PetrolTankHealth = -1
  2834.  
  2835.                 World.AddExplosion(pChainTarget.Position, ExplosionType.Molotov, 10.0, True, False, 0)
  2836.  
  2837.                 pChainTarget.isRagdoll = True
  2838.                 pChainTarget.isOnFire = True
  2839.  
  2840.                 If Not Exists(pChainTargetGrab) AndAlso Not Exists(vChainTargetGrab) Then _
  2841.                     pChainTarget.Velocity = Game.CurrentCamera.Direction * 15 + Vector3.WorldUp * 3
  2842.  
  2843.                 pChainTarget.isRagdoll = False
  2844.                 pChainTarget = Nothing
  2845.                 pChainTargetGrab = Nothing
  2846.                 vChainTarget = Nothing
  2847.                 vChainTargetGrab = Nothing
  2848.  
  2849.                 chainAttackMode = 0
  2850.  
  2851.                 FleePeds(pChainTarget.Position, 5.0F)
  2852.                 FleePeds(Player.Character.Position, 5.0F)
  2853.             End If
  2854.         end if
  2855.        
  2856.         if exists(vChainTarget) andalso exists(objChain(maxChainObj)) then
  2857.             'timeOutMoveChain = 0
  2858.                
  2859.             If (Not Exists(vChainTargetGrab) AndAlso moveChainToVeh(vChainTarget, 0, 10)) OrElse (Exists(vChainTargetGrab) AndAlso moveChainToVec(grabTargetPos, 1, 0)) Then 'moveChainToVec(vChainTargetGrab.metadata.ChainTargetPos, 1, 0)) then
  2860.                 If Exists(vChainTargetGrab) Then vChainTargetGrab.PetrolTankHealth = -1
  2861.  
  2862.                 If Not Exists(pChainTargetGrab) Then
  2863.                     FleePeds(vChainTarget.Position, 10.0F)
  2864.                     FleePeds(Player.Character.Position, 10.0F)
  2865.  
  2866.                     If vChainTarget.Model.isHelicopter Then
  2867.                         vChainTarget.PetrolTankHealth = 0
  2868.                         vChainTarget.EngineHealth = 0
  2869.                     Else
  2870.                         vChainTarget.PetrolTankHealth = 1
  2871.                     End If
  2872.  
  2873.                     If Not Exists(vChainTargetGrab) Then
  2874.                         vChainTarget.ApplyForce(Vector3.WorldUp * 8 + ((Game.CurrentCamera.Direction * 2) - vChainTarget.Velocity) * 2, Vector3.WorldUp * 2)
  2875.  
  2876.                         World.AddExplosion(vChainTarget.Position, ExplosionType.Molotov, 10.0, True, False, 0.0F)
  2877.                     Else
  2878.                         World.AddExplosion(vChainTarget.Position, ExplosionType.Rocket, 2.0, True, False, 0.5)
  2879.                     End If
  2880.                 Else
  2881.                     vChainTarget.ApplyForce(Vector3.WorldDown * 15)
  2882.                 End If
  2883.  
  2884.                 For c As Int16 = 0 To 5
  2885.                     random(1, 11)
  2886.                     random(1, 11)
  2887.                     If random(1, 11) Mod 2 = 0 Then Native.Function.Call("BREAK_CAR_DOOR", vChainTarget, c, False)
  2888.                 Next
  2889.  
  2890.                 pChainTarget = Nothing
  2891.                 pChainTargetGrab = Nothing
  2892.                 vChainTarget = Nothing
  2893.                 vChainTargetGrab = Nothing
  2894.  
  2895.                 chainAttackMode = 0
  2896.  
  2897.                 Wait(500)
  2898.             End If
  2899.         end if
  2900.        
  2901.         if (not exists(pChainTarget) andalso not exists(vChainTarget)) orelse not exists(objChain(maxChainObj)) then
  2902.             pChainTarget = nothing
  2903.             pChainTargetGrab = nothing
  2904.             vChainTarget = nothing
  2905.             vChainTargetGrab = nothing
  2906.             chainAttackMode = 0
  2907.         end if
  2908.     end sub
  2909.    
  2910.     private sub chainGrab      
  2911.         if (chainAttackMode <> 2) andalso (chainAttackMode <> 3) then exit sub
  2912.        
  2913.         if exists(pChainTargetGrab) andalso exists(objChain(maxChainObj)) then 
  2914.             timeOutMoveChain = 0
  2915.            
  2916.             if ((chainAttackMode = 2) andalso moveChaintoPed(pChainTargetGrab, 0)) orelse (chainAttackMode = 3) then
  2917.                 if ChainGrabFlyFromVeh then                
  2918.                     pChainTargetGrab.isRagdoll = True
  2919.                     vecVelocityGeneral = (objChain(maxChainObj).Position - pChainTargetGrab.Position) * (objChain(maxChainObj).Position.DistanceTo(pChainTargetGrab.Position) * 10)
  2920.                     pChainTargetGrab.Velocity = ControlVelocity(vecVelocityGeneral, 100.0)
  2921.                    
  2922.                     if timeScript mod 500 = 0 then native.function.call("ON_FIRE_SCREAM", pChainTargetGrab)
  2923.                    
  2924.                     chainAttackMode = 3
  2925.                 end if
  2926.             end if
  2927.         end if
  2928.         if exists(vChainTargetGrab) andalso exists(objChain(maxChainObj)) then
  2929.             timeOutMoveChain = 0
  2930.            
  2931.             if ((chainAttackMode = 2) andalso moveChaintoVeh(vChainTargetGrab, 0)) orelse (chainAttackMode = 3) then               
  2932.                 if chainAttackMode = 2 then                
  2933.                     World.AddExplosion(vChainTargetGrab.Position.ToGround, ExplosionType.Molotov, 3.0, True, False, 0.0F)
  2934.                    
  2935.                     vChainTargetGrab.applyforce(vector3.worlddown * 3)
  2936.                 end if
  2937.                
  2938.                 chainAttackMode = 3
  2939.             end if
  2940.         end if
  2941.     end sub
  2942.    
  2943.     private function ChainGrabFlyFromVeh
  2944.         try
  2945.             if exists(pChainTargetGrab.currentvehicle) then
  2946.                 if not pChainTargetGrab.currentvehicle.model.isboat then
  2947.                     dim hAux as int16 = player.character.heading - pChainTargetGrab.currentvehicle.heading
  2948.                    
  2949.                     native.function.call("SET_PED_FORCE_FLY_THROUGH_WINDSCREEN", pChainTargetGrab)
  2950.                    
  2951.                     dim iCont as int16 = 0
  2952.                    
  2953.                     while (iCont < 500) andalso exists(pChainTargetGrab.currentvehicle)
  2954.                         wait(getInterval)
  2955.                        
  2956.                         timeOutMoveChain = 0
  2957.                        
  2958.                         moveChaintoPed(pChainTargetGrab, 0)
  2959.                        
  2960.                         iCont += Me.Interval
  2961.                        
  2962.                         player.character.health += 1
  2963.                     end while
  2964.                    
  2965.                     native.function.call("BREAK_CAR_DOOR", pChainTargetGrab.currentvehicle, 1, false)
  2966.                     native.function.call("BREAK_CAR_DOOR", pChainTargetGrab.currentvehicle, 3, false)
  2967.                     native.function.call("BREAK_CAR_DOOR", pChainTargetGrab.currentvehicle, 0, false)
  2968.                     native.function.call("BREAK_CAR_DOOR", pChainTargetGrab.currentvehicle, 2, false)
  2969.                    
  2970.                     if iCont >= 500 then
  2971.                         pChainTargetGrab.task.leavevehicleimmediately(pChainTargetGrab.currentvehicle)
  2972.                        
  2973.                         iCont = 0
  2974.                        
  2975.                         while (iCont < 500) andalso exists(pChainTargetGrab.currentvehicle)
  2976.                             wait(getInterval)
  2977.                            
  2978.                             timeOutMoveChain = 0
  2979.                            
  2980.                             moveChaintoPed(pChainTargetGrab, 0)
  2981.                            
  2982.                             iCont += Me.Interval
  2983.                            
  2984.                             player.character.health += 1
  2985.                         end while
  2986.                        
  2987.                         if iCont >= 500 then
  2988.                             chainAttackMode = 0
  2989.                             pChainTargetGrab = nothing
  2990.                             pChainTarget = nothing
  2991.                            
  2992.                             return false
  2993.                         end if
  2994.                     end if
  2995.                 else
  2996.                     pChainTargetGrab.task.leavevehicleimmediately(pChainTargetGrab.currentvehicle)
  2997.                 end if
  2998.             end if
  2999.         catch
  3000.         end try
  3001.        
  3002.         return true
  3003.     end function
  3004.    
  3005.     private sub FleePeds(vec as vector3, round as double, optional pedIgnore as ped = nothing)
  3006.         try
  3007.             dim bIgnore as boolean = false
  3008.            
  3009.             for each p as ped in world.getpeds(vec, round)
  3010.                 if exists(p) andalso (p <> player.character) andalso (p <> pedIgnore) andalso (p <> pChainTarget) andalso (p <> pChainTargetGrab) then
  3011.                     for c as int16 = 1 to penanceStaretArrCount
  3012.                         if exists(penanceStaretArr(c)) andalso (p = penanceStaretArr(c)) then
  3013.                             bIgnore = true
  3014.                            
  3015.                             exit for
  3016.                         end if
  3017.                     next
  3018.                    
  3019.                     if not bIgnore then
  3020.                         if (p.pedtype <> PedType.Cop) andalso (not exists(p.currentvehicle) orelse (exists(p.currentvehicle) andalso not p.currentvehicle.model.ishelicopter)) then
  3021.                             p.task.FleeFromChar(player.character)
  3022.                         else
  3023.                             p.enemy = true
  3024.                            
  3025.                             if player.WantedLevel = 0 then player.WantedLevel = 1                          
  3026.                         end if
  3027.                     end if
  3028.                 end if
  3029.             next       
  3030.         catch
  3031.         end try
  3032.     end sub
  3033.    
  3034.     private function moveChaintoPed(p as ped, freezeTime as int16, optional speed as double = 1)       
  3035.         if exists(p) andalso exists(objChain(maxChainObj)) then        
  3036.             if timeOutMoveChain > 700 then
  3037.                 chainAttackMode = 0
  3038.                 vChainTarget = nothing
  3039.                 pChainTarget = nothing
  3040.                 return true
  3041.             end if
  3042.            
  3043.             if chainAttackMode > 0 then player.character.heading = game.currentcamera.heading
  3044.            
  3045.             if (not exists(p.currentvehicle) andalso not native.function.call(of boolean)("IS_CHAR_TOUCHING_OBJECT", p, objChain(maxChainObj))) orelse
  3046.                (exists(p.currentvehicle) andalso not native.function.call(of boolean)("IS_VEHICLE_TOUCHING_OBJECT", p.currentvehicle, objChain(maxChainObj))) then
  3047.                 timeOutMoveChain += Me.Interval
  3048.  
  3049.                 vecVelocityGeneral = ((p.Position - objChain(maxChainObj).Position) * p.Position.DistanceTo(objChain(maxChainObj).Position) * 25) * speed
  3050.                 objChain(maxChainObj).Velocity = ControlVelocity(vecVelocityGeneral, 100.0)
  3051.                
  3052.                 if (objChain(maxChainObj).position.distanceto(p.position) < 3) andalso (objChain(maxChainObj).velocity.distanceto(vector3.zero) < 10) then
  3053.                     return true
  3054.                 end if
  3055.                
  3056.                 If (chainAttackMode = 1) AndAlso Exists(pChainTargetGrab) AndAlso (pChainTargetGrab.Position.DistanceTo(p.Position) > 4) Then
  3057.                     vecVelocityGeneral = ((p.Position - pChainTargetGrab.Position) * 5)
  3058.                     pChainTargetGrab.Velocity = ControlVelocity(vecVelocityGeneral, 100.0)
  3059.                    
  3060.                     if (freezeTime = 0) andalso (pChainTargetGrab <> p) andalso (pChainTargetGrab.position.distanceto(p.position) < 2) then
  3061.                         return true
  3062.                     end if
  3063.                 End If
  3064.                
  3065.                 If Exists(vChainTargetGrab) Then
  3066.                     'vChainTargetGrab.ApplyForce((p.Position - vChainTargetGrab.Position) * 2)
  3067.                     vChainTargetGrab.ApplyForce(Vector3.Normalize(p.Position - vChainTargetGrab.Position) * 20)
  3068.  
  3069.                     If (freezeTime = 0) AndAlso (vChainTargetGrab.Position.DistanceTo(p.Position) < 10) Then
  3070.                         Return True
  3071.                     End If
  3072.                 end if
  3073.  
  3074.                 Return False
  3075.             Else
  3076.                 While freezeTime >= 0
  3077.                     freezeTime -= getInterval()
  3078.  
  3079.                     vecVelocityGeneral = ((p.GetBonePosition(Bone.Head) - objChain(maxChainObj).Position) * _
  3080.                         p.GetBonePosition(Bone.Head).DistanceTo(objChain(maxChainObj).Position) * 10)
  3081.                     objChain(maxChainObj).Velocity = ControlVelocity(vecVelocityGeneral, 50.0)
  3082.  
  3083.                     Wait(getInterval)
  3084.                 End While
  3085.  
  3086.                 Return True
  3087.             End If
  3088.         Else
  3089.             Return False
  3090.         End If
  3091.     end function
  3092.    
  3093.     private function moveChainToVeh(v as vehicle, freezeTime as int16, optional speed as double = 1)       
  3094.         if exists(v) andalso exists(objChain(maxChainObj)) then        
  3095.             if timeOutMoveChain > 700 then
  3096.                 chainAttackMode = 0
  3097.                 vChainTarget = nothing
  3098.                 pChainTarget = nothing
  3099.                 return true
  3100.             end if
  3101.            
  3102.             if chainAttackMode > 0 then player.character.heading = game.currentcamera.heading
  3103.            
  3104.             if (objChain(maxChainObj).position.distanceto(v.position) > 1) andalso not native.function.call(of boolean)("IS_VEHICLE_TOUCHING_OBJECT", v, objChain(maxChainObj)) then               
  3105.                 timeOutMoveChain += Me.Interval
  3106.  
  3107.                 vecVelocityGeneral = ((v.Position - objChain(maxChainObj).Position) * _
  3108.                     v.Position.DistanceTo(objChain(maxChainObj).Position) * 10) * speed
  3109.                 objChain(maxChainObj).Velocity = ControlVelocity(vecVelocityGeneral, 100.0)
  3110.                
  3111.                 If Exists(pChainTargetGrab) AndAlso (pChainTargetGrab.Position.DistanceTo(v.Position) > 2) Then
  3112.                     vecVelocityGeneral = ((v.Position - pChainTargetGrab.Position) * 15) * speed
  3113.                     pChainTargetGrab.Velocity = ControlVelocity(vecVelocityGeneral, 100.0)
  3114.                    
  3115.                     if (freezeTime = 0) andalso (pChainTargetGrab.position.distanceto(v.position) < 2) then
  3116.                         return true
  3117.                     end if
  3118.                 End If
  3119.  
  3120.                 If Exists(vChainTargetGrab) Then
  3121.                     'vChainTargetGrab.ApplyForce((v.Position - vChainTargetGrab.Position) * 2)
  3122.                     vChainTargetGrab.ApplyForce(Vector3.Normalize(v.Position - vChainTargetGrab.Position))
  3123.                    
  3124.                     if (freezeTime = 0) andalso (vChainTargetGrab <> v) andalso (vChainTargetGrab.position.distanceto(v.position) < 3) then
  3125.                         return true
  3126.                     end if
  3127.                 end if
  3128.                
  3129.                 Return False
  3130.             Else
  3131.                 While freezeTime >= 0
  3132.                     freezeTime -= getInterval()
  3133.  
  3134.                     vecVelocityGeneral = ((v.Position - objChain(maxChainObj).Position) * _
  3135.                         v.Position.DistanceTo(objChain(maxChainObj).Position) * 5) * speed
  3136.                     objChain(maxChainObj).Velocity = ControlVelocity(vecVelocityGeneral, 50.0)
  3137.  
  3138.                     Wait(getInterval)
  3139.                 End While
  3140.  
  3141.                 Return True
  3142.             End If
  3143.         Else
  3144.             Return False
  3145.         End If
  3146.     end function
  3147.  
  3148.     private function moveChainToVec(v as vector3, speed as double, freezeTime as int16)    
  3149.         if exists(objChain(maxChainObj)) then          
  3150.             if timeOutMoveChain > 700 then
  3151.                 chainAttackMode = 0
  3152.                 return true
  3153.             end if
  3154.            
  3155.             if chainAttackMode > 0 then player.character.heading = game.currentcamera.heading
  3156.            
  3157.             if (objChain(maxChainObj).position.distanceto(v) > 2) then     
  3158.                 timeOutMoveChain += Me.Interval
  3159.  
  3160.                 vecVelocityGeneral = (v - objChain(maxChainObj).Position) * v.DistanceTo(objChain(maxChainObj).Position) * 2 * speed
  3161.                 objChain(maxChainObj).Velocity = ControlVelocity(vecVelocityGeneral, 100.0)
  3162.                
  3163.                 If Exists(pChainTargetGrab) Then
  3164.                     vecVelocityGeneral = (v - pChainTargetGrab.Position) * 10 * speed
  3165.                     pChainTargetGrab.Velocity = ControlVelocity(vecVelocityGeneral, 100.0)
  3166.                    
  3167.                     if (freezeTime = 0) andalso (pChainTargetGrab.position.distanceto(v) <= 1) then return true
  3168.                 End If
  3169.  
  3170.                 If Exists(vChainTargetGrab) Then
  3171.                     If (freezeTime = 0) AndAlso Exists(vChainTarget) AndAlso vChainTarget.Model.isHelicopter AndAlso Not vChainTarget.Metadata.hit Then
  3172.                         If vChainTargetGrab.Position.DistanceTo(Player.Character.Position) > vChainTargetGrab.Position.DistanceTo(vChainTarget.Position) Then _
  3173.                             vChainTarget.Metadata.hit = True
  3174.  
  3175.                         If vChainTargetGrab.Position.DistanceTo(vChainTarget.Position) < 20 Then
  3176.                             'vChainTargetGrab.ApplyForce((vChainTarget.Position - vChainTargetGrab.Position))
  3177.                             vChainTargetGrab.ApplyForce(Vector3.Normalize(vChainTarget.Position - vChainTargetGrab.Position) * 50)
  3178.                         End If
  3179.                     Else
  3180.                         'vChainTargetGrab.ApplyForce((v - vChainTargetGrab.Position) / 4)
  3181.                         vChainTargetGrab.ApplyForce(Vector3.Normalize(v - vChainTargetGrab.Position) * 10)
  3182.                     End If
  3183.                    
  3184.                     if (freezeTime = 0) andalso (vChainTargetGrab.position.distanceto(v) <= 3) then
  3185.                         return true
  3186.                     end if
  3187.                 End If
  3188.                
  3189.                 Return False
  3190.             Else
  3191.                 If Exists(pChainTargetGrab) Then pChainTargetGrab.Velocity = Vector3.Zero
  3192.  
  3193.                 While freezeTime >= 0
  3194.                     freezeTime -= getInterval()
  3195.  
  3196.                     objChain(maxChainObj).Velocity = (v - objChain(maxChainObj).Position) * v.DistanceTo(objChain(maxChainObj).Position) * 2 * speed
  3197.  
  3198.                     If Exists(pChainTargetGrab) Then pChainTargetGrab.Velocity = Vector3.WorldUp / 2
  3199.  
  3200.                     If Exists(vChainTargetGrab) Then vChainTargetGrab.ApplyForce(Vector3.WorldUp / 3, Vector3.WorldEast * 3)
  3201.  
  3202.                     Wait(getInterval)
  3203.                 End While
  3204.  
  3205.                 Return True
  3206.             End If
  3207.         Else
  3208.             Return False
  3209.         End If
  3210.     end function
  3211.        
  3212.     private sub chainTick
  3213.         try        
  3214.             if exists(player.character.currentvehicle) andalso _
  3215.                (player.character.weapons.current = weapon.Misc_Object) andalso exists(objChain(1)) andalso objChain(1).isAttachedSomewhere then
  3216.                 if (player.character.weapons.current <> weapon.unarmed) then player.character.weapons.inslot(weapon.unarmed).select
  3217.             end if
  3218.            
  3219.             if (player.character.weapons.current <> weapon.Misc_Object) orelse _
  3220.                (exists(objChain(2)) andalso not objChain(2).metadata.isAttToPl andalso not objChain(2).isAttachedSomewhere) then
  3221.                
  3222.                 if (exists(objChain(1)) andalso (not objChain(1).metadata.isAttToPl orelse not objChain(1).isAttachedSomewhere) orelse (exists(objChain(2)) andalso not objChain(2).isAttachedSomewhere)) then _
  3223.                     unequipChains
  3224.  
  3225.                 bIconChains = False
  3226.  
  3227.                 exit sub
  3228.             End If
  3229.  
  3230.             If ((Player.Character.Weapons.Current = Weapon.Misc_Object) AndAlso Exists(objChain(1)) AndAlso _
  3231.                objChain(1).isAttachedSomewhere And Exists(objChain(2)) AndAlso objChain(2).Metadata.isAttToPl) Then
  3232.                 unequipChains()
  3233.  
  3234.                 Exit Sub
  3235.             End If
  3236.  
  3237.             If (Exists(objChain(1)) AndAlso Not objChain(1).isAttachedSomewhere) Then unequipChains()
  3238.  
  3239.             bIconChains = True
  3240.  
  3241.             chainAttack1()
  3242.  
  3243.             chainGrab()
  3244.  
  3245.             If (chainAttackMode = 0) OrElse (chainAttackMode = 3) Then
  3246.                 If Not Exists(vChainTargetGrab) Then
  3247.                     For c As Int16 = 2 To maxChainObj
  3248.                         If Exists(objChain(c)) Then
  3249.                             objChain(c).isOnFire = False
  3250.  
  3251.                             If Game.isKeyPressed(hkAimKey) Then
  3252.                                 If Player.Character.Weapons.Current <> Weapon.Misc_Object Then
  3253.                                     Player.Character.Weapons.inSlot(Weapon.Misc_Object).Select
  3254.                                 End If
  3255.  
  3256.                                 vecChainVelocity = ((objChain(1).Position - objChain(c).Position) * 3 + Vector3.WorldDown / 1.5 _
  3257.                                  + (objChain(1).Direction * 4)) + Player.Character.Velocity + Vector3.WorldDown
  3258.                             ElseIf Player.Character.Weapons.Current = Weapon.Misc_Object Then
  3259.                                 vecChainVelocity = ((objChain(c - 1).Position - objChain(c).Position) * 3 * objChain(5).Position.DistanceTo(Player.Character.Position) _
  3260.                                  + Vector3.WorldDown / 1.5 _
  3261.                                  - (Player.Character.Direction / 1.6) + (objChain(1).Direction / 3)) + Player.Character.Velocity
  3262.                             End If
  3263.  
  3264.                             While vecChainVelocity.DistanceTo(Vector3.Zero) > 30
  3265.                                 vecChainVelocity = vecChainVelocity / 2
  3266.                             End While
  3267.  
  3268.                             If objChain(1).isAttachedSomewhere AndAlso objChain(2).isAttachedSomewhere Then
  3269.                                 If (c > 2) AndAlso (c < 7) AndAlso Native.Function.Call(Of Boolean)("IS_CHAR_TOUCHING_OBJECT", Player.Character, objChain(c)) Then
  3270.                                     objChain(c).Velocity = objChain(c).Position - Player.Character.Position
  3271.                                 Else
  3272.                                     objChain(c).Velocity = vecChainVelocity
  3273.                                 End If
  3274.                             End If
  3275.                         End If
  3276.                     Next
  3277.                 ElseIf objChain(1).isAttachedSomewhere AndAlso objChain(2).isAttachedSomewhere Then
  3278.                     If Exists(objChain(maxChainObj)) Then
  3279.                         vecVelocityGeneral = (vChainTargetGrab.Position - objChain(maxChainObj).Position) * 10
  3280.                         objChain(maxChainObj).Velocity = ControlVelocity(vecVelocityGeneral, 50.0)
  3281.                     End If
  3282.  
  3283.                     If (vChainTargetGrab.Speed < 10) AndAlso (vChainTargetGrab.Position.DistanceTo(Player.Character.Position) > 10) Then
  3284.                         vChainTargetGrab.ApplyForce((Player.Character.Position - vChainTargetGrab.Position) / Player.Character.Position.DistanceTo(vChainTargetGrab.Position))
  3285.                     End If
  3286.  
  3287.                     If (vChainTargetGrab.Speed > 1) AndAlso (vChainTargetGrab.Position.DistanceTo(Player.Character.Position) < 5) Then
  3288.                         Try
  3289.                             vChainTargetGrab.ApplyForce(Vector3.WorldDown * 3)
  3290.                             Wait(200)
  3291.                             vChainTargetGrab.FreezePosition = True
  3292.                             vChainTargetGrab.FreezePosition = False
  3293.                         Catch
  3294.                         End Try
  3295.                     End If
  3296.                 End If
  3297.             End If
  3298.         Catch
  3299.         End Try
  3300.     end sub
  3301.  
  3302.     Private Sub unequipChains()
  3303.         If Exists(objChain(1)) AndAlso (Player.Character.Weapons.Current = Weapon.Misc_Object) Then
  3304.             Player.Character.Weapons.Current.Remove()
  3305.         End If
  3306.  
  3307.         chainAttackMode = 0
  3308.         pChainTargetGrab = Nothing
  3309.         vChainTargetGrab = Nothing
  3310.  
  3311.         Dim vecAux As Vector3
  3312.  
  3313.         vecAux.Y = 0.07
  3314.         vecAux.Z = 0.15
  3315.  
  3316.         For c As Int16 = 1 To maxChainObj
  3317.             If Exists(objChain(c)) Then
  3318.                 objChain(c).Metadata.isAttToPl = True
  3319.                 objChain(c).Detach()
  3320.                 objChain(c).Collision = False
  3321.                 objChain(c).AttachToPed(Player.Character, Bone.Spine, vecAux, Vector3.Zero)
  3322.             End If
  3323.         Next
  3324.  
  3325.         stopChainResFire()
  3326.     End Sub
  3327.    
  3328.     private sub leaveChains
  3329.         chainAttackMode = 0
  3330.         pChainTargetGrab = nothing
  3331.         vChainTargetGrab = nothing
  3332.        
  3333.         stopChainFire
  3334.        
  3335.         for c as int16 = 1 to maxChainObj
  3336.             if exists(objChain(c)) then
  3337.                 objChain(c).detach
  3338.                 objChain(c).delete
  3339.                 objChain(c) = nothing
  3340.             end if
  3341.         next
  3342.     end sub
  3343.    
  3344.     private sub stopChainFire
  3345.         dim effectAux as int32
  3346.        
  3347.         for c as int16 = 2 to maxChainObj
  3348.             if exists(objChain(c)) then
  3349.                 effectAux = objChain(c).metadata.chinEID
  3350.                 Native.Function.Call("STOP_PTFX_ON", effectAux)
  3351.             end if
  3352.         next
  3353.        
  3354.         stopChainResFire
  3355.     end sub
  3356.    
  3357.     private sub stopChainResFire       
  3358.         for c as int16 = 1 to maxChainObj
  3359.             if exists(objChain(c)) then
  3360.                 world.ExtinguishFire(objChain(c).position, 2.0)
  3361.             end if
  3362.         next
  3363.     end sub
  3364.    
  3365.     private sub startChainFire
  3366.         for c as int16 = 2 to maxChainObj
  3367.             if exists(objChain(c)) then
  3368.                 objChain(c).metadata.chinEID = Native.Function.Call(of int32)("START_PTFX_ON_OBJ", "ambient_fire_generic", objChain(c), 0, 0, 0, 0, 0, 0, 0.25)
  3369.             end if
  3370.         next
  3371.     end sub
  3372.    
  3373.     private function isChainOn         
  3374.         if exists(objChain(1)) andalso (player.character.weapons.current = weapon.Misc_Object) andalso exists(objChain(2)) andalso not objChain(2).metadata.isAtttoPl then
  3375.             return true
  3376.         else
  3377.             chainAttackMode = 0        
  3378.             pChainTargetGrab = nothing
  3379.             vChainTargetGrab = nothing
  3380.            
  3381.             return false
  3382.         end if
  3383.     End Function
  3384.  
  3385.     Private Function ControlVelocity(ByVal vel As Vector3, ByVal max As Double, optional min as double = 0)
  3386.         Dim vecAux As Vector3 = vel
  3387.  
  3388.         While vecAux.DistanceTo(Vector3.Zero) > max
  3389.             vecAux = vecAux / 2
  3390.         End While
  3391.        
  3392.         While (min > 0) andalso (vecAux.DistanceTo(Vector3.Zero) < min)
  3393.             vecAux = vecAux * 1.1
  3394.         End While
  3395.  
  3396.         Return vecAux
  3397.     End Function
  3398.    
  3399.     private function targetedGround(maxDist as double)
  3400.         dim vec as vector3 = player.character.getboneposition(bone.head) + game.currentcamera.direction * 6
  3401.         dim vecRes as vector3
  3402.        
  3403.         while vec.distanceto(player.character.position) < maxDist
  3404.             vecRes = world.getgroundposition(vec, groundtype.highest)
  3405.            
  3406.             'ChainTargetVeh = world.getclosestvehicle(vec, 1.5)
  3407.             ChainTargetVeh = vehTargeted
  3408.             'if not exists(ChainTargetVeh) then ChainTargetVeh = world.getclosestvehicle(vec, 3.0)
  3409.            
  3410.             if exists(ChainTargetVeh) then exit while
  3411.            
  3412.             if vecRes.distanceto(vec) < 1 then return vecRes
  3413.        
  3414.             vec += game.currentcamera.direction / 2
  3415.         end while
  3416.        
  3417.         return vector3.zero
  3418.     end function
  3419.    
  3420.     private sub ChainWarpToPos(optional targetVeh as vehicle = nothing)
  3421.         dim vecAux as vector3
  3422.        
  3423.         if not exists(ChainTargetVeh) then
  3424.             vecAux = targetedGround(200)
  3425.         else
  3426.             vecAux = ChainTargetVeh.position
  3427.         end if
  3428.        
  3429.         player.character.invincible = true
  3430.        
  3431.         if vecAux <> vector3.zero then
  3432.             PlaySound(".\scripts\GRSounds\ChainDrag.wav")
  3433.  
  3434.             chainThrowAnim()
  3435.            
  3436.             timeOutMoveChain = 0
  3437.            
  3438.             while not moveChainToVec(player.character.position + player.character.direction * 2 + vector3.worldup * 4, 1, 100)
  3439.                 wait(10)
  3440.             end while
  3441.            
  3442.             timeOutMoveChain = 500
  3443.            
  3444.             while not moveChainToVec(vecAux, 1.5, 0)
  3445.                 wait(10)
  3446.                
  3447.                 if exists(ChainTargetVeh) then vecAux = ChainTargetVeh.position
  3448.             end while
  3449.            
  3450.             dim pedDriverAux as ped = nothing
  3451.             dim timeOut as int16 = 0           
  3452.            
  3453.             if exists(ChainTargetVeh) then
  3454.                 wait(250)
  3455.                
  3456.                 pedDriverAux = ChainTargetVeh.getPedOnSeat(vehicleSeat.driver)
  3457.                
  3458.                 if exists(pedDriverAux) then
  3459.                     while exists(pedDriverAux) andalso pedDriverAux.isinvehicle andalso (timeOut < 1000)
  3460.                         native.function.call("SET_PED_FORCE_FLY_THROUGH_WINDSCREEN", pedDriverAux)
  3461.                        
  3462.                         moveChainToVec(pedDriverAux.position, 1, 0)
  3463.                        
  3464.                         wait(100)
  3465.                        
  3466.                         updateLightPos
  3467.                        
  3468.                         timeOut += 100
  3469.                     end while
  3470.                    
  3471.                     wait(250)
  3472.                    
  3473.                     if exists(pedDriverAux) andalso pedDriverAux.isinvehicle then pedDriverAux.delete
  3474.                 end if
  3475.                
  3476.                 native.function.call("BREAK_CAR_DOOR", ChainTargetVeh, 0, false)
  3477.             end if
  3478.            
  3479.             player.character.metadata.headingOriginal = player.character.heading
  3480.             player.character.euphoria.bodybalance.start
  3481.             player.character.euphoria.pedallegs.start
  3482.            
  3483.             dim vecDim as vector3
  3484.            
  3485.             if not exists(ChainTargetVeh) then
  3486.                 vecAux += vector3.worldup * 3 + player.character.direction / 2
  3487.             else
  3488.                 if ChainTargetVeh.model.ishelicopter then
  3489.                     vecDim = vector3.worlddown
  3490.                 else
  3491.                     vecDim = ChainTargetVeh.model.getdimensions
  3492.                 end if
  3493.                
  3494.                 vecAux = ChainTargetVeh.position               
  3495.                 vecAux.z += vecDim.z
  3496.             end if
  3497.            
  3498.             dim maxSpeed as double = 0
  3499.             dim failCont as int16 = 0
  3500.            
  3501.             while (player.character.position.distanceto(vecAux) > 1)
  3502.                 if exists(ChainTargetVeh) then
  3503.                     vecAux = ChainTargetVeh.position
  3504.                     vecAux.z += vecDim.z
  3505.                    
  3506.                     pedDriverAux = ChainTargetVeh.getPedOnSeat(vehicleSeat.driver)
  3507.                
  3508.                     if exists(pedDriverAux) then native.function.call("SET_PED_FORCE_FLY_THROUGH_WINDSCREEN", pedDriverAux)
  3509.                 end if
  3510.                
  3511.                 timeOutMoveChain = 0                               
  3512.                 moveChainToVec(vecAux - vector3.worldup * 3, 1, 0)
  3513.            
  3514.                 updateLightPos
  3515.                
  3516.                 if exists(objChain(1)) then
  3517.                     objChain(1).velocity = ControlVelocity((vecAux + vector3.worldup * 2 - objChain(1).position) * 10, 55, 40)
  3518.                 end if
  3519.                
  3520.                 player.character.velocity = ControlVelocity((vecAux - player.character.position) / 3, 30, 25)
  3521.                
  3522.                 wait(10)
  3523.                
  3524.                 updateLightPos
  3525.                
  3526.                 if maxSpeed - player.character.velocity.distanceto(vector3.zero) > 10 then
  3527.                     player.character.velocity = vector3.worldup * 10
  3528.                    
  3529.                     failCont += 10
  3530.                    
  3531.                     if failCont > 1000 then exit while
  3532.                 end if
  3533.                
  3534.                 if player.character.velocity.distanceto(vector3.zero) > maxSpeed then maxSpeed = player.character.velocity.distanceto(vector3.zero)            
  3535.             end while
  3536.            
  3537.             player.character.isragdoll = false 
  3538.  
  3539.             if exists(ChainTargetVeh) then
  3540.                 ChainTargetVeh.makeproofto(false, true, false, false, false)
  3541.                
  3542.                 world.addexplosion(ChainTargetVeh.position, explosiontype.molotov, 1.0)
  3543.                
  3544.                 pedDriverAux = ChainTargetVeh.getPedOnSeat(vehicleSeat.driver)
  3545.                
  3546.                 player.character.velocity = vector3.zero
  3547.                
  3548.                 if exists(pedDriverAux) then
  3549.                     pedDriverAux.delete
  3550.                     wait(250)
  3551.                 end if
  3552.                
  3553.                 player.character.warpintovehicle(ChainTargetVeh, vehicleseat.driver)
  3554.                
  3555.                 for each p as ped in world.getpeds(ChainTargetVeh.position, 3.0)
  3556.                     if exists(p) andalso (p <> player.character) then
  3557.                         p.isonfire = true
  3558.                     end if
  3559.                 next
  3560.             else
  3561.                 player.character.position = vecAux     
  3562.                 player.character.heading = player.character.metadata.headingOriginal   
  3563.                
  3564.                 player.character.animation.play(aSetChainClimb, "jump_land_roll", 10.0, animationflags.unknown01)
  3565.                
  3566.                 wait(100)
  3567.                
  3568.                 while player.character.animation.isplaying(aSetChainClimb, "jump_land_roll")
  3569.                     wait(10)
  3570.                    
  3571.                     updateLightPos
  3572.                 end while
  3573.                
  3574.                 RequipChainCounter = 500
  3575.             end if
  3576.         end if
  3577.        
  3578.         player.character.invincible = false
  3579.     end sub
  3580. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement