Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports GTA
- Imports GTA.Math
- Imports GTA.Native
- Imports Microsoft.VisualBasic
- Imports Microsoft.VisualBasic.CompilerServices
- Imports System
- Imports System.Collections.Generic
- Imports System.IO
- Imports System.Runtime.CompilerServices
- Imports System.Runtime.InteropServices
- Imports System.Windows.Forms
- Public Class JC2
- Inherits Script
- ' Methods
- Public Sub New()
- AddHandler MyBase.KeyDown, New KeyEventHandler(AddressOf Me.keyDown)
- AddHandler MyBase.KeyUp, New KeyEventHandler(AddressOf Me.keyUp)
- AddHandler MyBase.Tick, New EventHandler(AddressOf Me.general_tick)
- Me.scriptDisplayName = "Screw People Who Don't Share"
- Me.scriptCommandLine = "BaseScriptProject"
- Me.sGUI = "xxxxxxxxxx"
- Me.modFilesFolder = ""
- Me.bLoaded = False
- Me.hkParachute = Keys.Space
- Me.hkReleaseHookInVeh = Keys.Z
- Me.hkToggleHookMode = Keys.H
- Me.hkShowMenu = Keys.N
- Me.hkShowMenuKeyTwo = Keys.LControlKey
- Me.bEnabled = True
- Me.bHookMode = True
- Me.timerCheckMenu = DateAndTime.Now
- Me.sDict = "misstrevor2ig_9a"
- Me.sAnimFly = "get_on_plane_ped"
- Me.sDictJump = "oddjobs@bailbond_mountain"
- Me.sAnimJump = "base_jump_spot"
- Me.sDictLand = "misstrevor3"
- Me.sAnimLand = "biker_exit_2"
- Me.sDictPull = "rcmnigel3_trunk"
- Me.sAnimPull = "out_trunk_trevor"
- Me.sDictHang = "missfinale_b_ig_5"
- Me.sAnimHang = "hold_michael_loop_mic"
- Me.bPinFromGround = False
- Me.vehOnFoot = Nothing
- Me.timeSinceVehOnFootSet = DateAndTime.Now
- Me.sDictStealVeh1 = "veh@boat@jetski@front@ds"
- Me.sAnimStealVeh1 = "dead_fall_out"
- Me.sDictStealVeh1Heli = "missfinale_b_ig_5"
- Me.sAnimStealVeh1Heli = "hold_michael_headbut_mic"
- Me.sDictStealVeh2 = "veh@truck@mixer@ds@enter_exit"
- Me.sAnimStealVeh2 = "jack_dead_perp"
- Me.sDictStealVeh2b = "veh@plane@shamal@front@ps@enter_exit"
- Me.sAnimStealVeh2b = "jack_dead_perp"
- Me.canStealVeh = False
- Me.bPowersOn = False
- Me.targetHUDRot = 0
- Me.entityBullet = Nothing
- Me.entityTarget = Nothing
- Me.timeOut = DateAndTime.Now
- Me.lastDamagedEntity = Nothing
- Me.objectAuxList = New List(Of Entity)
- Me.timer1Sec = DateAndTime.Now
- Me.timerWaitAttachAgain = DateAndTime.Now
- Me.entitiesFound = New List(Of Entity)
- Me.handObject = Nothing
- Me.handObjectModelName = "hei_prop_hei_bank_mon"
- Me.movingToTarget = False
- Me.moveToTargetRope = Nothing
- Me.attachedToVehicle = False
- Me.timerPushingPlayerUp = DateAndTime.Now
- Me.bPushPlayerUp = False
- Me.chuteSpeed = 0
- Me.bUseRagdoll = True
- Me.bDisableWindMill = False
- Me.moveSoundID = -1
- Me.tmpTimeCounter = 0
- Me.playerParachute = Nothing
- Me.inititalParachutePush = True
- Me.targetsList = New List(Of Entity)
- Me.timerReloadTargets = DateAndTime.Now
- Me.reloadTargetPedAux = New List(Of Entity)
- Me.actualTarget = Nothing
- Me.timerSinceLastShoot = DateAndTime.Now
- Me.bShootDetected = False
- Me.last = New Vector3
- Me.waitForShootDetect = True
- Me.actualWindmill = Nothing
- Me.windMillObjects = New List(Of Prop)
- Me.Interval = 10
- Me.timerWaitLoad = DateAndTime.Now
- End Sub
- Public Shared Function ADD_ROPE(ByVal position_x As Double, ByVal position_y As Double, ByVal position_z As Double, ByVal angle_x As Double, ByVal angle_y As Double, ByVal angle_z As Double, ByVal length As Double, ByVal type As Integer, ByVal max_length As Double, ByVal min_length As Double, ByVal p10 As Double, ByVal p11 As Boolean, ByVal p12 As Boolean, ByVal p13 As Boolean, ByVal p14 As Double, ByVal breakable As Boolean, ByRef p16 As InputArgument) As Rope
- Dim position As New Vector3(CSng(position_x), CSng(position_y), CSng(position_z))
- Dim rotation As New Vector3(CSng(angle_x), CSng(angle_y), CSng(angle_z))
- Return World.AddRope(position, rotation, length, type, max_length, min_length, p10, p11, p12, p13, p14, False)
- End Function
- Public Shared Function attachEntitiesToRope(ByVal rope As Rope, ByVal e1 As Entity, ByVal e2 As Entity, Optional ByVal distCoef As Double = 1, Optional ByVal forcedDist As Double = 0, Optional ByVal offset_E1 As Vector3 = New Vector3(), Optional ByVal offset_E2 As Vector3 = New Vector3()) As Rope
- Dim vector3 As Vector3
- Dim position As Vector3 = e1.Position
- Dim destination As Vector3 = e2.Position
- If THelper.isPed(e1) Then
- position = Native.Function.Call(Of Vector3)(Hash.GET_PED_BONE_COORDS, New InputArgument() {e1, 0, 0, 0, 0})
- Native.Function.Call(Hash.SET_PED_TO_RAGDOLL, New InputArgument() {e1, -1, -1, 0, 0, 0})
- Native.Function.Call(Hash.SET_PED_DIES_WHEN_INJURED, New InputArgument() {e1, 0})
- Native.Function.Call(Hash.SET_PED_SUFFERS_CRITICAL_HITS, New InputArgument() {e1, 0})
- Native.Function.Call(Hash.SET_ENTITY_AS_MISSION_ENTITY, New InputArgument() {e1, 1, 1})
- Native.Function.Call(Hash.SET_PED_GENERATES_DEAD_BODY_EVENTS, New InputArgument() {e1, 0})
- If (e1.Health < 0) Then
- Native.Function.Call(Hash.REVIVE_INJURED_PED, New InputArgument() {e1})
- e1.Health = 100
- End If
- End If
- If THelper.isPed(e2) Then
- destination = Native.Function.Call(Of Vector3)(Hash.GET_PED_BONE_COORDS, New InputArgument() {e2, 0, 0, 0, 0})
- Native.Function.Call(Hash.SET_PED_TO_RAGDOLL, New InputArgument() {e2, -1, -1, 0, 0, 0})
- Native.Function.Call(Hash.SET_PED_DIES_WHEN_INJURED, New InputArgument() {e2, 0})
- Native.Function.Call(Hash.SET_PED_SUFFERS_CRITICAL_HITS, New InputArgument() {e2, 0})
- Native.Function.Call(Hash.SET_ENTITY_AS_MISSION_ENTITY, New InputArgument() {e2, 1, 1})
- Native.Function.Call(Hash.SET_PED_GENERATES_DEAD_BODY_EVENTS, New InputArgument() {e2, 0})
- If (e2.Health < 0) Then
- Native.Function.Call(Hash.REVIVE_INJURED_PED, New InputArgument() {e2})
- e2.Health = 100
- End If
- End If
- Dim argument As New InputArgument(0)
- Dim argument2 As New InputArgument(0)
- Dim num As Double = (World.GetDistance(position, destination) * distCoef)
- If (forcedDist > 0) Then
- num = forcedDist
- ElseIf (num <= 10) Then
- num = 10
- End If
- If (offset_E1 <> vector3) Then
- offset_E1 = DirectCast((offset_E1 * 0.5!), Vector3)
- position = Native.Function.Call(Of Vector3)(Hash.GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS, New InputArgument() {e1, offset_E1.X, offset_E1.Y, offset_E1.Z})
- End If
- If (offset_E2 <> vector3) Then
- offset_E2 = DirectCast((offset_E2 * 0.5!), Vector3)
- destination = Native.Function.Call(Of Vector3)(Hash.GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS, New InputArgument() {e2, offset_E2.X, offset_E2.Y, offset_E2.Z})
- End If
- THelper.isPed(e1)
- THelper.isPed(e2)
- Native.Function.Call(Hash.ATTACH_ENTITIES_TO_ROPE, New InputArgument() {rope.Handle, e1, e2, position.X, position.Y, position.Z, destination.X, destination.Y, destination.Z, num, 0, 0, argument, argument2})
- JC2.gasObject(e1, e2)
- JC2.gasObject(e2, e1)
- Return rope
- End Function
- Private Sub attachRopeToEntity(ByVal rope As Rope, ByVal e As Entity, Optional ByVal offset As Vector3 = New Vector3(), Optional ByVal forcedPos As Vector3 = New Vector3())
- Dim vector2 As Vector3
- Dim position As Vector3 = e.Position
- If (forcedPos <> vector2) Then
- position = forcedPos
- End If
- If (offset <> vector2) Then
- position = (position + offset)
- End If
- Native.Function.Call(Hash.ATTACH_ROPE_TO_ENTITY, New InputArgument() {rope.Handle, e, position.X, position.Y, position.Z, 0})
- Native.Function.Call(Hash._0x538D1179EC1AA9A9, New InputArgument() {rope.Handle})
- End Sub
- Private Sub attachToTarget(ByVal eTarget As Entity, Optional ByRef forcedPos As Vector3 = Nothing)
- Dim vector4 As Vector3
- If (THelper.Exists(eTarget) OrElse (Not forcedPos Is vector4)) Then
- Dim vector5 As Vector3
- Me.checkHandObject()
- Script.Wait(50)
- Me.resetHandObject()
- If (forcedPos Is vector4) Then
- If (Not eTarget Is Nothing) Then
- vector5 = New Vector3(0.0!, 0.0!, 1.15!)
- Me.moveToTargetRope = Me.createRopeForPlayer(eTarget, Me.handObject, vector4, vector5)
- Me.movingToTarget = True
- End If
- Else
- Dim vector2 As Vector3 = forcedPos
- Dim vector As Vector3 = DirectCast(THelper.RotationToDirection(GameplayCamera.Rotation), Vector3)
- Dim num As Double = 0.05
- Dim vector3 As Vector3 = (vector2 + DirectCast((vector * CSng(num)), Vector3))
- Do
- vector2.Z = World.GetGroundZ((vector3 + DirectCast((Vector3.WorldUp * 100.0!), Vector3)))
- If ((vector2.Z >= forcedPos.Z) AndAlso (vector2.DistanceTo(forcedPos) < 5.0!)) Then
- forcedPos = vector2
- Exit Do
- End If
- vector2 = forcedPos
- vector3 = (vector3 + DirectCast((vector * CSng(num)), Vector3))
- Loop While (THelper.getDistance2D(vector3, forcedPos) <= 3)
- forcedPos = DirectCast((forcedPos + (Vector3.WorldUp * 0.8!)), Vector3)
- vector5 = New Vector3(-0.05!, -0.05!, 1.1!)
- Me.moveToTargetRope = Me.createRopeForPlayer(eTarget, Me.handObject, vector2, vector5)
- Me.movingToTarget = True
- End If
- End If
- End Sub
- Private Sub cancelMoveToTarget()
- If Me.movingToTarget Then
- Me.movingToTarget = False
- Me.hideHandObject()
- Me.moveToTargetRope.Delete()
- End If
- End Sub
- Private Sub cancelVehAttach()
- If Me.attachedToVehicle Then
- Me.attachedToVehicle = False
- Me.moveToTarget_TargetVeh = Nothing
- Game.Player.Character.CanRagdoll = False
- Game.Player.Character.CanRagdoll = True
- Native.Function.Call(Hash.SET_PED_TO_RAGDOLL, New InputArgument() {Game.Player.Character, 100, 100, 0, 0, 0})
- Me.moveToTargetRope.Delete()
- Me.hideHandObject()
- End If
- End Sub
- Public Shared Sub checkGasModelHash(ByVal ent As Entity, ByVal er As Entity, ByVal hash As Integer)
- If (ent.Model.Hash = hash) Then
- Dim objects As New TGasObjects(ent, er)
- End If
- End Sub
- Private Function checkHandObject() As Boolean
- If Not THelper.Exists(Me.handObject) Then
- JC2.handObjectModel = New Model(Native.Function.Call(Of Integer)(Hash.GET_HASH_KEY, New InputArgument() {Me.handObjectModelName}))
- JC2.handObjectModel.Request()
- Dim now As DateTime = DateAndTime.Now
- Do While (Not JC2.handObjectModel.IsLoaded And (DateAndTime.Now.Subtract(now).TotalMilliseconds < 500))
- Script.Wait(50)
- Loop
- Me.handObject = World.CreateProp(JC2.handObjectModel, (Game.Player.Character.Position + DirectCast((Vector3.WorldDown * 49.0!), Vector3)), True, False)
- End If
- Return THelper.Exists(Me.handObject)
- End Function
- Private Sub checkMenu()
- If (DateAndTime.Now.Subtract(Me.timerCheckMenu).TotalMilliseconds > 1000) Then
- Me.timerCheckMenu = DateAndTime.Now
- If (Me.iniFileScripts.settingsGetString("menu", "display", "", True) = THelper.getScriptname) Then
- Me.iniFileScripts.WriteINI("menu", "display", "")
- Me.mMenu.closeMenu()
- Me.mMenu.showMenu()
- End If
- End If
- End Sub
- Private Sub checkVehiclePull(ByVal tmp As TEntityInRope, ByVal e1 As Entity, ByVal e2 As Entity, ByVal e1Object As Boolean, ByVal e2Object As Boolean, ByVal e1Vehicle As Boolean, ByVal e2Vehicle As Boolean)
- Try
- If (((DateAndTime.Now.Subtract(tmp.timerSinceAttach).TotalMilliseconds > 1000) AndAlso e2Object) AndAlso ((e2.Velocity.Length <= 0.01) AndAlso e1Vehicle)) Then
- Dim vector As Vector3
- Dim vehicle As Vehicle = DirectCast(e1, Vehicle)
- Dim velocity As Vector3 = e1.Velocity
- Dim num3 As Double = velocity.Length
- Dim flag As Boolean = (vehicle.Model.IsHelicopter OrElse vehicle.Model.IsPlane)
- If (Not e1 Is tmp.p1) Then
- vector = Native.Function.Call(Of Vector3)(Hash.GET_ROPE_VERTEX_COORD, New InputArgument() {tmp.rope.Handle, 0})
- Else
- vector = Native.Function.Call(Of Vector3)(Hash.GET_ROPE_LAST_VERTEX_COORD, New InputArgument() {tmp.rope.Handle})
- End If
- Dim distance As Double = World.GetDistance(e2.Position, vector)
- If (((distance >= (tmp.dist * 0.95)) AndAlso (num3 > 5)) AndAlso (vehicle.IsOnAllWheels OrElse flag)) Then
- Dim vector2 As Vector3 = Vector3.Normalize((vector - e1.Position))
- Dim worldUp As Vector3 = Vector3.WorldUp
- If ((flag AndAlso (num3 > 30)) AndAlso (vehicle.EngineHealth > 10.0!)) Then
- vehicle.EngineHealth = 0.0!
- Throw New Exception("done")
- End If
- vector2.Z = 0.0!
- If e1Vehicle Then
- velocity = (vector2 - Vector3.Normalize(e1.Velocity))
- If ((((velocity.Length > 0.3) AndAlso (num3 > 10)) AndAlso e1.Model.IsBike) OrElse e1.Model.IsBicycle) Then
- Me.ejectBikers(DirectCast(e1, Vehicle))
- End If
- If (num3 > 25) Then
- Dim num4 As Short = 0
- Do
- Native.Function.Call(Hash.SET_VEHICLE_DOOR_LATCHED, New InputArgument() {e1, num4})
- num4 = CShort((num4 + 1))
- Loop While (num4 <= 6)
- Dim num5 As Short = 0
- Do
- Native.Function.Call(Hash.SMASH_VEHICLE_WINDOW, New InputArgument() {e1, num5})
- num5 = CShort((num5 + 1))
- Loop While (num5 <= 7)
- Native.Function.Call(Hash._DETACH_VEHICLE_WINDSCREEN, New InputArgument() {e1})
- End If
- End If
- velocity = New Vector3(1.0!, 1.0!, 1.0!)
- e1.ApplyForce(DirectCast(((((vector2 + worldUp) - Vector3.Normalize(e1.Velocity)) * CSng(num3)) * 0.5!), Vector3), velocity)
- End If
- End If
- Catch exception1 As Exception
- ProjectData.SetProjectError(exception1)
- ProjectData.ClearProjectError()
- End Try
- End Sub
- Private Sub clearLists()
- If (Me.objectAuxList.Count > 0) Then
- Dim i As Integer = (Me.objectAuxList.Count - 1)
- Do While (i >= 0)
- Try
- Me.objectAuxList.Item(i).MarkAsNoLongerNeeded()
- Catch exception1 As Exception
- ProjectData.SetProjectError(exception1)
- ProjectData.ClearProjectError()
- End Try
- i = (i + -1)
- Loop
- Me.objectAuxList.Clear()
- End If
- If (JC2.entitiesInRope.Count > 0) Then
- Dim j As Integer = (JC2.entitiesInRope.Count - 1)
- Do While (j >= 0)
- Try
- If THelper.Exists(JC2.entitiesInRope.Item(j).p1) Then
- JC2.entitiesInRope.Item(j).p1.MarkAsNoLongerNeeded()
- End If
- Catch exception2 As Exception
- ProjectData.SetProjectError(exception2)
- ProjectData.ClearProjectError()
- End Try
- Try
- If THelper.Exists(JC2.entitiesInRope.Item(j).p2) Then
- JC2.entitiesInRope.Item(j).p2.MarkAsNoLongerNeeded()
- End If
- Catch exception3 As Exception
- ProjectData.SetProjectError(exception3)
- ProjectData.ClearProjectError()
- End Try
- j = (j + -1)
- Loop
- JC2.entitiesInRope.Clear()
- End If
- End Sub
- Public Shared Function createRope(ByVal ent1 As Entity, ByVal ent2 As Entity, Optional ByVal distanceCoef As Double = 1, Optional ByVal forcedDist As Double = 0) As Rope
- If (THelper.isPed(ent1) AndAlso Not THelper.Exists(ent2)) Then
- distanceCoef = 1
- forcedDist = World.GetDistance(ent1.Position, ent2.Position)
- End If
- Return JC2.createRope(ent1.Position, ent2.Position, distanceCoef, forcedDist)
- End Function
- Public Shared Function createRope(ByVal pos1 As Vector3, ByVal pos2 As Vector3, Optional ByVal distanceCoef As Double = 1, Optional ByVal forcedDist As Double = 0) As Rope
- Dim vector As Vector3 = pos1
- Dim length As Double = (World.GetDistance(pos1, pos2) * distanceCoef)
- If (forcedDist > 0) Then
- length = forcedDist
- ElseIf (length <= 0) Then
- length = 1
- End If
- Dim argument As New InputArgument(0)
- Native.Function.Call(Hash.ROPE_LOAD_TEXTURES, New InputArgument(0 - 1) {})
- Dim vector2 As Vector3 = THelper.directionToRotation(Vector3.Normalize((pos2 - pos1)), 0)
- Dim rope2 As Rope = JC2.ADD_ROPE(CDbl(vector.X), CDbl(vector.Y), CDbl(vector.Z), CDbl(vector2.X), CDbl(vector2.Y), CDbl(vector2.Z), length, 4, length, 1, 0, False, False, False, 10, False, argument)
- Script.Wait(10)
- Native.Function.Call(Hash.ACTIVATE_PHYSICS, New InputArgument() {rope2.Handle})
- Return rope2
- End Function
- Private Function createRopeForPlayer(ByVal eTarget As Entity, ByVal tmpObjAuxR As Prop, Optional ByVal forcedPos As Vector3 = New Vector3(), Optional ByVal ropeOffset As Vector3 = New Vector3()) As Rope
- Dim position As Vector3
- Dim rope As Rope = Nothing
- Dim vector4 As Vector3
- If THelper.Exists(eTarget) Then
- position = eTarget.Position
- rope = JC2.createRope(Game.Player.Character, eTarget, 0.4, 0)
- If THelper.Exists(tmpObjAuxR) Then
- Me.attachRopeToEntity(rope, tmpObjAuxR, ropeOffset, vector4)
- Return rope
- End If
- Dim vector2 As Vector3 = Native.Function.Call(Of Vector3)(Hash.GET_PED_BONE_COORDS, New InputArgument() {Game.Player.Character, &H6F06, 0, 0, 0})
- vector2.Z = (vector2.Z + CSng(0.01))
- Me.attachRopeToEntity(rope, Game.Player.Character, vector4, vector2)
- Return rope
- End If
- If (forcedPos <> vector4) Then
- position = forcedPos
- rope = JC2.createRope(Game.Player.Character.Position, position, 0.4, 0)
- Dim num As Integer = (Native.Function.Call(Of Integer)(Hash.GET_ROPE_VERTEX_COUNT, New InputArgument() {rope.Handle}) - 1)
- If THelper.Exists(tmpObjAuxR) Then
- Me.attachRopeToEntity(rope, tmpObjAuxR, ropeOffset, vector4)
- Else
- Dim vector3 As Vector3 = Native.Function.Call(Of Vector3)(Hash.GET_PED_BONE_COORDS, New InputArgument() {Game.Player.Character, &H6F06, 0, 0, 0})
- vector3.Z = (vector3.Z + CSng(0.01))
- Me.attachRopeToEntity(rope, Game.Player.Character, vector4, vector3)
- End If
- Native.Function.Call(Hash.PIN_ROPE_VERTEX, New InputArgument() {rope.Handle, num, position.X, position.Y, position.Z})
- End If
- Return rope
- End Function
- Private Sub ejectBikers(ByVal ent As Vehicle)
- Dim num As Short = -1
- Do
- Dim pedOnSeat As Ped = ent.GetPedOnSeat(DirectCast(num, VehicleSeat))
- If THelper.Exists(pedOnSeat) Then
- pedOnSeat.Task.ClearAll()
- Native.Function.Call(Hash.TASK_LEAVE_VEHICLE, New InputArgument() {pedOnSeat, ent, &H1000})
- pedOnSeat.CanRagdoll = True
- Native.Function.Call(Hash.SET_PED_TO_RAGDOLL, New InputArgument() {pedOnSeat, &HBB8, &HBB8, 0, 0, 0})
- pedOnSeat.ApplyForce(DirectCast(((ent.Velocity * 0.8!) + (Vector3.WorldUp * 2.0!)), Vector3), Vector3.WorldNorth)
- End If
- num = CShort((num + 1))
- Loop While (num <= 7)
- End Sub
- Private Function entitiesLinked(ByVal ent1 As Entity, ByVal ent2 As Entity) As Boolean
- Dim rope As TEntityInRope
- For Each rope In JC2.entitiesInRope
- If ((THelper.Exists(rope.p1) AndAlso THelper.Exists(rope.p2)) AndAlso (((rope.p1 Is ent1) AndAlso (rope.p2 Is ent2)) OrElse ((rope.p1 Is ent2) AndAlso (rope.p2 Is ent1)))) Then
- Return True
- End If
- Next
- Return False
- End Function
- Private Sub entitiesSubTick()
- Dim i As Integer = (JC2.entitiesInRope.Count - 1)
- Do While (i >= 0)
- Dim tmp As TEntityInRope = JC2.entitiesInRope.Item(i)
- Try
- tmp.pedTick()
- If (Not THelper.Exists(tmp.p1) OrElse Not THelper.Exists(tmp.p2)) Then
- Throw New Exception(("not exists " & Conversions.ToString(THelper.Exists(tmp.p1)) & " " & Conversions.ToString(THelper.Exists(tmp.p2))))
- End If
- If ((Not tmp.p1.IsAttached AndAlso (Not tmp.isVehicle_p1 OrElse (tmp.isVehicle_p2 AndAlso (tmp.p2 Is Game.Player.Character.CurrentVehicle)))) AndAlso (((tmp.p2.Velocity.Length > Math.Max(tmp.p1.Velocity.Length, 1.0!)) AndAlso (tmp.p2.Position.DistanceTo(tmp.p1.Position) > (tmp.dist * 0.98))) AndAlso (Not tmp.isObject_p2 OrElse (tmp.p2.Velocity.Length > 0.02)))) Then
- tmp.p1.ApplyForce(DirectCast(((tmp.p2.Position - tmp.p1.Position) * 0.2!), Vector3))
- ElseIf ((Not tmp.p2.IsAttached AndAlso (Not tmp.isVehicle_p2 OrElse (tmp.isVehicle_p1 AndAlso (tmp.p1 Is Game.Player.Character.CurrentVehicle)))) AndAlso (((tmp.p1.Velocity.Length > Math.Max(tmp.p2.Velocity.Length, 1.0!)) AndAlso (tmp.p2.Position.DistanceTo(tmp.p1.Position) > (tmp.dist * 0.98))) AndAlso (Not tmp.isObject_p1 OrElse (tmp.p1.Velocity.Length > 0.02)))) Then
- tmp.p2.ApplyForce(DirectCast(((tmp.p1.Position - tmp.p2.Position) * 0.2!), Vector3))
- End If
- Try
- If THelper.Exists(tmp.p1) Then
- If (((DateAndTime.Now.Subtract(Me.timerSinceLastShoot).TotalMilliseconds > 25000) AndAlso (World.GetDistance(tmp.p1.Position, GameplayCamera.Position) > Math.Max(CDbl(200), CDbl((tmp.dist * 1.5))))) AndAlso Not tmp.p1.IsOnScreen) Then
- tmp.p1.MarkAsNoLongerNeeded()
- tmp.p1 = Nothing
- Try
- If THelper.Exists(tmp.p2) Then
- tmp.p2.MarkAsNoLongerNeeded()
- End If
- tmp.p2 = Nothing
- Catch exception1 As Exception
- ProjectData.SetProjectError(exception1)
- ProjectData.ClearProjectError()
- End Try
- Throw New Exception(("away " & Conversions.ToString(World.GetDistance(tmp.p1.Position, GameplayCamera.Position))))
- End If
- If (((Me.tmpTimeCounter Mod 100) = 0) AndAlso THelper.Exists(tmp.p2)) Then
- Dim distance As Double = World.GetDistance(tmp.p1.Position, tmp.p2.Position)
- Native.Function.Call(Hash.ROPE_FORCE_LENGTH, New InputArgument() {Me.moveToTargetRope.Handle, (distance * 0.8)})
- End If
- If (((THelper.Exists(tmp.p2) AndAlso tmp.isObject_p2) AndAlso (tmp.p2.IsAttached AndAlso (tmp.p2.Model.Hash = JC2.windMillPipeHash))) AndAlso (tmp.p1.Position.DistanceTo(tmp.p2.Position) >= (tmp.dist * 0.9))) Then
- tmp.p1.ApplyForce(Vector3.Normalize((tmp.p2.Position - tmp.p1.Position)), (Vector3.WorldNorth + Vector3.WorldEast))
- If (tmp.p1.Model.IsBicycle OrElse tmp.p1.Model.IsBike) Then
- Me.ejectBikers(DirectCast(tmp.p1, Vehicle))
- ElseIf (tmp.p1.Model.IsHelicopter OrElse tmp.p1.Model.IsPlane) Then
- Native.Function.Call(Hash.SET_VEHICLE_ENGINE_HEALTH, New InputArgument() {tmp.p1, -1})
- End If
- End If
- If (((THelper.Exists(tmp.p1) AndAlso THelper.Exists(tmp.p2)) AndAlso (tmp.isObject_p1 AndAlso tmp.p1.IsAttached)) AndAlso ((tmp.p1.Model.Hash = JC2.windMillPipeHash) AndAlso (tmp.p1.Position.DistanceTo(tmp.p2.Position) >= (tmp.dist * 0.9)))) Then
- tmp.p2.ApplyForce(Vector3.Normalize((tmp.p1.Position - tmp.p2.Position)), (Vector3.WorldNorth + Vector3.WorldEast))
- If (tmp.p2.Model.IsBicycle OrElse tmp.p2.Model.IsBike) Then
- Me.ejectBikers(DirectCast(tmp.p2, Vehicle))
- ElseIf (tmp.p2.Model.IsHelicopter OrElse tmp.p2.Model.IsPlane) Then
- Native.Function.Call(Hash.SET_VEHICLE_ENGINE_HEALTH, New InputArgument() {tmp.p2, -1})
- End If
- End If
- Me.checkVehiclePull(tmp, tmp.p1, tmp.p2, tmp.isObject_p1, tmp.isObject_p2, tmp.isVehicle_p1, tmp.isVehicle_p2)
- Me.checkVehiclePull(tmp, tmp.p2, tmp.p1, tmp.isObject_p2, tmp.isObject_p1, tmp.isVehicle_p2, tmp.isVehicle_p1)
- End If
- Catch exception3 As Exception
- ProjectData.SetProjectError(exception3)
- Dim exception As Exception = exception3
- Throw New Exception(("error: " & exception.Message))
- End Try
- Catch exception4 As Exception
- ProjectData.SetProjectError(exception4)
- Dim exception2 As Exception = exception4
- tmp.remove()
- ProjectData.ClearProjectError()
- End Try
- i = (i + -1)
- Loop
- End Sub
- Private Function findObject(ByVal coords As Vector3) As Prop
- Dim argument As New OutputArgument
- Dim num As Integer = Native.Function.Call(Of Integer)(Hash.PLAYER_ID, New InputArgument(0 - 1) {})
- Try
- If Native.Function.Call(Of Boolean)(Hash._GET_AIMED_ENTITY, New InputArgument() {num, argument}) Then
- Dim result As Prop = argument.GetResult(Of Prop)()
- If THelper.Exists(result) Then
- Return result
- End If
- End If
- Catch exception1 As Exception
- ProjectData.SetProjectError(exception1)
- Dim exception As Exception = exception1
- ProjectData.ClearProjectError()
- End Try
- Return Nothing
- End Function
- Private Function findTarget(ByVal coords As Vector3, ByRef offset As Vector3) As Entity
- Dim flag As Boolean = False
- Dim e As Entity = Nothing
- offset = Vector3.Zero
- Me.entitiesFound.Clear()
- Dim entity3 As Entity
- For Each entity3 In Me.targetsList
- Try
- If THelper.Exists(entity3) Then
- Native.Function.Call(Hash.SET_ENTITY_CAN_BE_DAMAGED, New InputArgument() {entity3, 1})
- If Native.Function.Call(Of Boolean)(Hash.HAS_ENTITY_BEEN_DAMAGED_BY_ENTITY, New InputArgument() {entity3, Game.Player.Character}) Then
- Native.Function.Call(Hash.CLEAR_ENTITY_LAST_DAMAGE_ENTITY, New InputArgument() {entity3})
- If ((Not flag AndAlso Native.Function.Call(Of Boolean)(Hash.IS_ENTITY_VISIBLE, New InputArgument() {entity3})) AndAlso (entity3.Model.IsVehicle AndAlso (Not entity3 Is Game.Player.Character.CurrentVehicle))) Then
- e = entity3
- Exit For
- End If
- End If
- End If
- Catch exception1 As Exception
- ProjectData.SetProjectError(exception1)
- ProjectData.ClearProjectError()
- End Try
- Next
- If Not THelper.Exists(e) Then
- Dim vehicle As Vehicle
- For Each vehicle In World.GetNearbyVehicles(Game.Player.Character, 100.0!)
- Try
- If THelper.Exists(vehicle) Then
- Native.Function.Call(Hash.SET_ENTITY_CAN_BE_DAMAGED, New InputArgument() {vehicle, 1})
- If Not Me.entitiesFound.Contains(vehicle) Then
- Me.entitiesFound.Add(vehicle)
- End If
- If Native.Function.Call(Of Boolean)(Hash.HAS_ENTITY_BEEN_DAMAGED_BY_ENTITY, New InputArgument() {vehicle, Game.Player.Character}) Then
- Native.Function.Call(Hash.CLEAR_ENTITY_LAST_DAMAGE_ENTITY, New InputArgument() {vehicle})
- If ((Not flag AndAlso Native.Function.Call(Of Boolean)(Hash.IS_ENTITY_VISIBLE, New InputArgument() {vehicle})) AndAlso ((World.GetDistance(vehicle.Position, coords) < (vehicle.Model.GetDimensions.Length * 0.5)) AndAlso (Not vehicle Is Game.Player.Character.CurrentVehicle))) Then
- e = vehicle
- offset = Native.Function.Call(Of Vector3)(Hash.GET_OFFSET_FROM_ENTITY_GIVEN_WORLD_COORDS, New InputArgument() {vehicle, coords.X, coords.Y, coords.Z})
- flag = True
- End If
- End If
- End If
- Catch exception2 As Exception
- ProjectData.SetProjectError(exception2)
- ProjectData.ClearProjectError()
- End Try
- Next
- End If
- If Not THelper.Exists(e) Then
- flag = False
- Dim ped As Ped
- For Each ped In World.GetNearbyPeds(Game.Player.Character, 100.0!)
- Try
- If (THelper.Exists(ped) AndAlso (ped.Health >= 0)) Then
- Native.Function.Call(Hash.SET_ENTITY_CAN_BE_DAMAGED, New InputArgument() {ped, 1})
- If Not Me.entitiesFound.Contains(ped) Then
- Me.entitiesFound.Add(ped)
- End If
- If Native.Function.Call(Of Boolean)(Hash.HAS_ENTITY_BEEN_DAMAGED_BY_ENTITY, New InputArgument() {ped, Game.Player.Character}) Then
- Native.Function.Call(Hash.CLEAR_ENTITY_LAST_DAMAGE_ENTITY, New InputArgument() {ped})
- If ((Not flag AndAlso Native.Function.Call(Of Boolean)(Hash.IS_ENTITY_VISIBLE, New InputArgument() {ped})) AndAlso ((World.GetDistance(ped.Position, coords) < 2.0!) AndAlso Not THelper.Exists(ped.CurrentVehicle))) Then
- e = ped
- offset = New Vector3(0.0!, 0.0!, -0.25!)
- flag = True
- End If
- End If
- End If
- Catch exception3 As Exception
- ProjectData.SetProjectError(exception3)
- ProjectData.ClearProjectError()
- End Try
- Next
- End If
- If Not THelper.Exists(e) Then
- e = Game.Player.GetTargetedEntity
- End If
- If ((Not e Is Game.Player.Character) AndAlso (Not e Is Game.Player.Character.CurrentVehicle)) Then
- Return e
- End If
- Return Nothing
- End Function
- Private Sub findWindMill()
- If Not Me.bDisableWindMill Then
- Try
- If Game.Player.IsAiming Then
- Dim argument As New OutputArgument
- If Native.Function.Call(Of Boolean)(Hash._GET_AIMED_ENTITY, New InputArgument() {Game.Player, argument}) Then
- Dim result As Prop = argument.GetResult(Of Prop)()
- If ((THelper.Exists(result) AndAlso (result.Model.Hash = JC2.windMillHash)) AndAlso (Not Me.actualWindmill Is result)) Then
- Me.actualWindmill = result
- Me.prepareWindMill(result)
- End If
- Else
- Dim vector As Vector3 = DirectCast(THelper.RotationToDirection(GameplayCamera.Rotation), Vector3)
- Dim vector3 As Vector3 = (GameplayCamera.Position + DirectCast((vector * 30.0!), Vector3))
- Dim position As Vector3 = vector3
- Dim e As Prop = Nothing
- Do While (vector3.DistanceTo(position) < 50.0!)
- Dim vector4 As Vector3 = THelper.getGroundPos((vector3 + DirectCast((Vector3.WorldUp * 50.0!), Vector3)))
- e = Native.Function.Call(Of Prop)(Hash.GET_CLOSEST_OBJECT_OF_TYPE, New InputArgument() {vector4.X, vector4.Y, vector4.Z, 5, JC2.windMillHash, 0, 0, 1})
- If THelper.Exists(e) Then
- Exit Do
- End If
- vector3 = (vector3 + DirectCast((vector * 4.0!), Vector3))
- Loop
- If (THelper.Exists(e) AndAlso (Not Me.actualWindmill Is e)) Then
- Me.actualWindmill = e
- Me.prepareWindMill(e)
- End If
- End If
- End If
- Catch exception1 As Exception
- ProjectData.SetProjectError(exception1)
- Dim exception As Exception = exception1
- ProjectData.ClearProjectError()
- End Try
- End If
- End Sub
- Public Shared Sub finishEntityInRope(ByVal er As TEntityInRope)
- JC2.entitiesInRope.Remove(er)
- End Sub
- Public Shared Sub gasObject(ByVal ent As Entity, ByVal er As Entity)
- If THelper.isObject(ent) Then
- JC2.checkGasModelHash(ent, er, -1779825653)
- JC2.checkGasModelHash(ent, er, -1738103333)
- JC2.checkGasModelHash(ent, er, -1348598835)
- JC2.checkGasModelHash(ent, er, &H4BBBAC6E)
- JC2.checkGasModelHash(ent, er, -921781850)
- JC2.checkGasModelHash(ent, er, -925511118)
- JC2.checkGasModelHash(ent, er, &H78053C0E)
- JC2.checkGasModelHash(ent, er, &H4A46E08E)
- JC2.checkGasModelHash(ent, er, &H2EA68690)
- JC2.checkGasModelHash(ent, er, &H10D18544)
- JC2.checkGasModelHash(ent, er, -260208501)
- JC2.checkGasModelHash(ent, er, &H6277EC7E)
- JC2.checkGasModelHash(ent, er, &H25A0F2D1)
- JC2.checkGasModelHash(ent, er, &H148B20A6)
- JC2.checkGasModelHash(ent, er, -1920001264)
- JC2.checkGasModelHash(ent, er, &H37D28693)
- JC2.checkGasModelHash(ent, er, &H4A0DAB09)
- End If
- End Sub
- Private Sub general_tick(ByVal sender As Object, ByVal e As EventArgs)
- Dim vector8 As Vector3
- Dim velocity As Vector3
- If Not Me.bLoaded Then
- Me.loadMod()
- Return
- End If
- Me.checkMenu()
- Me.mMenu.menuTick()
- If Not Me.bEnabled Then
- Return
- End If
- Me.reloadTargets()
- If (Me.canStealVeh AndAlso THelper.isButtonJustPressed(controls.INPUT_ENTER)) Then
- Me.stealVeh()
- End If
- If ((Me.tmpTimeCounter Mod 500) = 0) Then
- Dim ped As Ped
- For Each ped In Me.reloadTargetPedAux
- Try
- If (Not ped Is Game.Player.Character) Then
- ped.Health = -1
- ped.IsVisible = False
- End If
- Catch exception1 As Exception
- ProjectData.SetProjectError(exception1)
- ProjectData.ClearProjectError()
- End Try
- Next
- End If
- If THelper.Exists(Me.vehOnFoot) Then
- If ((Me.tmpTimeCounter Mod 100) = 0) Then
- If ((Not Me.attachedToVehicle AndAlso Not Me.vehOnFoot.IsTouching(Game.Player.Character)) AndAlso (DateAndTime.Now.Subtract(Me.timeSinceVehOnFootSet).TotalMilliseconds > 2000)) Then
- Me.vehOnFoot = Nothing
- Me.canStealVeh = False
- Else
- Dim pedOnSeat As Ped = Me.vehOnFoot.GetPedOnSeat(VehicleSeat.Driver)
- If Not THelper.Exists(pedOnSeat) Then
- Me.canStealVeh = True
- Else
- Dim offsetInWorldCoords As Vector3 = pedOnSeat.GetOffsetInWorldCoords(Vector3.Zero)
- Me.canStealVeh = (Me.attachedToVehicle OrElse (Not Me.vehOnFoot.Model.IsTrain AndAlso (THelper.getDistance2D(offsetInWorldCoords, Game.Player.Character.Position) < 1)))
- If Me.canStealVeh Then
- UI.ShowSubtitle("Press Enter Vehicle button to steal the vehicle...", 150)
- End If
- End If
- End If
- End If
- ElseIf ((Me.tmpTimeCounter Mod 200) = 0) Then
- Me.canStealVeh = False
- End If
- Dim i As Integer = (JC2.listOfGasObjects.Count - 1)
- Do While (i >= 0)
- Try
- JC2.listOfGasObjects.Item(i).tick()
- Catch exception2 As Exception
- ProjectData.SetProjectError(exception2)
- ProjectData.ClearProjectError()
- End Try
- i = (i + -1)
- Loop
- Me.tmpTimeCounter = (Me.tmpTimeCounter + 10)
- If (Me.tmpTimeCounter > &H3E8) Then
- Me.tmpTimeCounter = 0
- End If
- If ((Me.tmpTimeCounter Mod 500) = 0) Then
- Me.findWindMill()
- End If
- Me.subTick()
- If (Game.Player.Character.Health <= 0) Then
- Me.cancelMoveToTarget()
- Me.cancelVehAttach()
- Me.clearLists()
- Return
- End If
- Dim num As Integer = -1
- If Me.bPushPlayerUp Then
- num = Native.Function.Call(Of Integer)(Hash.GET_PED_PARACHUTE_STATE, New InputArgument() {Game.Player.Character})
- Dim totalMilliseconds As Double = DateAndTime.Now.Subtract(Me.timerPushingPlayerUp).TotalMilliseconds
- Dim direction As Vector3 = DirectCast(THelper.RotationToDirection(GameplayCamera.Rotation), Vector3)
- direction.Z = 0.0!
- If Not THelper.Exists(Me.playerParachute) Then
- Dim vector3 As Vector3 = Game.Player.Character.Position
- Dim num4 As Integer = Native.Function.Call(Of Integer)(Hash.GET_HASH_KEY, New InputArgument() {"p_parachute1_sp_s"})
- Me.playerParachute = Native.Function.Call(Of Prop)(Hash.GET_CLOSEST_OBJECT_OF_TYPE, New InputArgument() {vector3.X, vector3.Y, vector3.Z, 5, num4, 0, 0, 1})
- Me.inititalParachutePush = True
- End If
- If (totalMilliseconds < 3000) Then
- If (((num = 1) AndAlso Me.inititalParachutePush) AndAlso THelper.Exists(Me.playerParachute)) Then
- velocity = Me.playerParachute.Velocity
- Me.inititalParachutePush = (velocity.Z < 1.0!)
- Dim playerParachute As Prop = Me.playerParachute
- playerParachute.Velocity = (playerParachute.Velocity + DirectCast((Vector3.WorldUp * 10.0!), Vector3))
- End If
- If (num = 1) Then
- velocity = Game.Player.Character.Velocity
- If (velocity.Length < (Me.chuteSpeed * 0.4)) Then
- Game.Player.Character.ApplyForce(direction)
- End If
- End If
- Else
- Me.bPushPlayerUp = False
- End If
- End If
- If THelper.Exists(Me.playerParachute) Then
- If (Not Game.IsKeyPressed(Keys.W) AndAlso (Me.playerParachute.Velocity.Z < -2.5)) Then
- Me.playerParachute.ApplyForce(Vector3.WorldUp)
- End If
- velocity = Me.playerParachute.Velocity
- If ((velocity.Length < (Me.chuteSpeed * 0.4)) AndAlso Not Game.IsKeyPressed(Keys.S)) Then
- Me.playerParachute.ApplyForce(DirectCast(THelper.RotationToDirection(Me.playerParachute.Rotation), Vector3))
- End If
- Else
- Me.playerParachute = Nothing
- End If
- If Me.attachedToVehicle Then
- Try
- If Game.IsKeyPressed(Me.hkReleaseHookInVeh) Then
- Me.cancelVehAttach()
- ElseIf (THelper.Exists(Me.moveToTarget_TargetVeh) AndAlso Me.moveToTarget_TargetVeh.Model.IsHelicopter) Then
- velocity = New Vector3(0.0!, 0.0!, -2.0!)
- Dim vector4 As Vector3 = Me.moveToTarget_TargetVeh.GetOffsetInWorldCoords(velocity)
- velocity = New Vector3(0.0!, 0.0!, -2.0!)
- Dim vector5 As Vector3 = Me.moveToTarget_TargetVeh.GetOffsetInWorldCoords(velocity)
- If THelper.Exists(Me.handObject) Then
- Me.handObject.Velocity = DirectCast(((vector4 - Me.handObject.Position) * 4.0!), Vector3)
- End If
- If ((Me.tmpTimeCounter Mod 100) = 0) Then
- End If
- End If
- Return
- Catch exception3 As Exception
- ProjectData.SetProjectError(exception3)
- Dim exception As Exception = exception3
- Me.cancelVehAttach()
- ProjectData.ClearProjectError()
- Return
- End Try
- End If
- If ((THelper.Exists(Me.entityBullet) AndAlso (World.GetDistance(Me.entityBullet.Position, GameplayCamera.Position) < 200.0!)) AndAlso (THelper.isPed(Me.entityBullet) AndAlso Not Native.Function.Call(Of Boolean)(Hash.IS_PED_RAGDOLL, New InputArgument() {Me.entityBullet}))) Then
- Native.Function.Call(Hash.SET_PED_CAN_RAGDOLL, New InputArgument() {Me.entityBullet, 1})
- Native.Function.Call(Hash.SET_PED_TO_RAGDOLL, New InputArgument() {Me.entityBullet, &H1388, &H1388, 0, 0, 0})
- Native.Function.Call(Hash.SET_PED_DIES_WHEN_INJURED, New InputArgument() {Me.entityBullet, 0})
- Native.Function.Call(Hash.SET_PED_GENERATES_DEAD_BODY_EVENTS, New InputArgument() {Me.entityBullet, 0})
- End If
- If ((THelper.Exists(Me.entityTarget) AndAlso (World.GetDistance(Me.entityTarget.Position, GameplayCamera.Position) < 200.0!)) AndAlso (THelper.isPed(Me.entityTarget) AndAlso Not Native.Function.Call(Of Boolean)(Hash.IS_PED_RAGDOLL, New InputArgument() {Me.entityTarget}))) Then
- Native.Function.Call(Hash.SET_PED_CAN_RAGDOLL, New InputArgument() {Me.entityTarget, 1})
- Native.Function.Call(Hash.SET_PED_TO_RAGDOLL, New InputArgument() {Me.entityTarget, &H1388, &H1388, 0, 0, 0})
- Native.Function.Call(Hash.SET_PED_DIES_WHEN_INJURED, New InputArgument() {Me.entityTarget, 0})
- Native.Function.Call(Hash.SET_PED_GENERATES_DEAD_BODY_EVENTS, New InputArgument() {Me.entityTarget, 0})
- End If
- If Not Me.movingToTarget Then
- GoTo Label_0DFF
- End If
- If Game.Player.IsAiming Then
- If (((Me.tmpTimeCounter Mod 50) = 0) AndAlso THelper.Exists(Me.entityBullet)) Then
- Me.resetRopeLenght(Me.entityBullet)
- End If
- GoTo Label_0DFF
- End If
- If Game.Player.Character.IsRagdoll Then
- Me.cancelMoveToTarget()
- Return
- End If
- If Not THelper.Exists(Me.entityBullet) Then
- Me.moveToTarget(Nothing, Me.lastImpactCoord)
- GoTo Label_0DBE
- End If
- If Not THelper.isPed(Me.entityBullet) Then
- If THelper.isObject(Me.entityBullet) Then
- Me.entityBullet.ApplyForce(DirectCast(((Game.Player.Character.Position - Me.entityBullet.Position) * 0.7!), Vector3), (Vector3.WorldNorth + Vector3.WorldEast))
- End If
- Me.moveToTarget(Me.entityBullet, vector8)
- GoTo Label_0DBE
- End If
- If THelper.Exists(Game.Player.Character.CurrentVehicle) Then
- Dim currentVehicle As Vehicle = Game.Player.Character.CurrentVehicle
- Me.cancelMoveToTarget()
- Dim pDist As Double = Me.entityBullet.Position.DistanceTo(currentVehicle.Position)
- Dim rope2 As Rope = JC2.createRope(currentVehicle, Me.entityBullet, 1, 0)
- JC2.attachEntitiesToRope(rope2, Me.entityBullet, currentVehicle, 1, 0, vector8, vector8)
- Dim rope As New TEntityInRope(Me.entityBullet, currentVehicle, rope2, pDist, Vector3.Zero, Vector3.Zero)
- If THelper.isObject(Me.entityBullet) Then
- Me.entityBullet.ApplyForce((Game.Player.Character.CurrentVehicle.Position - Me.entityBullet.Position))
- End If
- Me.entityBullet = Nothing
- GoTo Label_0DBE
- End If
- Dim now As DateTime = DateAndTime.Now
- If Not THelper.isPed(Me.entityBullet) Then
- GoTo Label_0B35
- End If
- Label_0AE1:
- If (Not Native.Function.Call(Of Boolean)(Hash.IS_PED_RAGDOLL, New InputArgument() {Me.entityBullet}) And (DateAndTime.Now.Subtract(now).TotalMilliseconds < 1000)) Then
- Native.Function.Call(Hash.SET_PED_CAN_RAGDOLL, New InputArgument() {Me.entityBullet, 1})
- Native.Function.Call(Hash.SET_PED_TO_RAGDOLL, New InputArgument() {Me.entityBullet, &HBB8, &HBB8, 0, 0, 0})
- GoTo Label_0AE1
- End If
- Label_0B35:
- If THelper.anim_requestDict(Me.sDictPull) Then
- Game.Player.Character.Task.ClearAllImmediately()
- THelper.anim_playPedAnim(Game.Player.Character, Me.sDictPull, Me.sAnimPull, 8, animFlags.normal, False)
- Script.Wait(100)
- If THelper.anim_isPlayingPedAnim(Game.Player.Character, Me.sDictPull, Me.sAnimPull, 1) Then
- THelper.anim_setAnimTime(Game.Player.Character, Me.sDictPull, Me.sAnimPull, 0.01)
- THelper.anim_setAnimSpeed(Game.Player.Character, Me.sDictPull, Me.sAnimPull, 4)
- End If
- End If
- Do While THelper.anim_isPlayingPedAnim(Game.Player.Character, Me.sDictPull, Me.sAnimPull, 0.05)
- Script.Wait(10)
- Loop
- Me.cancelMoveToTarget()
- GameplayCamera.Shake(CameraShake.SmallExplosion, 0.1!)
- Dim num6 As Double = Math.Min(15.0!, Math.Max(10.0!, Me.entityBullet.Position.DistanceTo(Game.Player.Character.Position)))
- Dim position As Vector3 = (Game.Player.Character.Position + DirectCast((Vector3.WorldUp * CSng(num6)), Vector3))
- Dim vector6 As Vector3 = Me.entityBullet.Position
- Do While THelper.anim_isPlayingPedAnim(Game.Player.Character, Me.sDictPull, Me.sAnimPull, 0.085)
- If (THelper.Exists(Me.entityBullet) AndAlso (Me.entityBullet.Position.DistanceTo(position) > 2.0!)) Then
- Me.entityBullet.ApplyForce(DirectCast(((Vector3.Normalize((position - vector6)) * CSng(num6)) * 0.1!), Vector3), Vector3.WorldNorth)
- End If
- Script.Wait(10)
- Loop
- GameplayCamera.StopShaking()
- Game.Player.Character.Task.ClearAnimation(Me.sDictPull, Me.sAnimPull)
- Label_0DBE:
- Me.entityBullet = Nothing
- Me.entityTarget = Nothing
- Me.lastImpactCoord = New Vector3
- Label_0DFF:
- Me.entitiesSubTick()
- Me.hookCreationTick()
- End Sub
- <DllImport("user32", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)> _
- Private Shared Function GetAsyncKeyState(ByVal vkey As Integer) As Short
- End Function
- Private Sub hideHandObject()
- If THelper.Exists(Me.handObject) Then
- Me.handObject.Detach()
- Me.handObject.Delete()
- Me.handObject = Nothing
- End If
- End Sub
- Part 2 of script.
- Private Sub hookCreationTick()
- Try
- Dim position As Vector3
- Dim currentVehicle As Entity
- Dim prop As Prop
- Dim zero As Vector3
- Dim vector3 As Vector3
- Dim flag As Boolean
- Dim vector7 As Vector3
- Dim vector8 As Vector3
- Dim vector9 As Vector3
- If Not Me.bHookMode Then
- Return
- End If
- Select Case CLng(CULng(Game.Player.Character.Weapons.Current.Hash))
- Case &HA2719263, &H787F0BB, &H24B17070, &HFDBC8A50, &H958A4A8F, &H2C3731D9, &HAB564B93, &H34A67B97, &H678B81B1, &H99B507EA, &H4E875F73, &HF9DCBF2D, &H440E4788, &H60EC506, &H7F7497E5, &H92A27487, &H84BD7BFD, &HA0973D5E, &H93E220BD
- Return
- Case Else
- Dim argument As New OutputArgument
- flag = False
- If Game.Player.Character.IsShooting Then
- Me.timerSinceLastShoot = DateAndTime.Now
- Me.bShootDetected = True
- End If
- zero = Vector3.Zero
- prop = Nothing
- currentVehicle = Nothing
- vector3 = Vector3.Zero
- position = Vector3.Zero
- Dim objectValue As Object = RuntimeHelpers.GetObjectValue(THelper.RotationToDirection(GameplayCamera.Rotation))
- If Native.Function.Call(Of Boolean)(Hash.GET_PED_LAST_WEAPON_IMPACT_COORD, New InputArgument() {Game.Player.Character, argument}) Then
- position = (argument.GetResult(Of Vector3)() + DirectCast(objectValue, Vector3))
- argument.Dispose()
- If Not THelper.Exists(currentVehicle) Then
- currentVehicle = Me.findTarget(position, vector3)
- End If
- If Not THelper.Exists(currentVehicle) Then
- currentVehicle = Me.findObject(position)
- End If
- If (Not THelper.Exists(currentVehicle) AndAlso Me.waitForShootDetect) Then
- Me.waitForShootDetect = False
- Dim vector4 As Vector3 = DirectCast(THelper.RotationToDirection(GameplayCamera.Rotation), Vector3)
- Dim vector5 As Vector3 = (GameplayCamera.Position + DirectCast((vector4 * 10.0!), Vector3))
- Dim vector6 As Vector3 = (vector5 + DirectCast((vector4 * 500.0!), Vector3))
- Dim hash As Integer = CInt(Game.Player.Character.Weapons.Current.Hash)
- Native.Function.Call(Hash.SHOOT_SINGLE_BULLET_BETWEEN_COORDS, New InputArgument() {vector5.X, vector5.Y, vector5.Z, vector6.X, vector6.Y, vector6.Z, 0, 1, hash, Game.Player.Character, 1, 1, 0})
- Return
- End If
- flag = THelper.Exists(currentVehicle)
- Me.waitForShootDetect = True
- End If
- If ((Not Me.waitForShootDetect OrElse flag) OrElse ((DateAndTime.Now.Subtract(Me.timerSinceLastShoot).TotalMilliseconds >= 500) OrElse Not Me.bShootDetected)) Then
- GoTo Label_0510
- End If
- Dim span2 As New TimeSpan(1, 1, 1)
- Me.timerSinceLastShoot = DateAndTime.Now.Subtract(span2)
- Me.bShootDetected = False
- currentVehicle = Me.findTarget(Game.Player.Character.Position, vector3)
- If THelper.Exists(currentVehicle) Then
- GoTo Label_050D
- End If
- vector7 = DirectCast(THelper.RotationToDirection(GameplayCamera.Rotation), Vector3)
- vector8 = (GameplayCamera.Position + vector7)
- Dim num3 As Short = 0
- Do
- prop = THelper.getTargetedDistProp((vector8 + (vector7 * num3)), (vector8 + (vector7 * (num3 + 100))), 101)
- If THelper.Exists(prop) Then
- Exit Do
- End If
- num3 = CShort((num3 + 100))
- Loop While (num3 <= &H7D0)
- Exit Select
- End Select
- If Not THelper.Exists(prop) Then
- Dim num4 As Short = 0
- Do
- zero = THelper.getTargetedCoord((vector8 + (vector7 * num4)), (vector8 + (vector7 * (num4 + 100))), 101)
- If (zero <> Vector3.Zero) Then
- Exit Do
- End If
- num4 = CShort((num4 + 100))
- Loop While (num4 <= 500)
- End If
- flag = ((zero <> Vector3.Zero) OrElse THelper.Exists(prop))
- GoTo Label_0510
- Label_050D:
- flag = True
- Label_0510:
- If (flag AndAlso (DateAndTime.Now.Subtract(Me.timerWaitAttachAgain).TotalMilliseconds > 500)) Then
- Me.timerWaitAttachAgain = DateAndTime.Now
- Else
- Return
- End If
- If (zero <> Vector3.Zero) Then
- position = zero
- ElseIf THelper.Exists(prop) Then
- position = prop.Position
- Try
- currentVehicle = prop
- Catch exception1 As Exception
- ProjectData.SetProjectError(exception1)
- ProjectData.ClearProjectError()
- End Try
- End If
- If (Not Me.bDisableWindMill AndAlso THelper.Exists(currentVehicle)) Then
- If ((Not currentVehicle Is Me.actualWindmill) AndAlso (currentVehicle.Model.Hash = JC2.windMillHash)) Then
- Me.actualWindmill = DirectCast(currentVehicle, Prop)
- Me.prepareWindMill(currentVehicle)
- End If
- Dim e As Prop = Native.Function.Call(Of Prop)(Hash.GET_CLOSEST_OBJECT_OF_TYPE, New InputArgument() {position.X, position.Y, position.Z, (JC2.windMillPipeSize.Y * 5.0!), JC2.windMillPipeHash, 0, 0, 0})
- If ((THelper.Exists(e) AndAlso e.IsAttached) AndAlso Not e.IsVisible) Then
- currentVehicle = e
- ElseIf (currentVehicle.Model.Hash = JC2.windMillHash) Then
- currentVehicle = Nothing
- Return
- End If
- End If
- Me.timeOut = DateAndTime.Now
- If ((THelper.Exists(Game.Player.Character.CurrentVehicle) AndAlso THelper.Exists(currentVehicle)) AndAlso (Not THelper.isVehicle(currentVehicle) AndAlso THelper.Exists(Me.entityBullet))) Then
- Me.entityBullet = Game.Player.Character.CurrentVehicle
- Me.entityTarget = Nothing
- End If
- If THelper.Exists(currentVehicle) Then
- Me.timeOut = DateAndTime.Now
- If (Me.movingToTarget AndAlso Not THelper.Exists(Me.entityBullet)) Then
- Me.entityBullet = currentVehicle
- Me.moveDir = Vector3.Normalize((Me.lastImpactCoord - Me.entityBullet.Position))
- Me.cancelMoveToTarget()
- Me.bPinFromGround = True
- Dim rope As Rope = Me.pinEntityToCoord(Me.lastImpactCoord, Me.entityBullet, Nothing, 0, vector9)
- currentVehicle = Nothing
- Me.entityBullet = Nothing
- Me.entityTarget = Nothing
- Me.lastImpactCoord = New Vector3
- Else
- If THelper.isPed(currentVehicle) Then
- Dim ped As Ped = DirectCast(currentVehicle, Ped)
- If THelper.Exists(ped.CurrentVehicle) Then
- currentVehicle = ped.CurrentVehicle
- End If
- End If
- If Not THelper.Exists(Me.entityBullet) Then
- If (Not currentVehicle Is Me.entityBullet) Then
- Me.entityBullet = currentVehicle
- Me.entityTarget = Nothing
- Me.entityBulletOffset = vector3
- Me.lastImpactCoord = New Vector3
- Dim forcedPos As Vector3 = vector9
- Me.attachToTarget(Me.entityBullet, forcedPos)
- End If
- Else
- Me.entityTarget = currentVehicle
- Me.entityTargetOffset = vector3
- Me.cancelMoveToTarget()
- Me.moveDir = Vector3.Normalize((Me.entityTarget.Position - Me.entityBullet.Position))
- Dim distance As Double = World.GetDistance(Me.entityTarget.Position, Me.entityBullet.Position)
- Dim rope2 As Rope = JC2.createRope(Me.entityBullet, Me.entityTarget, 1, distance)
- If ((Not Me.entityBullet Is Me.entityTarget) AndAlso Not Me.entitiesLinked(Me.entityBullet, Me.entityTarget)) Then
- If (THelper.isObject(Me.entityBullet) AndAlso (Me.entityBullet.Velocity.Length < 0.05)) Then
- Me.entityBullet.FreezePosition = False
- Me.entityBullet.ApplyForce((Me.entityTarget.Position - Me.entityBullet.Position), (Vector3.WorldNorth + Vector3.WorldEast))
- End If
- If (THelper.isObject(Me.entityTarget) AndAlso (Me.entityTarget.Velocity.Length < 0.05)) Then
- Me.entityTarget.FreezePosition = False
- Me.entityTarget.ApplyForce((Me.entityBullet.Position - Me.entityTarget.Position), (Vector3.WorldNorth + Vector3.WorldEast))
- End If
- If (THelper.isPed(Me.entityBullet) OrElse THelper.isObject(Me.entityBullet)) Then
- JC2.attachEntitiesToRope(rope2, Me.entityBullet, Me.entityTarget, 1, 0, Me.entityTargetOffset, Me.entityBulletOffset)
- Else
- JC2.attachEntitiesToRope(rope2, Me.entityTarget, Me.entityBullet, 1, 0, Me.entityTargetOffset, Me.entityBulletOffset)
- End If
- Else
- Me.entityTarget = Nothing
- Me.entityBullet = Nothing
- Me.lastImpactCoord = New Vector3
- Return
- End If
- If (THelper.isPed(Me.entityBullet) OrElse THelper.isObject(Me.entityBullet)) Then
- Me.entityBullet.ApplyForce(DirectCast((Me.moveDir * CSng(distance)), Vector3))
- End If
- Dim rope3 As New TEntityInRope(Me.entityBullet, Me.entityTarget, rope2, distance, Me.entityTargetOffset, Me.entityBulletOffset)
- If (THelper.isPed(Me.entityTarget) OrElse THelper.isObject(Me.entityTarget)) Then
- Me.entityTarget.ApplyForce(DirectCast(((Me.moveDir * CSng(distance)) * -1.0!), Vector3))
- End If
- Me.entityTarget = Nothing
- Me.entityBullet = Nothing
- Me.lastImpactCoord = New Vector3
- End If
- End If
- Else
- Me.lastImpactCoord = position
- If Not THelper.Exists(Me.entityBullet) Then
- If Me.movingToTarget Then
- Me.lastImpactCoord = New Vector3
- Me.cancelMoveToTarget()
- Else
- Me.attachToTarget(Nothing, Me.lastImpactCoord)
- End If
- Me.entityBullet = Nothing
- Me.entityTarget = Nothing
- Else
- Me.moveDir = Vector3.Normalize((Me.lastImpactCoord - Me.entityBullet.Position))
- Me.cancelMoveToTarget()
- Dim rope4 As Rope = Me.pinEntityToCoord(Me.lastImpactCoord, Me.entityBullet, Nothing, 0, vector9)
- Me.entityBullet = Nothing
- Me.entityTarget = Nothing
- Me.lastImpactCoord = New Vector3
- End If
- End If
- Catch exception2 As Exception
- ProjectData.SetProjectError(exception2)
- Dim exception As Exception = exception2
- UI.ShowSubtitle(("Hook creation error: " & exception.Message))
- Me.cancelMoveToTarget()
- Me.entityBullet = Nothing
- Me.entityTarget = Nothing
- Me.lastImpactCoord = New Vector3
- ProjectData.ClearProjectError()
- End Try
- End Sub
- Private Sub keyDown(ByVal sender As Object, ByVal e As KeyEventArgs)
- If ((e.KeyCode = Me.hkShowMenu) AndAlso ((Me.hkShowMenuKeyTwo = Keys.None) OrElse THelper._iskeyPressed(Me.hkShowMenuKeyTwo))) Then
- Me.mMenu.closeMenu()
- End If
- If (Me.mMenu.keyDown(e.KeyCode) = menuResult.selectItem) Then
- If (Me.mMenu.selectedItem.name = "bEnabled") Then
- Me.toggleMod()
- ElseIf (Me.mMenu.selectedItem.name = "bHookMode") Then
- Me.toggleHookMode()
- ElseIf (Me.mMenu.selectedItem.name = "bUseRagdoll") Then
- Me.bUseRagdoll = Not Me.bUseRagdoll
- Me.iniFile.WriteINIBool("v2_bUseRagdoll", "general", Me.bUseRagdoll)
- Me.mMenu.selectedItem.value = Conversions.ToString(Me.bUseRagdoll)
- ElseIf (Me.mMenu.selectedItem.name = "bDisableWindMill") Then
- Me.bDisableWindMill = Not Me.bDisableWindMill
- Me.iniFile.WriteINIBool("bDisableWindMill", "general", Me.bDisableWindMill)
- Me.mMenu.selectedItem.value = Conversions.ToString(Me.bDisableWindMill)
- End If
- End If
- If Me.bEnabled Then
- If (e.KeyCode = Me.hkToggleHookMode) Then
- Me.toggleHookMode()
- End If
- If ((e.KeyCode = Me.hkReleaseHookInVeh) AndAlso (JC2.entitiesInRope.Count > 0)) Then
- Dim rope As TEntityInRope = JC2.entitiesInRope.Item((JC2.entitiesInRope.Count - 1))
- Try
- Try
- If ((Not rope.p1 Is Game.Player.Character) AndAlso (Not rope.p1 Is Game.Player.Character.CurrentVehicle)) Then
- rope.p1.MarkAsNoLongerNeeded()
- End If
- Catch exception1 As Exception
- ProjectData.SetProjectError(exception1)
- ProjectData.ClearProjectError()
- End Try
- Try
- If ((Not rope.p2 Is Game.Player.Character) AndAlso (Not rope.p2 Is Game.Player.Character.CurrentVehicle)) Then
- rope.p2.MarkAsNoLongerNeeded()
- End If
- Catch exception2 As Exception
- ProjectData.SetProjectError(exception2)
- ProjectData.ClearProjectError()
- End Try
- JC2.entitiesInRope.Item((JC2.entitiesInRope.Count - 1)).rope.Delete()
- JC2.finishEntityInRope(JC2.entitiesInRope.Item((JC2.entitiesInRope.Count - 1)))
- Catch exception3 As Exception
- ProjectData.SetProjectError(exception3)
- ProjectData.ClearProjectError()
- End Try
- End If
- End If
- End Sub
- Private Sub keyUp(ByVal sender As Object, ByVal e As KeyEventArgs)
- End Sub
- Private Sub loadMod()
- If (DateAndTime.Now.Subtract(Me.timerWaitLoad).TotalMilliseconds > 200) Then
- Me.bLoaded = True
- JC2.TRandom = New Random(DateAndTime.Now.Millisecond)
- THelper.anim_requestDict(Me.sDict)
- THelper.anim_requestDict(Me.sDictJump)
- THelper.anim_requestDict(Me.sDictLand)
- THelper.anim_requestDict(Me.sDictPull)
- THelper.anim_requestDict(Me.sDictHang)
- THelper.anim_requestDict(Me.sDictStealVeh1)
- THelper.anim_requestDict(Me.sDictStealVeh1Heli)
- THelper.anim_requestDict(Me.sDictStealVeh2)
- THelper.anim_requestDict(Me.sDictStealVeh2b)
- Me.iniFile = New CustomIniFile("")
- Me.bEnabled = (Me.iniFile.settingsGetString("bEnabled", "general", "1", True) = "1")
- Me.bUseRagdoll = (Me.iniFile.settingsGetString("v2_bUseRagdoll", "general", "0", True) = "1")
- Me.bDisableWindMill = (Me.iniFile.settingsGetString("bDisableWindMill", "general", "0", True) = "1")
- Me.bHookMode = (Me.iniFile.settingsGetString("bHookMode", "general", "1", True) = "1")
- Me.hkToggleHookMode = Me.iniFile.settingsGetKey("hkToggleHookMode", "hotkeys", Me.hkToggleHookMode, True)
- Me.hkParachute = Me.iniFile.settingsGetKey("hkParachute", "hotkeys", Me.hkParachute, True)
- Me.hkReleaseHookInVeh = Me.iniFile.settingsGetKey("hkReleaseHookInVeh", "hotkeys", Me.hkReleaseHookInVeh, True)
- Dim writer As New StreamWriter((".\Scripts\" & THelper.getScriptname & ".nibmod"))
- writer.Write(Me.scriptDisplayName)
- writer.Close()
- writer.Dispose()
- Me.iniFileScripts = New CustomIniFile(".\scripts\NIBScripts.ini")
- Me.hkShowMenu = Me.iniFileScripts.settingsGetKey("hkShowMenu", "hotkeys", Me.hkShowMenu, True)
- Me.hkShowMenuKeyTwo = Me.iniFileScripts.settingsGetKey("hkShowMenuKeyTwo", "hotkeys", Me.hkShowMenuKeyTwo, True)
- Me.mMenu = New TMenu(Me.scriptDisplayName)
- Me.mMenu.addItem("bEnabled", "Enabled: ", Conversions.ToString(Me.bEnabled), -1)
- Me.mMenu.addItem("bHookMode", ("Hook mode (" & Me.hkToggleHookMode.ToString & "): "), Conversions.ToString(Me.bHookMode), -1)
- Me.mMenu.addItem("bUseRagdoll", "Use ragdoll when moving to target: ", Conversions.ToString(Me.bUseRagdoll), -1)
- Me.mMenu.addItem("bDisableWindMill", "Disable windmill feature: ", Conversions.ToString(Me.bDisableWindMill), -1)
- Me.mMenu.addItem("close", "Close", "", -1)
- Native.Function.Call(Hash.REQUEST_NAMED_PTFX_ASSET, New InputArgument() {"scr_exile2"})
- Me.loadWindMillModels()
- Me.hiddenPedModel = New Model(DirectCast(-1011537562, PedHash))
- Me.hiddenPedModel.Request()
- Script.Wait(200)
- Dim ped As Ped
- For Each ped In World.GetNearbyPeds(Game.Player.Character, 200.0!)
- Try
- If ((THelper.Exists(ped) AndAlso (ped.Model.Hash = Me.hiddenPedModel)) AndAlso Not ped.IsVisible) Then
- Dim ped2 As Ped
- For Each ped2 In World.GetNearbyPeds(ped, 200.0!)
- Try
- If ((THelper.Exists(ped2) AndAlso (ped2.Model.Hash = Me.hiddenPedModel)) AndAlso Not ped2.IsVisible) Then
- ped2.Detach()
- ped2.MarkAsNoLongerNeeded()
- ped2.Delete()
- End If
- Catch exception1 As Exception
- ProjectData.SetProjectError(exception1)
- ProjectData.ClearProjectError()
- End Try
- Next
- ped.Detach()
- ped.MarkAsNoLongerNeeded()
- ped.Delete()
- End If
- Catch exception2 As Exception
- ProjectData.SetProjectError(exception2)
- ProjectData.ClearProjectError()
- End Try
- Next
- THelper.enabledLog(False)
- End If
- End Sub
- Private Sub loadWindMillModels()
- Dim now As DateTime = DateAndTime.Now
- JC2.windMillPipeModelAux = New Model("prop_pipes_conc_01")
- JC2.windMillPipeModelAux.Request()
- Do While (Not JC2.windMillPipeModelAux.IsLoaded And (DateAndTime.Now.Subtract(now).TotalMilliseconds < 1000))
- Script.Wait(100)
- Loop
- If JC2.windMillPipeModelAux.IsLoaded Then
- JC2.windMillPipeHash = JC2.windMillPipeModelAux.Hash
- JC2.windMillPipeSize = JC2.windMillPipeModelAux.GetDimensions
- Else
- UI.ShowSubtitle("Error requesting windmill objects...", &H2710)
- End If
- JC2.windMillModelAux = New Model("prop_windmill_01")
- JC2.windMillModelAux.Request()
- now = DateAndTime.Now
- Do While (Not JC2.windMillModelAux.IsLoaded And (DateAndTime.Now.Subtract(now).TotalMilliseconds < 1000))
- Script.Wait(100)
- Loop
- If JC2.windMillModelAux.IsLoaded Then
- JC2.windMillHash = JC2.windMillModelAux.Hash
- Else
- UI.ShowSubtitle("Error requesting windmill model...", &H2710)
- End If
- End Sub
- Private Sub moveToTarget(ByVal eTarget As Entity, Optional ByVal forcedPos As Vector3 = New Vector3())
- Try
- Dim flag3 As Boolean
- Dim vector12 As Vector3
- Dim velocity As Vector3
- Dim character As Ped
- Me.lastImpactCoord = New Vector3
- Me.moveToTarget_TargetVeh = Nothing
- Me.cancelVehAttach()
- If ((Not THelper.Exists(eTarget) AndAlso (forcedPos = vector12)) OrElse (THelper.Exists(Game.Player.Character.CurrentVehicle) OrElse (Game.Player.Character.IsAttached AndAlso (Native.Function.Call(Of Integer)(Hash.GET_PED_PARACHUTE_STATE, New InputArgument() {Game.Player.Character}) Is -1)))) Then
- Me.cancelMoveToTarget()
- Return
- End If
- If ((THelper.Exists(eTarget) AndAlso (World.GetDistance(eTarget.Position, Game.Player.Character.Position) < 5.0!)) OrElse (World.GetDistance(forcedPos, Game.Player.Character.Position) < 5.0!)) Then
- Me.cancelMoveToTarget()
- Return
- End If
- Dim now As DateTime = DateAndTime.Now
- Dim e As Prop = Nothing
- If Me.bUseRagdoll Then
- e = Me.handObject
- End If
- Dim heading As Double = Game.Player.Character.Heading
- If ((Not Game.Player.Character.IsInAir OrElse Me.canStealVeh) AndAlso (Not Me.attachedToVehicle AndAlso THelper.anim_requestDict(Me.sDictJump))) Then
- THelper.anim_playPedAnim(Game.Player.Character, Me.sDictJump, Me.sAnimJump, 8, animFlags.normal, False)
- Script.Wait(100)
- THelper.anim_setAnimSpeed(Game.Player.Character, Me.sDictJump, Me.sAnimJump, 1.5)
- now = DateAndTime.Now
- Do While (THelper.anim_isPlayingPedAnim(Game.Player.Character, Me.sDictJump, Me.sAnimJump, 0.55) And (DateAndTime.Now.Subtract(now).TotalMilliseconds < 1000))
- Game.Player.Character.ApplyForce(Vector3.WorldUp)
- Script.Wait(10)
- Loop
- End If
- Game.Player.Character.IsVisible = True
- If (Game.Player.Character.IsRagdoll OrElse Game.Player.Character.IsInAir) Then
- Game.Player.Character.CanRagdoll = False
- Game.Player.Character.CanRagdoll = True
- Game.Player.Character.Task.ClearAllImmediately()
- End If
- Dim list As New List(Of Prop)
- Dim prop As Prop = Nothing
- Dim prop2 As Prop = Nothing
- Dim prop4 As Prop = Nothing
- If Me.bUseRagdoll Then
- prop = World.CreateProp(JC2.handObjectModel, (Game.Player.Character.Position + DirectCast((Vector3.WorldDown * 50.0!), Vector3)), True, False)
- prop2 = World.CreateProp(JC2.handObjectModel, (Game.Player.Character.Position + DirectCast((Vector3.WorldDown * 51.0!), Vector3)), True, False)
- prop4 = World.CreateProp(JC2.handObjectModel, (Game.Player.Character.Position + DirectCast((Vector3.WorldDown * 52.0!), Vector3)), True, False)
- End If
- If THelper.Exists(prop) Then
- list.Add(prop)
- prop.IsVisible = False
- End If
- If THelper.Exists(e) Then
- list.Add(e)
- e.IsVisible = False
- End If
- If THelper.Exists(prop2) Then
- list.Add(prop2)
- prop2.IsVisible = False
- End If
- If THelper.Exists(prop4) Then
- list.Add(prop4)
- prop4.IsVisible = False
- End If
- If (Not Me.bUseRagdoll AndAlso THelper.anim_requestDict(Me.sDictHang)) Then
- THelper.anim_playPedAnim(Game.Player.Character, Me.sDictHang, Me.sAnimHang, 6, animFlags.repeat, True)
- End If
- If THelper.Exists(prop) Then
- Dim prop5 As Prop
- For Each prop5 In list
- Try
- prop5.IsVisible = False
- Native.Function.Call(Hash.SET_ENTITY_COLLISION, New InputArgument() {prop5, 0, 0})
- Catch exception1 As Exception
- ProjectData.SetProjectError(exception1)
- ProjectData.ClearProjectError()
- End Try
- Next
- Game.Player.Character.CanRagdoll = True
- Native.Function.Call(Hash.SET_PED_TO_RAGDOLL, New InputArgument() {Game.Player.Character, -1, -1, 0, 0, 0})
- Script.Wait(200)
- prop.Position = Native.Function.Call(Of Vector3)(Hash.GET_PED_BONE_COORDS, New InputArgument() {Game.Player.Character, &H796E, 0, 0, 0})
- Native.Function.Call(Hash.ATTACH_ENTITY_TO_ENTITY_PHYSICALLY, New InputArgument() {prop, Game.Player.Character, 0, THelper.getPedBoneIndex(Game.Player.Character, &H796E), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0})
- If THelper.Exists(e) Then
- e.Detach()
- e.Position = Native.Function.Call(Of Vector3)(Hash.GET_PED_BONE_COORDS, New InputArgument() {Game.Player.Character, &H6F06, 0, 0, 0})
- Native.Function.Call(Hash.ATTACH_ENTITY_TO_ENTITY_PHYSICALLY, New InputArgument() {e, Game.Player.Character, 0, THelper.getPedBoneIndex(Game.Player.Character, &H6F06), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0})
- End If
- If THelper.Exists(prop2) Then
- prop2.Position = (Native.Function.Call(Of Vector3)(Hash.GET_PED_BONE_COORDS, New InputArgument() {Game.Player.Character, &HE175, 0, 0, 0}) + DirectCast((Vector3.WorldUp * 0.1!), Vector3))
- Native.Function.Call(Hash.ATTACH_ENTITY_TO_ENTITY_PHYSICALLY, New InputArgument() {prop2, Game.Player.Character, 0, THelper.getPedBoneIndex(Game.Player.Character, &HE175), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0})
- End If
- If THelper.Exists(prop4) Then
- prop4.Position = (Native.Function.Call(Of Vector3)(Hash.GET_PED_BONE_COORDS, New InputArgument() {Game.Player.Character, &H60E6, 0, 0, 0}) + DirectCast((Vector3.WorldUp * 0.1!), Vector3))
- Native.Function.Call(Hash.ATTACH_ENTITY_TO_ENTITY_PHYSICALLY, New InputArgument() {prop4, Game.Player.Character, 0, THelper.getPedBoneIndex(Game.Player.Character, &H60E6), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0})
- End If
- End If
- If THelper.Exists(eTarget) Then
- forcedPos = eTarget.Position
- End If
- Dim dir As Vector3 = Vector3.Normalize((forcedPos - Game.Player.Character.Position))
- Dim destination As Vector3 = (forcedPos + dir)
- Dim distance As Double = World.GetDistance(Game.Player.Character.Position, forcedPos)
- Dim num4 As Double = World.GetDistance(Game.Player.Character.Position, destination)
- Game.Player.Character.CanRagdoll = True
- THelper.setEntityProofs(Game.Player.Character, False, False, False, True, True, False, False, False)
- Native.Function.Call(Hash.SET_ENTITY_RECORDS_COLLISIONS, New InputArgument() {Game.Player.Character, 0})
- Native.Function.Call(Hash.SET_ENTITY_RECORDS_COLLISIONS, New InputArgument() {Game.Player.Character, 1})
- If (Not Me.bUseRagdoll AndAlso THelper.Exists(Me.handObject)) Then
- Native.Function.Call(Hash.SET_ENTITY_RECORDS_COLLISIONS, New InputArgument() {Me.handObject, 0})
- Native.Function.Call(Hash.SET_ENTITY_RECORDS_COLLISIONS, New InputArgument() {Me.handObject, 1})
- End If
- If Not Me.bUseRagdoll Then
- Me.handObject.Detach()
- Dim rotation As Vector3 = Game.Player.Character.Rotation
- rotation.X = (rotation.X + 90.0!)
- Me.handObject.Rotation = rotation
- Dim position As New Vector3(0.1!, 0.11!, -1.2!)
- Game.Player.Character.AttachTo(Me.handObject, 0, position, Vector3.Zero)
- Native.Function.Call(Hash.HIDE_PED_WEAPON_FOR_SCRIPTED_CUTSCENE, New InputArgument() {Game.Player.Character, 1})
- End If
- Dim flag As Boolean = False
- now = DateAndTime.Now
- Dim num2 As Integer = 0
- If THelper.Exists(e) Then
- e.Velocity = DirectCast((dir * 10.0!), Vector3)
- End If
- Dim flag2 As Boolean = ((THelper.Exists(eTarget) AndAlso THelper.isVehicle(eTarget)) AndAlso eTarget.Model.IsHelicopter)
- Dim zero As Vector3 = Vector3.Zero
- Dim num3 As Double = 0.5
- If THelper.Exists(eTarget) Then
- num3 = 1.5
- Dim z As Double = eTarget.Model.GetDimensions.Z
- If flag2 Then
- num3 = 3
- z = (z * 1.5)
- ElseIf (z > 2) Then
- z = (z * 0.85)
- Else
- z = (z * 1.5)
- End If
- If flag2 Then
- velocity = THelper.getGroundPos(eTarget.Position)
- If ((eTarget.Position.Z - velocity.Z) > 2.0!) Then
- zero = DirectCast((Vector3.WorldDown * CSng(z)), Vector3)
- GoTo Label_0E9D
- End If
- End If
- If Not flag2 Then
- If eTarget.Model.IsPlane Then
- zero = DirectCast(((Vector3.WorldUp * CSng(z)) * 0.6!), Vector3)
- ElseIf (((eTarget.Model.IsBicycle OrElse eTarget.Model.IsBike) OrElse ((eTarget.Model.Hash = &H8125BCF9) OrElse (eTarget.Model.Hash = &HFD231729))) OrElse ((eTarget.Model.Hash = &HB44F0582) OrElse (eTarget.Model.Hash = &HDFF0594C))) Then
- zero = DirectCast(((Vector3.WorldUp * CSng(z)) * 0.5!), Vector3)
- Else
- zero = DirectCast((Vector3.WorldUp * CSng(z)), Vector3)
- End If
- Else
- flag2 = False
- End If
- End If
- Label_0E9D:
- flag3 = False
- Dim num10 As Double = 0
- Dim num11 As Double = 1
- Dim num9 As Double = 1
- If (Me.moveSoundID = -1) Then
- Me.moveSoundID = Native.Function.Call(Of Integer)(Hash.GET_SOUND_ID, New InputArgument(0 - 1) {})
- End If
- If (Me.moveSoundID > -1) Then
- Native.Function.Call(Hash.PLAY_SOUND_FROM_ENTITY, New InputArgument() {Me.moveSoundID, "helicopter_wind_idle", Game.Player.Character, "basejumps_sounds", 0, 0})
- End If
- GameplayCamera.Shake(CameraShake.SkyDiving, 2.0!)
- Dim num8 As Double = 0
- Dim num As Short = 0
- If Not Me.bUseRagdoll Then
- If THelper.Exists(Me.handObject) Then
- Me.handObject.IsVisible = False
- End If
- Game.Player.Character.IsVisible = False
- Game.Player.Character.IsVisible = True
- End If
- Try
- Do While (((distance > num3) AndAlso (distance < num4)) AndAlso (Game.Player.Character.Health > 0))
- Dim vector3 As Vector3
- Dim flag4 As Boolean = False
- velocity = Game.Player.Character.Velocity
- num8 = velocity.Length
- If (Not Me.bUseRagdoll AndAlso THelper.Exists(Me.handObject)) Then
- velocity = Me.handObject.Velocity
- num8 = velocity.Length
- End If
- If ((DateAndTime.Now.Subtract(now).TotalMilliseconds > 5000) AndAlso (num8 < 10)) Then
- GoTo Label_18DA
- End If
- If THelper.Exists(eTarget) Then
- If Not Me.bUseRagdoll Then
- If (eTarget.Model.IsPlane OrElse eTarget.Model.IsHelicopter) Then
- velocity = eTarget.Velocity
- num9 = Math.Min(3, Math.Max(CDbl(1), CDbl((Math.Max((velocity.Length * 0.7), distance) * 0.05))))
- Else
- num9 = Math.Min(3, Math.Max(CDbl(1), CDbl((distance * 0.05))))
- End If
- If THelper.Exists(Me.handObject) Then
- Native.Function.Call(Hash.SET_ENTITY_MAX_SPEED, New InputArgument() {Me.handObject, (distance * num9)})
- End If
- Else
- velocity = eTarget.Velocity
- num9 = Math.Max((num9 * 0.8), Math.Min(1.2, Math.Max(CDbl((velocity.Length * 0.1)), CDbl(1))))
- End If
- ElseIf Not Me.bUseRagdoll Then
- num9 = Math.Max((num9 * 0.8), Math.Min(3, Math.Max(CDbl(1), CDbl((distance * 0.05)))))
- If THelper.Exists(Me.handObject) Then
- Native.Function.Call(Hash.SET_ENTITY_MAX_SPEED, New InputArgument() {Me.handObject, (distance * num9)})
- End If
- Else
- num9 = 1
- End If
- If (Me.bUseRagdoll AndAlso THelper.Exists(prop)) Then
- prop.Velocity = DirectCast(((dir * 45.0!) * CSng(num9)), Vector3)
- flag4 = True
- Dim vector6 As Vector3 = Game.Player.Character.Rotation
- vector6.Y = CSng(num10)
- vector6.X = (vector6.X + CSng((num10 * 0.1)))
- vector6.Z = (vector6.Z + CSng((num10 * 0.1)))
- num10 = (num10 + (num11 * 0.25))
- If (num10 > 5) Then
- num11 = -1
- ElseIf (num10 < -5) Then
- num11 = 1
- End If
- Game.Player.Character.Rotation = vector6
- Dim prop6 As Prop
- For Each prop6 In list
- Try
- If (prop6 Is e) Then
- velocity = prop6.Velocity
- If (velocity.Length < (prop.Velocity.Length * 0.9)) Then
- prop6.ApplyForce(DirectCast(((dir * 10.0!) * CSng(num9)), Vector3))
- Else
- prop6.Velocity = prop.Velocity
- End If
- ElseIf (prop6 Is prop2) Then
- Dim vector7 As Vector3 = Native.Function.Call(Of Vector3)(Hash.GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS, New InputArgument() {Game.Player.Character, -1, 0, 0})
- prop6.ApplyForce((((DirectCast(((dir * CSng(num9)) * -2.0!), Vector3) + vector7) - prop6.Position) + Vector3.WorldUp))
- ElseIf (prop6 Is prop4) Then
- Dim vector8 As Vector3 = Native.Function.Call(Of Vector3)(Hash.GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS, New InputArgument() {Game.Player.Character, 1, 0, 0})
- prop6.ApplyForce((((DirectCast(((dir * CSng(num9)) * -2.0!), Vector3) + vector8) - prop6.Position) + Vector3.WorldUp))
- End If
- Catch exception3 As Exception
- ProjectData.SetProjectError(exception3)
- ProjectData.ClearProjectError()
- End Try
- Next
- Else
- Dim vector10 As Vector3 = THelper.directionToRotation(dir, 0)
- vector10.X = (vector10.X - 90.0!)
- vector10.Z = (vector10.Z - 10.0!)
- Dim vector9 As Vector3 = Me.handObject.Rotation
- vector9.X = (vector9.X + CSng(((vector10.X - vector9.X) * 0.05)))
- vector9.Z = vector10.Z
- Me.handObject.Rotation = vector10
- Me.handObject.Velocity = DirectCast(((dir * 45.0!) * CSng(num9)), Vector3)
- End If
- If Not flag4 Then
- Game.Player.Character.Velocity = DirectCast(((dir * 35.0!) * CSng(num9)), Vector3)
- End If
- If THelper.Exists(eTarget) Then
- vector3 = (eTarget.Position + zero)
- dir = Vector3.Normalize((vector3 - Game.Player.Character.Position))
- heading = THelper.directionToHeading(dir)
- If Not Game.Player.Character.IsTouching(eTarget) Then
- GoTo Label_1609
- End If
- GoTo Label_18DA
- End If
- If (forcedPos <> vector12) Then
- vector3 = forcedPos
- End If
- Label_1609:
- destination = (vector3 + dir)
- distance = World.GetDistance(Game.Player.Character.Position, vector3)
- num4 = World.GetDistance(Game.Player.Character.Position, destination)
- flag = (((num8 < 10) OrElse Native.Function.Call(Of Boolean)(Hash.HAS_ENTITY_COLLIDED_WITH_ANYTHING, New InputArgument() {Game.Player.Character})) OrElse ((Not Me.bUseRagdoll AndAlso THelper.Exists(Me.handObject)) AndAlso Native.Function.Call(Of Boolean)(Hash.HAS_ENTITY_COLLIDED_WITH_ANYTHING, New InputArgument() {Me.handObject})))
- If flag Then
- num = CShort((num + 1))
- End If
- If flag Then
- Native.Function.Call(Hash.SET_ENTITY_RECORDS_COLLISIONS, New InputArgument() {Game.Player.Character, 0})
- Native.Function.Call(Hash.SET_ENTITY_RECORDS_COLLISIONS, New InputArgument() {Game.Player.Character, 1})
- If (Not Me.bUseRagdoll AndAlso THelper.Exists(Me.handObject)) Then
- Native.Function.Call(Hash.SET_ENTITY_RECORDS_COLLISIONS, New InputArgument() {Me.handObject, 0})
- Native.Function.Call(Hash.SET_ENTITY_RECORDS_COLLISIONS, New InputArgument() {Me.handObject, 1})
- End If
- End If
- flag = False
- If ((DateAndTime.Now.Subtract(now).TotalMilliseconds > 500) AndAlso (num > &H19)) Then
- GoTo Label_18DA
- End If
- If (num8 > 15) Then
- num = 0
- End If
- If (THelper._iskeyPressed(Me.hkParachute) OrElse THelper.isButtonPressed(controls.INPUT_JUMP)) Then
- flag3 = True
- Me.chuteSpeed = (num8 * 0.5)
- If (Me.chuteSpeed > 20) Then
- Me.chuteSpeed = 20
- End If
- GoTo Label_18DA
- End If
- num2 = (num2 + 10)
- If ((num2 Mod 50) = 0) Then
- If THelper.Exists(eTarget) Then
- Me.resetRopeLenght(eTarget)
- Else
- Native.Function.Call(Hash.ROPE_FORCE_LENGTH, New InputArgument() {Me.moveToTargetRope.Handle, (distance * 0.5)})
- End If
- End If
- Script.Wait(10)
- Loop
- Catch exception4 As Exception
- ProjectData.SetProjectError(exception4)
- ProjectData.ClearProjectError()
- End Try
- Label_18DA:
- GameplayCamera.StopShaking()
- Game.Player.Character.IsVisible = False
- Game.Player.Character.IsVisible = True
- Dim num6 As Integer = Native.Function.Call(Of Integer)(Hash.GET_HASH_KEY, New InputArgument() {"GADGET_PARACHUTE"})
- Native.Function.Call(Hash.GIVE_WEAPON_TO_PED, New InputArgument() {Game.Player.Character, num6, 1, 1, 1})
- If (Me.moveSoundID > -1) Then
- Native.Function.Call(Hash.STOP_SOUND, New InputArgument() {Me.moveSoundID})
- End If
- If (Me.bUseRagdoll OrElse Game.Player.Character.IsAttached) Then
- Native.Function.Call(Hash.HIDE_PED_WEAPON_FOR_SCRIPTED_CUTSCENE, New InputArgument() {Game.Player.Character, 1})
- Game.Player.Character.Detach()
- velocity = Game.Player.Character.Position
- If ((velocity.Z - World.GetGroundZ(Game.Player.Character.Position)) < 0.25) Then
- character = Game.Player.Character
- character.Position = (character.Position + DirectCast((Vector3.WorldUp * 1.0!), Vector3))
- End If
- If Not flag3 Then
- Game.Player.Character.Velocity = dir
- End If
- Me.hideHandObject()
- End If
- Dim prop7 As Prop
- For Each prop7 In list
- Try
- If (THelper.Exists(prop7) AndAlso (Not prop7 Is Me.handObject)) Then
- prop7.Detach()
- prop7.Delete()
- End If
- Catch exception5 As Exception
- ProjectData.SetProjectError(exception5)
- ProjectData.ClearProjectError()
- End Try
- Next
- If THelper.anim_isPlayingPedAnim(Game.Player.Character, Me.sDictHang, Me.sAnimHang, 1) Then
- Game.Player.Character.Task.ClearAnimation(Me.sDictHang, Me.sAnimHang)
- End If
- If flag3 Then
- Game.Player.Character.CanRagdoll = False
- Game.Player.Character.CanRagdoll = True
- THelper.setEntityProofs(Game.Player.Character, False, False, False, False, False, False, False, False)
- Me.cancelMoveToTarget()
- Native.Function.Call(Hash.GIVE_WEAPON_TO_PED, New InputArgument() {Game.Player.Character, num6, 1, 100, 100})
- Game.Player.Character.Task.ClearAllImmediately()
- Game.Player.Character.Heading = CSng(THelper.directionToHeading(DirectCast(THelper.RotationToDirection(GameplayCamera.Rotation), Vector3)))
- Dim vector11 As Vector3 = ((Game.Player.Character.Position + DirectCast(Operators.MultiplyObject(THelper.RotationToDirection(GameplayCamera.Rotation), 10), Vector3)) + DirectCast((Vector3.WorldUp * 50.0!), Vector3))
- Native.Function.Call(Hash.TASK_PARACHUTE_TO_TARGET, New InputArgument() {Game.Player.Character, vector11.X, vector11.Y, vector11.Z})
- Me.bPushPlayerUp = True
- Me.timerPushingPlayerUp = DateAndTime.Now
- Game.Player.Character.Velocity = DirectCast(((dir * CSng(Me.chuteSpeed)) + (Vector3.WorldUp * 12.0!)), Vector3)
- Return
- End If
- If ((num > &H19) OrElse (Game.Player.Character.Health <= 0)) Then
- If Me.bUseRagdoll Then
- Game.Player.Character.CanRagdoll = False
- Game.Player.Character.CanRagdoll = True
- Native.Function.Call(Hash.SET_PED_TO_RAGDOLL, New InputArgument() {Game.Player.Character, 10, 10, 0, 0, 0})
- Else
- Game.Player.Character.Detach()
- If ((Game.Player.Character.Position.Z - World.GetGroundZ(Game.Player.Character.Position)) < 0.25) Then
- character = Game.Player.Character
- character.Position = (character.Position + DirectCast((Vector3.WorldUp * 1.0!), Vector3))
- End If
- Script.Wait(50)
- End If
- THelper.setEntityProofs(Game.Player.Character, False, False, False, False, False, False, False, False)
- Me.cancelMoveToTarget()
- Return
- End If
- num = 0
- If (THelper.Exists(eTarget) AndAlso ((Not eTarget.Model.IsHelicopter OrElse Not eTarget.Model.IsPlane) OrElse Not eTarget.Model.IsVehicle)) Then
- Dim vehicle As Vehicle
- For Each vehicle In World.GetNearbyVehicles(Game.Player.Character, 50.0!)
- Try
- If THelper.Exists(vehicle) Then
- If (vehicle.Handle <> eTarget.Handle) Then
- velocity = vehicle.Position
- If (velocity.DistanceTo(eTarget.Position) >= 1.0!) Then
- Continue For
- End If
- End If
- eTarget = vehicle
- Exit For
- End If
- Catch exception6 As Exception
- ProjectData.SetProjectError(exception6)
- ProjectData.ClearProjectError()
- End Try
- Next
- End If
- If Not THelper.Exists(eTarget) Then
- GoTo Label_2639
- End If
- Me.attachedToVehicle = flag2
- Try
- Me.vehOnFoot = DirectCast(eTarget, Vehicle)
- Catch exception7 As Exception
- ProjectData.SetProjectError(exception7)
- Dim exception As Exception = exception7
- ProjectData.ClearProjectError()
- End Try
- Me.timeSinceVehOnFootSet = DateAndTime.Now
- If Not flag2 Then
- If ((((eTarget.Model.IsBicycle OrElse eTarget.Model.IsBike) OrElse ((eTarget.Model.Hash = &H8125BCF9) OrElse (eTarget.Model.Hash = &HFD231729))) OrElse ((eTarget.Model.Hash = &HB44F0582) OrElse (eTarget.Model.Hash = &HDFF0594C))) AndAlso THelper.Exists(DirectCast(eTarget, Vehicle).GetPedOnSeat(VehicleSeat.Driver))) Then
- Me.ejectBikers(DirectCast(eTarget, Vehicle))
- Try
- Native.Function.Call(Hash.TASK_WARP_PED_INTO_VEHICLE, New InputArgument() {Game.Player.Character, eTarget, -1})
- GoTo Label_261D
- Catch exception8 As Exception
- ProjectData.SetProjectError(exception8)
- ProjectData.ClearProjectError()
- GoTo Label_261D
- End Try
- End If
- Game.Player.Character.CanRagdoll = False
- Game.Player.Character.Task.ClearAllImmediately()
- Game.Player.Character.Heading = CSng(heading)
- Me.cancelMoveToTarget()
- If eTarget.Model.IsPlane Then
- Game.Player.Character.Velocity = DirectCast(((((eTarget.Position + zero) - Game.Player.Character.Position) + (eTarget.Velocity * 1.05!)) + (Vector3.WorldDown * 3.0!)), Vector3)
- Else
- Game.Player.Character.Velocity = DirectCast(((eTarget.Velocity * 1.2!) + (Vector3.WorldDown * 3.0!)), Vector3)
- End If
- Else
- Game.Player.Character.CanRagdoll = True
- Native.Function.Call(Hash.SET_PED_TO_RAGDOLL, New InputArgument() {Game.Player.Character, -1, -1, 0, 0, 0})
- Me.cancelMoveToTarget()
- Me.hideHandObject()
- Me.checkHandObject()
- Me.resetHandObject()
- Me.handObject.Detach()
- Native.Function.Call(Hash.SET_ENTITY_COLLISION, New InputArgument() {Me.handObject, 0, 0})
- Script.Wait(100)
- Me.moveToTargetRope = JC2.createRope(Game.Player.Character, eTarget, 0.5, 0)
- If THelper.Exists(Me.handObject) Then
- Me.handObject.Position = Native.Function.Call(Of Vector3)(Hash.GET_PED_BONE_COORDS, New InputArgument() {Game.Player.Character, &H796E, 0, 0, 0})
- Native.Function.Call(Hash.ATTACH_ENTITY_TO_ENTITY_PHYSICALLY, New InputArgument() {Game.Player.Character, Me.handObject, THelper.getPedBoneIndex(Game.Player.Character, &H796E), 0, 0, -0.15, -0.45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0})
- Native.Function.Call(Hash.ATTACH_ENTITY_TO_ENTITY_PHYSICALLY, New InputArgument() {Game.Player.Character, Me.handObject, THelper.getPedBoneIndex(Game.Player.Character, &H6F06), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0})
- Native.Function.Call(Hash.ATTACH_ENTITY_TO_ENTITY_PHYSICALLY, New InputArgument() {Game.Player.Character, Me.handObject, THelper.getPedBoneIndex(Game.Player.Character, &HEB95), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0})
- End If
- character = Game.Player.Character
- character.Velocity = DirectCast((character.Velocity * 0.2!), Vector3)
- velocity = New Vector3(-0.1!, -0.1!, 2.3!)
- JC2.attachEntitiesToRope(Me.moveToTargetRope, Game.Player.Character, eTarget, 1, 0, velocity, vector12)
- Game.Player.Character.CanRagdoll = True
- Me.moveToTarget_TargetVeh = eTarget
- End If
- Label_261D:
- THelper.setEntityProofs(Game.Player.Character, False, False, False, False, False, False, False, False)
- Return
- Label_2639:
- Me.cancelMoveToTarget()
- Game.Player.Character.CanRagdoll = False
- Game.Player.Character.Task.ClearAllImmediately()
- Game.Player.Character.Heading = CSng(heading)
- Game.Player.Character.ApplyForce(DirectCast((dir * 5.0!), Vector3))
- If THelper.anim_requestDict(Me.sDictLand) Then
- THelper.anim_playPedAnim(Game.Player.Character, Me.sDictLand, Me.sAnimLand, 8, animFlags.normal, False)
- Script.Wait(100)
- THelper.anim_setAnimSpeed(Game.Player.Character, Me.sDictLand, Me.sAnimLand, 2)
- Do While THelper.anim_isPlayingPedAnim(Game.Player.Character, Me.sDictLand, Me.sAnimLand, 0.35)
- Script.Wait(100)
- Loop
- Game.Player.Character.Task.ClearAnimation(Me.sDictLand, Me.sAnimLand)
- End If
- Game.Player.Character.CanRagdoll = True
- THelper.setEntityProofs(Game.Player.Character, False, False, False, False, False, False, False, False)
- Catch exception9 As Exception
- ProjectData.SetProjectError(exception9)
- Dim exception2 As Exception = exception9
- Game.Player.Character.IsVisible = True
- UI.ShowSubtitle(("Error when moving to target: " & exception2.Message), &H2710)
- ProjectData.ClearProjectError()
- End Try
- End Sub
- Private Function pinEntityToCoord(ByVal pos As Vector3, ByVal ent As Entity, Optional ByVal objTarget As Entity = Nothing, Optional ByVal objTargetBone As Short = 0, Optional ByVal objTargetOffset As Vector3 = New Vector3()) As Rope
- Dim now As DateTime = DateAndTime.Now
- If THelper.Exists(objTarget) Then
- pos = objTarget.Position
- End If
- Dim e As Entity = World.CreateProp(JC2.handObjectModel, (ent.Position + DirectCast((Vector3.WorldDown * 100.0!), Vector3)), True, False)
- Script.Wait(50)
- Dim rope As Rope = Nothing
- If THelper.Exists(e) Then
- Dim vector3 As Vector3
- e.IsVisible = False
- Native.Function.Call(Hash.SET_ENTITY_COLLISION, New InputArgument() {e, 0, 0})
- e.FreezePosition = True
- e.Health = -1
- If Not THelper.Exists(objTarget) Then
- Native.Function.Call(Hash.SET_ENTITY_COORDS, New InputArgument() {e, pos.X, pos.Y, (pos.Z - 1.2), 1, 1, 1, 1})
- Else
- Native.Function.Call(Hash.ATTACH_ENTITY_TO_ENTITY_PHYSICALLY, New InputArgument() {e, objTarget, 0, objTargetBone, objTargetOffset.X, objTargetOffset.Y, objTargetOffset.Z, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0})
- End If
- If THelper.isPed(ent) Then
- Native.Function.Call(Hash.SET_PED_CAN_RAGDOLL, New InputArgument() {ent, 0})
- Native.Function.Call(Hash.SET_PED_CAN_RAGDOLL, New InputArgument() {ent, 1})
- Native.Function.Call(Hash.SET_PED_TO_RAGDOLL, New InputArgument() {ent, &H2710, &H2710, 0, 0, 0})
- End If
- Dim distance As Double = World.GetDistance(ent.Position, pos)
- If THelper.isPed(ent) Then
- now = DateAndTime.Now
- distance = World.GetDistance(ent.Position, pos)
- ent.ApplyForce(DirectCast(((pos - ent.Position) * 2.0!), Vector3))
- Do While ((World.GetDistance(ent.Position, pos) > (distance * 0.3)) AndAlso (DateAndTime.Now.Subtract(now).TotalMilliseconds < 2000))
- Script.Wait(10)
- Loop
- distance = World.GetDistance(ent.Position, pos)
- rope = JC2.createRope(ent.Position, pos, 1, 0)
- vector3 = New Vector3(0.0!, 0.0!, CSng(((pos.Z - e.Position.Z) * 0.5)))
- JC2.attachEntitiesToRope(rope, e, ent, 1, distance, vector3, Me.entityBulletOffset)
- Else
- Dim velocity As Vector3
- rope = JC2.createRope(ent.Position, pos, 1, 0)
- Me.entityBulletOffset = Vector3.Zero
- If Me.bPinFromGround Then
- velocity = New Vector3(0.0!, 0.0!, CSng(((pos.Z - e.Position.Z) * 0.2)))
- JC2.attachEntitiesToRope(rope, e, ent, 1, 0, velocity, Me.entityBulletOffset)
- Else
- velocity = New Vector3(0.0!, 0.0!, CSng(((pos.Z - e.Position.Z) * 0.5)))
- JC2.attachEntitiesToRope(rope, e, ent, 1, 0, velocity, Me.entityBulletOffset)
- End If
- Dim vector As Vector3 = Vector3.Normalize((pos - ent.Position))
- vector3 = (vector - Vector3.Normalize(ent.Velocity))
- If (vector3.Length > 0.3) Then
- velocity = ent.Velocity
- If ((velocity.Length > 5.0!) AndAlso (ent.Model.IsBike OrElse ent.Model.IsBicycle)) Then
- Me.ejectBikers(DirectCast(ent, Vehicle))
- End If
- End If
- velocity = New Vector3(1.0!, 1.0!, 1.0!)
- ent.ApplyForce((DirectCast((((vector - Vector3.Normalize(ent.Velocity)) * ent.Velocity.Length) * 0.5!), Vector3) + Vector3.WorldUp), velocity)
- End If
- Me.bPinFromGround = False
- Me.objectAuxList.Add(e)
- Dim rope3 As New TEntityInRope(ent, e, rope, distance, Me.entityBulletOffset, pos) With { _
- .pinCoord = pos _
- }
- End If
- Me.bPinFromGround = False
- Return rope
- End Function
- Part 3 of script.
- Private Sub prepareWindMill(ByVal windmill As Entity)
- If Not Me.bDisableWindMill Then
- Dim vector3 As Vector3
- Dim list As New List(Of Prop)
- Dim i As Integer = (Me.windMillObjects.Count - 1)
- Do While (i >= 0)
- Try
- Dim e As Prop = Me.windMillObjects.Item(i)
- If ((THelper.Exists(e) AndAlso e.IsAttached) AndAlso Native.Function.Call(Of Boolean)(Hash.IS_ENTITY_ATTACHED_TO_ENTITY, New InputArgument() {e, windmill})) Then
- Dim j As Integer = (JC2.entitiesInRope.Count - 1)
- Do While (j >= 0)
- Dim rope As TEntityInRope = JC2.entitiesInRope.Item(j)
- If ((rope.p1 Is e) OrElse (rope.p2 Is e)) Then
- rope.remove()
- End If
- j = (j + -1)
- Loop
- e.Detach()
- list.Add(e)
- End If
- Catch exception1 As Exception
- ProjectData.SetProjectError(exception1)
- ProjectData.ClearProjectError()
- End Try
- i = (i + -1)
- Loop
- THelper.requestModel("", CLng(JC2.windMillPipeHash), 500, True)
- Dim position As Vector3 = windmill.Position
- Dim vector As Vector3 = (position.Around(15.0!) + DirectCast((Vector3.WorldDown * 35.0!), Vector3))
- Dim flag As Boolean = False
- Dim num3 As Short = 1
- Do
- Dim prop2 As Prop = Nothing
- If (list.Count > 0) Then
- prop2 = list.Item(0)
- list.RemoveAt(0)
- Else
- prop2 = World.CreateProp(JC2.windMillPipeHash, vector, False, False)
- End If
- Script.Wait(10)
- If THelper.Exists(prop2) Then
- Me.windMillObjects.Add(prop2)
- prop2.IsVisible = flag
- position = New Vector3(0.0!, 0.0!, ((JC2.windMillPipeSize.Y * num3) - CSng((JC2.windMillPipeSize.Y * 0.5))))
- vector3 = New Vector3(90.0!, 0.0!, 0.0!)
- prop2.AttachTo(Me.actualWindmill, 1, position, vector3)
- Script.Wait(10)
- End If
- num3 = CShort((num3 + 2))
- Loop While (num3 <= 7)
- Dim num4 As Short = 1
- Do
- Dim prop3 As Prop = Nothing
- If (list.Count > 0) Then
- prop3 = list.Item(0)
- list.RemoveAt(0)
- Else
- prop3 = World.CreateProp(JC2.windMillPipeHash, vector, False, False)
- End If
- Script.Wait(10)
- If THelper.Exists(prop3) Then
- Me.windMillObjects.Add(prop3)
- prop3.IsVisible = flag
- Dim num5 As Double = ((JC2.windMillPipeSize.Y * num4) - (JC2.windMillPipeSize.Y * 0.5))
- vector3 = New Vector3(CSng((num5 * 0.9)), 0.0!, CSng((num5 * -0.6)))
- position = New Vector3(90.0!, 120.0!, 0.0!)
- prop3.AttachTo(Me.actualWindmill, 1, vector3, position)
- Script.Wait(10)
- End If
- num4 = CShort((num4 + 2))
- Loop While (num4 <= 7)
- Dim num6 As Short = 1
- Do
- Dim prop4 As Prop = Nothing
- If (list.Count > 0) Then
- prop4 = list.Item(0)
- list.RemoveAt(0)
- Else
- prop4 = World.CreateProp(JC2.windMillPipeHash, vector, False, False)
- End If
- Script.Wait(10)
- If THelper.Exists(prop4) Then
- Me.windMillObjects.Add(prop4)
- prop4.IsVisible = flag
- Dim num7 As Double = ((JC2.windMillPipeSize.Y * num6) - (JC2.windMillPipeSize.Y * 0.5))
- vector3 = New Vector3(CSng((num7 * -0.9)), 0.0!, CSng((num7 * -0.6)))
- position = New Vector3(90.0!, 240.0!, 0.0!)
- prop4.AttachTo(Me.actualWindmill, 1, vector3, position)
- Script.Wait(10)
- End If
- num6 = CShort((num6 + 2))
- Loop While (num6 <= 7)
- End If
- End Sub
- Private Sub reloadTargets()
- If (Game.Player.IsAiming AndAlso (DateAndTime.Now.Subtract(Me.timerReloadTargets).TotalMilliseconds > 1000)) Then
- Me.timerReloadTargets = DateAndTime.Now
- Try
- Dim enumerator As Enumerator(Of Entity)
- Do While (Me.reloadTargetPedAux.Count < 4)
- Dim e As Ped = World.CreatePed(Me.hiddenPedModel, ((GameplayCamera.Position - DirectCast(Operators.MultiplyObject(THelper.RotationToDirection(GameplayCamera.Rotation), 10), Vector3)) + DirectCast((Vector3.WorldDown * 50.0!), Vector3)))
- Script.Wait(10)
- If THelper.Exists(e) Then
- Me.reloadTargetPedAux.Add(e)
- End If
- Loop
- Dim entity As Entity
- For Each entity In Me.targetsList
- Try
- If THelper.Exists(entity) Then
- Native.Function.Call(Hash.CLEAR_ENTITY_LAST_DAMAGE_ENTITY, New InputArgument() {entity})
- End If
- Catch exception1 As Exception
- ProjectData.SetProjectError(exception1)
- ProjectData.ClearProjectError()
- End Try
- Next
- Me.targetsList.Clear()
- Dim num As Short = 1
- Try
- enumerator = Me.reloadTargetPedAux.GetEnumerator
- Do While enumerator.MoveNext
- Dim current As Ped = DirectCast(enumerator.Current, Ped)
- Try
- If (Not current Is Game.Player.Character) Then
- current.Health = -1
- Dim position As New Vector3(-5.0!, CSng((num * 20)), -2.0!)
- current.AttachTo(Game.Player.Character, &H6F06, position, Vector3.Zero)
- Native.Function.Call(Hash.SET_ENTITY_ALPHA, New InputArgument() {current, 10, 0})
- num = CShort((num + 1))
- End If
- Dim ped3 As Ped
- For Each ped3 In World.GetNearbyPeds(current, 100.0!)
- Try
- If (((THelper.Exists(ped3) AndAlso Not Me.targetsList.Contains(ped3)) AndAlso (Not Me.reloadTargetPedAux.Contains(ped3) AndAlso (Not ped3 Is Game.Player.Character))) AndAlso Not THelper.Exists(ped3.CurrentVehicle)) Then
- Me.targetsList.Add(ped3)
- Native.Function.Call(Hash.CLEAR_ENTITY_LAST_DAMAGE_ENTITY, New InputArgument() {ped3})
- End If
- Catch exception2 As Exception
- ProjectData.SetProjectError(exception2)
- ProjectData.ClearProjectError()
- End Try
- Next
- Dim vehicle As Vehicle
- For Each vehicle In World.GetNearbyVehicles(current, 100.0!)
- Try
- If ((THelper.Exists(vehicle) AndAlso Not Me.targetsList.Contains(vehicle)) AndAlso (Not vehicle Is Game.Player.Character.CurrentVehicle)) Then
- Me.targetsList.Add(vehicle)
- Native.Function.Call(Hash.CLEAR_ENTITY_LAST_DAMAGE_ENTITY, New InputArgument() {vehicle})
- End If
- Catch exception3 As Exception
- ProjectData.SetProjectError(exception3)
- ProjectData.ClearProjectError()
- End Try
- Next
- Continue Do
- Catch exception4 As Exception
- ProjectData.SetProjectError(exception4)
- ProjectData.ClearProjectError()
- Continue Do
- End Try
- Loop
- Finally
- enumerator.Dispose()
- End Try
- Catch exception5 As Exception
- ProjectData.SetProjectError(exception5)
- ProjectData.ClearProjectError()
- End Try
- End If
- End Sub
- Private Sub resetHandObject()
- If THelper.Exists(Me.handObject) Then
- Me.handObject.IsVisible = False
- Native.Function.Call(Hash.SET_ENTITY_COLLISION, New InputArgument() {Me.handObject, 0, 0})
- Native.Function.Call(Hash.ATTACH_ENTITY_TO_ENTITY, New InputArgument() {Me.handObject, Game.Player.Character, THelper.getPedBoneIndex(Game.Player.Character, &H6F06), 0, 0.05, -1.075, 0, 0, 0, 0, 0, 0, 0, 0, 0})
- End If
- End Sub
- Private Sub resetRopeLenght(ByVal eTarget As Entity)
- Dim distance As Double = World.GetDistance(eTarget.Position, Game.Player.Character.Position)
- Native.Function.Call(Hash.ROPE_FORCE_LENGTH, New InputArgument() {Me.moveToTargetRope.Handle, (distance * 0.5)})
- Dim num2 As Integer = (Native.Function.Call(Of Integer)(Hash.GET_ROPE_VERTEX_COUNT, New InputArgument() {Me.moveToTargetRope.Handle}) - 1)
- Dim position As Vector3 = eTarget.Position
- Native.Function.Call(Hash.PIN_ROPE_VERTEX, New InputArgument() {Me.moveToTargetRope.Handle, num2, position.X, position.Y, position.Z})
- End Sub
- Private Sub stealVeh()
- If (Not Me.canStealVeh AndAlso Not Me.attachedToVehicle) Then
- Return
- End If
- Try
- If Not THelper.Exists(Me.vehOnFoot) Then
- GoTo Label_0C78
- End If
- Game.Player.Character.Task.ClearAllImmediately()
- Dim pedOnSeat As Ped = Me.vehOnFoot.GetPedOnSeat(VehicleSeat.Driver)
- If (Not THelper.Exists(pedOnSeat) OrElse Me.vehOnFoot.Model.IsPlane) Then
- Game.Player.Character.Task.WarpIntoVehicle(Me.vehOnFoot, VehicleSeat.Driver)
- Me.vehOnFoot = Nothing
- Return
- End If
- Dim offsetInWorldCoords As Vector3 = pedOnSeat.GetOffsetInWorldCoords(Vector3.Zero)
- Dim position As Vector3 = Native.Function.Call(Of Vector3)(Hash.GET_OFFSET_FROM_ENTITY_GIVEN_WORLD_COORDS, New InputArgument() {Me.vehOnFoot, offsetInWorldCoords.X, offsetInWorldCoords.Y, offsetInWorldCoords.Z})
- If Me.vehOnFoot.Model.IsHelicopter Then
- If THelper.anim_requestDict(Me.sDictStealVeh1Heli) Then
- Game.Player.Character.CanRagdoll = False
- Game.Player.Character.Task.ClearAllImmediately()
- Dim vector4 As Vector3 = Game.Player.Character.Position
- Dim vector3 As Vector3 = Native.Function.Call(Of Vector3)(Hash.GET_OFFSET_FROM_ENTITY_GIVEN_WORLD_COORDS, New InputArgument() {Me.vehOnFoot, vector4.X, vector4.Y, vector4.Z})
- Dim num As Double = (vector3.Z - position.Z)
- Dim num2 As Double = (num * 0.02)
- position.X = (position.X - CSng(0.7))
- position.Y = (position.Y - CSng(0.05))
- position.Z = (position.Z + CSng(0.3))
- vector3.X = position.X
- vector3.Y = position.Y
- Game.Player.Character.AttachTo(Me.vehOnFoot, 0, vector3, Vector3.Zero)
- THelper.anim_playPedAnim(Game.Player.Character, Me.sDictStealVeh1Heli, Me.sAnimStealVeh1Heli, 8, animFlags.normal, False)
- Script.Wait(50)
- Do While THelper.anim_isPlayingPedAnim(Game.Player.Character, Me.sDictStealVeh1Heli, Me.sAnimStealVeh1Heli, 0.1)
- Script.Wait(10)
- Native.Function.Call(Hash.STOP_CURRENT_PLAYING_AMBIENT_SPEECH, New InputArgument() {Game.Player.Character})
- THelper.anim_setAnimSpeed(Game.Player.Character, Me.sDictStealVeh1Heli, Me.sAnimStealVeh1Heli, 4)
- Loop
- Do While THelper.anim_isPlayingPedAnim(Game.Player.Character, Me.sDictStealVeh1Heli, Me.sAnimStealVeh1Heli, 0.4)
- Script.Wait(10)
- Native.Function.Call(Hash.STOP_CURRENT_PLAYING_AMBIENT_SPEECH, New InputArgument() {Game.Player.Character})
- THelper.anim_setAnimSpeed(Game.Player.Character, Me.sDictStealVeh1Heli, Me.sAnimStealVeh1Heli, 4)
- If (num < -1.5) Then
- num = (num - (num2 * 1.2))
- vector3.Z = CSng(num)
- vector3.X = (vector3.X - CSng(0.005))
- Dim rotation As New Vector3(0.0!, 0.0!, 0.0!)
- Game.Player.Character.AttachTo(Me.vehOnFoot, 0, vector3, rotation)
- End If
- Loop
- Game.Player.Character.Task.ClearAnimation(Me.sDictStealVeh1Heli, Me.sAnimStealVeh1Heli)
- End If
- ElseIf THelper.anim_requestDict(Me.sDictStealVeh1) Then
- Game.Player.Character.CanRagdoll = False
- Dim vector6 As Vector3 = Game.Player.Character.Position
- Dim vector5 As Vector3 = Native.Function.Call(Of Vector3)(Hash.GET_OFFSET_FROM_ENTITY_GIVEN_WORLD_COORDS, New InputArgument() {Me.vehOnFoot, vector6.X, vector6.Y, vector6.Z})
- Dim num3 As Double = (vector5.Z - position.Z)
- Dim num4 As Double = (num3 * 0.02)
- vector5.X = position.X
- vector5.Y = position.Y
- vector5.Z = (vector5.Z - CSng(0.5))
- position.X = (position.X - CSng(0.7))
- position.Y = (position.Y - CSng(0.05))
- position.Z = (position.Z + CSng(0.3))
- Game.Player.Character.AttachTo(Me.vehOnFoot, 0, vector5, Vector3.Zero)
- THelper.anim_playPedAnim(Game.Player.Character, Me.sDictStealVeh1, Me.sAnimStealVeh1, 8, animFlags.normal, False)
- Script.Wait(50)
- Do While THelper.anim_isPlayingPedAnim(Game.Player.Character, Me.sDictStealVeh1, Me.sAnimStealVeh1, 0.22)
- Script.Wait(10)
- Native.Function.Call(Hash.STOP_CURRENT_PLAYING_AMBIENT_SPEECH, New InputArgument() {Game.Player.Character})
- THelper.anim_setAnimSpeed(Game.Player.Character, Me.sDictStealVeh1, Me.sAnimStealVeh1, 2)
- If (num3 > 0.05) Then
- Game.Player.Character.AttachTo(Me.vehOnFoot, 0, vector5, Vector3.Zero)
- num3 = (num3 - num4)
- vector5.Z = CSng(num3)
- vector5.X = (vector5.X - CSng(0.01))
- End If
- Loop
- Game.Player.Character.Task.ClearAnimation(Me.sDictStealVeh1, Me.sAnimStealVeh1)
- End If
- Native.Function.Call(Hash.SET_VEHICLE_DOOR_OPEN, New InputArgument() {Me.vehOnFoot, 0, 0, 0})
- Game.Player.Character.AttachTo(Me.vehOnFoot, 0, position, Vector3.Zero)
- Dim str As String = Me.sAnimStealVeh2
- If (Me.vehOnFoot.Model.GetDimensions.Z > 2.0!) Then
- str = Me.sAnimStealVeh2b
- position.Z = (position.Z - CSng(0.2))
- End If
- If Not THelper.anim_requestDict(Me.sDictStealVeh2) Then
- GoTo Label_0A05
- End If
- THelper.anim_playPedAnim(Game.Player.Character, Me.sDictStealVeh2, Me.sAnimStealVeh2, 8, animFlags.normal, True)
- Script.Wait(50)
- Me.vehOnFoot.SmashWindow(VehicleWindow.FrontLeftWindow)
- Do While THelper.anim_isPlayingPedAnim(Game.Player.Character, Me.sDictStealVeh2, Me.sAnimStealVeh2, 0.2)
- Script.Wait(10)
- THelper.anim_setAnimSpeed(Game.Player.Character, Me.sDictStealVeh2, Me.sAnimStealVeh2, 2)
- Loop
- If Me.vehOnFoot.Model.IsHelicopter Then
- GoTo Label_08EC
- End If
- pedOnSeat.Task.ClearAll()
- pedOnSeat.Task.ClearSecondary()
- pedOnSeat.AlwaysKeepTask = False
- pedOnSeat.AlwaysKeepTask = True
- Native.Function.Call(Hash.TASK_LEAVE_VEHICLE, New InputArgument() {pedOnSeat, Me.vehOnFoot, &H1000})
- pedOnSeat.CanRagdoll = True
- If (pedOnSeat.Health < 0) Then
- pedOnSeat.Task.ClearAllImmediately()
- End If
- Native.Function.Call(Hash.SET_PED_TO_RAGDOLL, New InputArgument() {pedOnSeat, &HBB8, &HBB8, 0, 0, 0})
- GoTo Label_09DC
- Label_08C1:
- Script.Wait(10)
- THelper.anim_setAnimSpeed(Game.Player.Character, Me.sDictStealVeh2, Me.sAnimStealVeh2, 2)
- Label_08EC:
- If THelper.anim_isPlayingPedAnim(Game.Player.Character, Me.sDictStealVeh2, Me.sAnimStealVeh2, 0.35) Then
- GoTo Label_08C1
- End If
- pedOnSeat.Task.ClearAllImmediately()
- Native.Function.Call(Hash.SET_PED_TO_RAGDOLL, New InputArgument() {pedOnSeat, &HBB8, &HBB8, 0, 0, 0})
- Label_09DC:
- Do While THelper.anim_isPlayingPedAnim(Game.Player.Character, Me.sDictStealVeh2, Me.sAnimStealVeh2, 0.65)
- Script.Wait(10)
- position.X = (position.X + CSng(0.01))
- Game.Player.Character.AttachTo(Me.vehOnFoot, 0, position, Vector3.Zero)
- THelper.anim_setAnimSpeed(Game.Player.Character, Me.sDictStealVeh2, Me.sAnimStealVeh2, 1.5)
- Loop
- Label_0A05:
- Native.Function.Call(Hash.TASK_WARP_PED_INTO_VEHICLE, New InputArgument() {Game.Player.Character, Me.vehOnFoot, -1})
- Script.Wait(200)
- Dim now As DateTime = DateAndTime.Now
- Do While ((Not Game.Player.Character.CurrentVehicle Is Me.vehOnFoot) And (DateAndTime.Now.Subtract(now).TotalMilliseconds < 1000))
- Game.Player.Character.Task.WarpIntoVehicle(Me.vehOnFoot, VehicleSeat.Driver)
- Script.Wait(100)
- Loop
- Script.Wait(100)
- If (pedOnSeat.CurrentVehicle Is Me.vehOnFoot) Then
- pedOnSeat.Task.ClearAllImmediately()
- End If
- If Me.vehOnFoot.Model.IsHelicopter Then
- Dim num5 As Short = 0
- Do
- pedOnSeat = Me.vehOnFoot.GetPedOnSeat(DirectCast(num5, VehicleSeat))
- If (THelper.Exists(pedOnSeat) AndAlso (pedOnSeat.Health >= 0)) Then
- pedOnSeat.Task.ClearAll()
- pedOnSeat.Task.ClearSecondary()
- pedOnSeat.AlwaysKeepTask = False
- pedOnSeat.AlwaysKeepTask = True
- Native.Function.Call(Hash.TASK_LEAVE_VEHICLE, New InputArgument() {pedOnSeat, Me.vehOnFoot, &H1000})
- pedOnSeat.CanRagdoll = True
- Native.Function.Call(Hash.SET_PED_TO_RAGDOLL, New InputArgument() {pedOnSeat, &HBB8, &HBB8, 0, 0, 0})
- End If
- num5 = CShort((num5 + 1))
- Loop While (num5 <= 10)
- End If
- Game.Player.Character.CanRagdoll = True
- Me.vehOnFoot = Nothing
- Catch exception1 As Exception
- ProjectData.SetProjectError(exception1)
- Dim exception As Exception = exception1
- Try
- Native.Function.Call(Hash.TASK_WARP_PED_INTO_VEHICLE, New InputArgument() {Game.Player.Character, Me.vehOnFoot, -1})
- Catch exception2 As Exception
- ProjectData.SetProjectError(exception2)
- ProjectData.ClearProjectError()
- End Try
- ProjectData.ClearProjectError()
- End Try
- Label_0C78:
- Me.cancelVehAttach()
- End Sub
- Private Sub subTick()
- If (DateAndTime.Now.Subtract(Me.timer1Sec).TotalMilliseconds > 1000) Then
- Me.timer1Sec = DateAndTime.Now
- Dim i As Integer = (Me.objectAuxList.Count - 1)
- Do While (i >= 0)
- Try
- If (THelper.Exists(Me.objectAuxList.Item(i)) AndAlso (World.GetDistance(Me.objectAuxList.Item(i).Position, GameplayCamera.Position) > 200.0!)) Then
- Me.objectAuxList.Item(i).MarkAsNoLongerNeeded()
- End If
- Catch exception1 As Exception
- ProjectData.SetProjectError(exception1)
- ProjectData.ClearProjectError()
- End Try
- i = (i + -1)
- Loop
- End If
- End Sub
- Private Sub toggleHookMode()
- Me.bHookMode = Not Me.bHookMode
- Try
- Me.cancelMoveToTarget()
- Catch exception1 As Exception
- ProjectData.SetProjectError(exception1)
- ProjectData.ClearProjectError()
- End Try
- Try
- Me.cancelVehAttach()
- Catch exception2 As Exception
- ProjectData.SetProjectError(exception2)
- ProjectData.ClearProjectError()
- End Try
- Me.clearLists()
- Me.iniFile.WriteINIBool("bHookMode", "general", Me.bHookMode)
- Me.mMenu.findItem("bHookMode").value = Conversions.ToString(Me.bHookMode)
- UI.ShowSubtitle(("Just Cause 2 mod - Hook On: " & Conversions.ToString(Me.bHookMode)))
- End Sub
- Private Sub toggleMod()
- Me.bEnabled = Not Me.bEnabled
- Try
- Me.cancelMoveToTarget()
- Catch exception1 As Exception
- ProjectData.SetProjectError(exception1)
- ProjectData.ClearProjectError()
- End Try
- Try
- Me.cancelVehAttach()
- Catch exception2 As Exception
- ProjectData.SetProjectError(exception2)
- ProjectData.ClearProjectError()
- End Try
- Me.clearLists()
- Me.mMenu.findItem("bEnabled").value = Conversions.ToString(Me.bEnabled)
- Me.iniFile.WriteINIBool("bEnabled", "general", Me.bEnabled)
- UI.ShowSubtitle(("Just Cause 2 Mod enabled: " & Conversions.ToString(Me.bEnabled)))
- End Sub
- ' Fields
- Private actualTarget As Entity
- Private actualWindmill As Prop
- Private attachedToVehicle As Boolean
- Private bDisableWindMill As Boolean
- Private bEnabled As Boolean
- Private bHookMode As Boolean
- Private bLoaded As Boolean
- Private bPinFromGround As Boolean
- Private bPowersOn As Object
- Private bPushPlayerUp As Boolean
- Private bShootDetected As Boolean
- Private bUseRagdoll As Boolean
- Private canStealVeh As Boolean
- Private chuteSpeed As Double
- Private entitiesFound As List(Of Entity)
- Private Shared entitiesInRope As List(Of TEntityInRope) = New List(Of TEntityInRope)
- Private entityBullet As Entity
- Private entityBulletOffset As Vector3
- Private entityTarget As Entity
- Private entityTargetOffset As Vector3
- Private Shared gasObjectsUsed As List(Of Prop) = New List(Of Prop)
- Private handObject As Prop
- Private Shared handObjectModel As Model = New Model
- Private handObjectModelName As String
- Private hiddenPedModel As Model
- Private hkParachute As Keys
- Private hkReleaseHookInVeh As Keys
- Private hkShowMenu As Keys
- Private hkShowMenuKeyTwo As Keys
- Private hkToggleHookMode As Keys
- Private iniFile As CustomIniFile
- Private iniFileScripts As CustomIniFile
- Private inititalParachutePush As Boolean
- Private last As Vector3
- Private lastDamagedEntity As Entity
- Private lastImpactCoord As Vector3
- Private Shared listOfGasObjects As List(Of TGasObjects) = New List(Of TGasObjects)
- Private mMenu As TMenu
- Private modFilesFolder As String
- Private moveDir As Vector3
- Private moveSoundID As Integer
- Private moveToTarget_TargetVeh As Entity
- Private moveToTargetRope As Rope
- Private movingToTarget As Boolean
- Private objectAuxList As List(Of Entity)
- Private playerParachute As Prop
- Private reloadTargetPedAux As List(Of Entity)
- Private sAnimFly As String
- Private sAnimHang As String
- Private sAnimJump As String
- Private sAnimLand As String
- Private sAnimPull As String
- Private sAnimStealVeh1 As String
- Private sAnimStealVeh1Heli As String
- Private sAnimStealVeh2 As String
- Private sAnimStealVeh2b As String
- Private scriptCommandLine As String
- Private scriptDisplayName As String
- Private sDict As String
- Private sDictHang As String
- Private sDictJump As String
- Private sDictLand As String
- Private sDictPull As String
- Private sDictStealVeh1 As String
- Private sDictStealVeh1Heli As String
- Private sDictStealVeh2 As String
- Private sDictStealVeh2b As String
- Private sGUI As String
- Private targetHUDRot As Double
- Private targetsList As List(Of Entity)
- Private timeOut As DateTime
- Private timer1Sec As DateTime
- Private timerCheckMenu As DateTime
- Private timerPushingPlayerUp As DateTime
- Private timerReloadTargets As DateTime
- Private timerSinceLastShoot As DateTime
- Private timerWaitAttachAgain As DateTime
- Private timerWaitLoad As DateTime
- Private timeSinceVehOnFootSet As DateTime
- Private tmpTimeCounter As Integer
- Private Shared TRandom As Random
- Private vehOnFoot As Vehicle
- Private waitForShootDetect As Boolean
- Private Shared windMillHash As Integer
- Private Shared windMillModelAux As Model
- Private windMillObjects As List(Of Prop)
- Private Shared windMillPipeHash As Integer
- Private Shared windMillPipeModelAux As Model
- Private Shared windMillPipeSize As Vector3
- ' Nested Types
- Public Class TEntityInRope
- ' Methods
- Public Sub New(ByVal e1 As Entity, ByVal e2 As Entity, ByVal r As Rope, ByVal pDist As Double, ByVal e1_Off As Vector3, ByVal e2_Off As Vector3)
- Me.p1 = e1
- Me.p2 = e2
- Me.rope = r
- Me.dist = pDist
- Me.e1_offset = e1_Off
- Me.e2_offset = e2_Off
- If THelper.Exists(Me.p1) Then
- Me.isPed_p1 = THelper.isPed(Me.p1)
- Me.isObject_p1 = THelper.isObject(Me.p1)
- Me.isVehicle_p1 = THelper.isVehicle(Me.p1)
- If Not Native.Function.Call(Of Boolean)(Hash.IS_ENTITY_A_MISSION_ENTITY, New InputArgument() {Me.p1}) Then
- Native.Function.Call(Hash.SET_ENTITY_AS_MISSION_ENTITY, New InputArgument() {Me.p1, 1, 1})
- End If
- If Me.isVehicle_p1 Then
- Native.Function.Call(Hash._SET_VEHICLE_ENGINE_POWER_MULTIPLIER, New InputArgument() {Me.p1, 15})
- End If
- End If
- If THelper.Exists(Me.p2) Then
- Me.isPed_p2 = THelper.isPed(Me.p2)
- Me.isObject_p2 = THelper.isObject(Me.p2)
- Me.isVehicle_p2 = THelper.isVehicle(Me.p2)
- If Not Native.Function.Call(Of Boolean)(Hash.IS_ENTITY_A_MISSION_ENTITY, New InputArgument() {Me.p2}) Then
- Native.Function.Call(Hash.SET_ENTITY_AS_MISSION_ENTITY, New InputArgument() {Me.p2, 1, 1})
- End If
- If Me.isVehicle_p2 Then
- Native.Function.Call(Hash._SET_VEHICLE_ENGINE_POWER_MULTIPLIER, New InputArgument() {Me.p2, 15})
- End If
- End If
- Me.timerSinceAttach = DateAndTime.Now
- JC2.entitiesInRope.Add(Me)
- End Sub
- Public Sub pedTick()
- Try
- If (DateAndTime.Now.Subtract(Me.timerResetRope).TotalMilliseconds > 1000) Then
- Me.timerResetRope = DateAndTime.Now
- If (THelper.Exists(Me.p1) AndAlso THelper.isPed(Me.p1)) Then
- If (Me.p1.Health < 0) Then
- Native.Function.Call(Hash.REVIVE_INJURED_PED, New InputArgument() {Me.p1})
- Me.p1.Health = 100
- Native.Function.Call(Hash.SET_PED_TO_RAGDOLL, New InputArgument() {Me.p1, &HC350, &HC350, 0, 0, 0})
- End If
- Native.Function.Call(Hash.SET_PED_DIES_WHEN_INJURED, New InputArgument() {Me.p1, 0})
- Native.Function.Call(Hash.SET_PED_SUFFERS_CRITICAL_HITS, New InputArgument() {Me.p1, 0})
- Native.Function.Call(Hash.SET_ENTITY_AS_MISSION_ENTITY, New InputArgument() {Me.p1, 1, 1})
- Native.Function.Call(Hash.SET_PED_GENERATES_DEAD_BODY_EVENTS, New InputArgument() {Me.p1, 0})
- If ((Me.pinCoord <> Vector3.Zero) AndAlso Not Native.Function.Call(Of Boolean)(Hash.IS_PED_RAGDOLL, New InputArgument() {Me.p1})) Then
- Native.Function.Call(Hash.SET_PED_CAN_RAGDOLL, New InputArgument() {Me.p1, 1})
- THelper.setPedToRagdoll(DirectCast(Me.p1, Ped), &H2710, &H2710, False, False, False)
- End If
- End If
- If (THelper.Exists(Me.p2) AndAlso THelper.isPed(Me.p2)) Then
- If (Me.p2.Health < 0) Then
- Native.Function.Call(Hash.REVIVE_INJURED_PED, New InputArgument() {Me.p2})
- Me.p2.Health = 100
- Native.Function.Call(Hash.SET_PED_TO_RAGDOLL, New InputArgument() {Me.p2, &HC350, &HC350, 0, 0, 0})
- End If
- Native.Function.Call(Hash.SET_PED_DIES_WHEN_INJURED, New InputArgument() {Me.p2, 0})
- Native.Function.Call(Hash.SET_PED_SUFFERS_CRITICAL_HITS, New InputArgument() {Me.p2, 0})
- Native.Function.Call(Hash.SET_ENTITY_AS_MISSION_ENTITY, New InputArgument() {Me.p2, 1, 1})
- Native.Function.Call(Hash.SET_PED_GENERATES_DEAD_BODY_EVENTS, New InputArgument() {Me.p2, 0})
- If ((Me.pinCoord <> Vector3.Zero) AndAlso Not Native.Function.Call(Of Boolean)(Hash.IS_PED_RAGDOLL, New InputArgument() {Me.p2})) Then
- Native.Function.Call(Hash.SET_PED_CAN_RAGDOLL, New InputArgument() {Me.p2, 1})
- THelper.setPedToRagdoll(DirectCast(Me.p2, Ped), &H2710, &H2710, False, False, False)
- End If
- End If
- If (THelper.Exists(Me.p1) AndAlso THelper.Exists(Me.p2)) Then
- Dim distance As Double = World.GetDistance(Me.p1.Position, Me.p2.Position)
- Native.Function.Call(Hash.ROPE_FORCE_LENGTH, New InputArgument() {Me.rope.Handle, (distance * 1.15)})
- If (Me.isPed_p1 AndAlso Me.isVehicle_p2) Then
- Dim ped As Ped = DirectCast(Me.p1, Ped)
- Dim num2 As Double = Me.p2.Velocity.Length
- Dim num3 As Double = ped.Velocity.Length
- Dim destination As Vector3 = Native.Function.Call(Of Vector3)(Hash.GET_ROPE_VERTEX_COORD, New InputArgument() {Me.rope.Handle, 0})
- Dim vector2 As Vector3 = Native.Function.Call(Of Vector3)(Hash.GET_ROPE_LAST_VERTEX_COORD, New InputArgument() {Me.rope.Handle})
- If (((num3 < 0.3) AndAlso (World.GetDistance(Me.p2.Position, destination) >= (Me.dist * 0.95))) OrElse ((World.GetDistance(Me.p2.Position, vector2) > 3.0!) OrElse ((Not ped.IsRagdoll AndAlso Me.p2.Model.IsVehicle) AndAlso (Me.p2.Velocity.Length > 5.0!)))) Then
- Me.rope.Delete()
- Me.rope = JC2.createRope(Me.p1.Position, Me.p2.Position, 1, (Me.dist * 0.95))
- ped.FreezePosition = False
- Native.Function.Call(Hash.SET_PED_CAN_RAGDOLL, New InputArgument() {ped, 1})
- Native.Function.Call(Hash.SET_PED_TO_RAGDOLL, New InputArgument() {ped, &H7530, &H7530, 0, 0, 0})
- ped.Health = 100
- ped.ApplyForce((Me.p2.Position - ped.Position))
- ped.Velocity = (Me.p2.Position - ped.Position)
- JC2.attachEntitiesToRope(Me.rope, Me.p1, Me.p2, 1, (Me.dist * 0.95), Me.e1_offset, Me.e2_offset)
- End If
- End If
- End If
- End If
- Catch exception1 As Exception
- ProjectData.SetProjectError(exception1)
- ProjectData.ClearProjectError()
- End Try
- End Sub
- Public Sub remove()
- Try
- Me.rope.Delete()
- Catch exception1 As Exception
- ProjectData.SetProjectError(exception1)
- ProjectData.ClearProjectError()
- End Try
- Try
- Me.p1.MarkAsNoLongerNeeded()
- Me.p1 = Nothing
- Catch exception2 As Exception
- ProjectData.SetProjectError(exception2)
- ProjectData.ClearProjectError()
- End Try
- Try
- Me.p2.MarkAsNoLongerNeeded()
- Me.p2 = Nothing
- Catch exception3 As Exception
- ProjectData.SetProjectError(exception3)
- ProjectData.ClearProjectError()
- End Try
- JC2.entitiesInRope.Remove(Me)
- End Sub
- ' Fields
- Public dist As Double
- Public e1_offset As Vector3
- Public e2_offset As Vector3
- Public isObject_p1 As Boolean = False
- Public isObject_p2 As Boolean = False
- Public isPed_p1 As Boolean = False
- Public isPed_p2 As Boolean = False
- Public isVehicle_p1 As Boolean = False
- Public isVehicle_p2 As Boolean = False
- Public p1 As Entity = Nothing
- Public p2 As Entity = Nothing
- Public pinCoord As Vector3
- Public rope As Rope
- Private timerResetRope As DateTime = DateAndTime.Now
- Private timerResetRope2 As DateTime = DateAndTime.Now
- Public timerSinceAttach As DateTime
- End Class
- Public Class TGasObjects
- ' Methods
- Public Sub New(ByVal o As Entity, ByVal e2 As Entity)
- Try
- If Not THelper.isObject(o) Then
- Throw New Exception("")
- End If
- If JC2.gasObjectsUsed.Contains(DirectCast(o, Prop)) Then
- Throw New Exception("")
- End If
- If THelper.isObject(o) Then
- Me.ent2 = e2
- Me.obj = DirectCast(o, Prop)
- Me.timerLive = DateAndTime.Now
- Me.moveDir = New Vector3(CSng(JC2.TRandom.NextDouble), CSng(JC2.TRandom.NextDouble), 1.0!)
- Native.Function.Call(Hash._SET_PTFX_ASSET_NEXT_CALL, New InputArgument() {"scr_exile2"})
- Me.PTFXID = Native.Function.Call(Of Integer)(Hash.START_PARTICLE_FX_LOOPED_ON_ENTITY, New InputArgument() {"scr_ex2_jeep_engine_fire", Me.obj, 0, 0, 0, 0, 0, 0, 0.5, 0, 0, 0})
- Me.soundID = Native.Function.Call(Of Integer)(Hash.GET_SOUND_ID, New InputArgument(0 - 1) {})
- If (Me.soundID > -1) Then
- THelper.playSoundFromEntity(Me.soundID, "fire_missile_loop", Me.obj, "exile_2_sounds")
- End If
- JC2.listOfGasObjects.Add(Me)
- JC2.gasObjectsUsed.Add(DirectCast(o, Prop))
- End If
- Catch exception1 As Exception
- ProjectData.SetProjectError(exception1)
- If (Me.PTFXID <> 0) Then
- Native.Function.Call(Hash.STOP_PARTICLE_FX_LOOPED, New InputArgument() {Me.PTFXID})
- End If
- If (Me.soundID > -1) Then
- Native.Function.Call(Hash.STOP_SOUND, New InputArgument() {Me.soundID})
- End If
- ProjectData.ClearProjectError()
- End Try
- End Sub
- Public Sub tick()
- Try
- If (DateAndTime.Now.Subtract(Me.timerSinceCreation).TotalMilliseconds < 250) Then
- Me.timerLive = DateAndTime.Now
- Else
- If (DateAndTime.Now.Subtract(Me.timerLive).TotalMilliseconds >= 3000) Then
- Throw New Exception("done")
- End If
- Me.obj.ApplyForce(Me.moveDir)
- Me.timeCounter = (Me.timeCounter + 10)
- If (Me.timeCounter = 200) Then
- Me.timeCounter = 0
- Me.moveDir = New Vector3(CSng(JC2.TRandom.NextDouble), CSng(JC2.TRandom.NextDouble), 1.0!)
- End If
- If (THelper.Exists(Me.ent2) AndAlso THelper.isPed(Me.ent2)) Then
- Native.Function.Call(Hash.SET_PED_CAN_RAGDOLL, New InputArgument() {Me.ent2, 1})
- Native.Function.Call(Hash.SET_PED_TO_RAGDOLL, New InputArgument() {Me.ent2, -1, -1, 0, 0, 0})
- End If
- End If
- Catch exception1 As Exception
- ProjectData.SetProjectError(exception1)
- Dim exception As Exception = exception1
- If (Me.PTFXID <> 0) Then
- Native.Function.Call(Hash.STOP_PARTICLE_FX_LOOPED, New InputArgument() {Me.PTFXID})
- End If
- If (Me.soundID > -1) Then
- Native.Function.Call(Hash.STOP_SOUND, New InputArgument() {Me.soundID})
- End If
- JC2.listOfGasObjects.Remove(Me)
- ProjectData.ClearProjectError()
- End Try
- End Sub
- ' Fields
- Private ent2 As Entity = Nothing
- Private moveDir As Vector3
- Private obj As Prop = Nothing
- Private PTFXID As Integer = -1
- Private soundID As Integer = -1
- Private timeCounter As Integer = 0
- Private timerLive As DateTime = DateAndTime.Now
- Private timerSinceCreation As DateTime = DateAndTime.Now
- End Class
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement