Advertisement
Guest User

Rope script?

a guest
Jun 22nd, 2015
3,058
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 143.63 KB | None | 0 0
  1. Imports GTA
  2. Imports GTA.Math
  3. Imports GTA.Native
  4. Imports Microsoft.VisualBasic
  5. Imports Microsoft.VisualBasic.CompilerServices
  6. Imports System
  7. Imports System.Collections.Generic
  8. Imports System.IO
  9. Imports System.Runtime.CompilerServices
  10. Imports System.Runtime.InteropServices
  11. Imports System.Windows.Forms
  12.  
  13. Public Class JC2
  14. Inherits Script
  15. ' Methods
  16. Public Sub New()
  17. AddHandler MyBase.KeyDown, New KeyEventHandler(AddressOf Me.keyDown)
  18. AddHandler MyBase.KeyUp, New KeyEventHandler(AddressOf Me.keyUp)
  19. AddHandler MyBase.Tick, New EventHandler(AddressOf Me.general_tick)
  20. Me.scriptDisplayName = "Screw People Who Don't Share"
  21. Me.scriptCommandLine = "BaseScriptProject"
  22. Me.sGUI = "xxxxxxxxxx"
  23. Me.modFilesFolder = ""
  24. Me.bLoaded = False
  25. Me.hkParachute = Keys.Space
  26. Me.hkReleaseHookInVeh = Keys.Z
  27. Me.hkToggleHookMode = Keys.H
  28. Me.hkShowMenu = Keys.N
  29. Me.hkShowMenuKeyTwo = Keys.LControlKey
  30. Me.bEnabled = True
  31. Me.bHookMode = True
  32. Me.timerCheckMenu = DateAndTime.Now
  33. Me.sDict = "misstrevor2ig_9a"
  34. Me.sAnimFly = "get_on_plane_ped"
  35. Me.sDictJump = "oddjobs@bailbond_mountain"
  36. Me.sAnimJump = "base_jump_spot"
  37. Me.sDictLand = "misstrevor3"
  38. Me.sAnimLand = "biker_exit_2"
  39. Me.sDictPull = "rcmnigel3_trunk"
  40. Me.sAnimPull = "out_trunk_trevor"
  41. Me.sDictHang = "missfinale_b_ig_5"
  42. Me.sAnimHang = "hold_michael_loop_mic"
  43. Me.bPinFromGround = False
  44. Me.vehOnFoot = Nothing
  45. Me.timeSinceVehOnFootSet = DateAndTime.Now
  46. Me.sDictStealVeh1 = "veh@boat@jetski@front@ds"
  47. Me.sAnimStealVeh1 = "dead_fall_out"
  48. Me.sDictStealVeh1Heli = "missfinale_b_ig_5"
  49. Me.sAnimStealVeh1Heli = "hold_michael_headbut_mic"
  50. Me.sDictStealVeh2 = "veh@truck@mixer@ds@enter_exit"
  51. Me.sAnimStealVeh2 = "jack_dead_perp"
  52. Me.sDictStealVeh2b = "veh@plane@shamal@front@ps@enter_exit"
  53. Me.sAnimStealVeh2b = "jack_dead_perp"
  54. Me.canStealVeh = False
  55. Me.bPowersOn = False
  56. Me.targetHUDRot = 0
  57. Me.entityBullet = Nothing
  58. Me.entityTarget = Nothing
  59. Me.timeOut = DateAndTime.Now
  60. Me.lastDamagedEntity = Nothing
  61. Me.objectAuxList = New List(Of Entity)
  62. Me.timer1Sec = DateAndTime.Now
  63. Me.timerWaitAttachAgain = DateAndTime.Now
  64. Me.entitiesFound = New List(Of Entity)
  65. Me.handObject = Nothing
  66. Me.handObjectModelName = "hei_prop_hei_bank_mon"
  67. Me.movingToTarget = False
  68. Me.moveToTargetRope = Nothing
  69. Me.attachedToVehicle = False
  70. Me.timerPushingPlayerUp = DateAndTime.Now
  71. Me.bPushPlayerUp = False
  72. Me.chuteSpeed = 0
  73. Me.bUseRagdoll = True
  74. Me.bDisableWindMill = False
  75. Me.moveSoundID = -1
  76. Me.tmpTimeCounter = 0
  77. Me.playerParachute = Nothing
  78. Me.inititalParachutePush = True
  79. Me.targetsList = New List(Of Entity)
  80. Me.timerReloadTargets = DateAndTime.Now
  81. Me.reloadTargetPedAux = New List(Of Entity)
  82. Me.actualTarget = Nothing
  83. Me.timerSinceLastShoot = DateAndTime.Now
  84. Me.bShootDetected = False
  85. Me.last = New Vector3
  86. Me.waitForShootDetect = True
  87. Me.actualWindmill = Nothing
  88. Me.windMillObjects = New List(Of Prop)
  89. Me.Interval = 10
  90. Me.timerWaitLoad = DateAndTime.Now
  91. End Sub
  92.  
  93. 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
  94. Dim position As New Vector3(CSng(position_x), CSng(position_y), CSng(position_z))
  95. Dim rotation As New Vector3(CSng(angle_x), CSng(angle_y), CSng(angle_z))
  96. Return World.AddRope(position, rotation, length, type, max_length, min_length, p10, p11, p12, p13, p14, False)
  97. End Function
  98.  
  99. 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
  100. Dim vector3 As Vector3
  101. Dim position As Vector3 = e1.Position
  102. Dim destination As Vector3 = e2.Position
  103. If THelper.isPed(e1) Then
  104. position = Native.Function.Call(Of Vector3)(Hash.GET_PED_BONE_COORDS, New InputArgument() {e1, 0, 0, 0, 0})
  105. Native.Function.Call(Hash.SET_PED_TO_RAGDOLL, New InputArgument() {e1, -1, -1, 0, 0, 0})
  106. Native.Function.Call(Hash.SET_PED_DIES_WHEN_INJURED, New InputArgument() {e1, 0})
  107. Native.Function.Call(Hash.SET_PED_SUFFERS_CRITICAL_HITS, New InputArgument() {e1, 0})
  108. Native.Function.Call(Hash.SET_ENTITY_AS_MISSION_ENTITY, New InputArgument() {e1, 1, 1})
  109. Native.Function.Call(Hash.SET_PED_GENERATES_DEAD_BODY_EVENTS, New InputArgument() {e1, 0})
  110. If (e1.Health < 0) Then
  111. Native.Function.Call(Hash.REVIVE_INJURED_PED, New InputArgument() {e1})
  112. e1.Health = 100
  113. End If
  114. End If
  115. If THelper.isPed(e2) Then
  116. destination = Native.Function.Call(Of Vector3)(Hash.GET_PED_BONE_COORDS, New InputArgument() {e2, 0, 0, 0, 0})
  117. Native.Function.Call(Hash.SET_PED_TO_RAGDOLL, New InputArgument() {e2, -1, -1, 0, 0, 0})
  118. Native.Function.Call(Hash.SET_PED_DIES_WHEN_INJURED, New InputArgument() {e2, 0})
  119. Native.Function.Call(Hash.SET_PED_SUFFERS_CRITICAL_HITS, New InputArgument() {e2, 0})
  120. Native.Function.Call(Hash.SET_ENTITY_AS_MISSION_ENTITY, New InputArgument() {e2, 1, 1})
  121. Native.Function.Call(Hash.SET_PED_GENERATES_DEAD_BODY_EVENTS, New InputArgument() {e2, 0})
  122. If (e2.Health < 0) Then
  123. Native.Function.Call(Hash.REVIVE_INJURED_PED, New InputArgument() {e2})
  124. e2.Health = 100
  125. End If
  126. End If
  127. Dim argument As New InputArgument(0)
  128. Dim argument2 As New InputArgument(0)
  129. Dim num As Double = (World.GetDistance(position, destination) * distCoef)
  130. If (forcedDist > 0) Then
  131. num = forcedDist
  132. ElseIf (num <= 10) Then
  133. num = 10
  134. End If
  135. If (offset_E1 <> vector3) Then
  136. offset_E1 = DirectCast((offset_E1 * 0.5!), Vector3)
  137. 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})
  138. End If
  139. If (offset_E2 <> vector3) Then
  140. offset_E2 = DirectCast((offset_E2 * 0.5!), Vector3)
  141. 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})
  142. End If
  143. THelper.isPed(e1)
  144. THelper.isPed(e2)
  145. 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})
  146. JC2.gasObject(e1, e2)
  147. JC2.gasObject(e2, e1)
  148. Return rope
  149. End Function
  150.  
  151. 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())
  152. Dim vector2 As Vector3
  153. Dim position As Vector3 = e.Position
  154. If (forcedPos <> vector2) Then
  155. position = forcedPos
  156. End If
  157. If (offset <> vector2) Then
  158. position = (position + offset)
  159. End If
  160. Native.Function.Call(Hash.ATTACH_ROPE_TO_ENTITY, New InputArgument() {rope.Handle, e, position.X, position.Y, position.Z, 0})
  161. Native.Function.Call(Hash._0x538D1179EC1AA9A9, New InputArgument() {rope.Handle})
  162. End Sub
  163.  
  164. Private Sub attachToTarget(ByVal eTarget As Entity, Optional ByRef forcedPos As Vector3 = Nothing)
  165. Dim vector4 As Vector3
  166. If (THelper.Exists(eTarget) OrElse (Not forcedPos Is vector4)) Then
  167. Dim vector5 As Vector3
  168. Me.checkHandObject()
  169. Script.Wait(50)
  170. Me.resetHandObject()
  171. If (forcedPos Is vector4) Then
  172. If (Not eTarget Is Nothing) Then
  173. vector5 = New Vector3(0.0!, 0.0!, 1.15!)
  174. Me.moveToTargetRope = Me.createRopeForPlayer(eTarget, Me.handObject, vector4, vector5)
  175. Me.movingToTarget = True
  176. End If
  177. Else
  178. Dim vector2 As Vector3 = forcedPos
  179. Dim vector As Vector3 = DirectCast(THelper.RotationToDirection(GameplayCamera.Rotation), Vector3)
  180. Dim num As Double = 0.05
  181. Dim vector3 As Vector3 = (vector2 + DirectCast((vector * CSng(num)), Vector3))
  182. Do
  183. vector2.Z = World.GetGroundZ((vector3 + DirectCast((Vector3.WorldUp * 100.0!), Vector3)))
  184. If ((vector2.Z >= forcedPos.Z) AndAlso (vector2.DistanceTo(forcedPos) < 5.0!)) Then
  185. forcedPos = vector2
  186. Exit Do
  187. End If
  188. vector2 = forcedPos
  189. vector3 = (vector3 + DirectCast((vector * CSng(num)), Vector3))
  190. Loop While (THelper.getDistance2D(vector3, forcedPos) <= 3)
  191. forcedPos = DirectCast((forcedPos + (Vector3.WorldUp * 0.8!)), Vector3)
  192. vector5 = New Vector3(-0.05!, -0.05!, 1.1!)
  193. Me.moveToTargetRope = Me.createRopeForPlayer(eTarget, Me.handObject, vector2, vector5)
  194. Me.movingToTarget = True
  195. End If
  196. End If
  197. End Sub
  198.  
  199. Private Sub cancelMoveToTarget()
  200. If Me.movingToTarget Then
  201. Me.movingToTarget = False
  202. Me.hideHandObject()
  203. Me.moveToTargetRope.Delete()
  204. End If
  205. End Sub
  206.  
  207. Private Sub cancelVehAttach()
  208. If Me.attachedToVehicle Then
  209. Me.attachedToVehicle = False
  210. Me.moveToTarget_TargetVeh = Nothing
  211. Game.Player.Character.CanRagdoll = False
  212. Game.Player.Character.CanRagdoll = True
  213. Native.Function.Call(Hash.SET_PED_TO_RAGDOLL, New InputArgument() {Game.Player.Character, 100, 100, 0, 0, 0})
  214. Me.moveToTargetRope.Delete()
  215. Me.hideHandObject()
  216. End If
  217. End Sub
  218.  
  219. Public Shared Sub checkGasModelHash(ByVal ent As Entity, ByVal er As Entity, ByVal hash As Integer)
  220. If (ent.Model.Hash = hash) Then
  221. Dim objects As New TGasObjects(ent, er)
  222. End If
  223. End Sub
  224.  
  225. Private Function checkHandObject() As Boolean
  226. If Not THelper.Exists(Me.handObject) Then
  227. JC2.handObjectModel = New Model(Native.Function.Call(Of Integer)(Hash.GET_HASH_KEY, New InputArgument() {Me.handObjectModelName}))
  228. JC2.handObjectModel.Request()
  229. Dim now As DateTime = DateAndTime.Now
  230. Do While (Not JC2.handObjectModel.IsLoaded And (DateAndTime.Now.Subtract(now).TotalMilliseconds < 500))
  231. Script.Wait(50)
  232. Loop
  233. Me.handObject = World.CreateProp(JC2.handObjectModel, (Game.Player.Character.Position + DirectCast((Vector3.WorldDown * 49.0!), Vector3)), True, False)
  234. End If
  235. Return THelper.Exists(Me.handObject)
  236. End Function
  237.  
  238. Private Sub checkMenu()
  239. If (DateAndTime.Now.Subtract(Me.timerCheckMenu).TotalMilliseconds > 1000) Then
  240. Me.timerCheckMenu = DateAndTime.Now
  241. If (Me.iniFileScripts.settingsGetString("menu", "display", "", True) = THelper.getScriptname) Then
  242. Me.iniFileScripts.WriteINI("menu", "display", "")
  243. Me.mMenu.closeMenu()
  244. Me.mMenu.showMenu()
  245. End If
  246. End If
  247. End Sub
  248.  
  249. 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)
  250. Try
  251. If (((DateAndTime.Now.Subtract(tmp.timerSinceAttach).TotalMilliseconds > 1000) AndAlso e2Object) AndAlso ((e2.Velocity.Length <= 0.01) AndAlso e1Vehicle)) Then
  252. Dim vector As Vector3
  253. Dim vehicle As Vehicle = DirectCast(e1, Vehicle)
  254. Dim velocity As Vector3 = e1.Velocity
  255. Dim num3 As Double = velocity.Length
  256. Dim flag As Boolean = (vehicle.Model.IsHelicopter OrElse vehicle.Model.IsPlane)
  257. If (Not e1 Is tmp.p1) Then
  258. vector = Native.Function.Call(Of Vector3)(Hash.GET_ROPE_VERTEX_COORD, New InputArgument() {tmp.rope.Handle, 0})
  259. Else
  260. vector = Native.Function.Call(Of Vector3)(Hash.GET_ROPE_LAST_VERTEX_COORD, New InputArgument() {tmp.rope.Handle})
  261. End If
  262. Dim distance As Double = World.GetDistance(e2.Position, vector)
  263. If (((distance >= (tmp.dist * 0.95)) AndAlso (num3 > 5)) AndAlso (vehicle.IsOnAllWheels OrElse flag)) Then
  264. Dim vector2 As Vector3 = Vector3.Normalize((vector - e1.Position))
  265. Dim worldUp As Vector3 = Vector3.WorldUp
  266. If ((flag AndAlso (num3 > 30)) AndAlso (vehicle.EngineHealth > 10.0!)) Then
  267. vehicle.EngineHealth = 0.0!
  268. Throw New Exception("done")
  269. End If
  270. vector2.Z = 0.0!
  271. If e1Vehicle Then
  272. velocity = (vector2 - Vector3.Normalize(e1.Velocity))
  273. If ((((velocity.Length > 0.3) AndAlso (num3 > 10)) AndAlso e1.Model.IsBike) OrElse e1.Model.IsBicycle) Then
  274. Me.ejectBikers(DirectCast(e1, Vehicle))
  275. End If
  276. If (num3 > 25) Then
  277. Dim num4 As Short = 0
  278. Do
  279. Native.Function.Call(Hash.SET_VEHICLE_DOOR_LATCHED, New InputArgument() {e1, num4})
  280. num4 = CShort((num4 + 1))
  281. Loop While (num4 <= 6)
  282. Dim num5 As Short = 0
  283. Do
  284. Native.Function.Call(Hash.SMASH_VEHICLE_WINDOW, New InputArgument() {e1, num5})
  285. num5 = CShort((num5 + 1))
  286. Loop While (num5 <= 7)
  287. Native.Function.Call(Hash._DETACH_VEHICLE_WINDSCREEN, New InputArgument() {e1})
  288. End If
  289. End If
  290. velocity = New Vector3(1.0!, 1.0!, 1.0!)
  291. e1.ApplyForce(DirectCast(((((vector2 + worldUp) - Vector3.Normalize(e1.Velocity)) * CSng(num3)) * 0.5!), Vector3), velocity)
  292. End If
  293. End If
  294. Catch exception1 As Exception
  295. ProjectData.SetProjectError(exception1)
  296. ProjectData.ClearProjectError()
  297. End Try
  298. End Sub
  299.  
  300. Private Sub clearLists()
  301. If (Me.objectAuxList.Count > 0) Then
  302. Dim i As Integer = (Me.objectAuxList.Count - 1)
  303. Do While (i >= 0)
  304. Try
  305. Me.objectAuxList.Item(i).MarkAsNoLongerNeeded()
  306. Catch exception1 As Exception
  307. ProjectData.SetProjectError(exception1)
  308. ProjectData.ClearProjectError()
  309. End Try
  310. i = (i + -1)
  311. Loop
  312. Me.objectAuxList.Clear()
  313. End If
  314. If (JC2.entitiesInRope.Count > 0) Then
  315. Dim j As Integer = (JC2.entitiesInRope.Count - 1)
  316. Do While (j >= 0)
  317. Try
  318. If THelper.Exists(JC2.entitiesInRope.Item(j).p1) Then
  319. JC2.entitiesInRope.Item(j).p1.MarkAsNoLongerNeeded()
  320. End If
  321. Catch exception2 As Exception
  322. ProjectData.SetProjectError(exception2)
  323. ProjectData.ClearProjectError()
  324. End Try
  325. Try
  326. If THelper.Exists(JC2.entitiesInRope.Item(j).p2) Then
  327. JC2.entitiesInRope.Item(j).p2.MarkAsNoLongerNeeded()
  328. End If
  329. Catch exception3 As Exception
  330. ProjectData.SetProjectError(exception3)
  331. ProjectData.ClearProjectError()
  332. End Try
  333. j = (j + -1)
  334. Loop
  335. JC2.entitiesInRope.Clear()
  336. End If
  337. End Sub
  338.  
  339. 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
  340. If (THelper.isPed(ent1) AndAlso Not THelper.Exists(ent2)) Then
  341. distanceCoef = 1
  342. forcedDist = World.GetDistance(ent1.Position, ent2.Position)
  343. End If
  344. Return JC2.createRope(ent1.Position, ent2.Position, distanceCoef, forcedDist)
  345. End Function
  346.  
  347. 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
  348. Dim vector As Vector3 = pos1
  349. Dim length As Double = (World.GetDistance(pos1, pos2) * distanceCoef)
  350. If (forcedDist > 0) Then
  351. length = forcedDist
  352. ElseIf (length <= 0) Then
  353. length = 1
  354. End If
  355. Dim argument As New InputArgument(0)
  356. Native.Function.Call(Hash.ROPE_LOAD_TEXTURES, New InputArgument(0 - 1) {})
  357. Dim vector2 As Vector3 = THelper.directionToRotation(Vector3.Normalize((pos2 - pos1)), 0)
  358. 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)
  359. Script.Wait(10)
  360. Native.Function.Call(Hash.ACTIVATE_PHYSICS, New InputArgument() {rope2.Handle})
  361. Return rope2
  362. End Function
  363.  
  364. 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
  365. Dim position As Vector3
  366. Dim rope As Rope = Nothing
  367. Dim vector4 As Vector3
  368. If THelper.Exists(eTarget) Then
  369. position = eTarget.Position
  370. rope = JC2.createRope(Game.Player.Character, eTarget, 0.4, 0)
  371. If THelper.Exists(tmpObjAuxR) Then
  372. Me.attachRopeToEntity(rope, tmpObjAuxR, ropeOffset, vector4)
  373. Return rope
  374. End If
  375. Dim vector2 As Vector3 = Native.Function.Call(Of Vector3)(Hash.GET_PED_BONE_COORDS, New InputArgument() {Game.Player.Character, &H6F06, 0, 0, 0})
  376. vector2.Z = (vector2.Z + CSng(0.01))
  377. Me.attachRopeToEntity(rope, Game.Player.Character, vector4, vector2)
  378. Return rope
  379. End If
  380. If (forcedPos <> vector4) Then
  381. position = forcedPos
  382. rope = JC2.createRope(Game.Player.Character.Position, position, 0.4, 0)
  383. Dim num As Integer = (Native.Function.Call(Of Integer)(Hash.GET_ROPE_VERTEX_COUNT, New InputArgument() {rope.Handle}) - 1)
  384. If THelper.Exists(tmpObjAuxR) Then
  385. Me.attachRopeToEntity(rope, tmpObjAuxR, ropeOffset, vector4)
  386. Else
  387. Dim vector3 As Vector3 = Native.Function.Call(Of Vector3)(Hash.GET_PED_BONE_COORDS, New InputArgument() {Game.Player.Character, &H6F06, 0, 0, 0})
  388. vector3.Z = (vector3.Z + CSng(0.01))
  389. Me.attachRopeToEntity(rope, Game.Player.Character, vector4, vector3)
  390. End If
  391. Native.Function.Call(Hash.PIN_ROPE_VERTEX, New InputArgument() {rope.Handle, num, position.X, position.Y, position.Z})
  392. End If
  393. Return rope
  394. End Function
  395.  
  396. Private Sub ejectBikers(ByVal ent As Vehicle)
  397. Dim num As Short = -1
  398. Do
  399. Dim pedOnSeat As Ped = ent.GetPedOnSeat(DirectCast(num, VehicleSeat))
  400. If THelper.Exists(pedOnSeat) Then
  401. pedOnSeat.Task.ClearAll()
  402. Native.Function.Call(Hash.TASK_LEAVE_VEHICLE, New InputArgument() {pedOnSeat, ent, &H1000})
  403. pedOnSeat.CanRagdoll = True
  404. Native.Function.Call(Hash.SET_PED_TO_RAGDOLL, New InputArgument() {pedOnSeat, &HBB8, &HBB8, 0, 0, 0})
  405. pedOnSeat.ApplyForce(DirectCast(((ent.Velocity * 0.8!) + (Vector3.WorldUp * 2.0!)), Vector3), Vector3.WorldNorth)
  406. End If
  407. num = CShort((num + 1))
  408. Loop While (num <= 7)
  409. End Sub
  410.  
  411. Private Function entitiesLinked(ByVal ent1 As Entity, ByVal ent2 As Entity) As Boolean
  412. Dim rope As TEntityInRope
  413. For Each rope In JC2.entitiesInRope
  414. 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
  415. Return True
  416. End If
  417. Next
  418. Return False
  419. End Function
  420.  
  421. Private Sub entitiesSubTick()
  422. Dim i As Integer = (JC2.entitiesInRope.Count - 1)
  423. Do While (i >= 0)
  424. Dim tmp As TEntityInRope = JC2.entitiesInRope.Item(i)
  425. Try
  426. tmp.pedTick()
  427. If (Not THelper.Exists(tmp.p1) OrElse Not THelper.Exists(tmp.p2)) Then
  428. Throw New Exception(("not exists " & Conversions.ToString(THelper.Exists(tmp.p1)) & " " & Conversions.ToString(THelper.Exists(tmp.p2))))
  429. End If
  430. 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
  431. tmp.p1.ApplyForce(DirectCast(((tmp.p2.Position - tmp.p1.Position) * 0.2!), Vector3))
  432. 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
  433. tmp.p2.ApplyForce(DirectCast(((tmp.p1.Position - tmp.p2.Position) * 0.2!), Vector3))
  434. End If
  435. Try
  436. If THelper.Exists(tmp.p1) Then
  437. 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
  438. tmp.p1.MarkAsNoLongerNeeded()
  439. tmp.p1 = Nothing
  440. Try
  441. If THelper.Exists(tmp.p2) Then
  442. tmp.p2.MarkAsNoLongerNeeded()
  443. End If
  444. tmp.p2 = Nothing
  445. Catch exception1 As Exception
  446. ProjectData.SetProjectError(exception1)
  447. ProjectData.ClearProjectError()
  448. End Try
  449. Throw New Exception(("away " & Conversions.ToString(World.GetDistance(tmp.p1.Position, GameplayCamera.Position))))
  450. End If
  451. If (((Me.tmpTimeCounter Mod 100) = 0) AndAlso THelper.Exists(tmp.p2)) Then
  452. Dim distance As Double = World.GetDistance(tmp.p1.Position, tmp.p2.Position)
  453. Native.Function.Call(Hash.ROPE_FORCE_LENGTH, New InputArgument() {Me.moveToTargetRope.Handle, (distance * 0.8)})
  454. End If
  455. 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
  456. tmp.p1.ApplyForce(Vector3.Normalize((tmp.p2.Position - tmp.p1.Position)), (Vector3.WorldNorth + Vector3.WorldEast))
  457. If (tmp.p1.Model.IsBicycle OrElse tmp.p1.Model.IsBike) Then
  458. Me.ejectBikers(DirectCast(tmp.p1, Vehicle))
  459. ElseIf (tmp.p1.Model.IsHelicopter OrElse tmp.p1.Model.IsPlane) Then
  460. Native.Function.Call(Hash.SET_VEHICLE_ENGINE_HEALTH, New InputArgument() {tmp.p1, -1})
  461. End If
  462. End If
  463. 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
  464. tmp.p2.ApplyForce(Vector3.Normalize((tmp.p1.Position - tmp.p2.Position)), (Vector3.WorldNorth + Vector3.WorldEast))
  465. If (tmp.p2.Model.IsBicycle OrElse tmp.p2.Model.IsBike) Then
  466. Me.ejectBikers(DirectCast(tmp.p2, Vehicle))
  467. ElseIf (tmp.p2.Model.IsHelicopter OrElse tmp.p2.Model.IsPlane) Then
  468. Native.Function.Call(Hash.SET_VEHICLE_ENGINE_HEALTH, New InputArgument() {tmp.p2, -1})
  469. End If
  470. End If
  471. Me.checkVehiclePull(tmp, tmp.p1, tmp.p2, tmp.isObject_p1, tmp.isObject_p2, tmp.isVehicle_p1, tmp.isVehicle_p2)
  472. Me.checkVehiclePull(tmp, tmp.p2, tmp.p1, tmp.isObject_p2, tmp.isObject_p1, tmp.isVehicle_p2, tmp.isVehicle_p1)
  473. End If
  474. Catch exception3 As Exception
  475. ProjectData.SetProjectError(exception3)
  476. Dim exception As Exception = exception3
  477. Throw New Exception(("error: " & exception.Message))
  478. End Try
  479. Catch exception4 As Exception
  480. ProjectData.SetProjectError(exception4)
  481. Dim exception2 As Exception = exception4
  482. tmp.remove()
  483. ProjectData.ClearProjectError()
  484. End Try
  485. i = (i + -1)
  486. Loop
  487. End Sub
  488.  
  489. Private Function findObject(ByVal coords As Vector3) As Prop
  490. Dim argument As New OutputArgument
  491. Dim num As Integer = Native.Function.Call(Of Integer)(Hash.PLAYER_ID, New InputArgument(0 - 1) {})
  492. Try
  493. If Native.Function.Call(Of Boolean)(Hash._GET_AIMED_ENTITY, New InputArgument() {num, argument}) Then
  494. Dim result As Prop = argument.GetResult(Of Prop)()
  495. If THelper.Exists(result) Then
  496. Return result
  497. End If
  498. End If
  499. Catch exception1 As Exception
  500. ProjectData.SetProjectError(exception1)
  501. Dim exception As Exception = exception1
  502. ProjectData.ClearProjectError()
  503. End Try
  504. Return Nothing
  505. End Function
  506.  
  507. Private Function findTarget(ByVal coords As Vector3, ByRef offset As Vector3) As Entity
  508. Dim flag As Boolean = False
  509. Dim e As Entity = Nothing
  510. offset = Vector3.Zero
  511. Me.entitiesFound.Clear()
  512. Dim entity3 As Entity
  513. For Each entity3 In Me.targetsList
  514. Try
  515. If THelper.Exists(entity3) Then
  516. Native.Function.Call(Hash.SET_ENTITY_CAN_BE_DAMAGED, New InputArgument() {entity3, 1})
  517. If Native.Function.Call(Of Boolean)(Hash.HAS_ENTITY_BEEN_DAMAGED_BY_ENTITY, New InputArgument() {entity3, Game.Player.Character}) Then
  518. Native.Function.Call(Hash.CLEAR_ENTITY_LAST_DAMAGE_ENTITY, New InputArgument() {entity3})
  519. 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
  520. e = entity3
  521. Exit For
  522. End If
  523. End If
  524. End If
  525. Catch exception1 As Exception
  526. ProjectData.SetProjectError(exception1)
  527. ProjectData.ClearProjectError()
  528. End Try
  529. Next
  530. If Not THelper.Exists(e) Then
  531. Dim vehicle As Vehicle
  532. For Each vehicle In World.GetNearbyVehicles(Game.Player.Character, 100.0!)
  533. Try
  534. If THelper.Exists(vehicle) Then
  535. Native.Function.Call(Hash.SET_ENTITY_CAN_BE_DAMAGED, New InputArgument() {vehicle, 1})
  536. If Not Me.entitiesFound.Contains(vehicle) Then
  537. Me.entitiesFound.Add(vehicle)
  538. End If
  539. If Native.Function.Call(Of Boolean)(Hash.HAS_ENTITY_BEEN_DAMAGED_BY_ENTITY, New InputArgument() {vehicle, Game.Player.Character}) Then
  540. Native.Function.Call(Hash.CLEAR_ENTITY_LAST_DAMAGE_ENTITY, New InputArgument() {vehicle})
  541. 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
  542. e = vehicle
  543. offset = Native.Function.Call(Of Vector3)(Hash.GET_OFFSET_FROM_ENTITY_GIVEN_WORLD_COORDS, New InputArgument() {vehicle, coords.X, coords.Y, coords.Z})
  544. flag = True
  545. End If
  546. End If
  547. End If
  548. Catch exception2 As Exception
  549. ProjectData.SetProjectError(exception2)
  550. ProjectData.ClearProjectError()
  551. End Try
  552. Next
  553. End If
  554. If Not THelper.Exists(e) Then
  555. flag = False
  556. Dim ped As Ped
  557. For Each ped In World.GetNearbyPeds(Game.Player.Character, 100.0!)
  558. Try
  559. If (THelper.Exists(ped) AndAlso (ped.Health >= 0)) Then
  560. Native.Function.Call(Hash.SET_ENTITY_CAN_BE_DAMAGED, New InputArgument() {ped, 1})
  561. If Not Me.entitiesFound.Contains(ped) Then
  562. Me.entitiesFound.Add(ped)
  563. End If
  564. If Native.Function.Call(Of Boolean)(Hash.HAS_ENTITY_BEEN_DAMAGED_BY_ENTITY, New InputArgument() {ped, Game.Player.Character}) Then
  565. Native.Function.Call(Hash.CLEAR_ENTITY_LAST_DAMAGE_ENTITY, New InputArgument() {ped})
  566. 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
  567. e = ped
  568. offset = New Vector3(0.0!, 0.0!, -0.25!)
  569. flag = True
  570. End If
  571. End If
  572. End If
  573. Catch exception3 As Exception
  574. ProjectData.SetProjectError(exception3)
  575. ProjectData.ClearProjectError()
  576. End Try
  577. Next
  578. End If
  579. If Not THelper.Exists(e) Then
  580. e = Game.Player.GetTargetedEntity
  581. End If
  582. If ((Not e Is Game.Player.Character) AndAlso (Not e Is Game.Player.Character.CurrentVehicle)) Then
  583. Return e
  584. End If
  585. Return Nothing
  586. End Function
  587.  
  588. Private Sub findWindMill()
  589. If Not Me.bDisableWindMill Then
  590. Try
  591. If Game.Player.IsAiming Then
  592. Dim argument As New OutputArgument
  593. If Native.Function.Call(Of Boolean)(Hash._GET_AIMED_ENTITY, New InputArgument() {Game.Player, argument}) Then
  594. Dim result As Prop = argument.GetResult(Of Prop)()
  595. If ((THelper.Exists(result) AndAlso (result.Model.Hash = JC2.windMillHash)) AndAlso (Not Me.actualWindmill Is result)) Then
  596. Me.actualWindmill = result
  597. Me.prepareWindMill(result)
  598. End If
  599. Else
  600. Dim vector As Vector3 = DirectCast(THelper.RotationToDirection(GameplayCamera.Rotation), Vector3)
  601. Dim vector3 As Vector3 = (GameplayCamera.Position + DirectCast((vector * 30.0!), Vector3))
  602. Dim position As Vector3 = vector3
  603. Dim e As Prop = Nothing
  604. Do While (vector3.DistanceTo(position) < 50.0!)
  605. Dim vector4 As Vector3 = THelper.getGroundPos((vector3 + DirectCast((Vector3.WorldUp * 50.0!), Vector3)))
  606. 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})
  607. If THelper.Exists(e) Then
  608. Exit Do
  609. End If
  610. vector3 = (vector3 + DirectCast((vector * 4.0!), Vector3))
  611. Loop
  612. If (THelper.Exists(e) AndAlso (Not Me.actualWindmill Is e)) Then
  613. Me.actualWindmill = e
  614. Me.prepareWindMill(e)
  615. End If
  616. End If
  617. End If
  618. Catch exception1 As Exception
  619. ProjectData.SetProjectError(exception1)
  620. Dim exception As Exception = exception1
  621. ProjectData.ClearProjectError()
  622. End Try
  623. End If
  624. End Sub
  625.  
  626. Public Shared Sub finishEntityInRope(ByVal er As TEntityInRope)
  627. JC2.entitiesInRope.Remove(er)
  628. End Sub
  629.  
  630. Public Shared Sub gasObject(ByVal ent As Entity, ByVal er As Entity)
  631. If THelper.isObject(ent) Then
  632. JC2.checkGasModelHash(ent, er, -1779825653)
  633. JC2.checkGasModelHash(ent, er, -1738103333)
  634. JC2.checkGasModelHash(ent, er, -1348598835)
  635. JC2.checkGasModelHash(ent, er, &H4BBBAC6E)
  636. JC2.checkGasModelHash(ent, er, -921781850)
  637. JC2.checkGasModelHash(ent, er, -925511118)
  638. JC2.checkGasModelHash(ent, er, &H78053C0E)
  639. JC2.checkGasModelHash(ent, er, &H4A46E08E)
  640. JC2.checkGasModelHash(ent, er, &H2EA68690)
  641. JC2.checkGasModelHash(ent, er, &H10D18544)
  642. JC2.checkGasModelHash(ent, er, -260208501)
  643. JC2.checkGasModelHash(ent, er, &H6277EC7E)
  644. JC2.checkGasModelHash(ent, er, &H25A0F2D1)
  645. JC2.checkGasModelHash(ent, er, &H148B20A6)
  646. JC2.checkGasModelHash(ent, er, -1920001264)
  647. JC2.checkGasModelHash(ent, er, &H37D28693)
  648. JC2.checkGasModelHash(ent, er, &H4A0DAB09)
  649. End If
  650. End Sub
  651.  
  652. Private Sub general_tick(ByVal sender As Object, ByVal e As EventArgs)
  653. Dim vector8 As Vector3
  654. Dim velocity As Vector3
  655. If Not Me.bLoaded Then
  656. Me.loadMod()
  657. Return
  658. End If
  659. Me.checkMenu()
  660. Me.mMenu.menuTick()
  661. If Not Me.bEnabled Then
  662. Return
  663. End If
  664. Me.reloadTargets()
  665. If (Me.canStealVeh AndAlso THelper.isButtonJustPressed(controls.INPUT_ENTER)) Then
  666. Me.stealVeh()
  667. End If
  668. If ((Me.tmpTimeCounter Mod 500) = 0) Then
  669. Dim ped As Ped
  670. For Each ped In Me.reloadTargetPedAux
  671. Try
  672. If (Not ped Is Game.Player.Character) Then
  673. ped.Health = -1
  674. ped.IsVisible = False
  675. End If
  676. Catch exception1 As Exception
  677. ProjectData.SetProjectError(exception1)
  678. ProjectData.ClearProjectError()
  679. End Try
  680. Next
  681. End If
  682. If THelper.Exists(Me.vehOnFoot) Then
  683. If ((Me.tmpTimeCounter Mod 100) = 0) Then
  684. If ((Not Me.attachedToVehicle AndAlso Not Me.vehOnFoot.IsTouching(Game.Player.Character)) AndAlso (DateAndTime.Now.Subtract(Me.timeSinceVehOnFootSet).TotalMilliseconds > 2000)) Then
  685. Me.vehOnFoot = Nothing
  686. Me.canStealVeh = False
  687. Else
  688. Dim pedOnSeat As Ped = Me.vehOnFoot.GetPedOnSeat(VehicleSeat.Driver)
  689. If Not THelper.Exists(pedOnSeat) Then
  690. Me.canStealVeh = True
  691. Else
  692. Dim offsetInWorldCoords As Vector3 = pedOnSeat.GetOffsetInWorldCoords(Vector3.Zero)
  693. Me.canStealVeh = (Me.attachedToVehicle OrElse (Not Me.vehOnFoot.Model.IsTrain AndAlso (THelper.getDistance2D(offsetInWorldCoords, Game.Player.Character.Position) < 1)))
  694. If Me.canStealVeh Then
  695. UI.ShowSubtitle("Press Enter Vehicle button to steal the vehicle...", 150)
  696. End If
  697. End If
  698. End If
  699. End If
  700. ElseIf ((Me.tmpTimeCounter Mod 200) = 0) Then
  701. Me.canStealVeh = False
  702. End If
  703. Dim i As Integer = (JC2.listOfGasObjects.Count - 1)
  704. Do While (i >= 0)
  705. Try
  706. JC2.listOfGasObjects.Item(i).tick()
  707. Catch exception2 As Exception
  708. ProjectData.SetProjectError(exception2)
  709. ProjectData.ClearProjectError()
  710. End Try
  711. i = (i + -1)
  712. Loop
  713. Me.tmpTimeCounter = (Me.tmpTimeCounter + 10)
  714. If (Me.tmpTimeCounter > &H3E8) Then
  715. Me.tmpTimeCounter = 0
  716. End If
  717. If ((Me.tmpTimeCounter Mod 500) = 0) Then
  718. Me.findWindMill()
  719. End If
  720. Me.subTick()
  721. If (Game.Player.Character.Health <= 0) Then
  722. Me.cancelMoveToTarget()
  723. Me.cancelVehAttach()
  724. Me.clearLists()
  725. Return
  726. End If
  727. Dim num As Integer = -1
  728. If Me.bPushPlayerUp Then
  729. num = Native.Function.Call(Of Integer)(Hash.GET_PED_PARACHUTE_STATE, New InputArgument() {Game.Player.Character})
  730. Dim totalMilliseconds As Double = DateAndTime.Now.Subtract(Me.timerPushingPlayerUp).TotalMilliseconds
  731. Dim direction As Vector3 = DirectCast(THelper.RotationToDirection(GameplayCamera.Rotation), Vector3)
  732. direction.Z = 0.0!
  733. If Not THelper.Exists(Me.playerParachute) Then
  734. Dim vector3 As Vector3 = Game.Player.Character.Position
  735. Dim num4 As Integer = Native.Function.Call(Of Integer)(Hash.GET_HASH_KEY, New InputArgument() {"p_parachute1_sp_s"})
  736. 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})
  737. Me.inititalParachutePush = True
  738. End If
  739. If (totalMilliseconds < 3000) Then
  740. If (((num = 1) AndAlso Me.inititalParachutePush) AndAlso THelper.Exists(Me.playerParachute)) Then
  741. velocity = Me.playerParachute.Velocity
  742. Me.inititalParachutePush = (velocity.Z < 1.0!)
  743. Dim playerParachute As Prop = Me.playerParachute
  744. playerParachute.Velocity = (playerParachute.Velocity + DirectCast((Vector3.WorldUp * 10.0!), Vector3))
  745. End If
  746. If (num = 1) Then
  747. velocity = Game.Player.Character.Velocity
  748. If (velocity.Length < (Me.chuteSpeed * 0.4)) Then
  749. Game.Player.Character.ApplyForce(direction)
  750. End If
  751. End If
  752. Else
  753. Me.bPushPlayerUp = False
  754. End If
  755. End If
  756. If THelper.Exists(Me.playerParachute) Then
  757. If (Not Game.IsKeyPressed(Keys.W) AndAlso (Me.playerParachute.Velocity.Z < -2.5)) Then
  758. Me.playerParachute.ApplyForce(Vector3.WorldUp)
  759. End If
  760. velocity = Me.playerParachute.Velocity
  761. If ((velocity.Length < (Me.chuteSpeed * 0.4)) AndAlso Not Game.IsKeyPressed(Keys.S)) Then
  762. Me.playerParachute.ApplyForce(DirectCast(THelper.RotationToDirection(Me.playerParachute.Rotation), Vector3))
  763. End If
  764. Else
  765. Me.playerParachute = Nothing
  766. End If
  767. If Me.attachedToVehicle Then
  768. Try
  769. If Game.IsKeyPressed(Me.hkReleaseHookInVeh) Then
  770. Me.cancelVehAttach()
  771. ElseIf (THelper.Exists(Me.moveToTarget_TargetVeh) AndAlso Me.moveToTarget_TargetVeh.Model.IsHelicopter) Then
  772. velocity = New Vector3(0.0!, 0.0!, -2.0!)
  773. Dim vector4 As Vector3 = Me.moveToTarget_TargetVeh.GetOffsetInWorldCoords(velocity)
  774. velocity = New Vector3(0.0!, 0.0!, -2.0!)
  775. Dim vector5 As Vector3 = Me.moveToTarget_TargetVeh.GetOffsetInWorldCoords(velocity)
  776. If THelper.Exists(Me.handObject) Then
  777. Me.handObject.Velocity = DirectCast(((vector4 - Me.handObject.Position) * 4.0!), Vector3)
  778. End If
  779. If ((Me.tmpTimeCounter Mod 100) = 0) Then
  780. End If
  781. End If
  782. Return
  783. Catch exception3 As Exception
  784. ProjectData.SetProjectError(exception3)
  785. Dim exception As Exception = exception3
  786. Me.cancelVehAttach()
  787. ProjectData.ClearProjectError()
  788. Return
  789. End Try
  790. End If
  791. 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
  792. Native.Function.Call(Hash.SET_PED_CAN_RAGDOLL, New InputArgument() {Me.entityBullet, 1})
  793. Native.Function.Call(Hash.SET_PED_TO_RAGDOLL, New InputArgument() {Me.entityBullet, &H1388, &H1388, 0, 0, 0})
  794. Native.Function.Call(Hash.SET_PED_DIES_WHEN_INJURED, New InputArgument() {Me.entityBullet, 0})
  795. Native.Function.Call(Hash.SET_PED_GENERATES_DEAD_BODY_EVENTS, New InputArgument() {Me.entityBullet, 0})
  796. End If
  797. 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
  798. Native.Function.Call(Hash.SET_PED_CAN_RAGDOLL, New InputArgument() {Me.entityTarget, 1})
  799. Native.Function.Call(Hash.SET_PED_TO_RAGDOLL, New InputArgument() {Me.entityTarget, &H1388, &H1388, 0, 0, 0})
  800. Native.Function.Call(Hash.SET_PED_DIES_WHEN_INJURED, New InputArgument() {Me.entityTarget, 0})
  801. Native.Function.Call(Hash.SET_PED_GENERATES_DEAD_BODY_EVENTS, New InputArgument() {Me.entityTarget, 0})
  802. End If
  803. If Not Me.movingToTarget Then
  804. GoTo Label_0DFF
  805. End If
  806. If Game.Player.IsAiming Then
  807. If (((Me.tmpTimeCounter Mod 50) = 0) AndAlso THelper.Exists(Me.entityBullet)) Then
  808. Me.resetRopeLenght(Me.entityBullet)
  809. End If
  810. GoTo Label_0DFF
  811. End If
  812. If Game.Player.Character.IsRagdoll Then
  813. Me.cancelMoveToTarget()
  814. Return
  815. End If
  816. If Not THelper.Exists(Me.entityBullet) Then
  817. Me.moveToTarget(Nothing, Me.lastImpactCoord)
  818. GoTo Label_0DBE
  819. End If
  820. If Not THelper.isPed(Me.entityBullet) Then
  821. If THelper.isObject(Me.entityBullet) Then
  822. Me.entityBullet.ApplyForce(DirectCast(((Game.Player.Character.Position - Me.entityBullet.Position) * 0.7!), Vector3), (Vector3.WorldNorth + Vector3.WorldEast))
  823. End If
  824. Me.moveToTarget(Me.entityBullet, vector8)
  825. GoTo Label_0DBE
  826. End If
  827. If THelper.Exists(Game.Player.Character.CurrentVehicle) Then
  828. Dim currentVehicle As Vehicle = Game.Player.Character.CurrentVehicle
  829. Me.cancelMoveToTarget()
  830. Dim pDist As Double = Me.entityBullet.Position.DistanceTo(currentVehicle.Position)
  831. Dim rope2 As Rope = JC2.createRope(currentVehicle, Me.entityBullet, 1, 0)
  832. JC2.attachEntitiesToRope(rope2, Me.entityBullet, currentVehicle, 1, 0, vector8, vector8)
  833. Dim rope As New TEntityInRope(Me.entityBullet, currentVehicle, rope2, pDist, Vector3.Zero, Vector3.Zero)
  834. If THelper.isObject(Me.entityBullet) Then
  835. Me.entityBullet.ApplyForce((Game.Player.Character.CurrentVehicle.Position - Me.entityBullet.Position))
  836. End If
  837. Me.entityBullet = Nothing
  838. GoTo Label_0DBE
  839. End If
  840. Dim now As DateTime = DateAndTime.Now
  841. If Not THelper.isPed(Me.entityBullet) Then
  842. GoTo Label_0B35
  843. End If
  844. Label_0AE1:
  845. If (Not Native.Function.Call(Of Boolean)(Hash.IS_PED_RAGDOLL, New InputArgument() {Me.entityBullet}) And (DateAndTime.Now.Subtract(now).TotalMilliseconds < 1000)) Then
  846. Native.Function.Call(Hash.SET_PED_CAN_RAGDOLL, New InputArgument() {Me.entityBullet, 1})
  847. Native.Function.Call(Hash.SET_PED_TO_RAGDOLL, New InputArgument() {Me.entityBullet, &HBB8, &HBB8, 0, 0, 0})
  848. GoTo Label_0AE1
  849. End If
  850. Label_0B35:
  851. If THelper.anim_requestDict(Me.sDictPull) Then
  852. Game.Player.Character.Task.ClearAllImmediately()
  853. THelper.anim_playPedAnim(Game.Player.Character, Me.sDictPull, Me.sAnimPull, 8, animFlags.normal, False)
  854. Script.Wait(100)
  855. If THelper.anim_isPlayingPedAnim(Game.Player.Character, Me.sDictPull, Me.sAnimPull, 1) Then
  856. THelper.anim_setAnimTime(Game.Player.Character, Me.sDictPull, Me.sAnimPull, 0.01)
  857. THelper.anim_setAnimSpeed(Game.Player.Character, Me.sDictPull, Me.sAnimPull, 4)
  858. End If
  859. End If
  860. Do While THelper.anim_isPlayingPedAnim(Game.Player.Character, Me.sDictPull, Me.sAnimPull, 0.05)
  861. Script.Wait(10)
  862. Loop
  863. Me.cancelMoveToTarget()
  864. GameplayCamera.Shake(CameraShake.SmallExplosion, 0.1!)
  865. Dim num6 As Double = Math.Min(15.0!, Math.Max(10.0!, Me.entityBullet.Position.DistanceTo(Game.Player.Character.Position)))
  866. Dim position As Vector3 = (Game.Player.Character.Position + DirectCast((Vector3.WorldUp * CSng(num6)), Vector3))
  867. Dim vector6 As Vector3 = Me.entityBullet.Position
  868. Do While THelper.anim_isPlayingPedAnim(Game.Player.Character, Me.sDictPull, Me.sAnimPull, 0.085)
  869. If (THelper.Exists(Me.entityBullet) AndAlso (Me.entityBullet.Position.DistanceTo(position) > 2.0!)) Then
  870. Me.entityBullet.ApplyForce(DirectCast(((Vector3.Normalize((position - vector6)) * CSng(num6)) * 0.1!), Vector3), Vector3.WorldNorth)
  871. End If
  872. Script.Wait(10)
  873. Loop
  874. GameplayCamera.StopShaking()
  875. Game.Player.Character.Task.ClearAnimation(Me.sDictPull, Me.sAnimPull)
  876. Label_0DBE:
  877. Me.entityBullet = Nothing
  878. Me.entityTarget = Nothing
  879. Me.lastImpactCoord = New Vector3
  880. Label_0DFF:
  881. Me.entitiesSubTick()
  882. Me.hookCreationTick()
  883. End Sub
  884.  
  885. <DllImport("user32", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)> _
  886. Private Shared Function GetAsyncKeyState(ByVal vkey As Integer) As Short
  887. End Function
  888.  
  889. Private Sub hideHandObject()
  890. If THelper.Exists(Me.handObject) Then
  891. Me.handObject.Detach()
  892. Me.handObject.Delete()
  893. Me.handObject = Nothing
  894. End If
  895. End Sub
  896.  
  897.  
  898. Part 2 of script.
  899.  
  900. Private Sub hookCreationTick()
  901. Try
  902. Dim position As Vector3
  903. Dim currentVehicle As Entity
  904. Dim prop As Prop
  905. Dim zero As Vector3
  906. Dim vector3 As Vector3
  907. Dim flag As Boolean
  908. Dim vector7 As Vector3
  909. Dim vector8 As Vector3
  910. Dim vector9 As Vector3
  911. If Not Me.bHookMode Then
  912. Return
  913. End If
  914. Select Case CLng(CULng(Game.Player.Character.Weapons.Current.Hash))
  915. Case &HA2719263, &H787F0BB, &H24B17070, &HFDBC8A50, &H958A4A8F, &H2C3731D9, &HAB564B93, &H34A67B97, &H678B81B1, &H99B507EA, &H4E875F73, &HF9DCBF2D, &H440E4788, &H60EC506, &H7F7497E5, &H92A27487, &H84BD7BFD, &HA0973D5E, &H93E220BD
  916. Return
  917. Case Else
  918. Dim argument As New OutputArgument
  919. flag = False
  920. If Game.Player.Character.IsShooting Then
  921. Me.timerSinceLastShoot = DateAndTime.Now
  922. Me.bShootDetected = True
  923. End If
  924. zero = Vector3.Zero
  925. prop = Nothing
  926. currentVehicle = Nothing
  927. vector3 = Vector3.Zero
  928. position = Vector3.Zero
  929. Dim objectValue As Object = RuntimeHelpers.GetObjectValue(THelper.RotationToDirection(GameplayCamera.Rotation))
  930. If Native.Function.Call(Of Boolean)(Hash.GET_PED_LAST_WEAPON_IMPACT_COORD, New InputArgument() {Game.Player.Character, argument}) Then
  931. position = (argument.GetResult(Of Vector3)() + DirectCast(objectValue, Vector3))
  932. argument.Dispose()
  933. If Not THelper.Exists(currentVehicle) Then
  934. currentVehicle = Me.findTarget(position, vector3)
  935. End If
  936. If Not THelper.Exists(currentVehicle) Then
  937. currentVehicle = Me.findObject(position)
  938. End If
  939. If (Not THelper.Exists(currentVehicle) AndAlso Me.waitForShootDetect) Then
  940. Me.waitForShootDetect = False
  941. Dim vector4 As Vector3 = DirectCast(THelper.RotationToDirection(GameplayCamera.Rotation), Vector3)
  942. Dim vector5 As Vector3 = (GameplayCamera.Position + DirectCast((vector4 * 10.0!), Vector3))
  943. Dim vector6 As Vector3 = (vector5 + DirectCast((vector4 * 500.0!), Vector3))
  944. Dim hash As Integer = CInt(Game.Player.Character.Weapons.Current.Hash)
  945. 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})
  946. Return
  947. End If
  948. flag = THelper.Exists(currentVehicle)
  949. Me.waitForShootDetect = True
  950. End If
  951. If ((Not Me.waitForShootDetect OrElse flag) OrElse ((DateAndTime.Now.Subtract(Me.timerSinceLastShoot).TotalMilliseconds >= 500) OrElse Not Me.bShootDetected)) Then
  952. GoTo Label_0510
  953. End If
  954. Dim span2 As New TimeSpan(1, 1, 1)
  955. Me.timerSinceLastShoot = DateAndTime.Now.Subtract(span2)
  956. Me.bShootDetected = False
  957. currentVehicle = Me.findTarget(Game.Player.Character.Position, vector3)
  958. If THelper.Exists(currentVehicle) Then
  959. GoTo Label_050D
  960. End If
  961. vector7 = DirectCast(THelper.RotationToDirection(GameplayCamera.Rotation), Vector3)
  962. vector8 = (GameplayCamera.Position + vector7)
  963. Dim num3 As Short = 0
  964. Do
  965. prop = THelper.getTargetedDistProp((vector8 + (vector7 * num3)), (vector8 + (vector7 * (num3 + 100))), 101)
  966. If THelper.Exists(prop) Then
  967. Exit Do
  968. End If
  969. num3 = CShort((num3 + 100))
  970. Loop While (num3 <= &H7D0)
  971. Exit Select
  972. End Select
  973. If Not THelper.Exists(prop) Then
  974. Dim num4 As Short = 0
  975. Do
  976. zero = THelper.getTargetedCoord((vector8 + (vector7 * num4)), (vector8 + (vector7 * (num4 + 100))), 101)
  977. If (zero <> Vector3.Zero) Then
  978. Exit Do
  979. End If
  980. num4 = CShort((num4 + 100))
  981. Loop While (num4 <= 500)
  982. End If
  983. flag = ((zero <> Vector3.Zero) OrElse THelper.Exists(prop))
  984. GoTo Label_0510
  985. Label_050D:
  986. flag = True
  987. Label_0510:
  988. If (flag AndAlso (DateAndTime.Now.Subtract(Me.timerWaitAttachAgain).TotalMilliseconds > 500)) Then
  989. Me.timerWaitAttachAgain = DateAndTime.Now
  990. Else
  991. Return
  992. End If
  993. If (zero <> Vector3.Zero) Then
  994. position = zero
  995. ElseIf THelper.Exists(prop) Then
  996. position = prop.Position
  997. Try
  998. currentVehicle = prop
  999. Catch exception1 As Exception
  1000. ProjectData.SetProjectError(exception1)
  1001. ProjectData.ClearProjectError()
  1002. End Try
  1003. End If
  1004. If (Not Me.bDisableWindMill AndAlso THelper.Exists(currentVehicle)) Then
  1005. If ((Not currentVehicle Is Me.actualWindmill) AndAlso (currentVehicle.Model.Hash = JC2.windMillHash)) Then
  1006. Me.actualWindmill = DirectCast(currentVehicle, Prop)
  1007. Me.prepareWindMill(currentVehicle)
  1008. End If
  1009. 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})
  1010. If ((THelper.Exists(e) AndAlso e.IsAttached) AndAlso Not e.IsVisible) Then
  1011. currentVehicle = e
  1012. ElseIf (currentVehicle.Model.Hash = JC2.windMillHash) Then
  1013. currentVehicle = Nothing
  1014. Return
  1015. End If
  1016. End If
  1017. Me.timeOut = DateAndTime.Now
  1018. If ((THelper.Exists(Game.Player.Character.CurrentVehicle) AndAlso THelper.Exists(currentVehicle)) AndAlso (Not THelper.isVehicle(currentVehicle) AndAlso THelper.Exists(Me.entityBullet))) Then
  1019. Me.entityBullet = Game.Player.Character.CurrentVehicle
  1020. Me.entityTarget = Nothing
  1021. End If
  1022. If THelper.Exists(currentVehicle) Then
  1023. Me.timeOut = DateAndTime.Now
  1024. If (Me.movingToTarget AndAlso Not THelper.Exists(Me.entityBullet)) Then
  1025. Me.entityBullet = currentVehicle
  1026. Me.moveDir = Vector3.Normalize((Me.lastImpactCoord - Me.entityBullet.Position))
  1027. Me.cancelMoveToTarget()
  1028. Me.bPinFromGround = True
  1029. Dim rope As Rope = Me.pinEntityToCoord(Me.lastImpactCoord, Me.entityBullet, Nothing, 0, vector9)
  1030. currentVehicle = Nothing
  1031. Me.entityBullet = Nothing
  1032. Me.entityTarget = Nothing
  1033. Me.lastImpactCoord = New Vector3
  1034. Else
  1035. If THelper.isPed(currentVehicle) Then
  1036. Dim ped As Ped = DirectCast(currentVehicle, Ped)
  1037. If THelper.Exists(ped.CurrentVehicle) Then
  1038. currentVehicle = ped.CurrentVehicle
  1039. End If
  1040. End If
  1041. If Not THelper.Exists(Me.entityBullet) Then
  1042. If (Not currentVehicle Is Me.entityBullet) Then
  1043. Me.entityBullet = currentVehicle
  1044. Me.entityTarget = Nothing
  1045. Me.entityBulletOffset = vector3
  1046. Me.lastImpactCoord = New Vector3
  1047. Dim forcedPos As Vector3 = vector9
  1048. Me.attachToTarget(Me.entityBullet, forcedPos)
  1049. End If
  1050. Else
  1051. Me.entityTarget = currentVehicle
  1052. Me.entityTargetOffset = vector3
  1053. Me.cancelMoveToTarget()
  1054. Me.moveDir = Vector3.Normalize((Me.entityTarget.Position - Me.entityBullet.Position))
  1055. Dim distance As Double = World.GetDistance(Me.entityTarget.Position, Me.entityBullet.Position)
  1056. Dim rope2 As Rope = JC2.createRope(Me.entityBullet, Me.entityTarget, 1, distance)
  1057. If ((Not Me.entityBullet Is Me.entityTarget) AndAlso Not Me.entitiesLinked(Me.entityBullet, Me.entityTarget)) Then
  1058. If (THelper.isObject(Me.entityBullet) AndAlso (Me.entityBullet.Velocity.Length < 0.05)) Then
  1059. Me.entityBullet.FreezePosition = False
  1060. Me.entityBullet.ApplyForce((Me.entityTarget.Position - Me.entityBullet.Position), (Vector3.WorldNorth + Vector3.WorldEast))
  1061. End If
  1062. If (THelper.isObject(Me.entityTarget) AndAlso (Me.entityTarget.Velocity.Length < 0.05)) Then
  1063. Me.entityTarget.FreezePosition = False
  1064. Me.entityTarget.ApplyForce((Me.entityBullet.Position - Me.entityTarget.Position), (Vector3.WorldNorth + Vector3.WorldEast))
  1065. End If
  1066. If (THelper.isPed(Me.entityBullet) OrElse THelper.isObject(Me.entityBullet)) Then
  1067. JC2.attachEntitiesToRope(rope2, Me.entityBullet, Me.entityTarget, 1, 0, Me.entityTargetOffset, Me.entityBulletOffset)
  1068. Else
  1069. JC2.attachEntitiesToRope(rope2, Me.entityTarget, Me.entityBullet, 1, 0, Me.entityTargetOffset, Me.entityBulletOffset)
  1070. End If
  1071. Else
  1072. Me.entityTarget = Nothing
  1073. Me.entityBullet = Nothing
  1074. Me.lastImpactCoord = New Vector3
  1075. Return
  1076. End If
  1077. If (THelper.isPed(Me.entityBullet) OrElse THelper.isObject(Me.entityBullet)) Then
  1078. Me.entityBullet.ApplyForce(DirectCast((Me.moveDir * CSng(distance)), Vector3))
  1079. End If
  1080. Dim rope3 As New TEntityInRope(Me.entityBullet, Me.entityTarget, rope2, distance, Me.entityTargetOffset, Me.entityBulletOffset)
  1081. If (THelper.isPed(Me.entityTarget) OrElse THelper.isObject(Me.entityTarget)) Then
  1082. Me.entityTarget.ApplyForce(DirectCast(((Me.moveDir * CSng(distance)) * -1.0!), Vector3))
  1083. End If
  1084. Me.entityTarget = Nothing
  1085. Me.entityBullet = Nothing
  1086. Me.lastImpactCoord = New Vector3
  1087. End If
  1088. End If
  1089. Else
  1090. Me.lastImpactCoord = position
  1091. If Not THelper.Exists(Me.entityBullet) Then
  1092. If Me.movingToTarget Then
  1093. Me.lastImpactCoord = New Vector3
  1094. Me.cancelMoveToTarget()
  1095. Else
  1096. Me.attachToTarget(Nothing, Me.lastImpactCoord)
  1097. End If
  1098. Me.entityBullet = Nothing
  1099. Me.entityTarget = Nothing
  1100. Else
  1101. Me.moveDir = Vector3.Normalize((Me.lastImpactCoord - Me.entityBullet.Position))
  1102. Me.cancelMoveToTarget()
  1103. Dim rope4 As Rope = Me.pinEntityToCoord(Me.lastImpactCoord, Me.entityBullet, Nothing, 0, vector9)
  1104. Me.entityBullet = Nothing
  1105. Me.entityTarget = Nothing
  1106. Me.lastImpactCoord = New Vector3
  1107. End If
  1108. End If
  1109. Catch exception2 As Exception
  1110. ProjectData.SetProjectError(exception2)
  1111. Dim exception As Exception = exception2
  1112. UI.ShowSubtitle(("Hook creation error: " & exception.Message))
  1113. Me.cancelMoveToTarget()
  1114. Me.entityBullet = Nothing
  1115. Me.entityTarget = Nothing
  1116. Me.lastImpactCoord = New Vector3
  1117. ProjectData.ClearProjectError()
  1118. End Try
  1119. End Sub
  1120.  
  1121. Private Sub keyDown(ByVal sender As Object, ByVal e As KeyEventArgs)
  1122. If ((e.KeyCode = Me.hkShowMenu) AndAlso ((Me.hkShowMenuKeyTwo = Keys.None) OrElse THelper._iskeyPressed(Me.hkShowMenuKeyTwo))) Then
  1123. Me.mMenu.closeMenu()
  1124. End If
  1125. If (Me.mMenu.keyDown(e.KeyCode) = menuResult.selectItem) Then
  1126. If (Me.mMenu.selectedItem.name = "bEnabled") Then
  1127. Me.toggleMod()
  1128. ElseIf (Me.mMenu.selectedItem.name = "bHookMode") Then
  1129. Me.toggleHookMode()
  1130. ElseIf (Me.mMenu.selectedItem.name = "bUseRagdoll") Then
  1131. Me.bUseRagdoll = Not Me.bUseRagdoll
  1132. Me.iniFile.WriteINIBool("v2_bUseRagdoll", "general", Me.bUseRagdoll)
  1133. Me.mMenu.selectedItem.value = Conversions.ToString(Me.bUseRagdoll)
  1134. ElseIf (Me.mMenu.selectedItem.name = "bDisableWindMill") Then
  1135. Me.bDisableWindMill = Not Me.bDisableWindMill
  1136. Me.iniFile.WriteINIBool("bDisableWindMill", "general", Me.bDisableWindMill)
  1137. Me.mMenu.selectedItem.value = Conversions.ToString(Me.bDisableWindMill)
  1138. End If
  1139. End If
  1140. If Me.bEnabled Then
  1141. If (e.KeyCode = Me.hkToggleHookMode) Then
  1142. Me.toggleHookMode()
  1143. End If
  1144. If ((e.KeyCode = Me.hkReleaseHookInVeh) AndAlso (JC2.entitiesInRope.Count > 0)) Then
  1145. Dim rope As TEntityInRope = JC2.entitiesInRope.Item((JC2.entitiesInRope.Count - 1))
  1146. Try
  1147. Try
  1148. If ((Not rope.p1 Is Game.Player.Character) AndAlso (Not rope.p1 Is Game.Player.Character.CurrentVehicle)) Then
  1149. rope.p1.MarkAsNoLongerNeeded()
  1150. End If
  1151. Catch exception1 As Exception
  1152. ProjectData.SetProjectError(exception1)
  1153. ProjectData.ClearProjectError()
  1154. End Try
  1155. Try
  1156. If ((Not rope.p2 Is Game.Player.Character) AndAlso (Not rope.p2 Is Game.Player.Character.CurrentVehicle)) Then
  1157. rope.p2.MarkAsNoLongerNeeded()
  1158. End If
  1159. Catch exception2 As Exception
  1160. ProjectData.SetProjectError(exception2)
  1161. ProjectData.ClearProjectError()
  1162. End Try
  1163. JC2.entitiesInRope.Item((JC2.entitiesInRope.Count - 1)).rope.Delete()
  1164. JC2.finishEntityInRope(JC2.entitiesInRope.Item((JC2.entitiesInRope.Count - 1)))
  1165. Catch exception3 As Exception
  1166. ProjectData.SetProjectError(exception3)
  1167. ProjectData.ClearProjectError()
  1168. End Try
  1169. End If
  1170. End If
  1171. End Sub
  1172.  
  1173. Private Sub keyUp(ByVal sender As Object, ByVal e As KeyEventArgs)
  1174. End Sub
  1175.  
  1176. Private Sub loadMod()
  1177. If (DateAndTime.Now.Subtract(Me.timerWaitLoad).TotalMilliseconds > 200) Then
  1178. Me.bLoaded = True
  1179. JC2.TRandom = New Random(DateAndTime.Now.Millisecond)
  1180. THelper.anim_requestDict(Me.sDict)
  1181. THelper.anim_requestDict(Me.sDictJump)
  1182. THelper.anim_requestDict(Me.sDictLand)
  1183. THelper.anim_requestDict(Me.sDictPull)
  1184. THelper.anim_requestDict(Me.sDictHang)
  1185. THelper.anim_requestDict(Me.sDictStealVeh1)
  1186. THelper.anim_requestDict(Me.sDictStealVeh1Heli)
  1187. THelper.anim_requestDict(Me.sDictStealVeh2)
  1188. THelper.anim_requestDict(Me.sDictStealVeh2b)
  1189. Me.iniFile = New CustomIniFile("")
  1190. Me.bEnabled = (Me.iniFile.settingsGetString("bEnabled", "general", "1", True) = "1")
  1191. Me.bUseRagdoll = (Me.iniFile.settingsGetString("v2_bUseRagdoll", "general", "0", True) = "1")
  1192. Me.bDisableWindMill = (Me.iniFile.settingsGetString("bDisableWindMill", "general", "0", True) = "1")
  1193. Me.bHookMode = (Me.iniFile.settingsGetString("bHookMode", "general", "1", True) = "1")
  1194. Me.hkToggleHookMode = Me.iniFile.settingsGetKey("hkToggleHookMode", "hotkeys", Me.hkToggleHookMode, True)
  1195. Me.hkParachute = Me.iniFile.settingsGetKey("hkParachute", "hotkeys", Me.hkParachute, True)
  1196. Me.hkReleaseHookInVeh = Me.iniFile.settingsGetKey("hkReleaseHookInVeh", "hotkeys", Me.hkReleaseHookInVeh, True)
  1197. Dim writer As New StreamWriter((".\Scripts\" & THelper.getScriptname & ".nibmod"))
  1198. writer.Write(Me.scriptDisplayName)
  1199. writer.Close()
  1200. writer.Dispose()
  1201. Me.iniFileScripts = New CustomIniFile(".\scripts\NIBScripts.ini")
  1202. Me.hkShowMenu = Me.iniFileScripts.settingsGetKey("hkShowMenu", "hotkeys", Me.hkShowMenu, True)
  1203. Me.hkShowMenuKeyTwo = Me.iniFileScripts.settingsGetKey("hkShowMenuKeyTwo", "hotkeys", Me.hkShowMenuKeyTwo, True)
  1204. Me.mMenu = New TMenu(Me.scriptDisplayName)
  1205. Me.mMenu.addItem("bEnabled", "Enabled: ", Conversions.ToString(Me.bEnabled), -1)
  1206. Me.mMenu.addItem("bHookMode", ("Hook mode (" & Me.hkToggleHookMode.ToString & "): "), Conversions.ToString(Me.bHookMode), -1)
  1207. Me.mMenu.addItem("bUseRagdoll", "Use ragdoll when moving to target: ", Conversions.ToString(Me.bUseRagdoll), -1)
  1208. Me.mMenu.addItem("bDisableWindMill", "Disable windmill feature: ", Conversions.ToString(Me.bDisableWindMill), -1)
  1209. Me.mMenu.addItem("close", "Close", "", -1)
  1210. Native.Function.Call(Hash.REQUEST_NAMED_PTFX_ASSET, New InputArgument() {"scr_exile2"})
  1211. Me.loadWindMillModels()
  1212. Me.hiddenPedModel = New Model(DirectCast(-1011537562, PedHash))
  1213. Me.hiddenPedModel.Request()
  1214. Script.Wait(200)
  1215. Dim ped As Ped
  1216. For Each ped In World.GetNearbyPeds(Game.Player.Character, 200.0!)
  1217. Try
  1218. If ((THelper.Exists(ped) AndAlso (ped.Model.Hash = Me.hiddenPedModel)) AndAlso Not ped.IsVisible) Then
  1219. Dim ped2 As Ped
  1220. For Each ped2 In World.GetNearbyPeds(ped, 200.0!)
  1221. Try
  1222. If ((THelper.Exists(ped2) AndAlso (ped2.Model.Hash = Me.hiddenPedModel)) AndAlso Not ped2.IsVisible) Then
  1223. ped2.Detach()
  1224. ped2.MarkAsNoLongerNeeded()
  1225. ped2.Delete()
  1226. End If
  1227. Catch exception1 As Exception
  1228. ProjectData.SetProjectError(exception1)
  1229. ProjectData.ClearProjectError()
  1230. End Try
  1231. Next
  1232. ped.Detach()
  1233. ped.MarkAsNoLongerNeeded()
  1234. ped.Delete()
  1235. End If
  1236. Catch exception2 As Exception
  1237. ProjectData.SetProjectError(exception2)
  1238. ProjectData.ClearProjectError()
  1239. End Try
  1240. Next
  1241. THelper.enabledLog(False)
  1242. End If
  1243. End Sub
  1244.  
  1245. Private Sub loadWindMillModels()
  1246. Dim now As DateTime = DateAndTime.Now
  1247. JC2.windMillPipeModelAux = New Model("prop_pipes_conc_01")
  1248. JC2.windMillPipeModelAux.Request()
  1249. Do While (Not JC2.windMillPipeModelAux.IsLoaded And (DateAndTime.Now.Subtract(now).TotalMilliseconds < 1000))
  1250. Script.Wait(100)
  1251. Loop
  1252. If JC2.windMillPipeModelAux.IsLoaded Then
  1253. JC2.windMillPipeHash = JC2.windMillPipeModelAux.Hash
  1254. JC2.windMillPipeSize = JC2.windMillPipeModelAux.GetDimensions
  1255. Else
  1256. UI.ShowSubtitle("Error requesting windmill objects...", &H2710)
  1257. End If
  1258. JC2.windMillModelAux = New Model("prop_windmill_01")
  1259. JC2.windMillModelAux.Request()
  1260. now = DateAndTime.Now
  1261. Do While (Not JC2.windMillModelAux.IsLoaded And (DateAndTime.Now.Subtract(now).TotalMilliseconds < 1000))
  1262. Script.Wait(100)
  1263. Loop
  1264. If JC2.windMillModelAux.IsLoaded Then
  1265. JC2.windMillHash = JC2.windMillModelAux.Hash
  1266. Else
  1267. UI.ShowSubtitle("Error requesting windmill model...", &H2710)
  1268. End If
  1269. End Sub
  1270.  
  1271. Private Sub moveToTarget(ByVal eTarget As Entity, Optional ByVal forcedPos As Vector3 = New Vector3())
  1272. Try
  1273. Dim flag3 As Boolean
  1274. Dim vector12 As Vector3
  1275. Dim velocity As Vector3
  1276. Dim character As Ped
  1277. Me.lastImpactCoord = New Vector3
  1278. Me.moveToTarget_TargetVeh = Nothing
  1279. Me.cancelVehAttach()
  1280. 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
  1281. Me.cancelMoveToTarget()
  1282. Return
  1283. End If
  1284. 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
  1285. Me.cancelMoveToTarget()
  1286. Return
  1287. End If
  1288. Dim now As DateTime = DateAndTime.Now
  1289. Dim e As Prop = Nothing
  1290. If Me.bUseRagdoll Then
  1291. e = Me.handObject
  1292. End If
  1293. Dim heading As Double = Game.Player.Character.Heading
  1294. If ((Not Game.Player.Character.IsInAir OrElse Me.canStealVeh) AndAlso (Not Me.attachedToVehicle AndAlso THelper.anim_requestDict(Me.sDictJump))) Then
  1295. THelper.anim_playPedAnim(Game.Player.Character, Me.sDictJump, Me.sAnimJump, 8, animFlags.normal, False)
  1296. Script.Wait(100)
  1297. THelper.anim_setAnimSpeed(Game.Player.Character, Me.sDictJump, Me.sAnimJump, 1.5)
  1298. now = DateAndTime.Now
  1299. Do While (THelper.anim_isPlayingPedAnim(Game.Player.Character, Me.sDictJump, Me.sAnimJump, 0.55) And (DateAndTime.Now.Subtract(now).TotalMilliseconds < 1000))
  1300. Game.Player.Character.ApplyForce(Vector3.WorldUp)
  1301. Script.Wait(10)
  1302. Loop
  1303. End If
  1304. Game.Player.Character.IsVisible = True
  1305. If (Game.Player.Character.IsRagdoll OrElse Game.Player.Character.IsInAir) Then
  1306. Game.Player.Character.CanRagdoll = False
  1307. Game.Player.Character.CanRagdoll = True
  1308. Game.Player.Character.Task.ClearAllImmediately()
  1309. End If
  1310. Dim list As New List(Of Prop)
  1311. Dim prop As Prop = Nothing
  1312. Dim prop2 As Prop = Nothing
  1313. Dim prop4 As Prop = Nothing
  1314. If Me.bUseRagdoll Then
  1315. prop = World.CreateProp(JC2.handObjectModel, (Game.Player.Character.Position + DirectCast((Vector3.WorldDown * 50.0!), Vector3)), True, False)
  1316. prop2 = World.CreateProp(JC2.handObjectModel, (Game.Player.Character.Position + DirectCast((Vector3.WorldDown * 51.0!), Vector3)), True, False)
  1317. prop4 = World.CreateProp(JC2.handObjectModel, (Game.Player.Character.Position + DirectCast((Vector3.WorldDown * 52.0!), Vector3)), True, False)
  1318. End If
  1319. If THelper.Exists(prop) Then
  1320. list.Add(prop)
  1321. prop.IsVisible = False
  1322. End If
  1323. If THelper.Exists(e) Then
  1324. list.Add(e)
  1325. e.IsVisible = False
  1326. End If
  1327. If THelper.Exists(prop2) Then
  1328. list.Add(prop2)
  1329. prop2.IsVisible = False
  1330. End If
  1331. If THelper.Exists(prop4) Then
  1332. list.Add(prop4)
  1333. prop4.IsVisible = False
  1334. End If
  1335. If (Not Me.bUseRagdoll AndAlso THelper.anim_requestDict(Me.sDictHang)) Then
  1336. THelper.anim_playPedAnim(Game.Player.Character, Me.sDictHang, Me.sAnimHang, 6, animFlags.repeat, True)
  1337. End If
  1338. If THelper.Exists(prop) Then
  1339. Dim prop5 As Prop
  1340. For Each prop5 In list
  1341. Try
  1342. prop5.IsVisible = False
  1343. Native.Function.Call(Hash.SET_ENTITY_COLLISION, New InputArgument() {prop5, 0, 0})
  1344. Catch exception1 As Exception
  1345. ProjectData.SetProjectError(exception1)
  1346. ProjectData.ClearProjectError()
  1347. End Try
  1348. Next
  1349. Game.Player.Character.CanRagdoll = True
  1350. Native.Function.Call(Hash.SET_PED_TO_RAGDOLL, New InputArgument() {Game.Player.Character, -1, -1, 0, 0, 0})
  1351. Script.Wait(200)
  1352. prop.Position = Native.Function.Call(Of Vector3)(Hash.GET_PED_BONE_COORDS, New InputArgument() {Game.Player.Character, &H796E, 0, 0, 0})
  1353. 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})
  1354. If THelper.Exists(e) Then
  1355. e.Detach()
  1356. e.Position = Native.Function.Call(Of Vector3)(Hash.GET_PED_BONE_COORDS, New InputArgument() {Game.Player.Character, &H6F06, 0, 0, 0})
  1357. 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})
  1358. End If
  1359. If THelper.Exists(prop2) Then
  1360. 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))
  1361. 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})
  1362. End If
  1363. If THelper.Exists(prop4) Then
  1364. 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))
  1365. 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})
  1366. End If
  1367. End If
  1368. If THelper.Exists(eTarget) Then
  1369. forcedPos = eTarget.Position
  1370. End If
  1371. Dim dir As Vector3 = Vector3.Normalize((forcedPos - Game.Player.Character.Position))
  1372. Dim destination As Vector3 = (forcedPos + dir)
  1373. Dim distance As Double = World.GetDistance(Game.Player.Character.Position, forcedPos)
  1374. Dim num4 As Double = World.GetDistance(Game.Player.Character.Position, destination)
  1375. Game.Player.Character.CanRagdoll = True
  1376. THelper.setEntityProofs(Game.Player.Character, False, False, False, True, True, False, False, False)
  1377. Native.Function.Call(Hash.SET_ENTITY_RECORDS_COLLISIONS, New InputArgument() {Game.Player.Character, 0})
  1378. Native.Function.Call(Hash.SET_ENTITY_RECORDS_COLLISIONS, New InputArgument() {Game.Player.Character, 1})
  1379. If (Not Me.bUseRagdoll AndAlso THelper.Exists(Me.handObject)) Then
  1380. Native.Function.Call(Hash.SET_ENTITY_RECORDS_COLLISIONS, New InputArgument() {Me.handObject, 0})
  1381. Native.Function.Call(Hash.SET_ENTITY_RECORDS_COLLISIONS, New InputArgument() {Me.handObject, 1})
  1382. End If
  1383. If Not Me.bUseRagdoll Then
  1384. Me.handObject.Detach()
  1385. Dim rotation As Vector3 = Game.Player.Character.Rotation
  1386. rotation.X = (rotation.X + 90.0!)
  1387. Me.handObject.Rotation = rotation
  1388. Dim position As New Vector3(0.1!, 0.11!, -1.2!)
  1389. Game.Player.Character.AttachTo(Me.handObject, 0, position, Vector3.Zero)
  1390. Native.Function.Call(Hash.HIDE_PED_WEAPON_FOR_SCRIPTED_CUTSCENE, New InputArgument() {Game.Player.Character, 1})
  1391. End If
  1392. Dim flag As Boolean = False
  1393. now = DateAndTime.Now
  1394. Dim num2 As Integer = 0
  1395. If THelper.Exists(e) Then
  1396. e.Velocity = DirectCast((dir * 10.0!), Vector3)
  1397. End If
  1398. Dim flag2 As Boolean = ((THelper.Exists(eTarget) AndAlso THelper.isVehicle(eTarget)) AndAlso eTarget.Model.IsHelicopter)
  1399. Dim zero As Vector3 = Vector3.Zero
  1400. Dim num3 As Double = 0.5
  1401. If THelper.Exists(eTarget) Then
  1402. num3 = 1.5
  1403. Dim z As Double = eTarget.Model.GetDimensions.Z
  1404. If flag2 Then
  1405. num3 = 3
  1406. z = (z * 1.5)
  1407. ElseIf (z > 2) Then
  1408. z = (z * 0.85)
  1409. Else
  1410. z = (z * 1.5)
  1411. End If
  1412. If flag2 Then
  1413. velocity = THelper.getGroundPos(eTarget.Position)
  1414. If ((eTarget.Position.Z - velocity.Z) > 2.0!) Then
  1415. zero = DirectCast((Vector3.WorldDown * CSng(z)), Vector3)
  1416. GoTo Label_0E9D
  1417. End If
  1418. End If
  1419. If Not flag2 Then
  1420. If eTarget.Model.IsPlane Then
  1421. zero = DirectCast(((Vector3.WorldUp * CSng(z)) * 0.6!), Vector3)
  1422. 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
  1423. zero = DirectCast(((Vector3.WorldUp * CSng(z)) * 0.5!), Vector3)
  1424. Else
  1425. zero = DirectCast((Vector3.WorldUp * CSng(z)), Vector3)
  1426. End If
  1427. Else
  1428. flag2 = False
  1429. End If
  1430. End If
  1431. Label_0E9D:
  1432. flag3 = False
  1433. Dim num10 As Double = 0
  1434. Dim num11 As Double = 1
  1435. Dim num9 As Double = 1
  1436. If (Me.moveSoundID = -1) Then
  1437. Me.moveSoundID = Native.Function.Call(Of Integer)(Hash.GET_SOUND_ID, New InputArgument(0 - 1) {})
  1438. End If
  1439. If (Me.moveSoundID > -1) Then
  1440. Native.Function.Call(Hash.PLAY_SOUND_FROM_ENTITY, New InputArgument() {Me.moveSoundID, "helicopter_wind_idle", Game.Player.Character, "basejumps_sounds", 0, 0})
  1441. End If
  1442. GameplayCamera.Shake(CameraShake.SkyDiving, 2.0!)
  1443. Dim num8 As Double = 0
  1444. Dim num As Short = 0
  1445. If Not Me.bUseRagdoll Then
  1446. If THelper.Exists(Me.handObject) Then
  1447. Me.handObject.IsVisible = False
  1448. End If
  1449. Game.Player.Character.IsVisible = False
  1450. Game.Player.Character.IsVisible = True
  1451. End If
  1452. Try
  1453. Do While (((distance > num3) AndAlso (distance < num4)) AndAlso (Game.Player.Character.Health > 0))
  1454. Dim vector3 As Vector3
  1455. Dim flag4 As Boolean = False
  1456. velocity = Game.Player.Character.Velocity
  1457. num8 = velocity.Length
  1458. If (Not Me.bUseRagdoll AndAlso THelper.Exists(Me.handObject)) Then
  1459. velocity = Me.handObject.Velocity
  1460. num8 = velocity.Length
  1461. End If
  1462. If ((DateAndTime.Now.Subtract(now).TotalMilliseconds > 5000) AndAlso (num8 < 10)) Then
  1463. GoTo Label_18DA
  1464. End If
  1465. If THelper.Exists(eTarget) Then
  1466. If Not Me.bUseRagdoll Then
  1467. If (eTarget.Model.IsPlane OrElse eTarget.Model.IsHelicopter) Then
  1468. velocity = eTarget.Velocity
  1469. num9 = Math.Min(3, Math.Max(CDbl(1), CDbl((Math.Max((velocity.Length * 0.7), distance) * 0.05))))
  1470. Else
  1471. num9 = Math.Min(3, Math.Max(CDbl(1), CDbl((distance * 0.05))))
  1472. End If
  1473. If THelper.Exists(Me.handObject) Then
  1474. Native.Function.Call(Hash.SET_ENTITY_MAX_SPEED, New InputArgument() {Me.handObject, (distance * num9)})
  1475. End If
  1476. Else
  1477. velocity = eTarget.Velocity
  1478. num9 = Math.Max((num9 * 0.8), Math.Min(1.2, Math.Max(CDbl((velocity.Length * 0.1)), CDbl(1))))
  1479. End If
  1480. ElseIf Not Me.bUseRagdoll Then
  1481. num9 = Math.Max((num9 * 0.8), Math.Min(3, Math.Max(CDbl(1), CDbl((distance * 0.05)))))
  1482. If THelper.Exists(Me.handObject) Then
  1483. Native.Function.Call(Hash.SET_ENTITY_MAX_SPEED, New InputArgument() {Me.handObject, (distance * num9)})
  1484. End If
  1485. Else
  1486. num9 = 1
  1487. End If
  1488. If (Me.bUseRagdoll AndAlso THelper.Exists(prop)) Then
  1489. prop.Velocity = DirectCast(((dir * 45.0!) * CSng(num9)), Vector3)
  1490. flag4 = True
  1491. Dim vector6 As Vector3 = Game.Player.Character.Rotation
  1492. vector6.Y = CSng(num10)
  1493. vector6.X = (vector6.X + CSng((num10 * 0.1)))
  1494. vector6.Z = (vector6.Z + CSng((num10 * 0.1)))
  1495. num10 = (num10 + (num11 * 0.25))
  1496. If (num10 > 5) Then
  1497. num11 = -1
  1498. ElseIf (num10 < -5) Then
  1499. num11 = 1
  1500. End If
  1501. Game.Player.Character.Rotation = vector6
  1502. Dim prop6 As Prop
  1503. For Each prop6 In list
  1504. Try
  1505. If (prop6 Is e) Then
  1506. velocity = prop6.Velocity
  1507. If (velocity.Length < (prop.Velocity.Length * 0.9)) Then
  1508. prop6.ApplyForce(DirectCast(((dir * 10.0!) * CSng(num9)), Vector3))
  1509. Else
  1510. prop6.Velocity = prop.Velocity
  1511. End If
  1512. ElseIf (prop6 Is prop2) Then
  1513. 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})
  1514. prop6.ApplyForce((((DirectCast(((dir * CSng(num9)) * -2.0!), Vector3) + vector7) - prop6.Position) + Vector3.WorldUp))
  1515. ElseIf (prop6 Is prop4) Then
  1516. 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})
  1517. prop6.ApplyForce((((DirectCast(((dir * CSng(num9)) * -2.0!), Vector3) + vector8) - prop6.Position) + Vector3.WorldUp))
  1518. End If
  1519. Catch exception3 As Exception
  1520. ProjectData.SetProjectError(exception3)
  1521. ProjectData.ClearProjectError()
  1522. End Try
  1523. Next
  1524. Else
  1525. Dim vector10 As Vector3 = THelper.directionToRotation(dir, 0)
  1526. vector10.X = (vector10.X - 90.0!)
  1527. vector10.Z = (vector10.Z - 10.0!)
  1528. Dim vector9 As Vector3 = Me.handObject.Rotation
  1529. vector9.X = (vector9.X + CSng(((vector10.X - vector9.X) * 0.05)))
  1530. vector9.Z = vector10.Z
  1531. Me.handObject.Rotation = vector10
  1532. Me.handObject.Velocity = DirectCast(((dir * 45.0!) * CSng(num9)), Vector3)
  1533. End If
  1534. If Not flag4 Then
  1535. Game.Player.Character.Velocity = DirectCast(((dir * 35.0!) * CSng(num9)), Vector3)
  1536. End If
  1537. If THelper.Exists(eTarget) Then
  1538. vector3 = (eTarget.Position + zero)
  1539. dir = Vector3.Normalize((vector3 - Game.Player.Character.Position))
  1540. heading = THelper.directionToHeading(dir)
  1541. If Not Game.Player.Character.IsTouching(eTarget) Then
  1542. GoTo Label_1609
  1543. End If
  1544. GoTo Label_18DA
  1545. End If
  1546. If (forcedPos <> vector12) Then
  1547. vector3 = forcedPos
  1548. End If
  1549. Label_1609:
  1550. destination = (vector3 + dir)
  1551. distance = World.GetDistance(Game.Player.Character.Position, vector3)
  1552. num4 = World.GetDistance(Game.Player.Character.Position, destination)
  1553. 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})))
  1554. If flag Then
  1555. num = CShort((num + 1))
  1556. End If
  1557. If flag Then
  1558. Native.Function.Call(Hash.SET_ENTITY_RECORDS_COLLISIONS, New InputArgument() {Game.Player.Character, 0})
  1559. Native.Function.Call(Hash.SET_ENTITY_RECORDS_COLLISIONS, New InputArgument() {Game.Player.Character, 1})
  1560. If (Not Me.bUseRagdoll AndAlso THelper.Exists(Me.handObject)) Then
  1561. Native.Function.Call(Hash.SET_ENTITY_RECORDS_COLLISIONS, New InputArgument() {Me.handObject, 0})
  1562. Native.Function.Call(Hash.SET_ENTITY_RECORDS_COLLISIONS, New InputArgument() {Me.handObject, 1})
  1563. End If
  1564. End If
  1565. flag = False
  1566. If ((DateAndTime.Now.Subtract(now).TotalMilliseconds > 500) AndAlso (num > &H19)) Then
  1567. GoTo Label_18DA
  1568. End If
  1569. If (num8 > 15) Then
  1570. num = 0
  1571. End If
  1572. If (THelper._iskeyPressed(Me.hkParachute) OrElse THelper.isButtonPressed(controls.INPUT_JUMP)) Then
  1573. flag3 = True
  1574. Me.chuteSpeed = (num8 * 0.5)
  1575. If (Me.chuteSpeed > 20) Then
  1576. Me.chuteSpeed = 20
  1577. End If
  1578. GoTo Label_18DA
  1579. End If
  1580. num2 = (num2 + 10)
  1581. If ((num2 Mod 50) = 0) Then
  1582. If THelper.Exists(eTarget) Then
  1583. Me.resetRopeLenght(eTarget)
  1584. Else
  1585. Native.Function.Call(Hash.ROPE_FORCE_LENGTH, New InputArgument() {Me.moveToTargetRope.Handle, (distance * 0.5)})
  1586. End If
  1587. End If
  1588. Script.Wait(10)
  1589. Loop
  1590. Catch exception4 As Exception
  1591. ProjectData.SetProjectError(exception4)
  1592. ProjectData.ClearProjectError()
  1593. End Try
  1594. Label_18DA:
  1595. GameplayCamera.StopShaking()
  1596. Game.Player.Character.IsVisible = False
  1597. Game.Player.Character.IsVisible = True
  1598. Dim num6 As Integer = Native.Function.Call(Of Integer)(Hash.GET_HASH_KEY, New InputArgument() {"GADGET_PARACHUTE"})
  1599. Native.Function.Call(Hash.GIVE_WEAPON_TO_PED, New InputArgument() {Game.Player.Character, num6, 1, 1, 1})
  1600. If (Me.moveSoundID > -1) Then
  1601. Native.Function.Call(Hash.STOP_SOUND, New InputArgument() {Me.moveSoundID})
  1602. End If
  1603. If (Me.bUseRagdoll OrElse Game.Player.Character.IsAttached) Then
  1604. Native.Function.Call(Hash.HIDE_PED_WEAPON_FOR_SCRIPTED_CUTSCENE, New InputArgument() {Game.Player.Character, 1})
  1605. Game.Player.Character.Detach()
  1606. velocity = Game.Player.Character.Position
  1607. If ((velocity.Z - World.GetGroundZ(Game.Player.Character.Position)) < 0.25) Then
  1608. character = Game.Player.Character
  1609. character.Position = (character.Position + DirectCast((Vector3.WorldUp * 1.0!), Vector3))
  1610. End If
  1611. If Not flag3 Then
  1612. Game.Player.Character.Velocity = dir
  1613. End If
  1614. Me.hideHandObject()
  1615. End If
  1616. Dim prop7 As Prop
  1617. For Each prop7 In list
  1618. Try
  1619. If (THelper.Exists(prop7) AndAlso (Not prop7 Is Me.handObject)) Then
  1620. prop7.Detach()
  1621. prop7.Delete()
  1622. End If
  1623. Catch exception5 As Exception
  1624. ProjectData.SetProjectError(exception5)
  1625. ProjectData.ClearProjectError()
  1626. End Try
  1627. Next
  1628. If THelper.anim_isPlayingPedAnim(Game.Player.Character, Me.sDictHang, Me.sAnimHang, 1) Then
  1629. Game.Player.Character.Task.ClearAnimation(Me.sDictHang, Me.sAnimHang)
  1630. End If
  1631. If flag3 Then
  1632. Game.Player.Character.CanRagdoll = False
  1633. Game.Player.Character.CanRagdoll = True
  1634. THelper.setEntityProofs(Game.Player.Character, False, False, False, False, False, False, False, False)
  1635. Me.cancelMoveToTarget()
  1636. Native.Function.Call(Hash.GIVE_WEAPON_TO_PED, New InputArgument() {Game.Player.Character, num6, 1, 100, 100})
  1637. Game.Player.Character.Task.ClearAllImmediately()
  1638. Game.Player.Character.Heading = CSng(THelper.directionToHeading(DirectCast(THelper.RotationToDirection(GameplayCamera.Rotation), Vector3)))
  1639. Dim vector11 As Vector3 = ((Game.Player.Character.Position + DirectCast(Operators.MultiplyObject(THelper.RotationToDirection(GameplayCamera.Rotation), 10), Vector3)) + DirectCast((Vector3.WorldUp * 50.0!), Vector3))
  1640. Native.Function.Call(Hash.TASK_PARACHUTE_TO_TARGET, New InputArgument() {Game.Player.Character, vector11.X, vector11.Y, vector11.Z})
  1641. Me.bPushPlayerUp = True
  1642. Me.timerPushingPlayerUp = DateAndTime.Now
  1643. Game.Player.Character.Velocity = DirectCast(((dir * CSng(Me.chuteSpeed)) + (Vector3.WorldUp * 12.0!)), Vector3)
  1644. Return
  1645. End If
  1646. If ((num > &H19) OrElse (Game.Player.Character.Health <= 0)) Then
  1647. If Me.bUseRagdoll Then
  1648. Game.Player.Character.CanRagdoll = False
  1649. Game.Player.Character.CanRagdoll = True
  1650. Native.Function.Call(Hash.SET_PED_TO_RAGDOLL, New InputArgument() {Game.Player.Character, 10, 10, 0, 0, 0})
  1651. Else
  1652. Game.Player.Character.Detach()
  1653. If ((Game.Player.Character.Position.Z - World.GetGroundZ(Game.Player.Character.Position)) < 0.25) Then
  1654. character = Game.Player.Character
  1655. character.Position = (character.Position + DirectCast((Vector3.WorldUp * 1.0!), Vector3))
  1656. End If
  1657. Script.Wait(50)
  1658. End If
  1659. THelper.setEntityProofs(Game.Player.Character, False, False, False, False, False, False, False, False)
  1660. Me.cancelMoveToTarget()
  1661. Return
  1662. End If
  1663. num = 0
  1664. If (THelper.Exists(eTarget) AndAlso ((Not eTarget.Model.IsHelicopter OrElse Not eTarget.Model.IsPlane) OrElse Not eTarget.Model.IsVehicle)) Then
  1665. Dim vehicle As Vehicle
  1666. For Each vehicle In World.GetNearbyVehicles(Game.Player.Character, 50.0!)
  1667. Try
  1668. If THelper.Exists(vehicle) Then
  1669. If (vehicle.Handle <> eTarget.Handle) Then
  1670. velocity = vehicle.Position
  1671. If (velocity.DistanceTo(eTarget.Position) >= 1.0!) Then
  1672. Continue For
  1673. End If
  1674. End If
  1675. eTarget = vehicle
  1676. Exit For
  1677. End If
  1678. Catch exception6 As Exception
  1679. ProjectData.SetProjectError(exception6)
  1680. ProjectData.ClearProjectError()
  1681. End Try
  1682. Next
  1683. End If
  1684. If Not THelper.Exists(eTarget) Then
  1685. GoTo Label_2639
  1686. End If
  1687. Me.attachedToVehicle = flag2
  1688. Try
  1689. Me.vehOnFoot = DirectCast(eTarget, Vehicle)
  1690. Catch exception7 As Exception
  1691. ProjectData.SetProjectError(exception7)
  1692. Dim exception As Exception = exception7
  1693. ProjectData.ClearProjectError()
  1694. End Try
  1695. Me.timeSinceVehOnFootSet = DateAndTime.Now
  1696. If Not flag2 Then
  1697. 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
  1698. Me.ejectBikers(DirectCast(eTarget, Vehicle))
  1699. Try
  1700. Native.Function.Call(Hash.TASK_WARP_PED_INTO_VEHICLE, New InputArgument() {Game.Player.Character, eTarget, -1})
  1701. GoTo Label_261D
  1702. Catch exception8 As Exception
  1703. ProjectData.SetProjectError(exception8)
  1704. ProjectData.ClearProjectError()
  1705. GoTo Label_261D
  1706. End Try
  1707. End If
  1708. Game.Player.Character.CanRagdoll = False
  1709. Game.Player.Character.Task.ClearAllImmediately()
  1710. Game.Player.Character.Heading = CSng(heading)
  1711. Me.cancelMoveToTarget()
  1712. If eTarget.Model.IsPlane Then
  1713. Game.Player.Character.Velocity = DirectCast(((((eTarget.Position + zero) - Game.Player.Character.Position) + (eTarget.Velocity * 1.05!)) + (Vector3.WorldDown * 3.0!)), Vector3)
  1714. Else
  1715. Game.Player.Character.Velocity = DirectCast(((eTarget.Velocity * 1.2!) + (Vector3.WorldDown * 3.0!)), Vector3)
  1716. End If
  1717. Else
  1718. Game.Player.Character.CanRagdoll = True
  1719. Native.Function.Call(Hash.SET_PED_TO_RAGDOLL, New InputArgument() {Game.Player.Character, -1, -1, 0, 0, 0})
  1720. Me.cancelMoveToTarget()
  1721. Me.hideHandObject()
  1722. Me.checkHandObject()
  1723. Me.resetHandObject()
  1724. Me.handObject.Detach()
  1725. Native.Function.Call(Hash.SET_ENTITY_COLLISION, New InputArgument() {Me.handObject, 0, 0})
  1726. Script.Wait(100)
  1727. Me.moveToTargetRope = JC2.createRope(Game.Player.Character, eTarget, 0.5, 0)
  1728. If THelper.Exists(Me.handObject) Then
  1729. Me.handObject.Position = Native.Function.Call(Of Vector3)(Hash.GET_PED_BONE_COORDS, New InputArgument() {Game.Player.Character, &H796E, 0, 0, 0})
  1730. 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})
  1731. 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})
  1732. 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})
  1733. End If
  1734. character = Game.Player.Character
  1735. character.Velocity = DirectCast((character.Velocity * 0.2!), Vector3)
  1736. velocity = New Vector3(-0.1!, -0.1!, 2.3!)
  1737. JC2.attachEntitiesToRope(Me.moveToTargetRope, Game.Player.Character, eTarget, 1, 0, velocity, vector12)
  1738. Game.Player.Character.CanRagdoll = True
  1739. Me.moveToTarget_TargetVeh = eTarget
  1740. End If
  1741. Label_261D:
  1742. THelper.setEntityProofs(Game.Player.Character, False, False, False, False, False, False, False, False)
  1743. Return
  1744. Label_2639:
  1745. Me.cancelMoveToTarget()
  1746. Game.Player.Character.CanRagdoll = False
  1747. Game.Player.Character.Task.ClearAllImmediately()
  1748. Game.Player.Character.Heading = CSng(heading)
  1749. Game.Player.Character.ApplyForce(DirectCast((dir * 5.0!), Vector3))
  1750. If THelper.anim_requestDict(Me.sDictLand) Then
  1751. THelper.anim_playPedAnim(Game.Player.Character, Me.sDictLand, Me.sAnimLand, 8, animFlags.normal, False)
  1752. Script.Wait(100)
  1753. THelper.anim_setAnimSpeed(Game.Player.Character, Me.sDictLand, Me.sAnimLand, 2)
  1754. Do While THelper.anim_isPlayingPedAnim(Game.Player.Character, Me.sDictLand, Me.sAnimLand, 0.35)
  1755. Script.Wait(100)
  1756. Loop
  1757. Game.Player.Character.Task.ClearAnimation(Me.sDictLand, Me.sAnimLand)
  1758. End If
  1759. Game.Player.Character.CanRagdoll = True
  1760. THelper.setEntityProofs(Game.Player.Character, False, False, False, False, False, False, False, False)
  1761. Catch exception9 As Exception
  1762. ProjectData.SetProjectError(exception9)
  1763. Dim exception2 As Exception = exception9
  1764. Game.Player.Character.IsVisible = True
  1765. UI.ShowSubtitle(("Error when moving to target: " & exception2.Message), &H2710)
  1766. ProjectData.ClearProjectError()
  1767. End Try
  1768. End Sub
  1769.  
  1770. 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
  1771. Dim now As DateTime = DateAndTime.Now
  1772. If THelper.Exists(objTarget) Then
  1773. pos = objTarget.Position
  1774. End If
  1775. Dim e As Entity = World.CreateProp(JC2.handObjectModel, (ent.Position + DirectCast((Vector3.WorldDown * 100.0!), Vector3)), True, False)
  1776. Script.Wait(50)
  1777. Dim rope As Rope = Nothing
  1778. If THelper.Exists(e) Then
  1779. Dim vector3 As Vector3
  1780. e.IsVisible = False
  1781. Native.Function.Call(Hash.SET_ENTITY_COLLISION, New InputArgument() {e, 0, 0})
  1782. e.FreezePosition = True
  1783. e.Health = -1
  1784. If Not THelper.Exists(objTarget) Then
  1785. Native.Function.Call(Hash.SET_ENTITY_COORDS, New InputArgument() {e, pos.X, pos.Y, (pos.Z - 1.2), 1, 1, 1, 1})
  1786. Else
  1787. 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})
  1788. End If
  1789. If THelper.isPed(ent) Then
  1790. Native.Function.Call(Hash.SET_PED_CAN_RAGDOLL, New InputArgument() {ent, 0})
  1791. Native.Function.Call(Hash.SET_PED_CAN_RAGDOLL, New InputArgument() {ent, 1})
  1792. Native.Function.Call(Hash.SET_PED_TO_RAGDOLL, New InputArgument() {ent, &H2710, &H2710, 0, 0, 0})
  1793. End If
  1794. Dim distance As Double = World.GetDistance(ent.Position, pos)
  1795. If THelper.isPed(ent) Then
  1796. now = DateAndTime.Now
  1797. distance = World.GetDistance(ent.Position, pos)
  1798. ent.ApplyForce(DirectCast(((pos - ent.Position) * 2.0!), Vector3))
  1799. Do While ((World.GetDistance(ent.Position, pos) > (distance * 0.3)) AndAlso (DateAndTime.Now.Subtract(now).TotalMilliseconds < 2000))
  1800. Script.Wait(10)
  1801. Loop
  1802. distance = World.GetDistance(ent.Position, pos)
  1803. rope = JC2.createRope(ent.Position, pos, 1, 0)
  1804. vector3 = New Vector3(0.0!, 0.0!, CSng(((pos.Z - e.Position.Z) * 0.5)))
  1805. JC2.attachEntitiesToRope(rope, e, ent, 1, distance, vector3, Me.entityBulletOffset)
  1806. Else
  1807. Dim velocity As Vector3
  1808. rope = JC2.createRope(ent.Position, pos, 1, 0)
  1809. Me.entityBulletOffset = Vector3.Zero
  1810. If Me.bPinFromGround Then
  1811. velocity = New Vector3(0.0!, 0.0!, CSng(((pos.Z - e.Position.Z) * 0.2)))
  1812. JC2.attachEntitiesToRope(rope, e, ent, 1, 0, velocity, Me.entityBulletOffset)
  1813. Else
  1814. velocity = New Vector3(0.0!, 0.0!, CSng(((pos.Z - e.Position.Z) * 0.5)))
  1815. JC2.attachEntitiesToRope(rope, e, ent, 1, 0, velocity, Me.entityBulletOffset)
  1816. End If
  1817. Dim vector As Vector3 = Vector3.Normalize((pos - ent.Position))
  1818. vector3 = (vector - Vector3.Normalize(ent.Velocity))
  1819. If (vector3.Length > 0.3) Then
  1820. velocity = ent.Velocity
  1821. If ((velocity.Length > 5.0!) AndAlso (ent.Model.IsBike OrElse ent.Model.IsBicycle)) Then
  1822. Me.ejectBikers(DirectCast(ent, Vehicle))
  1823. End If
  1824. End If
  1825. velocity = New Vector3(1.0!, 1.0!, 1.0!)
  1826. ent.ApplyForce((DirectCast((((vector - Vector3.Normalize(ent.Velocity)) * ent.Velocity.Length) * 0.5!), Vector3) + Vector3.WorldUp), velocity)
  1827. End If
  1828. Me.bPinFromGround = False
  1829. Me.objectAuxList.Add(e)
  1830. Dim rope3 As New TEntityInRope(ent, e, rope, distance, Me.entityBulletOffset, pos) With { _
  1831. .pinCoord = pos _
  1832. }
  1833. End If
  1834. Me.bPinFromGround = False
  1835. Return rope
  1836. End Function
  1837.  
  1838.  
  1839. Part 3 of script.
  1840.  
  1841. Private Sub prepareWindMill(ByVal windmill As Entity)
  1842. If Not Me.bDisableWindMill Then
  1843. Dim vector3 As Vector3
  1844. Dim list As New List(Of Prop)
  1845. Dim i As Integer = (Me.windMillObjects.Count - 1)
  1846. Do While (i >= 0)
  1847. Try
  1848. Dim e As Prop = Me.windMillObjects.Item(i)
  1849. If ((THelper.Exists(e) AndAlso e.IsAttached) AndAlso Native.Function.Call(Of Boolean)(Hash.IS_ENTITY_ATTACHED_TO_ENTITY, New InputArgument() {e, windmill})) Then
  1850. Dim j As Integer = (JC2.entitiesInRope.Count - 1)
  1851. Do While (j >= 0)
  1852. Dim rope As TEntityInRope = JC2.entitiesInRope.Item(j)
  1853. If ((rope.p1 Is e) OrElse (rope.p2 Is e)) Then
  1854. rope.remove()
  1855. End If
  1856. j = (j + -1)
  1857. Loop
  1858. e.Detach()
  1859. list.Add(e)
  1860. End If
  1861. Catch exception1 As Exception
  1862. ProjectData.SetProjectError(exception1)
  1863. ProjectData.ClearProjectError()
  1864. End Try
  1865. i = (i + -1)
  1866. Loop
  1867. THelper.requestModel("", CLng(JC2.windMillPipeHash), 500, True)
  1868. Dim position As Vector3 = windmill.Position
  1869. Dim vector As Vector3 = (position.Around(15.0!) + DirectCast((Vector3.WorldDown * 35.0!), Vector3))
  1870. Dim flag As Boolean = False
  1871. Dim num3 As Short = 1
  1872. Do
  1873. Dim prop2 As Prop = Nothing
  1874. If (list.Count > 0) Then
  1875. prop2 = list.Item(0)
  1876. list.RemoveAt(0)
  1877. Else
  1878. prop2 = World.CreateProp(JC2.windMillPipeHash, vector, False, False)
  1879. End If
  1880. Script.Wait(10)
  1881. If THelper.Exists(prop2) Then
  1882. Me.windMillObjects.Add(prop2)
  1883. prop2.IsVisible = flag
  1884. position = New Vector3(0.0!, 0.0!, ((JC2.windMillPipeSize.Y * num3) - CSng((JC2.windMillPipeSize.Y * 0.5))))
  1885. vector3 = New Vector3(90.0!, 0.0!, 0.0!)
  1886. prop2.AttachTo(Me.actualWindmill, 1, position, vector3)
  1887. Script.Wait(10)
  1888. End If
  1889. num3 = CShort((num3 + 2))
  1890. Loop While (num3 <= 7)
  1891. Dim num4 As Short = 1
  1892. Do
  1893. Dim prop3 As Prop = Nothing
  1894. If (list.Count > 0) Then
  1895. prop3 = list.Item(0)
  1896. list.RemoveAt(0)
  1897. Else
  1898. prop3 = World.CreateProp(JC2.windMillPipeHash, vector, False, False)
  1899. End If
  1900. Script.Wait(10)
  1901. If THelper.Exists(prop3) Then
  1902. Me.windMillObjects.Add(prop3)
  1903. prop3.IsVisible = flag
  1904. Dim num5 As Double = ((JC2.windMillPipeSize.Y * num4) - (JC2.windMillPipeSize.Y * 0.5))
  1905. vector3 = New Vector3(CSng((num5 * 0.9)), 0.0!, CSng((num5 * -0.6)))
  1906. position = New Vector3(90.0!, 120.0!, 0.0!)
  1907. prop3.AttachTo(Me.actualWindmill, 1, vector3, position)
  1908. Script.Wait(10)
  1909. End If
  1910. num4 = CShort((num4 + 2))
  1911. Loop While (num4 <= 7)
  1912. Dim num6 As Short = 1
  1913. Do
  1914. Dim prop4 As Prop = Nothing
  1915. If (list.Count > 0) Then
  1916. prop4 = list.Item(0)
  1917. list.RemoveAt(0)
  1918. Else
  1919. prop4 = World.CreateProp(JC2.windMillPipeHash, vector, False, False)
  1920. End If
  1921. Script.Wait(10)
  1922. If THelper.Exists(prop4) Then
  1923. Me.windMillObjects.Add(prop4)
  1924. prop4.IsVisible = flag
  1925. Dim num7 As Double = ((JC2.windMillPipeSize.Y * num6) - (JC2.windMillPipeSize.Y * 0.5))
  1926. vector3 = New Vector3(CSng((num7 * -0.9)), 0.0!, CSng((num7 * -0.6)))
  1927. position = New Vector3(90.0!, 240.0!, 0.0!)
  1928. prop4.AttachTo(Me.actualWindmill, 1, vector3, position)
  1929. Script.Wait(10)
  1930. End If
  1931. num6 = CShort((num6 + 2))
  1932. Loop While (num6 <= 7)
  1933. End If
  1934. End Sub
  1935.  
  1936. Private Sub reloadTargets()
  1937. If (Game.Player.IsAiming AndAlso (DateAndTime.Now.Subtract(Me.timerReloadTargets).TotalMilliseconds > 1000)) Then
  1938. Me.timerReloadTargets = DateAndTime.Now
  1939. Try
  1940. Dim enumerator As Enumerator(Of Entity)
  1941. Do While (Me.reloadTargetPedAux.Count < 4)
  1942. 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)))
  1943. Script.Wait(10)
  1944. If THelper.Exists(e) Then
  1945. Me.reloadTargetPedAux.Add(e)
  1946. End If
  1947. Loop
  1948. Dim entity As Entity
  1949. For Each entity In Me.targetsList
  1950. Try
  1951. If THelper.Exists(entity) Then
  1952. Native.Function.Call(Hash.CLEAR_ENTITY_LAST_DAMAGE_ENTITY, New InputArgument() {entity})
  1953. End If
  1954. Catch exception1 As Exception
  1955. ProjectData.SetProjectError(exception1)
  1956. ProjectData.ClearProjectError()
  1957. End Try
  1958. Next
  1959. Me.targetsList.Clear()
  1960. Dim num As Short = 1
  1961. Try
  1962. enumerator = Me.reloadTargetPedAux.GetEnumerator
  1963. Do While enumerator.MoveNext
  1964. Dim current As Ped = DirectCast(enumerator.Current, Ped)
  1965. Try
  1966. If (Not current Is Game.Player.Character) Then
  1967. current.Health = -1
  1968. Dim position As New Vector3(-5.0!, CSng((num * 20)), -2.0!)
  1969. current.AttachTo(Game.Player.Character, &H6F06, position, Vector3.Zero)
  1970. Native.Function.Call(Hash.SET_ENTITY_ALPHA, New InputArgument() {current, 10, 0})
  1971. num = CShort((num + 1))
  1972. End If
  1973. Dim ped3 As Ped
  1974. For Each ped3 In World.GetNearbyPeds(current, 100.0!)
  1975. Try
  1976. 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
  1977. Me.targetsList.Add(ped3)
  1978. Native.Function.Call(Hash.CLEAR_ENTITY_LAST_DAMAGE_ENTITY, New InputArgument() {ped3})
  1979. End If
  1980. Catch exception2 As Exception
  1981. ProjectData.SetProjectError(exception2)
  1982. ProjectData.ClearProjectError()
  1983. End Try
  1984. Next
  1985. Dim vehicle As Vehicle
  1986. For Each vehicle In World.GetNearbyVehicles(current, 100.0!)
  1987. Try
  1988. If ((THelper.Exists(vehicle) AndAlso Not Me.targetsList.Contains(vehicle)) AndAlso (Not vehicle Is Game.Player.Character.CurrentVehicle)) Then
  1989. Me.targetsList.Add(vehicle)
  1990. Native.Function.Call(Hash.CLEAR_ENTITY_LAST_DAMAGE_ENTITY, New InputArgument() {vehicle})
  1991. End If
  1992. Catch exception3 As Exception
  1993. ProjectData.SetProjectError(exception3)
  1994. ProjectData.ClearProjectError()
  1995. End Try
  1996. Next
  1997. Continue Do
  1998. Catch exception4 As Exception
  1999. ProjectData.SetProjectError(exception4)
  2000. ProjectData.ClearProjectError()
  2001. Continue Do
  2002. End Try
  2003. Loop
  2004. Finally
  2005. enumerator.Dispose()
  2006. End Try
  2007. Catch exception5 As Exception
  2008. ProjectData.SetProjectError(exception5)
  2009. ProjectData.ClearProjectError()
  2010. End Try
  2011. End If
  2012. End Sub
  2013.  
  2014. Private Sub resetHandObject()
  2015. If THelper.Exists(Me.handObject) Then
  2016. Me.handObject.IsVisible = False
  2017. Native.Function.Call(Hash.SET_ENTITY_COLLISION, New InputArgument() {Me.handObject, 0, 0})
  2018. 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})
  2019. End If
  2020. End Sub
  2021.  
  2022. Private Sub resetRopeLenght(ByVal eTarget As Entity)
  2023. Dim distance As Double = World.GetDistance(eTarget.Position, Game.Player.Character.Position)
  2024. Native.Function.Call(Hash.ROPE_FORCE_LENGTH, New InputArgument() {Me.moveToTargetRope.Handle, (distance * 0.5)})
  2025. Dim num2 As Integer = (Native.Function.Call(Of Integer)(Hash.GET_ROPE_VERTEX_COUNT, New InputArgument() {Me.moveToTargetRope.Handle}) - 1)
  2026. Dim position As Vector3 = eTarget.Position
  2027. Native.Function.Call(Hash.PIN_ROPE_VERTEX, New InputArgument() {Me.moveToTargetRope.Handle, num2, position.X, position.Y, position.Z})
  2028. End Sub
  2029.  
  2030. Private Sub stealVeh()
  2031. If (Not Me.canStealVeh AndAlso Not Me.attachedToVehicle) Then
  2032. Return
  2033. End If
  2034. Try
  2035. If Not THelper.Exists(Me.vehOnFoot) Then
  2036. GoTo Label_0C78
  2037. End If
  2038. Game.Player.Character.Task.ClearAllImmediately()
  2039. Dim pedOnSeat As Ped = Me.vehOnFoot.GetPedOnSeat(VehicleSeat.Driver)
  2040. If (Not THelper.Exists(pedOnSeat) OrElse Me.vehOnFoot.Model.IsPlane) Then
  2041. Game.Player.Character.Task.WarpIntoVehicle(Me.vehOnFoot, VehicleSeat.Driver)
  2042. Me.vehOnFoot = Nothing
  2043. Return
  2044. End If
  2045. Dim offsetInWorldCoords As Vector3 = pedOnSeat.GetOffsetInWorldCoords(Vector3.Zero)
  2046. 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})
  2047. If Me.vehOnFoot.Model.IsHelicopter Then
  2048. If THelper.anim_requestDict(Me.sDictStealVeh1Heli) Then
  2049. Game.Player.Character.CanRagdoll = False
  2050. Game.Player.Character.Task.ClearAllImmediately()
  2051. Dim vector4 As Vector3 = Game.Player.Character.Position
  2052. 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})
  2053. Dim num As Double = (vector3.Z - position.Z)
  2054. Dim num2 As Double = (num * 0.02)
  2055. position.X = (position.X - CSng(0.7))
  2056. position.Y = (position.Y - CSng(0.05))
  2057. position.Z = (position.Z + CSng(0.3))
  2058. vector3.X = position.X
  2059. vector3.Y = position.Y
  2060. Game.Player.Character.AttachTo(Me.vehOnFoot, 0, vector3, Vector3.Zero)
  2061. THelper.anim_playPedAnim(Game.Player.Character, Me.sDictStealVeh1Heli, Me.sAnimStealVeh1Heli, 8, animFlags.normal, False)
  2062. Script.Wait(50)
  2063. Do While THelper.anim_isPlayingPedAnim(Game.Player.Character, Me.sDictStealVeh1Heli, Me.sAnimStealVeh1Heli, 0.1)
  2064. Script.Wait(10)
  2065. Native.Function.Call(Hash.STOP_CURRENT_PLAYING_AMBIENT_SPEECH, New InputArgument() {Game.Player.Character})
  2066. THelper.anim_setAnimSpeed(Game.Player.Character, Me.sDictStealVeh1Heli, Me.sAnimStealVeh1Heli, 4)
  2067. Loop
  2068. Do While THelper.anim_isPlayingPedAnim(Game.Player.Character, Me.sDictStealVeh1Heli, Me.sAnimStealVeh1Heli, 0.4)
  2069. Script.Wait(10)
  2070. Native.Function.Call(Hash.STOP_CURRENT_PLAYING_AMBIENT_SPEECH, New InputArgument() {Game.Player.Character})
  2071. THelper.anim_setAnimSpeed(Game.Player.Character, Me.sDictStealVeh1Heli, Me.sAnimStealVeh1Heli, 4)
  2072. If (num < -1.5) Then
  2073. num = (num - (num2 * 1.2))
  2074. vector3.Z = CSng(num)
  2075. vector3.X = (vector3.X - CSng(0.005))
  2076. Dim rotation As New Vector3(0.0!, 0.0!, 0.0!)
  2077. Game.Player.Character.AttachTo(Me.vehOnFoot, 0, vector3, rotation)
  2078. End If
  2079. Loop
  2080. Game.Player.Character.Task.ClearAnimation(Me.sDictStealVeh1Heli, Me.sAnimStealVeh1Heli)
  2081. End If
  2082. ElseIf THelper.anim_requestDict(Me.sDictStealVeh1) Then
  2083. Game.Player.Character.CanRagdoll = False
  2084. Dim vector6 As Vector3 = Game.Player.Character.Position
  2085. 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})
  2086. Dim num3 As Double = (vector5.Z - position.Z)
  2087. Dim num4 As Double = (num3 * 0.02)
  2088. vector5.X = position.X
  2089. vector5.Y = position.Y
  2090. vector5.Z = (vector5.Z - CSng(0.5))
  2091. position.X = (position.X - CSng(0.7))
  2092. position.Y = (position.Y - CSng(0.05))
  2093. position.Z = (position.Z + CSng(0.3))
  2094. Game.Player.Character.AttachTo(Me.vehOnFoot, 0, vector5, Vector3.Zero)
  2095. THelper.anim_playPedAnim(Game.Player.Character, Me.sDictStealVeh1, Me.sAnimStealVeh1, 8, animFlags.normal, False)
  2096. Script.Wait(50)
  2097. Do While THelper.anim_isPlayingPedAnim(Game.Player.Character, Me.sDictStealVeh1, Me.sAnimStealVeh1, 0.22)
  2098. Script.Wait(10)
  2099. Native.Function.Call(Hash.STOP_CURRENT_PLAYING_AMBIENT_SPEECH, New InputArgument() {Game.Player.Character})
  2100. THelper.anim_setAnimSpeed(Game.Player.Character, Me.sDictStealVeh1, Me.sAnimStealVeh1, 2)
  2101. If (num3 > 0.05) Then
  2102. Game.Player.Character.AttachTo(Me.vehOnFoot, 0, vector5, Vector3.Zero)
  2103. num3 = (num3 - num4)
  2104. vector5.Z = CSng(num3)
  2105. vector5.X = (vector5.X - CSng(0.01))
  2106. End If
  2107. Loop
  2108. Game.Player.Character.Task.ClearAnimation(Me.sDictStealVeh1, Me.sAnimStealVeh1)
  2109. End If
  2110. Native.Function.Call(Hash.SET_VEHICLE_DOOR_OPEN, New InputArgument() {Me.vehOnFoot, 0, 0, 0})
  2111. Game.Player.Character.AttachTo(Me.vehOnFoot, 0, position, Vector3.Zero)
  2112. Dim str As String = Me.sAnimStealVeh2
  2113. If (Me.vehOnFoot.Model.GetDimensions.Z > 2.0!) Then
  2114. str = Me.sAnimStealVeh2b
  2115. position.Z = (position.Z - CSng(0.2))
  2116. End If
  2117. If Not THelper.anim_requestDict(Me.sDictStealVeh2) Then
  2118. GoTo Label_0A05
  2119. End If
  2120. THelper.anim_playPedAnim(Game.Player.Character, Me.sDictStealVeh2, Me.sAnimStealVeh2, 8, animFlags.normal, True)
  2121. Script.Wait(50)
  2122. Me.vehOnFoot.SmashWindow(VehicleWindow.FrontLeftWindow)
  2123. Do While THelper.anim_isPlayingPedAnim(Game.Player.Character, Me.sDictStealVeh2, Me.sAnimStealVeh2, 0.2)
  2124. Script.Wait(10)
  2125. THelper.anim_setAnimSpeed(Game.Player.Character, Me.sDictStealVeh2, Me.sAnimStealVeh2, 2)
  2126. Loop
  2127. If Me.vehOnFoot.Model.IsHelicopter Then
  2128. GoTo Label_08EC
  2129. End If
  2130. pedOnSeat.Task.ClearAll()
  2131. pedOnSeat.Task.ClearSecondary()
  2132. pedOnSeat.AlwaysKeepTask = False
  2133. pedOnSeat.AlwaysKeepTask = True
  2134. Native.Function.Call(Hash.TASK_LEAVE_VEHICLE, New InputArgument() {pedOnSeat, Me.vehOnFoot, &H1000})
  2135. pedOnSeat.CanRagdoll = True
  2136. If (pedOnSeat.Health < 0) Then
  2137. pedOnSeat.Task.ClearAllImmediately()
  2138. End If
  2139. Native.Function.Call(Hash.SET_PED_TO_RAGDOLL, New InputArgument() {pedOnSeat, &HBB8, &HBB8, 0, 0, 0})
  2140. GoTo Label_09DC
  2141. Label_08C1:
  2142. Script.Wait(10)
  2143. THelper.anim_setAnimSpeed(Game.Player.Character, Me.sDictStealVeh2, Me.sAnimStealVeh2, 2)
  2144. Label_08EC:
  2145. If THelper.anim_isPlayingPedAnim(Game.Player.Character, Me.sDictStealVeh2, Me.sAnimStealVeh2, 0.35) Then
  2146. GoTo Label_08C1
  2147. End If
  2148. pedOnSeat.Task.ClearAllImmediately()
  2149. Native.Function.Call(Hash.SET_PED_TO_RAGDOLL, New InputArgument() {pedOnSeat, &HBB8, &HBB8, 0, 0, 0})
  2150. Label_09DC:
  2151. Do While THelper.anim_isPlayingPedAnim(Game.Player.Character, Me.sDictStealVeh2, Me.sAnimStealVeh2, 0.65)
  2152. Script.Wait(10)
  2153. position.X = (position.X + CSng(0.01))
  2154. Game.Player.Character.AttachTo(Me.vehOnFoot, 0, position, Vector3.Zero)
  2155. THelper.anim_setAnimSpeed(Game.Player.Character, Me.sDictStealVeh2, Me.sAnimStealVeh2, 1.5)
  2156. Loop
  2157. Label_0A05:
  2158. Native.Function.Call(Hash.TASK_WARP_PED_INTO_VEHICLE, New InputArgument() {Game.Player.Character, Me.vehOnFoot, -1})
  2159. Script.Wait(200)
  2160. Dim now As DateTime = DateAndTime.Now
  2161. Do While ((Not Game.Player.Character.CurrentVehicle Is Me.vehOnFoot) And (DateAndTime.Now.Subtract(now).TotalMilliseconds < 1000))
  2162. Game.Player.Character.Task.WarpIntoVehicle(Me.vehOnFoot, VehicleSeat.Driver)
  2163. Script.Wait(100)
  2164. Loop
  2165. Script.Wait(100)
  2166. If (pedOnSeat.CurrentVehicle Is Me.vehOnFoot) Then
  2167. pedOnSeat.Task.ClearAllImmediately()
  2168. End If
  2169. If Me.vehOnFoot.Model.IsHelicopter Then
  2170. Dim num5 As Short = 0
  2171. Do
  2172. pedOnSeat = Me.vehOnFoot.GetPedOnSeat(DirectCast(num5, VehicleSeat))
  2173. If (THelper.Exists(pedOnSeat) AndAlso (pedOnSeat.Health >= 0)) Then
  2174. pedOnSeat.Task.ClearAll()
  2175. pedOnSeat.Task.ClearSecondary()
  2176. pedOnSeat.AlwaysKeepTask = False
  2177. pedOnSeat.AlwaysKeepTask = True
  2178. Native.Function.Call(Hash.TASK_LEAVE_VEHICLE, New InputArgument() {pedOnSeat, Me.vehOnFoot, &H1000})
  2179. pedOnSeat.CanRagdoll = True
  2180. Native.Function.Call(Hash.SET_PED_TO_RAGDOLL, New InputArgument() {pedOnSeat, &HBB8, &HBB8, 0, 0, 0})
  2181. End If
  2182. num5 = CShort((num5 + 1))
  2183. Loop While (num5 <= 10)
  2184. End If
  2185. Game.Player.Character.CanRagdoll = True
  2186. Me.vehOnFoot = Nothing
  2187. Catch exception1 As Exception
  2188. ProjectData.SetProjectError(exception1)
  2189. Dim exception As Exception = exception1
  2190. Try
  2191. Native.Function.Call(Hash.TASK_WARP_PED_INTO_VEHICLE, New InputArgument() {Game.Player.Character, Me.vehOnFoot, -1})
  2192. Catch exception2 As Exception
  2193. ProjectData.SetProjectError(exception2)
  2194. ProjectData.ClearProjectError()
  2195. End Try
  2196. ProjectData.ClearProjectError()
  2197. End Try
  2198. Label_0C78:
  2199. Me.cancelVehAttach()
  2200. End Sub
  2201.  
  2202. Private Sub subTick()
  2203. If (DateAndTime.Now.Subtract(Me.timer1Sec).TotalMilliseconds > 1000) Then
  2204. Me.timer1Sec = DateAndTime.Now
  2205. Dim i As Integer = (Me.objectAuxList.Count - 1)
  2206. Do While (i >= 0)
  2207. Try
  2208. If (THelper.Exists(Me.objectAuxList.Item(i)) AndAlso (World.GetDistance(Me.objectAuxList.Item(i).Position, GameplayCamera.Position) > 200.0!)) Then
  2209. Me.objectAuxList.Item(i).MarkAsNoLongerNeeded()
  2210. End If
  2211. Catch exception1 As Exception
  2212. ProjectData.SetProjectError(exception1)
  2213. ProjectData.ClearProjectError()
  2214. End Try
  2215. i = (i + -1)
  2216. Loop
  2217. End If
  2218. End Sub
  2219.  
  2220. Private Sub toggleHookMode()
  2221. Me.bHookMode = Not Me.bHookMode
  2222. Try
  2223. Me.cancelMoveToTarget()
  2224. Catch exception1 As Exception
  2225. ProjectData.SetProjectError(exception1)
  2226. ProjectData.ClearProjectError()
  2227. End Try
  2228. Try
  2229. Me.cancelVehAttach()
  2230. Catch exception2 As Exception
  2231. ProjectData.SetProjectError(exception2)
  2232. ProjectData.ClearProjectError()
  2233. End Try
  2234. Me.clearLists()
  2235. Me.iniFile.WriteINIBool("bHookMode", "general", Me.bHookMode)
  2236. Me.mMenu.findItem("bHookMode").value = Conversions.ToString(Me.bHookMode)
  2237. UI.ShowSubtitle(("Just Cause 2 mod - Hook On: " & Conversions.ToString(Me.bHookMode)))
  2238. End Sub
  2239.  
  2240. Private Sub toggleMod()
  2241. Me.bEnabled = Not Me.bEnabled
  2242. Try
  2243. Me.cancelMoveToTarget()
  2244. Catch exception1 As Exception
  2245. ProjectData.SetProjectError(exception1)
  2246. ProjectData.ClearProjectError()
  2247. End Try
  2248. Try
  2249. Me.cancelVehAttach()
  2250. Catch exception2 As Exception
  2251. ProjectData.SetProjectError(exception2)
  2252. ProjectData.ClearProjectError()
  2253. End Try
  2254. Me.clearLists()
  2255. Me.mMenu.findItem("bEnabled").value = Conversions.ToString(Me.bEnabled)
  2256. Me.iniFile.WriteINIBool("bEnabled", "general", Me.bEnabled)
  2257. UI.ShowSubtitle(("Just Cause 2 Mod enabled: " & Conversions.ToString(Me.bEnabled)))
  2258. End Sub
  2259.  
  2260.  
  2261. ' Fields
  2262. Private actualTarget As Entity
  2263. Private actualWindmill As Prop
  2264. Private attachedToVehicle As Boolean
  2265. Private bDisableWindMill As Boolean
  2266. Private bEnabled As Boolean
  2267. Private bHookMode As Boolean
  2268. Private bLoaded As Boolean
  2269. Private bPinFromGround As Boolean
  2270. Private bPowersOn As Object
  2271. Private bPushPlayerUp As Boolean
  2272. Private bShootDetected As Boolean
  2273. Private bUseRagdoll As Boolean
  2274. Private canStealVeh As Boolean
  2275. Private chuteSpeed As Double
  2276. Private entitiesFound As List(Of Entity)
  2277. Private Shared entitiesInRope As List(Of TEntityInRope) = New List(Of TEntityInRope)
  2278. Private entityBullet As Entity
  2279. Private entityBulletOffset As Vector3
  2280. Private entityTarget As Entity
  2281. Private entityTargetOffset As Vector3
  2282. Private Shared gasObjectsUsed As List(Of Prop) = New List(Of Prop)
  2283. Private handObject As Prop
  2284. Private Shared handObjectModel As Model = New Model
  2285. Private handObjectModelName As String
  2286. Private hiddenPedModel As Model
  2287. Private hkParachute As Keys
  2288. Private hkReleaseHookInVeh As Keys
  2289. Private hkShowMenu As Keys
  2290. Private hkShowMenuKeyTwo As Keys
  2291. Private hkToggleHookMode As Keys
  2292. Private iniFile As CustomIniFile
  2293. Private iniFileScripts As CustomIniFile
  2294. Private inititalParachutePush As Boolean
  2295. Private last As Vector3
  2296. Private lastDamagedEntity As Entity
  2297. Private lastImpactCoord As Vector3
  2298. Private Shared listOfGasObjects As List(Of TGasObjects) = New List(Of TGasObjects)
  2299. Private mMenu As TMenu
  2300. Private modFilesFolder As String
  2301. Private moveDir As Vector3
  2302. Private moveSoundID As Integer
  2303. Private moveToTarget_TargetVeh As Entity
  2304. Private moveToTargetRope As Rope
  2305. Private movingToTarget As Boolean
  2306. Private objectAuxList As List(Of Entity)
  2307. Private playerParachute As Prop
  2308. Private reloadTargetPedAux As List(Of Entity)
  2309. Private sAnimFly As String
  2310. Private sAnimHang As String
  2311. Private sAnimJump As String
  2312. Private sAnimLand As String
  2313. Private sAnimPull As String
  2314. Private sAnimStealVeh1 As String
  2315. Private sAnimStealVeh1Heli As String
  2316. Private sAnimStealVeh2 As String
  2317. Private sAnimStealVeh2b As String
  2318. Private scriptCommandLine As String
  2319. Private scriptDisplayName As String
  2320. Private sDict As String
  2321. Private sDictHang As String
  2322. Private sDictJump As String
  2323. Private sDictLand As String
  2324. Private sDictPull As String
  2325. Private sDictStealVeh1 As String
  2326. Private sDictStealVeh1Heli As String
  2327. Private sDictStealVeh2 As String
  2328. Private sDictStealVeh2b As String
  2329. Private sGUI As String
  2330. Private targetHUDRot As Double
  2331. Private targetsList As List(Of Entity)
  2332. Private timeOut As DateTime
  2333. Private timer1Sec As DateTime
  2334. Private timerCheckMenu As DateTime
  2335. Private timerPushingPlayerUp As DateTime
  2336. Private timerReloadTargets As DateTime
  2337. Private timerSinceLastShoot As DateTime
  2338. Private timerWaitAttachAgain As DateTime
  2339. Private timerWaitLoad As DateTime
  2340. Private timeSinceVehOnFootSet As DateTime
  2341. Private tmpTimeCounter As Integer
  2342. Private Shared TRandom As Random
  2343. Private vehOnFoot As Vehicle
  2344. Private waitForShootDetect As Boolean
  2345. Private Shared windMillHash As Integer
  2346. Private Shared windMillModelAux As Model
  2347. Private windMillObjects As List(Of Prop)
  2348. Private Shared windMillPipeHash As Integer
  2349. Private Shared windMillPipeModelAux As Model
  2350. Private Shared windMillPipeSize As Vector3
  2351.  
  2352. ' Nested Types
  2353. Public Class TEntityInRope
  2354. ' Methods
  2355. 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)
  2356. Me.p1 = e1
  2357. Me.p2 = e2
  2358. Me.rope = r
  2359. Me.dist = pDist
  2360. Me.e1_offset = e1_Off
  2361. Me.e2_offset = e2_Off
  2362. If THelper.Exists(Me.p1) Then
  2363. Me.isPed_p1 = THelper.isPed(Me.p1)
  2364. Me.isObject_p1 = THelper.isObject(Me.p1)
  2365. Me.isVehicle_p1 = THelper.isVehicle(Me.p1)
  2366. If Not Native.Function.Call(Of Boolean)(Hash.IS_ENTITY_A_MISSION_ENTITY, New InputArgument() {Me.p1}) Then
  2367. Native.Function.Call(Hash.SET_ENTITY_AS_MISSION_ENTITY, New InputArgument() {Me.p1, 1, 1})
  2368. End If
  2369. If Me.isVehicle_p1 Then
  2370. Native.Function.Call(Hash._SET_VEHICLE_ENGINE_POWER_MULTIPLIER, New InputArgument() {Me.p1, 15})
  2371. End If
  2372. End If
  2373. If THelper.Exists(Me.p2) Then
  2374. Me.isPed_p2 = THelper.isPed(Me.p2)
  2375. Me.isObject_p2 = THelper.isObject(Me.p2)
  2376. Me.isVehicle_p2 = THelper.isVehicle(Me.p2)
  2377. If Not Native.Function.Call(Of Boolean)(Hash.IS_ENTITY_A_MISSION_ENTITY, New InputArgument() {Me.p2}) Then
  2378. Native.Function.Call(Hash.SET_ENTITY_AS_MISSION_ENTITY, New InputArgument() {Me.p2, 1, 1})
  2379. End If
  2380. If Me.isVehicle_p2 Then
  2381. Native.Function.Call(Hash._SET_VEHICLE_ENGINE_POWER_MULTIPLIER, New InputArgument() {Me.p2, 15})
  2382. End If
  2383. End If
  2384. Me.timerSinceAttach = DateAndTime.Now
  2385. JC2.entitiesInRope.Add(Me)
  2386. End Sub
  2387.  
  2388. Public Sub pedTick()
  2389. Try
  2390. If (DateAndTime.Now.Subtract(Me.timerResetRope).TotalMilliseconds > 1000) Then
  2391. Me.timerResetRope = DateAndTime.Now
  2392. If (THelper.Exists(Me.p1) AndAlso THelper.isPed(Me.p1)) Then
  2393. If (Me.p1.Health < 0) Then
  2394. Native.Function.Call(Hash.REVIVE_INJURED_PED, New InputArgument() {Me.p1})
  2395. Me.p1.Health = 100
  2396. Native.Function.Call(Hash.SET_PED_TO_RAGDOLL, New InputArgument() {Me.p1, &HC350, &HC350, 0, 0, 0})
  2397. End If
  2398. Native.Function.Call(Hash.SET_PED_DIES_WHEN_INJURED, New InputArgument() {Me.p1, 0})
  2399. Native.Function.Call(Hash.SET_PED_SUFFERS_CRITICAL_HITS, New InputArgument() {Me.p1, 0})
  2400. Native.Function.Call(Hash.SET_ENTITY_AS_MISSION_ENTITY, New InputArgument() {Me.p1, 1, 1})
  2401. Native.Function.Call(Hash.SET_PED_GENERATES_DEAD_BODY_EVENTS, New InputArgument() {Me.p1, 0})
  2402. If ((Me.pinCoord <> Vector3.Zero) AndAlso Not Native.Function.Call(Of Boolean)(Hash.IS_PED_RAGDOLL, New InputArgument() {Me.p1})) Then
  2403. Native.Function.Call(Hash.SET_PED_CAN_RAGDOLL, New InputArgument() {Me.p1, 1})
  2404. THelper.setPedToRagdoll(DirectCast(Me.p1, Ped), &H2710, &H2710, False, False, False)
  2405. End If
  2406. End If
  2407. If (THelper.Exists(Me.p2) AndAlso THelper.isPed(Me.p2)) Then
  2408. If (Me.p2.Health < 0) Then
  2409. Native.Function.Call(Hash.REVIVE_INJURED_PED, New InputArgument() {Me.p2})
  2410. Me.p2.Health = 100
  2411. Native.Function.Call(Hash.SET_PED_TO_RAGDOLL, New InputArgument() {Me.p2, &HC350, &HC350, 0, 0, 0})
  2412. End If
  2413. Native.Function.Call(Hash.SET_PED_DIES_WHEN_INJURED, New InputArgument() {Me.p2, 0})
  2414. Native.Function.Call(Hash.SET_PED_SUFFERS_CRITICAL_HITS, New InputArgument() {Me.p2, 0})
  2415. Native.Function.Call(Hash.SET_ENTITY_AS_MISSION_ENTITY, New InputArgument() {Me.p2, 1, 1})
  2416. Native.Function.Call(Hash.SET_PED_GENERATES_DEAD_BODY_EVENTS, New InputArgument() {Me.p2, 0})
  2417. If ((Me.pinCoord <> Vector3.Zero) AndAlso Not Native.Function.Call(Of Boolean)(Hash.IS_PED_RAGDOLL, New InputArgument() {Me.p2})) Then
  2418. Native.Function.Call(Hash.SET_PED_CAN_RAGDOLL, New InputArgument() {Me.p2, 1})
  2419. THelper.setPedToRagdoll(DirectCast(Me.p2, Ped), &H2710, &H2710, False, False, False)
  2420. End If
  2421. End If
  2422. If (THelper.Exists(Me.p1) AndAlso THelper.Exists(Me.p2)) Then
  2423. Dim distance As Double = World.GetDistance(Me.p1.Position, Me.p2.Position)
  2424. Native.Function.Call(Hash.ROPE_FORCE_LENGTH, New InputArgument() {Me.rope.Handle, (distance * 1.15)})
  2425. If (Me.isPed_p1 AndAlso Me.isVehicle_p2) Then
  2426. Dim ped As Ped = DirectCast(Me.p1, Ped)
  2427. Dim num2 As Double = Me.p2.Velocity.Length
  2428. Dim num3 As Double = ped.Velocity.Length
  2429. Dim destination As Vector3 = Native.Function.Call(Of Vector3)(Hash.GET_ROPE_VERTEX_COORD, New InputArgument() {Me.rope.Handle, 0})
  2430. Dim vector2 As Vector3 = Native.Function.Call(Of Vector3)(Hash.GET_ROPE_LAST_VERTEX_COORD, New InputArgument() {Me.rope.Handle})
  2431. 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
  2432. Me.rope.Delete()
  2433. Me.rope = JC2.createRope(Me.p1.Position, Me.p2.Position, 1, (Me.dist * 0.95))
  2434. ped.FreezePosition = False
  2435. Native.Function.Call(Hash.SET_PED_CAN_RAGDOLL, New InputArgument() {ped, 1})
  2436. Native.Function.Call(Hash.SET_PED_TO_RAGDOLL, New InputArgument() {ped, &H7530, &H7530, 0, 0, 0})
  2437. ped.Health = 100
  2438. ped.ApplyForce((Me.p2.Position - ped.Position))
  2439. ped.Velocity = (Me.p2.Position - ped.Position)
  2440. JC2.attachEntitiesToRope(Me.rope, Me.p1, Me.p2, 1, (Me.dist * 0.95), Me.e1_offset, Me.e2_offset)
  2441. End If
  2442. End If
  2443. End If
  2444. End If
  2445. Catch exception1 As Exception
  2446. ProjectData.SetProjectError(exception1)
  2447. ProjectData.ClearProjectError()
  2448. End Try
  2449. End Sub
  2450.  
  2451. Public Sub remove()
  2452. Try
  2453. Me.rope.Delete()
  2454. Catch exception1 As Exception
  2455. ProjectData.SetProjectError(exception1)
  2456. ProjectData.ClearProjectError()
  2457. End Try
  2458. Try
  2459. Me.p1.MarkAsNoLongerNeeded()
  2460. Me.p1 = Nothing
  2461. Catch exception2 As Exception
  2462. ProjectData.SetProjectError(exception2)
  2463. ProjectData.ClearProjectError()
  2464. End Try
  2465. Try
  2466. Me.p2.MarkAsNoLongerNeeded()
  2467. Me.p2 = Nothing
  2468. Catch exception3 As Exception
  2469. ProjectData.SetProjectError(exception3)
  2470. ProjectData.ClearProjectError()
  2471. End Try
  2472. JC2.entitiesInRope.Remove(Me)
  2473. End Sub
  2474.  
  2475.  
  2476. ' Fields
  2477. Public dist As Double
  2478. Public e1_offset As Vector3
  2479. Public e2_offset As Vector3
  2480. Public isObject_p1 As Boolean = False
  2481. Public isObject_p2 As Boolean = False
  2482. Public isPed_p1 As Boolean = False
  2483. Public isPed_p2 As Boolean = False
  2484. Public isVehicle_p1 As Boolean = False
  2485. Public isVehicle_p2 As Boolean = False
  2486. Public p1 As Entity = Nothing
  2487. Public p2 As Entity = Nothing
  2488. Public pinCoord As Vector3
  2489. Public rope As Rope
  2490. Private timerResetRope As DateTime = DateAndTime.Now
  2491. Private timerResetRope2 As DateTime = DateAndTime.Now
  2492. Public timerSinceAttach As DateTime
  2493. End Class
  2494.  
  2495. Public Class TGasObjects
  2496. ' Methods
  2497. Public Sub New(ByVal o As Entity, ByVal e2 As Entity)
  2498. Try
  2499. If Not THelper.isObject(o) Then
  2500. Throw New Exception("")
  2501. End If
  2502. If JC2.gasObjectsUsed.Contains(DirectCast(o, Prop)) Then
  2503. Throw New Exception("")
  2504. End If
  2505. If THelper.isObject(o) Then
  2506. Me.ent2 = e2
  2507. Me.obj = DirectCast(o, Prop)
  2508. Me.timerLive = DateAndTime.Now
  2509. Me.moveDir = New Vector3(CSng(JC2.TRandom.NextDouble), CSng(JC2.TRandom.NextDouble), 1.0!)
  2510. Native.Function.Call(Hash._SET_PTFX_ASSET_NEXT_CALL, New InputArgument() {"scr_exile2"})
  2511. 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})
  2512. Me.soundID = Native.Function.Call(Of Integer)(Hash.GET_SOUND_ID, New InputArgument(0 - 1) {})
  2513. If (Me.soundID > -1) Then
  2514. THelper.playSoundFromEntity(Me.soundID, "fire_missile_loop", Me.obj, "exile_2_sounds")
  2515. End If
  2516. JC2.listOfGasObjects.Add(Me)
  2517. JC2.gasObjectsUsed.Add(DirectCast(o, Prop))
  2518. End If
  2519. Catch exception1 As Exception
  2520. ProjectData.SetProjectError(exception1)
  2521. If (Me.PTFXID <> 0) Then
  2522. Native.Function.Call(Hash.STOP_PARTICLE_FX_LOOPED, New InputArgument() {Me.PTFXID})
  2523. End If
  2524. If (Me.soundID > -1) Then
  2525. Native.Function.Call(Hash.STOP_SOUND, New InputArgument() {Me.soundID})
  2526. End If
  2527. ProjectData.ClearProjectError()
  2528. End Try
  2529. End Sub
  2530.  
  2531. Public Sub tick()
  2532. Try
  2533. If (DateAndTime.Now.Subtract(Me.timerSinceCreation).TotalMilliseconds < 250) Then
  2534. Me.timerLive = DateAndTime.Now
  2535. Else
  2536. If (DateAndTime.Now.Subtract(Me.timerLive).TotalMilliseconds >= 3000) Then
  2537. Throw New Exception("done")
  2538. End If
  2539. Me.obj.ApplyForce(Me.moveDir)
  2540. Me.timeCounter = (Me.timeCounter + 10)
  2541. If (Me.timeCounter = 200) Then
  2542. Me.timeCounter = 0
  2543. Me.moveDir = New Vector3(CSng(JC2.TRandom.NextDouble), CSng(JC2.TRandom.NextDouble), 1.0!)
  2544. End If
  2545. If (THelper.Exists(Me.ent2) AndAlso THelper.isPed(Me.ent2)) Then
  2546. Native.Function.Call(Hash.SET_PED_CAN_RAGDOLL, New InputArgument() {Me.ent2, 1})
  2547. Native.Function.Call(Hash.SET_PED_TO_RAGDOLL, New InputArgument() {Me.ent2, -1, -1, 0, 0, 0})
  2548. End If
  2549. End If
  2550. Catch exception1 As Exception
  2551. ProjectData.SetProjectError(exception1)
  2552. Dim exception As Exception = exception1
  2553. If (Me.PTFXID <> 0) Then
  2554. Native.Function.Call(Hash.STOP_PARTICLE_FX_LOOPED, New InputArgument() {Me.PTFXID})
  2555. End If
  2556. If (Me.soundID > -1) Then
  2557. Native.Function.Call(Hash.STOP_SOUND, New InputArgument() {Me.soundID})
  2558. End If
  2559. JC2.listOfGasObjects.Remove(Me)
  2560. ProjectData.ClearProjectError()
  2561. End Try
  2562. End Sub
  2563.  
  2564.  
  2565. ' Fields
  2566. Private ent2 As Entity = Nothing
  2567. Private moveDir As Vector3
  2568. Private obj As Prop = Nothing
  2569. Private PTFXID As Integer = -1
  2570. Private soundID As Integer = -1
  2571. Private timeCounter As Integer = 0
  2572. Private timerLive As DateTime = DateAndTime.Now
  2573. Private timerSinceCreation As DateTime = DateAndTime.Now
  2574. End Class
  2575. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement