Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'http://gtabkmodding.blogspot.in/
- 'https://www.facebook.com/GTABKModding
- 'https://www.youtube.com/c/BKModdingForGTA
- 'QuickSilver script by GTA BK Modding
- 'Scripting, Ideas and Testing By
- 'GTA BK Modding(Me) :)
- 'QuickSilver Model By
- 'Sweet3d (http://gtaivpedworkshop.blogspot.in/)
- 'QuickSilver Retexture By
- 'Fanta Vy (https://www.youtube.com/channel/UCRTcjRrUodFz93c4QezDN5A)
- 'Requested By
- 'GTA Daman and Diu Stories (https://www.facebook.com/GTADDS)
- 'Note: I grouped all the declared variables so it may be easy for the reader to understand
- 'This was a complex code and i made it as simple as possible ;)
- 'Thanks Rockstar for this amazing game
- Imports System
- Imports GTA
- Imports System.Drawing
- Imports System.Windows.Forms
- Imports System.Collections.Generic
- Imports System.IO
- 'Imports SlimDX.XInput
- Imports System.Text
- Public Class QuickSilver
- Inherits Script
- 'Booleans
- Public QuickSilverOn As Boolean = False
- Public QuickSilverEnemy As Boolean = False
- Private EffectsEnabled As Boolean = False
- Private EnemyEnableWeapons As Boolean = False
- Public UseQuickSilverModel As Boolean = False
- Public DecisionTaken As Boolean = False
- Public TimeScaleOn As Boolean = False
- Public TimeScaleZero As Boolean = False
- Public EnemyTimeScale As Boolean = False
- 'End Booleans
- 'Generals
- Private iniFile As String
- Private QuickSilver As Int32
- Private Speed As Int32
- Private bTimeScale As Int32
- Private bTimeScaleIncrease As Int32
- Private bTimeScaleDecrease As Int32
- Private EnemySpawnKey As Int32
- Private Group As Group = Player.Group
- Shared TRandom As Random = New Random(System.DateTime.Now.Millisecond)
- Shared TRandom2 As Random = New Random(System.DateTime.Now.Second)
- Public TimeAux As Date
- Private EffectsID As Int32
- Dim rndAnim As New Random()
- 'End Generals
- 'Peds
- Public PedModel As Model = "m_y_cowboy_01"
- Public allyPed As Ped = Nothing
- Public enemyPed As Ped = Nothing
- 'End Peds
- 'Doubles
- Private TimeScale As Double
- Private PlayerSpeedValue As Double
- Private EnemySpeedValue As Double
- Private timeWaitSearchTargets As Double = 0
- Private targetAuxRoll As Double = 0
- Private Decide As Double = 0
- Private Decide2 As Double = 0
- 'End Doubles
- 'Vector3s
- Private RunDir As Vector3
- Private enemyForce As Vector3
- Private tmpPos As Vector3
- Private EnemyKickForce As Vector3
- 'End Vector3s
- Public Sub New()
- Me.Interval = 10
- Native.Function.Call("REQUEST_MODEL", 3721179013)
- Native.Function.Call("REQUEST_MODEL", 1862763509)
- If Settings.GetValueString("QuickSilverKey", "Main") = "" Then Settings.SetValue("QuickSilverKey", "Main", Keys.M)
- If Settings.GetValueString("UseQuickSilverModel", "Main", "") = "" Then Settings.SetValue("UseQuickSilverModel", "Main", "1")
- If Settings.GetValueString("EnemySpawnKey", "Main", "") = "" Then Settings.SetValue("EnemySpawnKey", "Main", Keys.PageDown)
- If Settings.GetValueString("Speed", "General", "") = "" Then Settings.SetValue("Speed", "General", 8)
- If Settings.GetValueString("bTimeScale", "General", "") = "" Then Settings.SetValue("bTimeScale", "General", Keys.R)
- If Settings.GetValueString("bTimeScaleIncrease", "General", "") = "" Then Settings.SetValue("bTimeScaleIncrease", "General", Keys.E)
- If Settings.GetValueString("bTimeScaleDecrease", "General", "") = "" Then Settings.SetValue("bTimeScaleDecrease", "General", Keys.Q)
- If Settings.GetValueString("EffectsEnabled", "General", "") = "" Then Settings.SetValue("EffectsEnabled", "General", "1")
- If Settings.GetValueString("EnemyEnableWeapons", "General", "") = "" Then Settings.SetValue("EnemyEnableWeapons", "General", "1")
- Settings.Save()
- QuickSilver = Settings.GetValueKey("QuickSilverKey", "Main", Keys.M)
- UseQuickSilverModel = Settings.GetValueKey("UseQuickSilverModel", "Main", "1") = "1"
- EnemySpawnKey = Settings.GetValueKey("EnemySpawnKey", "Main", Keys.PageDown)
- Speed = Settings.GetValueKey("Speed", "General", 8)
- bTimeScale = Settings.GetValueKey("bTimeScale", "General", Keys.R)
- bTimeScaleIncrease = Settings.GetValueKey("bTimeScaleIncrease", "General", Keys.E)
- bTimeScaleDecrease = Settings.GetValueKey("bTimeScaleDecrease", "General", Keys.Q)
- EffectsEnabled = Settings.GetValueString("EffectsEnabled", "General", "1") = "1"
- EnemyEnableWeapons = Settings.GetValueString("EnemyEnableWeapons", "General", "1") = "1"
- TimeScale = 0.2
- EnemySpeedValue = 1.75F
- End Sub
- Shadows Sub keyDown(ByVal sender As Object, ByVal e As GTA.KeyEventArgs) Handles MyBase.KeyDown
- If e.Key = QuickSilver Then
- QuickSilverOn = Not QuickSilverOn
- If QuickSilverOn Then
- If UseQuickSilverModel Then
- Player.Model = New Model("m_y_cowboy_01")
- End If
- Player.NeverGetsTired = True
- Native.Function.Call("SET_CHAR_DEFAULT_COMPONENT_VARIATION", Player.Character, True)
- msg("Quicksilver!!!", 2000)
- Else
- If UseQuickSilverModel Then
- Player.Model = New Model("m_y_cowboy_01")
- End If
- Player.Character.Task.ClearAllImmediately()
- Player.NeverGetsTired = False
- Native.Function.Call("SET_CHAR_DEFAULT_COMPONENT_VARIATION", Player.Character, True)
- Native.Function.Call("SET_CHAR_ALL_ANIMS_SPEED", Player.Character, 1.0)
- Native.Function.Call("Set_Char_Move_Anim_Speed_Multiplier", Player.Character, 1.0)
- Native.Function.Call("Set_Char_Climb_Anim_Rate", Player.Character, 1.0)
- Game.TimeScale = 1.0
- TimeScale = Nothing
- msg("Niko!!!", 2000)
- End If
- End If
- If e.Key = EnemySpawnKey Then
- QuickSilverEnemy = Not QuickSilverEnemy
- If QuickSilverEnemy Then
- EnemyEvent()
- End If
- End If
- If QuickSilverOn Then
- If e.Key = bTimeScale Then
- TimeScaleOn = Not TimeScaleOn
- End If
- End If
- End Sub
- Private Sub EnemyEvent()
- If QuickSilverEnemy Then
- msg("Creating New enemy", 2000)
- tmpPos = World.GetNextPositionOnPavement(Player.Character.Position.Around(50))
- If tmpPos.DistanceTo(Player.Character.Position) > 50 Then tmpPos = Player.Character.Position.Around(50)
- If Exists(enemyPed) Then enemyPed.Delete()
- Wait(100)
- enemyPed = World.CreatePed(PedModel, tmpPos.ToGround)
- If Exists(enemyPed) Then
- enemyPed.AttachBlip()
- enemyPed.AttachBlip.Color = BlipColor.Cyan
- enemyPed.BecomeMissionCharacter()
- enemyPed.CurrentRoom = Player.Character.CurrentRoom
- enemyPed.SetPathfinding(True, True, True)
- enemyPed.AlwaysDiesOnLowHealth = False
- enemyPed.Enemy = True
- enemyPed.WillDoDrivebys = True
- enemyPed.PriorityTargetForEnemies = True
- enemyPed.CanSwitchWeapons = True
- enemyPed.DuckWhenAimedAtByGroupMember = True
- enemyPed.WillFlyThroughWindscreen = True
- enemyPed.Accuracy = 100
- enemyPed.StartKillingSpree(alsoAttackPlayer:=True)
- enemyPed.Task.FightAgainst(Player.Character)
- enemyPed.MaxHealth = 18000
- enemyPed.Armor = 18000
- enemyPed.Health = 18000
- enemyPed.MakeProofTo(False, True, False, False, False)
- If Not EnemyEnableWeapons Then
- enemyPed.Weapons.RemoveAll()
- Else
- enemyPed.Weapons.MP5.Ammo = 300
- enemyPed.Weapons.MP5.Select()
- If enemyPed.Weapons.MP5.Ammo = 0 Then
- enemyPed.Weapons.RocketLauncher.Ammo = 50
- enemyPed.Weapons.Grenades.Ammo = 50
- enemyPed.Weapons.AssaultRifle_M4.Ammo = 600
- enemyPed.Weapons.DesertEagle.Ammo = 1500
- enemyPed.Weapons.BarettaShotgun.Ammo = 80
- End If
- End If
- End If
- End If
- End Sub
- Shadows Sub keyUp(ByVal sender As Object, ByVal e As GTA.KeyEventArgs) Handles MyBase.KeyUp
- End Sub
- Public Sub Effects(ByVal EffectsPed As Ped)
- Native.Function.Call("TRIGGER_PTFX_ON_PED_BONE", "qub_sm_explode_blue", EffectsPed, 0, 0, 0, 0, 0, 0, Bone.Spine, 0.25)
- Native.Function.Call("TRIGGER_PTFX_ON_PED_BONE", "qub_sm_explode_blue", EffectsPed, 0, 0, 0, 0, 0, 0, Bone.LeftArmRoll, 0.25)
- Native.Function.Call("TRIGGER_PTFX_ON_PED_BONE", "qub_sm_explode_blue", EffectsPed, 0, 0, 0, 0, 0, 0, Bone.RightArmRoll, 0.25)
- Native.Function.Call("TRIGGER_PTFX_ON_PED_BONE", "qub_sm_explode_blue", EffectsPed, 0, 0, 0, 0, 0, 0, Bone.LeftFoot, 0.25)
- Native.Function.Call("TRIGGER_PTFX_ON_PED_BONE", "qub_sm_explode_blue", EffectsPed, 0, 0, 0, 0, 0, 0, Bone.RightFoot, 0.25)
- Native.Function.Call("TRIGGER_PTFX_ON_PED_BONE", "qub_sm_explode_blue", EffectsPed, 0, 0, 0, 0, 0, 0, Bone.RightHand, 0.25)
- Native.Function.Call("TRIGGER_PTFX_ON_PED_BONE", "qub_sm_explode_blue", EffectsPed, 0, 0, 0, 0, 0, 0, Bone.LeftHand, 0.25)
- End Sub
- Private Sub general_tick(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Tick
- If TimeScaleOn Then
- If TimeScale = 0 Then
- TimeScaleZero = Not TimeScaleZero
- End If
- End If
- If QuickSilverOn Then
- If Player.Character.isInAir = False AndAlso Player.Character.isRagdoll = False Then
- If Game.isGameKeyPressed(GameKey.Sprint) Then
- PlayerSpeedValue = 1.75F
- If (Game.isGameKeyPressed(GameKey.MoveForward) OrElse Game.isGameKeyPressed(GameKey.MoveLeft) OrElse Game.isGameKeyPressed(GameKey.MoveRight)) Then
- RunDir.X = Player.Character.Direction.X * Speed '8
- RunDir.Y = Player.Character.Direction.Y * Speed '8
- RunDir.Z = Player.Character.Direction.Z
- Player.Character.ApplyForce(RunDir)
- End If
- Native.Function.Call("set_char_all_anims_speed", Player.Character, PlayerSpeedValue)
- If EffectsEnabled Then
- Effects(Player.Character)
- End If
- Else
- If Player.Character.isInMeleeCombat Then
- PlayerSpeedValue = 2.0F
- Else
- PlayerSpeedValue = 1.1F
- End If
- Speed -= 0.5
- If Speed < 0 Then Speed = 0
- End If
- End If
- If TimeScaleOn Then
- Game.TimeScale = TimeScale
- msg("TimeScale: " & TimeScale.ToString, 2000)
- If TimeScale = 0.2 Then
- Native.Function.Call("SET_CHAR_ALL_ANIMS_SPEED", Player.Character, 5.0F)
- Native.Function.Call("Set_Char_Move_Anim_Speed_Multiplier", Player.Character, 5.0F)
- Native.Function.Call("Set_Char_Climb_Anim_Rate", Player.Character, 5.0F)
- End If
- If Game.isKeyPressed(bTimeScaleIncrease) Then
- TimeScale += 0.1
- If TimeScale > 1.0 Then TimeScale = 1.0
- ElseIf Game.isKeyPressed(bTimeScaleDecrease) Then
- TimeScale -= 0.1
- If TimeScale < 0 Then TimeScale = 0
- End If
- If TimeScaleZero Then
- Native.Function.Call("SET_CHAR_ALL_ANIMS_SPEED", Player.Character, 10.0F)
- Native.Function.Call("Set_Char_Move_Anim_Speed_Multiplier", Player.Character, 10.0F)
- Native.Function.Call("Set_Char_Climb_Anim_Rate", Player.Character, 10.0F)
- End If
- Else
- Native.Function.Call("SET_CHAR_ALL_ANIMS_SPEED", Player.Character, PlayerSpeedValue)
- Native.Function.Call("Set_Char_Move_Anim_Speed_Multiplier", Player.Character, PlayerSpeedValue)
- Native.Function.Call("Set_Char_Climb_Anim_Rate", Player.Character, PlayerSpeedValue)
- Game.TimeScale = 1.0
- TimeScale = 0.2
- End If
- End If
- If QuickSilverOn Then
- Player.MaxHealth = 100
- Player.Character.MaxHealth = 100
- Player.Character.Health = 100
- Player.MaxArmor = 100
- Player.Character.Armor = 100
- Dim Armor As Integer = Player.Character.Armor
- Dim Health As Integer = Player.Character.Health
- If (Player.Character.isAlive AndAlso Armor < 100) Then
- Player.Character.Armor += 0.5
- End If
- If (Player.Character.isAlive AndAlso Armor < Health) Then
- Player.Character.Health += 0.5
- End If
- End If
- End Sub
- Private Sub Enemy_Tick(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Tick
- If QuickSilverEnemy Then
- If Exists(enemyPed) Then
- If enemyPed.isIdle Then
- enemyPed.StartKillingSpree(alsoAttackPlayer:=True)
- enemyPed.Task.FightAgainst(Player.Character)
- End If
- End If
- End If
- If TimeScaleOn Then
- If TimeScale = 0 Then
- TimeScaleZero = Not TimeScaleZero
- End If
- End If
- If QuickSilverEnemy Then
- If Exists(enemyPed) Then
- If enemyPed.isDead AndAlso Not enemyPed.isAlive Then
- If enemyPed.AttachBlip.Exists Then
- enemyPed.AttachBlip.Delete()
- End If
- End If
- If EffectsEnabled Then
- If enemyPed.isAlive Then
- Effects(enemyPed)
- End If
- End If
- Decide = TRandom.Next(200, 400)
- If Decide <= 225 Then
- DecisionTaken = True
- Else
- DecisionTaken = False
- End If
- Dim AllPeds As Ped() = Nothing
- AllPeds = World.GetAllPeds
- If Exists(AllPeds) Then
- For Each p As Ped In AllPeds
- If Exists(p) AndAlso (p <> enemyPed) AndAlso (enemyPed.isAlive) AndAlso Not (enemyPed.isDead) AndAlso (p.isAlive) AndAlso Not Exists(p.CurrentVehicle) Then
- If enemyPed.Position.DistanceTo(p.Position) < 2.0 Then
- If DecisionTaken Then
- enemyPed.PreventRagdoll = True
- enemyPed.isRagdoll = False
- Dim MeleeAnimSet As AnimationSet
- Dim MeleeAnimName1 As String = "lowblow_r"
- Dim MeleeAnimName2 As String = "lowblow_l"
- MeleeAnimSet = New AnimationSet("melee_player_unarmed")
- Native.Function.Call("REQUEST_ANIMS", MeleeAnimSet.Name)
- If rndAnim.Next(0, 2) >= 1 Then
- enemyPed.Animation.Play(MeleeAnimSet, MeleeAnimName1, 8.0)
- Else
- enemyPed.Animation.Play(MeleeAnimSet, MeleeAnimName2, 8.0)
- End If
- If enemyPed.Animation.isPlaying(MeleeAnimSet, MeleeAnimName1) OrElse
- enemyPed.Animation.isPlaying(MeleeAnimSet, MeleeAnimName2) Then
- If (p.Position.DistanceTo(enemyPed.GetBonePosition(Bone.RightHand)) OrElse p.Position.DistanceTo(enemyPed.GetBonePosition(Bone.LeftHand))) < 1.0 Then
- enemyPed.Heading = Helper.DirectionToHeading(p.Position - enemyPed.Position)
- enemyPed.ApplyForce(Vector3.Normalize(p.Position - enemyPed.Position) * Speed)
- enemyForce.X = enemyPed.Direction.X * Speed '8
- enemyForce.Y = enemyPed.Direction.Y * Speed '8
- enemyForce.Z = enemyPed.Direction.Z
- p.ApplyForce(enemyForce)
- p.PreventRagdoll = False
- p.ForceRagdoll(2000, False)
- Native.Function.Call("damage_char", p, 20, 0)
- End If
- End If
- Wait(100)
- If p.Position.DistanceTo(enemyPed.Position) > 5.0 Then
- enemyPed.PreventRagdoll = False
- End If
- enemyPed.StartKillingSpree(alsoAttackPlayer:=True)
- enemyPed.Task.FightAgainst(Player.Character)
- End If
- End If
- End If
- Next
- End If
- End If
- End If
- If QuickSilverEnemy Then
- If Exists(enemyPed) Then
- If TimeScaleOn Then
- Native.Function.Call("SET_CHAR_ALL_ANIMS_SPEED", enemyPed, 5.0F)
- Native.Function.Call("Set_Char_Move_Anim_Speed_Multiplier", enemyPed, 5.0F)
- Native.Function.Call("Set_Char_Climb_Anim_Rate", enemyPed, 5.0F)
- If TimeScaleZero Then
- Native.Function.Call("SET_CHAR_ALL_ANIMS_SPEED", enemyPed, 10.0F)
- Native.Function.Call("Set_Char_Move_Anim_Speed_Multiplier", enemyPed, 10.0F)
- Native.Function.Call("Set_Char_Climb_Anim_Rate", enemyPed, 10.0F)
- End If
- Else
- Native.Function.Call("SET_CHAR_ALL_ANIMS_SPEED", enemyPed, EnemySpeedValue)
- Native.Function.Call("Set_Char_Move_Anim_Speed_Multiplier", enemyPed, EnemySpeedValue)
- Native.Function.Call("Set_Char_Climb_Anim_Rate", enemyPed, EnemySpeedValue)
- End If
- End If
- End If
- End Sub
- Private Sub console_CMD(ByVal sender As Object, ByVal e As ConsoleEventArgs) Handles MyBase.ConsoleCommand
- End Sub
- Private Sub GraphicsEventHandler(ByVal sender As Object, ByVal e As GTA.GraphicsEventArgs) Handles MyBase.PerFrameDrawing
- End Sub
- Private Sub msg(ByVal sMsg As String, ByVal time As Int32)
- Native.Function.Call("PRINT_STRING_WITH_LITERAL_STRING_NOW", "STRING", sMsg, time, 1)
- End Sub
- Private Declare Auto Function GetPrivateProfileString Lib "Kernel32" _
- (ByVal lpAppName As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As StringBuilder, ByVal nSize As Integer, ByVal lpFileName As String) As Integer
- Private Declare Auto Function WritePrivateProfileString Lib "Kernel32" _
- (ByVal lpAppName As String, ByVal lpKeyName As String, ByVal lpString As String, ByVal lpFileName As String) As Integer
- Private Function ReadINI(ByVal key_name As String, ByVal section_name As String, ByVal default_value As String) As String
- Const MAX_LENGTH As Integer = 500
- Dim string_builder As New StringBuilder(MAX_LENGTH)
- GetPrivateProfileString(section_name, key_name, default_value, string_builder, MAX_LENGTH, iniFile)
- Return string_builder.ToString()
- End Function
- Private Sub WriteINI(ByVal key_name As String, ByVal section_name As String, ByVal value As String)
- WritePrivateProfileString(section_name, key_name, value, iniFile)
- End Sub
- Private Sub checkIniExists()
- If Not File.Exists(iniFile) Then
- File.CreateText(iniFile).Dispose()
- Wait(100)
- End If
- End Sub
- Private Function Read_INI_String(opt As String, categoy As String, def As String) As String
- If ReadINI(opt, categoy, "") = "" Then WriteINI(opt, categoy, def)
- Return ReadINI(opt, categoy, def)
- End Function
- End Class
Add Comment
Please, Sign In to add comment