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