Advertisement
julioCCs

[GTA iV] myTelekinesis powers script Source code

Jan 27th, 2013
3,910
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 58.03 KB | None | 0 0
  1. 'http://gtaxscripting.blogspot.com/
  2. 'http://www.facebook.com/GtaIVScripting
  3. 'https://www.youtube.com/user/GTAScripting
  4.  
  5. ' sorry people, i have no time now to comment and explain this mess :(
  6. ' this is not the best way to do the effects but works almost as expected
  7. ' this is my first script for GTA IV, totaly wierd
  8.  
  9. ' by JulioNIB
  10.  
  11. Imports System
  12. Imports System.Drawing
  13. Imports System.Windows.Forms
  14. Imports GTA
  15.  
  16. Public Class TelekinesisPowers
  17.     Inherits Script
  18.     Private SOn As Boolean = True
  19.     Private GTAIVVersion As Boolean = game.currentepisode = gameepisode.GTAIV
  20.     private showKeyCode as boolean = false
  21.     private vehFloatArray() as vehicle
  22.     private vehFloatCont as int32 = 0
  23.     private pedFloatArray() as ped
  24.     private pedFloatCont as int32 = 0
  25.     private oFakeCR as gta.object
  26.     private vecOFakeCR as vector3
  27.     private vehAlvoThrow as vehicle
  28.     private pedAlvoThrow as ped
  29.     private bClearArray as boolean = false
  30.     private chkWarp as checkpoint
  31.     private bPreviewWarpPos as boolean = false 
  32.     private bTelToWaypoint as boolean = true
  33.     private bTelToWaypointInProgress as boolean = false
  34.     private bAutoHeal as boolean = true
  35.     private bFloatThingsFollowPl as boolean = true
  36.     private bSafeWarpToVehicle as boolean = false
  37.     Private hkThrowAuto, hkFloatThings, hkThrowFloatThings, hkWarpVehicle, hkWarpAnywhere, hkWarpWaypoint, keyNitro, keyHidraulics, _
  38.         keySlowMotion, keyAim, keyHelp, keyNitroBoatBike, maxFloatPed, maxFloatVehicle As Int32
  39.     private vecNitro as vector3
  40.     private animSetJump_Std as animationset = new animationset("jump_std")
  41.     private DistTargetVehicle, DistTargetPed, DistTargetObj, DistTargetHelicopter as double
  42.     private bShowHelp as boolean = false
  43.     Private HidraulicsForce As Double
  44.     Private TargetedVehAutoIncDist As Double
  45.     Private bAchouVeh As Boolean = True
  46.  
  47.     Public Sub New()
  48.         Me.interval = 100
  49.        
  50.         chkWarp = new checkpoint
  51.         chkWarp.visible = false
  52.         chkWarp.color = system.drawing.color.FromArgb(100, system.drawing.color.red)
  53.         chkWarp.position = player.character.position
  54.         chkWarp.diameter = 2
  55.  
  56.         settings.load
  57.        
  58.         if Settings.GetValueKey("Skill_ThrowAuto", "Hotkeys", -1) = -1 then Settings.SetValue("Skill_ThrowAuto", "Hotkeys", Keys.D1)
  59.         if Settings.GetValueKey("Skill_FloatThings", "Hotkeys", -1) = -1 then Settings.SetValue("Skill_FloatThings", "Hotkeys", Keys.D2)
  60.         if Settings.GetValueKey("Skill_ThrowFloatingThings", "Hotkeys", -1) = -1 then Settings.SetValue("Skill_ThrowFloatingThings", "Hotkeys", Keys.D3)
  61.         if Settings.GetValueKey("Skill_WarpToVehicle", "Hotkeys", -1) = -1 then Settings.SetValue("Skill_WarpToVehicle", "Hotkeys", Keys.D4)
  62.         if Settings.GetValueKey("Skill_WarpToAnywhere", "Hotkeys", -1) = -1 then Settings.SetValue("Skill_WarpToAnywhere", "Hotkeys", Keys.D5)
  63.         if Settings.GetValueKey("Skill_WarpToWaypoint", "Hotkeys", -1) = -1 then Settings.SetValue("Skill_WarpToWaypoint", "Hotkeys", Keys.D6)
  64.         if Settings.GetValueKey("SlowMotion", "Hotkeys", -1) = -1 then Settings.SetValue("SlowMotion", "Hotkeys", Keys.LMenu)
  65.         if Settings.GetValueKey("Aim", "Hotkeys", -1) = -1 then Settings.SetValue("Aim", "Hotkeys", Keys.RButton)
  66.         if Settings.GetValueKey("Nitro", "Hotkeys", -1) = -1 then Settings.SetValue("Nitro", "Hotkeys", Keys.LShiftKey)
  67.         if Settings.GetValueKey("Nitro_boat_bike", "Hotkeys", -1) = -1 then Settings.SetValue("Nitro_boat_bike", "Hotkeys", Keys.MButton)
  68.         If Settings.GetValueKey("SuperHidraulics", "Hotkeys", -1) = -1 Then Settings.SetValue("SuperHidraulics", "Hotkeys", Keys.LControlKey)
  69.         If Settings.GetValueKey("ShowHelp", "Hotkeys", -1) = -1 Then Settings.SetValue("ShowHelp", "Hotkeys", Keys.F1)
  70.         if Settings.GetValueKey("Max_floating_peds", "General", -1) = -1 then Settings.SetValue("Max_floating_peds", "General", 20)
  71.         if Settings.GetValueKey("Max_floating_vehicles", "General", -1) = -1 then Settings.SetValue("Max_floating_vehicles", "General", 20)
  72.         if Settings.GetValueKey("AutoHeal", "General", -1) = -1 then Settings.SetValue("AutoHeal", "General", 1)
  73.         if Settings.GetValueKey("FloatThings_follow_player", "General", -1) = -1 then Settings.SetValue("FloatThings_follow_player", "General", 1)
  74.         if Settings.GetValueKey("Safe_Warp_to_Vehicle", "General", -1) = -1 then Settings.SetValue("Safe_Warp_to_Vehicle", "General", 0)
  75.         if Settings.GetValueKey("getTargeted_Vehicle_around", "General", -1) = -1 then Settings.SetValue("getTargeted_Vehicle_around", "General", 1)
  76.         if Settings.GetValueKey("getTargeted_Ped_around", "General", -1) = -1 then Settings.SetValue("getTargeted_Ped_around", "General", 1)
  77.         if Settings.GetValueKey("getTargeted_Object_around", "General", -1) = -1 then Settings.SetValue("getTargeted_Object_around", "General", 1)
  78.         if Settings.GetValueKey("getTargeted_Helicopter_around", "General", -1) = -1 then Settings.SetValue("getTargeted_Helicopter_around", "General", 3)
  79.         if Settings.GetValueKey("Hidraulics_Force", "General", -1) = -1 then Settings.SetValue("Hidraulics_Force", "General", 7)
  80.        
  81.         settings.save
  82.        
  83.         hkThrowAuto = Settings.GetValueKey("Skill_ThrowAuto", "Hotkeys", Keys.D1)
  84.         hkFloatThings = Settings.GetValueKey("Skill_FloatThings", "Hotkeys", Keys.D2)
  85.         hkThrowFloatThings = Settings.GetValueKey("Skill_ThrowFloatingThings", "Hotkeys", Keys.D3)
  86.         hkWarpVehicle = Settings.GetValueKey("Skill_WarpToVehicle", "Hotkeys", Keys.D4)
  87.         hkWarpAnywhere = Settings.GetValueKey("Skill_WarpToAnywhere", "Hotkeys", Keys.D5)
  88.         hkWarpWaypoint = Settings.GetValueKey("Skill_WarpToWaypoint", "Hotkeys", Keys.D6)
  89.         keyNitro = Settings.GetValueKey("Nitro", "Hotkeys", Keys.LShiftKey)
  90.         keyNitroBoatBike = Settings.GetValueKey("Nitro_boat_bike", "Hotkeys", Keys.MButton)
  91.         keyHidraulics = Settings.GetValueKey("SuperHidraulics", "Hotkeys", Keys.LControlKey)
  92.         keySlowMotion = Settings.GetValueKey("SlowMotion", "Hotkeys", Keys.LMenu)
  93.         keyAim = Settings.GetValueKey("Aim", "Hotkeys", Keys.RButton)
  94.         keyHelp = Settings.GetValueKey("ShowHelp", "Hotkeys", Keys.F1)
  95.         maxFloatPed = Settings.GetValueKey("Max_floating_peds", "General", 20) - 1
  96.         maxFloatVehicle = Settings.GetValueKey("Max_floating_vehicles", "General", 20) - 1
  97.         bAutoHeal = Settings.GetValueKey("AutoHeal", "General", 1) = 1
  98.         bFloatThingsFollowPl = Settings.GetValueKey("FloatThings_follow_player", "General", 1) = 1
  99.         bSafeWarpToVehicle = Settings.GetValueKey("Safe_Warp_to_Vehicle", "General", 0) = 1
  100.         DistTargetVehicle = Settings.GetValueKey("getTargeted_Vehicle_around", "General", 1)
  101.         DistTargetPed = Settings.GetValueKey("getTargeted_Ped_around", "General", 1)
  102.         DistTargetObj = Settings.GetValueKey("getTargeted_Object_around", "General", 1)
  103.         DistTargetHelicopter = Settings.GetValueKey("getTargeted_Helicopter_around", "General", 3)
  104.         HidraulicsForce = Settings.GetValueKey("Hidraulics_Force", "General", 7)
  105.        
  106.         redim pedFloatArray(maxFloatPed)
  107.         redim vehFloatArray(maxFloatVehicle)
  108.     End Sub
  109.        
  110.     private sub msg(smsg as string, duracao as int32)
  111.         Native.Function.Call("PRINT_STRING_WITH_LITERAL_STRING_NOW", "STRING", smsg, duracao, 1)
  112.     end sub
  113.    
  114.     private function random(min as int32, max as int32)
  115.         dim rnd as random = new random(System.DateTime.Now.Millisecond)
  116.         random = rnd.next(min, max)
  117.     end function
  118.    
  119.     private sub console_CMD(ByVal sender As Object, ByVal e As ConsoleEventArgs) Handles MyBase.ConsoleCommand     
  120.         'if e.command = "teclas" then
  121.         'showKeyCode = Not showKeyCode
  122.  
  123.         'msg("Mostra teclas: " & Convert.ToString(showKeyCode), 2000)
  124.         'end if
  125.  
  126.         If e.Command = "TK" Then
  127.             SOn = Not SOn
  128.  
  129.             If Not SOn Then
  130.                 msg("Telekinesis powers OFF", 3000)
  131.             Else
  132.                 msg("Telekinesis powers ON", 3000)
  133.             End If
  134.         End If
  135.     end sub
  136.    
  137.     private sub waitEx(time as int32)
  138.         dim c as double = 0
  139.        
  140.         while c < time
  141.             c += me.interval * 1.5
  142.             wait(me.interval)
  143.            
  144.             Geral_tick(nothing, nothing)
  145.         end while
  146.     end sub
  147.    
  148.     Private Sub keyDown(ByVal sender As Object, ByVal e As GTA.KeyEventArgs) Handles MyBase.KeyDown
  149.         If Not SOn Then Exit Sub
  150.  
  151.         If e.Key = 9 Then
  152.             If bFloatThingsFollowPl Then
  153.                 bFloatThingsFollowPl = False
  154.                 msg("FloatThings dont follow player...", 3000)
  155.                 Settings.SetValue("FloatThings_follow_player", "General", 0)
  156.             Else
  157.                 bFloatThingsFollowPl = True
  158.                 msg("FloatThings will follow player...", 3000)
  159.                 Settings.SetValue("FloatThings_follow_player", "General", 1)
  160.             End If
  161.  
  162.             Settings.Save()
  163.         End If
  164.  
  165.         If e.Key = hkWarpAnywhere And Game.isKeyPressed(keyAim) Then bPreviewWarpPos = True
  166.  
  167.         'car jump
  168.         If e.Key = keyHidraulics Then
  169.             If Exists(Player.Character.CurrentVehicle) andalso not Player.Character.CurrentVehicle.model.isboat AndAlso _
  170.                Player.Character.CurrentVehicle.isOnAllWheels Then
  171.                 msg("Hidraulics? Yeah", 3000)
  172.  
  173.                 Native.Function.Call("Apply_Force_To_Car", Player.Character.CurrentVehicle, True, 0, 0, HidraulicsForce, 0, 0, 0, False, False, False, True)
  174.             End If
  175.         End If
  176.  
  177.         If e.Key = hkThrowAuto And Game.isKeyPressed(keyAim) Then
  178.             If Not ThrowAutoPed() Then
  179.                 If Not ThrowAutoVeh() Then ThrowAutoHeli()
  180.             End If
  181.         End If
  182.         If e.Key = hkFloatThings And Game.isKeyPressed(keyAim) Then FloatThings()
  183.         If e.Key = hkThrowFloatThings And Game.isKeyPressed(keyAim) Then 'set targets to Float
  184.             vehAlvoThrow = targetedVehicle(2.0F, 200.0F, DistTargetVehicle)
  185.             If Exists(vehAlvoThrow) AndAlso (Not vehAlvoThrow.isOnScreen Or vehAlvoThrow.Metadata.float) Then vehAlvoThrow = Nothing
  186.  
  187.             pedAlvoThrow = targetedPed(2.0F, 100.0F, DistTargetPed, False, 0)
  188.             If Exists(pedAlvoThrow) AndAlso (Not pedAlvoThrow.isOnScreen Or pedAlvoThrow.Metadata.float) Then pedAlvoThrow = Nothing
  189.         End If
  190.         If e.Key = hkWarpVehicle And Game.isKeyPressed(keyAim) Then myWarpToVehicle()
  191.  
  192.         If e.Key = keyHelp Then bShowHelp = Not bShowHelp
  193.  
  194.         'show key codes
  195.         If showKeyCode Then msg("key: " & Convert.ToInt32(e.KeyWithModifiers), 1000)
  196.     End Sub
  197.     Private Sub keyUp(ByVal sender As Object, ByVal e As GTA.KeyEventArgs) Handles MyBase.KeyUp
  198.         If Not SOn Then Exit Sub
  199.  
  200.         If (e.Key = hkWarpAnywhere) And Game.isKeyPressed(keyAim) Then
  201.             bPreviewWarpPos = False
  202.             WarpToGround(1.0F, 1000.0F, 1.0F)
  203.         End If
  204.  
  205.         If (e.Key = hkWarpWaypoint) And Not Game.isKeyPressed(keyAim) Then telToWayPoint()
  206.  
  207.         If Not Game.isKeyPressed(hkWarpAnywhere) Or Not (e.Key = keyAim) Then
  208.             bPreviewWarpPos = False
  209.             chkWarp.Visible = False
  210.         End If
  211.  
  212.         If e.Key = hkThrowFloatThings Then
  213.             If bClearArray Then
  214.                 bClearArray = False
  215.  
  216.                 Try
  217.                     If Exists(vehAlvoThrow) Then
  218.                         vehAlvoThrow.NoLongerNeeded()
  219.                         vehAlvoThrow.Metadata.float = False
  220.                         vehAlvoThrow.Metadata.launched = False
  221.                     End If
  222.                     If Exists(pedAlvoThrow) Then
  223.                         pedAlvoThrow.NoLongerNeeded()
  224.                         pedAlvoThrow.Metadata.float = False
  225.                         pedAlvoThrow.Metadata.launched = False
  226.                     End If
  227.  
  228.                     vehAlvoThrow = Nothing
  229.                     pedAlvoThrow = Nothing
  230.  
  231.                     For i = 0 To maxFloatVehicle
  232.                         If Exists(vehFloatArray(i)) Then
  233.                             vehFloatArray(i).NoLongerNeeded()
  234.                             vehFloatArray(i).Metadata.float = False
  235.                             vehFloatArray(i).Metadata.launched = False
  236.                             vehFloatArray(i).FreezePosition = False
  237.                             vehFloatArray(i).ApplyForce(vehFloatArray(i).Position.RelativeTop)
  238.                         End If
  239.  
  240.                         vehFloatArray(i) = Nothing
  241.                     Next i
  242.  
  243.                     For i = 0 To maxFloatPed
  244.                         If Exists(pedFloatArray(i)) Then
  245.                             pedFloatArray(i).NoLongerNeeded()
  246.                             pedFloatArray(i).Metadata.float = False
  247.                             pedFloatArray(i).Metadata.launched = False
  248.                             pedFloatArray(i).FreezePosition = False
  249.                             pedFloatArray(i).ApplyForce(pedFloatArray(i).Position.RelativeTop)
  250.                         End If
  251.  
  252.                         pedFloatArray(i) = Nothing
  253.                     Next i
  254.                 Catch
  255.                 End Try
  256.             End If
  257.         End If
  258.     End Sub
  259.    
  260.     Private Sub telToWayPoint()
  261.         If Not bTelToWaypoint Then
  262.             bTelToWaypoint = True
  263.             Exit Sub
  264.         End If
  265.  
  266.         If bTelToWaypointInProgress Then
  267.             bTelToWaypointInProgress = False
  268.             Exit Sub
  269.         End If
  270.  
  271.         Dim vec, vecTmp, vecDest As Vector3
  272.         Dim ultValor
  273.         Dim zMulti = 1
  274.  
  275.         If Exists(Game.GetWaypoint) Then
  276.             vecDest = Game.GetWaypoint.Position
  277.             vecDest.z += 2
  278.  
  279.             Player.Character.Invincible = True
  280.  
  281.             If Exists(Player.Character.CurrentVehicle) Then
  282.                 Player.Character.CurrentVehicle.CanBeDamaged = False
  283.                 Player.Character.WillFlyThroughWindscreen = False
  284.             End If
  285.  
  286.             vecTmp = Player.Character.Position + ((vecDest - Player.Character.Position) / 2)
  287.             vecTmp.Z = Player.Character.Position.Z + vecDest.DistanceTo(Player.Character.Position) / 5
  288.  
  289.             vec = Player.Character.Position
  290.             vec.Z += 5
  291.  
  292.             If Not Exists(Player.Character.CurrentVehicle) Then
  293.                 ultValor = 100000
  294.  
  295.                 Player.Character.forceragdoll(2000, true)
  296.  
  297.                 While True
  298.                     Wait(20)
  299.  
  300.                     If (zMulti = 1) And (Player.Character.Position.DistanceTo(vecTmp) > ultValor) Then Exit While
  301.  
  302.                     If Game.isKeyPressed(hkWarpWaypoint) Then
  303.                         bTelToWaypointInProgress = True
  304.                         zMulti = 20
  305.                     Else
  306.                         zMulti = 1
  307.                     End If
  308.  
  309.                     vec = (vecTmp - Player.Character.Position) / 2
  310.  
  311.                     vec.Z *= zMulti
  312.  
  313.                     If Exists(Player.Character.CurrentVehicle) Then
  314.                         Native.Function.Call("Apply_Force_To_Car", Player.Character.CurrentVehicle, True, vec.X, vec.Y, vec.Z, 0, 0, 0, False, False, False, True)
  315.                     Else
  316.                         While vec.DistanceTo(vec.Zero) > 450
  317.                             vec /= 1.2
  318.                         End While
  319.                         While vec.DistanceTo(vec.Zero) < 400
  320.                             vec *= 1.2
  321.                         End While
  322.  
  323.                         Player.Character.Velocity = vec
  324.                         Native.Function.Call("Apply_Force_To_Ped", Player.Character, True, 0, 0, 1f, 0, 0, 1f, False, False, False, True)
  325.                     End If
  326.  
  327.             ultValor = Player.Character.Position.DistanceTo(vecTmp)
  328.  
  329.             msg("Hold tight... you will fly", 3000)
  330.                 End While
  331.             End If
  332.  
  333.             ultValor = 100000
  334.  
  335.             Player.Character.forceragdoll(2000, true)
  336.  
  337.             While True
  338.                 Wait(20)
  339.  
  340.                 If (zMulti = 1) And (Player.Character.Position.DistanceTo(vecDest) > ultValor) Then Exit While
  341.  
  342.                 If Game.isKeyPressed(hkWarpWaypoint) Then
  343.                     bTelToWaypointInProgress = True
  344.                     zMulti = -20
  345.                 Else
  346.                     zMulti = 1
  347.                 End If
  348.  
  349.                 vec = (vecDest - Player.Character.Position) / 2
  350.  
  351.                 vec.Z *= zMulti
  352.  
  353.                 If Exists(Player.Character.CurrentVehicle) Then
  354.                     Native.Function.Call("Apply_Force_To_Car", Player.Character.CurrentVehicle, True, vec.X, vec.Y, vec.Z, 0.0F, 0.0F, 5.0F, False, False, False, True)
  355.                 Else
  356.                     While vec.DistanceTo(vec.Zero) > 350
  357.                         vec /= 1.2
  358.                     End While
  359.                     While vec.DistanceTo(vec.Zero) < 200
  360.                         vec *= 1.2
  361.                     End While
  362.                    
  363.                     Player.Character.Velocity = vec
  364.                 End If
  365.  
  366.                 If Exists(Player.Character.CurrentVehicle) AndAlso (Player.Character.Position.DistanceTo(World.GetGroundPosition(Player.Character.Position)) < 5) Then
  367.                     For Each vAux As Vehicle In World.GetVehicles(Player.Character.Position, 10.0F)
  368.                         If Exists(vAux) AndAlso (Not vAux.Metadata.flying) AndAlso (vAux <> Player.Character.CurrentVehicle) Then
  369.                             vAux.Metadata.flying = True
  370.                             vec = (vAux.Position - (Player.Character.CurrentVehicle.Position + Game.CurrentCamera.Direction)) * 3
  371.                             vAux.PetrolTankHealth = -1
  372.                             Native.Function.Call("Apply_Force_To_Car", vAux, True, vec.X, vec.Y, 5.0F, 5.0F, 5.0F, 0, False, False, False, True)
  373.                         End If
  374.                     Next
  375.                    
  376.                     msg("Hold tight...", 3000)
  377.                 else
  378.                     msg("Hold more tight... you will fall", 3000)
  379.                 End If
  380.  
  381.                 ultValor = Player.Character.Position.DistanceTo(vecDest)
  382.             End While
  383.  
  384.             If Exists(Player.Character.CurrentVehicle) Then
  385.                 Player.Character.CurrentVehicle.FreezePosition = True
  386.                 Player.Character.CurrentVehicle.FreezePosition = False
  387.                 Native.Function.Call("Apply_Force_To_Car", Player.Character.CurrentVehicle, True, 2.0F, 2.0F, 3.0F, 0, 0, 0, False, False, False, True)
  388.                 Player.Character.CurrentVehicle.CanBeDamaged = False
  389.             Else
  390.                 Player.Character.WillFlyThroughWindscreen = True
  391.                 Player.Character.FreezePosition = True
  392.                 Player.Character.FreezePosition = False
  393.                 Native.Function.Call("Apply_Force_To_Ped", Player.Character, True, 2.0F, 2.0F, 3.0F, 0, 0, 0, False, False, False, True)
  394.                 Player.Character.isRagdoll = False
  395.             End If
  396.  
  397.             Player.Character.Invincible = False
  398.  
  399.             If Not Exists(Game.GetWaypoint) Then
  400.                 msg("Here we are", 3000)
  401.             Else
  402.                 msg("D'OH. There is something in the way...", 3000)
  403.             End If
  404.         Else
  405.             msg("Set the waypoint...", 3000)
  406.         End If
  407.     End Sub
  408.    
  409.     private sub FloatThings
  410.         dim distV As Double = DistTargetVehicle
  411.         dim distP as double = DistTargetPed
  412.         dim vAux as vehicle
  413.         dim pAux as ped
  414.         dim vecAux as vector3        
  415.        
  416.         While Game.isKeyPressed(hkFloatThings) Andalso Game.isKeyPressed(keyAim)
  417.             pAux = targetedPed(1F, 100.0F, distP, False, 0)
  418.  
  419.             If Exists(pAux) AndAlso (Not pAux.Metadata.float) Then
  420.                 If pedFloatCont < maxFloatPed Then
  421.                     pedFloatCont += 1
  422.                 Else
  423.                     pedFloatCont = 0
  424.                 End If
  425.  
  426.                 vecAux = pAux.Position
  427.                 vecAux.z += 7
  428.                 pAux.Metadata.pos = vecAux
  429.                 pAux.Metadata.float = True
  430.                 pAux.DropCurrentWeapon()
  431.                 pAux.Weapons.RemoveAll()
  432.                 if exists(pedFloatArray(pedFloatCont)) then pedFloatArray(pedFloatCont).metadata.float = false
  433.                 pedFloatArray(pedFloatCont) = pAux
  434.  
  435.                 msg("Float my dear", 3000)
  436.             Else
  437.                 vAux = targetedVehicle(1F, 200.0F, distV)
  438.  
  439.                 If Exists(vAux) AndAlso (Not vAux.Metadata.float) Then
  440.                     If vehFloatCont < maxFloatVehicle Then
  441.                         vehFloatCont += 1
  442.                     Else
  443.                         vehFloatCont = 0
  444.                     End If
  445.  
  446.                     vecAux = vAux.Position
  447.                     vecAux.z += 15
  448.                     vAux.Metadata.pos = vecAux
  449.                     vAux.Metadata.float = True
  450.                     vAux.canbedamaged = false
  451.                     vAux.metadata.FloatzPos = 100
  452.                     if exists(vehFloatArray(vehFloatCont)) then vehFloatArray(vehFloatCont).metadata.float = false
  453.                     vehFloatArray(vehFloatCont) = vAux
  454.  
  455.                     For Each pAux In World.GetPeds(vAux.Position, 3.0F)
  456.                         If pAux <> Player.Character Then pAux.Task.LeaveVehicleImmediately(vAux)
  457.                     Next
  458.  
  459.                     msg("Float my dear", 3000)
  460.                 End If
  461.             End If
  462.  
  463.             If Game.isKeyPressed(hkFloatThings) And Game.isKeyPressed(keyAim) Then
  464.                 WaitEx(500)
  465.                 distV = 3
  466.                 distP = 3
  467.             end if
  468.         End While
  469.     End sub
  470.    
  471.     private sub ThrowThings
  472.         dim vecAux as vector3      
  473.            
  474.         for each vehAux as vehicle in vehFloatArray
  475.             if exists(vehAux) andalso not vehAux.metadata.launched then
  476.                 if exists(vehAlvoThrow) then                   
  477.                     vecAux = (vehAlvoThrow.position - vehAux.position) * 15
  478.                     vehAux.PetrolTankHealth = -1
  479.                     vehAux.canbedamaged = true
  480.                    
  481.                     if vehAux.position.distanceto(vehAlvoThrow.position) < 10 then
  482.                         vehAux.metadata.launched = true                    
  483.                     end if
  484.                    
  485.                     msg("Throwing to targeted vehicle", 3000)
  486.                 elseif exists(pedAlvoThrow) then                   
  487.                     vecAux = (pedAlvoThrow.position - vehAux.position) * 15                
  488.                     vehAux.PetrolTankHealth = -1
  489.                     vehAux.canbedamaged = true
  490.                        
  491.                     if vehAux.position.distanceto(pedAlvoThrow.position) < 10 then
  492.                         pedAlvoThrow.freezeposition = true
  493.                         pedAlvoThrow.FreezePosition = False
  494.                         pedAlvoThrow.ApplyForce(pedAlvoThrow.Position.RelativeTop)
  495.                         pedAlvoThrow.isragdoll = true
  496.                         vehAux.metadata.launched = true                    
  497.                     end if
  498.                    
  499.                     msg("Throwing to targeted ped", 3000)
  500.                 else
  501.                     msg("Set the target...", 3000)
  502.                     exit sub
  503.                 end if
  504.                
  505.                 bClearArray = true
  506.                
  507.                 if not vehAux.metadata.prelaunched then
  508.                     vehAux.metadata.prelaunched = true
  509.                     vehAux.freezeposition = true
  510.                     vehAux.freezeposition = false
  511.                 end if
  512.                
  513.                 vehAux.metadata.float = false              
  514.                 vehAux.freezeposition = false
  515.                
  516.                 Native.Function.Call("Apply_Force_To_Car", vehAux, True, vecAux.x, vecAux.y, vecAux.z - 3, 0, 5f, 0, False, False, False, True)
  517.             end if
  518.         next
  519.        
  520.         for each pedAux as ped in pedFloatArray
  521.             if exists(pedAux) andalso not pedAux.metadata.launched then
  522.                 if exists(vehAlvoThrow) then
  523.                     vecAux = (vehAlvoThrow.position - pedAux.position) * 15
  524.                    
  525.                     if pedAux.position.distanceto(vehAlvoThrow.position) < 3 then pedAux.metadata.launched = true
  526.                    
  527.                     msg("Throwing to targeted vehicle", 3000)
  528.                 elseif exists(pedAlvoThrow) then
  529.                     vecAux = (pedAlvoThrow.position - pedAux.position) * 15
  530.                    
  531.                     if pedAux.position.distanceto(pedAlvoThrow.position) < 2 then
  532.                         pedAlvoThrow.freezeposition = true
  533.                         pedAlvoThrow.FreezePosition = False
  534.                         pedAlvoThrow.ApplyForce(pedAlvoThrow.Position.RelativeBottom)
  535.                         pedAlvoThrow.isragdoll = true
  536.                         pedAux.metadata.launched = true
  537.                     end if
  538.                    
  539.                     msg("Throwing to targeted ped", 3000)
  540.                 else
  541.                     msg("Set the target...", 3000)
  542.                     exit sub
  543.                 end if 
  544.                
  545.                 bClearArray = true
  546.                
  547.                 if not pedAux.metadata.prelaunched then
  548.                     pedAux.metadata.prelaunched = true
  549.                     pedAux.freezeposition = true
  550.                     pedAux.FreezePosition = False
  551.                     pedAux.ApplyForce(pedAux.Position.RelativeTop)
  552.                 end if
  553.                    
  554.                 pedAux.metadata.float = false
  555.                 pedAux.forceragdoll(1000, true)
  556.                 pedAux.freezeposition = false
  557.                
  558.                 Native.Function.Call("Apply_Force_To_Ped", pedAux, True, vecAux.x, vecAux.y, vecAux.z - 2, 0, 0, 0, False, False, False, True)                 
  559.             end if
  560.         next
  561.     end sub
  562.    
  563.     private sub myWarpToVehicle    
  564.         dim vAux as vehicle
  565.         dim pAux, pAux2 as ped
  566.         dim vecAux as vector3
  567.        
  568.         try
  569.             vAux = targetedVehicle(1.0, 200.0F, DistTargetVehicle)
  570.            
  571.             if exists(vAux) then
  572.                 player.character.invincible = true
  573.                
  574.                 vAux.PassengersLeaveVehicle(true)
  575.                
  576.                 msg("''myWarp'' to vehicle", 3000)
  577.                
  578.                 dim timeOut = 0
  579.                
  580.                 if exists(player.character.currentvehicle) then                
  581.                     native.function.call("SET_PED_FORCE_FLY_THROUGH_WINDSCREEN", player.character)
  582.                     while exists(player.character.currentvehicle) andalso (timeOut < 5000)
  583.                         timeOut += 300
  584.                         waitEx(100)
  585.                     end while
  586.                     Native.Function.Call("Apply_Force_To_Ped",  player.character, True, 0, 0, 7f, 0, 0f, 0, False, False, False, True)
  587.                     wait(500)
  588.                     player.character.freezeposition = true
  589.                     player.character.freezeposition = false
  590.                 else                       
  591.                     player.character.animation.play(animSetJump_Std, "jump_on_spot", 10.0, AnimationFlags.Unknown01)
  592.                     if GTAIVVersion then
  593.                         waitEx(800)
  594.                     else
  595.                         waitEx(200)
  596.                         Native.Function.Call("Apply_Force_To_Ped", player.character, True, 0, 0, 7f, 0, 0, 0, False, False, False, True)
  597.                         waitEx(200)
  598.                     end if
  599.                 end if
  600.                
  601.                 timeOut = 0
  602.                
  603.                 while exists(vAux) andalso ((player.character.position.distanceto(vAux.position) > 5) and (timeOut < 10000))
  604.                     player.character.isragdoll = true
  605.                    
  606.                     if exists(vAux) then
  607.                         vecAux = (vAux.position - player.character.position + (vAux.velocity / 2)) * 3
  608.                        
  609.                         if vecAux.distanceto(vecAux.zero) < 5 then
  610.                             vecAux *= 1.5
  611.                         else
  612.                             while vecAux.distanceto(vecAux.zero) > 250
  613.                                 vecAux /= 1.2
  614.                             end while
  615.                         end if
  616.                            
  617.                         player.character.velocity = vecAux
  618.                        
  619.                         if vAux.position.distanceto(player.character.position) < 30 then
  620.                             pAux = vAux.GetPedOnSeat(VehicleSeat.Driver)
  621.                            
  622.                             if exists(pAux) then                                               
  623.                                 native.function.call("SET_PED_FORCE_FLY_THROUGH_WINDSCREEN", paux)
  624.                                 waitEx(500)
  625.                                 if exists(pAux) then pAux.die
  626.                                 pAux = vAux.GetPedOnSeat(VehicleSeat.Driver)
  627.                                 if exists(pAux) then
  628.                                     vecAux = vAux.position
  629.                                     vecAux.z += 5      
  630.                                     pAux2 = world.createped(pAux.model, vecAux)
  631.                                     pAUx.delete
  632.                                     wait(200)
  633.                                     if exists(pAux2) then
  634.                                         pAux2.forceragdoll(3000, false)                            
  635.                                         pAux2.applyforce(pAux2.position - vAux.position)
  636.                                         pAux2.die
  637.                                     end if
  638.                                 end if
  639.                             end if
  640.                         end if
  641.                     end if
  642.                    
  643.                     wait(50)
  644.                     timeOut += 200
  645.                 end while
  646.                
  647.                 player.character.isragdoll = false
  648.                 player.character.invincible = false
  649.                
  650.                 if exists(vAux) then   
  651.                     pAux = vAux.GetPedOnSeat(VehicleSeat.Driver)
  652.                     if exists(pAux) then pAux.delete
  653.                    
  654.                     if bSafeWarpToVehicle then
  655.                         player.character.freezeposition = true
  656.                         player.character.freezeposition = false
  657.                         player.character.isragdoll = false
  658.                         wait(50)
  659.                         player.character.task.ClearAllImmediately
  660.                         wait(50)
  661.                         player.character.task.WarpIntoVehicle(vAux, VehicleSeat.Driver)
  662.                     else
  663.                         player.character.WarpIntoVehicle(vAux, VehicleSeat.Driver)
  664.                     end if
  665.                    
  666.                     if exists(vAux) then
  667.                         for each pAux in world.getpeds(vAux.position, 3f)
  668.                             if exists(pAux) andalso (pAux <> player.character) then
  669.                                 pAux.task.LeaveVehicleImmediately(vAux)
  670.                                
  671.                                 if pAux.pedtype <> pedtype.cop then pAux.task.fleefromchar(player.character)
  672.                             end if
  673.                         next
  674.                     end if
  675.                    
  676.                     if not player.character.isinvehicle and not bSafeWarpToVehicle then
  677.                         msg("D'OH!!! Fail", 3000)
  678.                         vAux.PassengersLeaveVehicle(true)
  679.                     end if                 
  680.                 else
  681.                     msg("Too late to warp, it's gone", 3000)
  682.                 end if
  683.             end if
  684.         catch exc As Exception
  685.             msg("D'OH, an error occurred...", 3000)
  686.         end try
  687.     end sub
  688.    
  689.     private function ThrowAutoPed      
  690.         dim fx, fy, fz as double
  691.         dim veh as vehicle = nothing
  692.         dim bPedInVeh as boolean = false
  693.         dim a as ped = nothing
  694.         dim vecAux as vector3
  695.        
  696.         a = targetedPed(1f, 100f, DistTargetPed, false, 0)
  697.        
  698.         if not exists(a) orelse not a.isalive then return false
  699.        
  700.         msg("Your ride", 2000)
  701.        
  702.         For Each veh In World.GetVehicles(a.Position, 20.0)
  703.             If Exists(veh) AndAlso Not veh.Metadata.used AndAlso Not veh.Model.isHelicopter AndAlso _
  704.                (veh <> a.CurrentVehicle) AndAlso veh.isOnScreen Then
  705.                 Exit For
  706.             Else
  707.                 veh = Nothing
  708.             End If
  709.         Next
  710.        
  711.         if not exists(veh) then
  712.             For Each veh In World.GetVehicles(a.Position, 50.0)
  713.                 If Exists(veh) AndAlso Not veh.Metadata.used AndAlso Not veh.Model.isHelicopter AndAlso _
  714.                     (veh <> a.CurrentVehicle) AndAlso veh.isOnScreen Then
  715.                     Exit For
  716.                 Else
  717.                     veh = Nothing
  718.                 End If
  719.             Next
  720.         end if
  721.        
  722.         if not exists(veh) andalso exists(a) then
  723.             dim oAux as gta.object
  724.             vecAux = a.position
  725.             vecAux.z += 30
  726.             oAux = world.createobject(&HFBCD74AB, vecAux)      
  727.             wait(200)
  728.             if exists(oAux) andalso exists(a) then
  729.                 oAux.applyforce((a.position - oAux.position) + a.velocity)
  730.                
  731.                 while exists(a) andalso exists(oAux)
  732.                     if oAux.position.distanceto(oAux.position.toground) <= 2 then
  733.                         world.addexplosion(oAux.position)
  734.                         a.die
  735.                         exit while
  736.                     end if
  737.                    
  738.                     world.startfire(oAux.position)
  739.                    
  740.                     wait(5)
  741.                 end while
  742.                
  743.                 world.ExtinguishFire(oAux.position, 100)
  744.             end if
  745.            
  746.             exit function
  747.         end if
  748.            
  749.         If Exists(veh) Then
  750.             If veh = Player.Character.CurrentVehicle Then
  751.                 veh.CanBeDamaged = False
  752.             Else
  753.                 veh.Metadata.used = True
  754.             End If
  755.  
  756.             If Exists(a) AndAlso a.isInVehicle Then
  757.                 bPedInVeh = True
  758.  
  759.                 If random(1, 5) < 3 Then
  760.                     a.LeaveVehicle()
  761.                 Else
  762.                     a.Die()
  763.                 End If
  764.             End If
  765.  
  766.             World.AddExplosion(veh.Position, ExplosionType.Molotov, 0.001, True, False, 0)
  767.             Wait(100)
  768.  
  769.             If veh <> Player.Character.CurrentVehicle Then veh.PetrolTankHealth = -1
  770.  
  771.             veh.FreezePosition = False
  772.             Native.Function.Call("Apply_Force_To_Car", veh, True, 0, 0, 10.0F, 0, 0, 0, False, False, False, True)
  773.             waitEx(500)
  774.             If Exists(veh) Then Native.Function.Call("Apply_Force_To_Car", veh, True, 0, 0, 0, 0, 5.0F, 0, False, False, False, True)
  775.             waitEx(500)
  776.             If Exists(veh) Then Native.Function.Call("Apply_Force_To_Car", veh, True, 0, 0, 2.0F, 0, 0, 0, False, False, False, True)
  777.             waitEx(500)
  778.  
  779.             If Exists(veh) Then
  780.                 If bPedInVeh OrElse Not Exists(a) Then
  781.                     If Exists(veh) Then
  782.                         veh.CanBeDamaged = False
  783.  
  784.                         Native.Function.Call("BREAK_CAR_DOOR", veh, 0, False)
  785.                         Native.Function.Call("BREAK_CAR_DOOR", veh, 1, False)
  786.                         Native.Function.Call("BREAK_CAR_DOOR", veh, 2, False)
  787.                         Native.Function.Call("BREAK_CAR_DOOR", veh, 3, False)
  788.                         Native.Function.Call("BREAK_CAR_DOOR", veh, 4, False)
  789.                         Native.Function.Call("BREAK_CAR_DOOR", veh, 5, False)
  790.  
  791.                         Dim expAux As Double = veh.Position.DistanceTo(Player.Character.Position)
  792.  
  793.                         expAux = ((100 - ((expAux * 100) / 60)) / 550)
  794.  
  795.                         If Exists(a) Then
  796.                             If bPedInVeh Then a.isOnFire = True
  797.                         End If
  798.  
  799.                         World.AddExplosion(veh.Position, ExplosionType.Rocket, 1, True, False, expAux)
  800.                         Native.Function.Call("Apply_Force_To_Car", veh, True, Convert.ToDouble(random(1, 2)), Convert.ToDouble(random(1, 2)), _
  801.                            Convert.ToDouble(random(30, 60)), Convert.ToDouble(random(5, 10)), Convert.ToDouble(random(5, 10)), Convert.ToDouble(random(5, 10)), False, False, False, True)
  802.                         Wait(100)
  803.                         If veh <> Player.Character.CurrentVehicle Then veh.PetrolTankHealth = -1
  804.                         waitEx(400)
  805.                     End If
  806.  
  807.                     If Exists(veh) And (veh <> Player.Character.CurrentVehicle) Then veh.CanBeDamaged = True
  808.                 Else
  809.                     If Exists(a) Then
  810.                         fx = (veh.Position.X - a.Position.X) * -15
  811.                         fy = (veh.Position.Y - a.Position.Y) * -15
  812.                         fz = (veh.Position.Z - a.Position.Z) * -13
  813.  
  814.                         If Exists(veh) Then
  815.                             veh.Health = -1
  816.                             veh.EngineHealth = -1
  817.                             If veh <> Player.Character.CurrentVehicle Then veh.PetrolTankHealth = -1
  818.                             Native.Function.Call("Apply_Force_To_Car", veh, True, fx, fy, fz, 0, 0.0F, 0.0F, False, False, False, True)
  819.                         Else
  820.                             msg("Too far...", 1000)
  821.                         End If
  822.                     Else
  823.                         msg("Too far...", 1000)
  824.                     End If
  825.                 End If
  826.             End If
  827.         Else
  828.             msg("Too far...", 1000)
  829.         End If
  830.  
  831.         If Exists(veh) Then
  832.             If veh = Player.Character.CurrentVehicle Then
  833.                 veh.EngineHealth = 1000
  834.                 veh.PetrolTankHealth = 1000
  835.             End If
  836.  
  837.             veh.CanBeDamaged = True
  838.         End If
  839.  
  840.         Return True
  841.     End Function
  842.    
  843.     private function ThrowAutoVeh
  844.         dim veh as vehicle = nothing
  845.        
  846.         veh = targetedVehicle(2f, 200f, DistTargetVehicle)
  847.        
  848.         if exists(veh) andalso ((veh = player.character.currentvehicle) orelse veh.model.ishelicopter) then veh = nothing
  849.        
  850.         if not exists(veh) then return false                               
  851.        
  852.         msg("Rise and burn", 2000)
  853.        
  854.         world.addexplosion(veh.position, explosiontype.molotov, 0.001, true, false, 0)
  855.         wait(100)
  856.         veh.PetrolTankHealth = -1
  857.         veh.freezeposition = false
  858.         Native.Function.Call("Apply_Force_To_Car", veh, True, 0, 0, 10f, 0, 0, 0, False, False, False, True)                   
  859.         waitEx(500)
  860.         if exists(veh) then Native.Function.Call("Apply_Force_To_Car", veh, True, 0, 0, 0, 0, 5f, 0, False, False, False, True)                
  861.         waitEx(500)
  862.         if exists(veh) then Native.Function.Call("Apply_Force_To_Car", veh, True, 0, 0, 2f, 0, 0, 0, False, False, False, True)                
  863.         waitEx(500)
  864.        
  865.         if exists(veh) then      
  866.             veh.CanBeDamaged = false
  867.        
  868.             Native.Function.Call("BREAK_CAR_DOOR", veh, 0, false)
  869.             Native.Function.Call("BREAK_CAR_DOOR", veh, 1, false)
  870.             Native.Function.Call("BREAK_CAR_DOOR", veh, 2, false)
  871.             Native.Function.Call("BREAK_CAR_DOOR", veh, 3, false)
  872.             Native.Function.Call("BREAK_CAR_DOOR", veh, 4, false)
  873.             Native.Function.Call("BREAK_CAR_DOOR", veh, 5, false)  
  874.            
  875.             dim expAux as double = veh.position.distanceto(player.character.position)
  876.                
  877.             expAux = ((100 -((expAux * 100) / 60)) / 550)
  878.                        
  879.             world.addexplosion(veh.position, explosiontype.rocket, 1, true, false, expAux)                                 
  880.             Native.Function.Call("Apply_Force_To_Car", veh, True, convert.todouble(random(1, 2)), convert.todouble(random(1, 2)), convert.todouble(random(30, 60)), convert.todouble(random(5, 10)), convert.todouble(random(5, 10)), convert.todouble(random(5, 10)), False, False, False, True)  
  881.             wait(100)
  882.             veh.PetrolTankHealth = -1
  883.             waitEx(400)
  884.        
  885.             if exists(veh) then veh.CanBeDamaged = true
  886.         else
  887.             msg("Too far...", 1000)
  888.         end if
  889.        
  890.         return true
  891.     end function
  892.    
  893.     private function ThrowAutoHeli     
  894.         dim veh as vehicle = nothing
  895.         dim a as ped = nothing
  896.         dim vecAux, force as vector3
  897.         dim vHeli as vehicle = nothing
  898.         dim AtackCont as int32 = 5
  899.        
  900.         if not exists(vHeli) then vHeli = targetedVehicle(2f, 300f, DistTargetHelicopter)
  901.  
  902.         if exists(vHeli) andalso ((vHeli = player.character.currentvehicle) orelse not vHeli.model.ishelicopter) then vHeli = nothing
  903.        
  904.         if not exists(vHeli) then return false
  905.            
  906.         for each veh in world.getvehicles(player.character.position, 60f)
  907.             if exists(veh) andalso (veh <> vHeli) andalso veh.isalive andalso (veh <> player.character.currentvehicle) andalso not veh.metadata.isHeliKiller then
  908.                 exit for                   
  909.             else
  910.                 veh = nothing
  911.             end if
  912.         next
  913.        
  914.         if not exists(veh) then                    
  915.             vecAux = player.character.direction
  916.             vecAux.x = vecAux.x * -5 + player.character.position.x
  917.             vecAux.y = vecAux.y * -5 + player.character.position.y
  918.             vecAux.z = vecAux.z + player.character.position.z
  919.             veh = world.createvehicle(vecAux)
  920.         end if
  921.            
  922.         if exists(veh) then        
  923.             veh.metadata.isHeliKiller = true
  924.            
  925.             msg("Heli down?", 2000)
  926.                
  927.             veh.health = -1
  928.             veh.enginehealth = -1
  929.             veh.PetrolTankHealth = -1
  930.            
  931.             a = world.getclosestped(veh.position, 1f)
  932.            
  933.             if exists(a) then a.die
  934.            
  935.             veh.freezeposition = false
  936.             Native.Function.Call("Apply_Force_To_Car", veh, True, 0, 0, 20f, 0, 0.0F, 0.0F, False, False, False, True)
  937.             waitEx(1000)
  938.             if exists(veh) then world.addexplosion(veh.position, explosiontype.default, 0.01, true, false, 0)  
  939.            
  940.             if exists(vHeli) then AtackCont = vheli.position.distanceto(player.character.position)
  941.            
  942.             msg("They have a Helicopter, i have telekinesis", 3000)
  943.            
  944.             while atackCont > 0                    
  945.                 if exists(vHeli) then
  946.                     force = vHeli.position - veh.position                  
  947.                     force.x = force.x * 230
  948.                     force.y = force.y * 230
  949.                     force.z = force.z * 230
  950.                     Native.Function.Call("Apply_Force_To_Car", veh, True, force.x, force.y, force.z, 0, 0.0F, 0.0F, False, False, False, True)
  951.                     atackCont -= 10
  952.                     wait(50)
  953.                 else
  954.                     exit while
  955.                 end if
  956.             end while
  957.         end if
  958.        
  959.         return true
  960.     end function
  961.        
  962.     private function targetedObj(distMin as double, distMax as double, dist as double, optional ignoreTaged as boolean = true)
  963.         dim vecPl, direction  as vector3   
  964.         dim objAlvo as gta.object = nothing
  965.         dim o as gta.object()
  966.         dim distAux, distDif as double
  967.  
  968.         o = world.getallobjects
  969.            
  970.         direction = game.currentcamera.direction / 2
  971.        
  972.         if exists(player.character.currentvehicle) andalso (player.character.currentvehicle.model.ishelicopter orelse _
  973.             (player.character.currentvehicle.position.distanceto(player.character.currentvehicle.position.toground) > 3)) then
  974.             direction.z += 0.12
  975.             dist += 2
  976.         else
  977.             if exists(player.character.currentvehicle) andalso not player.character.currentvehicle.model.isbike then direction.z += 0.02
  978.         end if
  979.        
  980.         if exists(player.character.currentvehicle) then        
  981.             vecPl = game.currentcamera.position + (direction * 7)
  982.         else
  983.             vecPl = game.currentcamera.position + (direction)
  984.         end if
  985.        
  986.         distDif = vecpl.distanceto(vecPl + direction)
  987.         distAux = distDif
  988.        
  989.         while distAux <= distMax       
  990.             vecPl += direction
  991.             distAux += distDif
  992.            
  993.             for each objAlvo in o
  994.                 if exists(objAlvo) andalso (objAlvo.position.distanceto(vecPl) <= dist) andalso (objAlvo.position.distanceto(player.character.position) >= distMin) andalso _
  995.                    (objAlvo.position.distanceto(player.character.position) <= distMax) andalso (objAlvo.position.distanceto(player.character.position) >= distMin) andalso _
  996.                    (not ignoreTaged orelse (ignoreTaged andalso not objAlvo.metadata.ignored))then
  997.                     exit while
  998.                 else
  999.                     objAlvo = nothing
  1000.                 end if
  1001.             next
  1002.            
  1003.             objAlvo = nothing
  1004.         end while
  1005.        
  1006.         return objAlvo
  1007.     end function
  1008.    
  1009.     private function targetedVehicle(distMin as double, distMax as double, dist as double, optional ignoreTaged as boolean = true)
  1010.         dim vecPl, direction as vector3
  1011.         dim vehAlvo as vehicle = nothing
  1012.         Dim distAux, distDif As Double
  1013.  
  1014.         If bAchouVeh Then
  1015.             TargetedVehAutoIncDist = distMax
  1016.         Else
  1017.             If TargetedVehAutoIncDist < 500 Then TargetedVehAutoIncDist += 50
  1018.             distMax = TargetedVehAutoIncDist
  1019.         End If
  1020.    
  1021.         direction = game.currentcamera.direction / 2
  1022.        
  1023.         if exists(player.character.currentvehicle) andalso (player.character.currentvehicle.model.ishelicopter orelse _
  1024.             (player.character.currentvehicle.position.distanceto(player.character.currentvehicle.position.toground) > 3)) then
  1025.             direction.z += 0.12
  1026.             dist += 2
  1027.         else
  1028.             if exists(player.character.currentvehicle) andalso not player.character.currentvehicle.model.isbike then direction.z += 0.02
  1029.         end if
  1030.        
  1031.         if exists(player.character.currentvehicle) then        
  1032.             vecPl = game.currentcamera.position + (direction * 7)
  1033.         else
  1034.             vecPl = game.currentcamera.position + (direction)
  1035.         end if
  1036.        
  1037.         distDif = vecpl.distanceto(vecPl + direction)
  1038.         distAux = distDif
  1039.        
  1040.         while distAux <= distMax       
  1041.             vecPl += direction
  1042.             distAux += distDif
  1043.            
  1044.             for each vehAlvo in world.getvehicles(vecPl, dist)
  1045.                 If Exists(vehAlvo) AndAlso (vehAlvo <> Player.Character.CurrentVehicle) AndAlso _
  1046.                    ((Not ignoreTaged) OrElse (ignoreTaged AndAlso Not vehAlvo.Metadata.ignore)) AndAlso _
  1047.                    (vehAlvo.Position.DistanceTo(Player.Character.Position) >= distMin) Then
  1048.                     Exit While
  1049.                 Else
  1050.                     vehAlvo = Nothing
  1051.                 End If
  1052.             next
  1053.         end while
  1054.  
  1055.         bAchouVeh = Exists(vehAlvo)
  1056.  
  1057.         return vehAlvo
  1058.     end function
  1059.    
  1060.     private function targetedPed(distMin as double, distMax as double, dist as double, inCarToo as boolean, mode as int32, _
  1061.        optional aliveOnly as boolean = true, optional ignoreTaged as boolean = true)
  1062.         dim pedAlvo as ped = nothing
  1063.         dim vecPl, direction as vector3
  1064.         dim distAux, distDif as double
  1065.    
  1066.         direction = game.currentcamera.direction / 2
  1067.        
  1068.         if exists(player.character.currentvehicle) andalso (player.character.currentvehicle.model.ishelicopter orelse _
  1069.             (player.character.currentvehicle.position.distanceto(player.character.currentvehicle.position.toground) > 3)) then
  1070.             direction.z += 0.12
  1071.             dist += 2
  1072.         else
  1073.             if exists(player.character.currentvehicle) andalso not player.character.currentvehicle.model.isbike then direction.z += 0.02
  1074.         end if
  1075.        
  1076.         if exists(player.character.currentvehicle) then        
  1077.             vecPl = game.currentcamera.position + (direction * 7)
  1078.         else
  1079.             vecPl = game.currentcamera.position + (direction)
  1080.         end if
  1081.        
  1082.         distDif = vecpl.distanceto(vecPl + direction)
  1083.         distAux = distDif
  1084.        
  1085.         while distAux <= distMax       
  1086.             vecPl += direction
  1087.             distAux += distDif
  1088.            
  1089.             for each pedAlvo in world.getpeds(vecPl, dist)
  1090.                 if exists(pedAlvo) andalso (pedAlvo <> player.character) andalso (inCarToo orelse not pedAlvo.isinvehicle) andalso _
  1091.                    (pedAlvo.position.distanceto(player.character.position) >= distMin) andalso _
  1092.                    ((mode = 0) orelse (player.istargetting(pedAlvo))) andalso (not aliveOnly orelse (aliveOnly andalso pedAlvo.isalive)) andalso _
  1093.                    (not ignoreTaged orelse (ignoreTaged andalso not pedAlvo.metadata.ignore))   then
  1094.                     exit while
  1095.                 else
  1096.                     pedAlvo = nothing
  1097.                 end if
  1098.             next
  1099.         end while
  1100.        
  1101.         return pedAlvo
  1102.     end function
  1103.    
  1104.     private function WarpToGround(distMin as double, distMax as double, dist as double)
  1105.         dim vecPl, vecAux, direction, vecThrowVeh as vector3
  1106.         dim timeOut, ultDist as int32
  1107.        
  1108.         bTelToWaypoint = false
  1109.        
  1110.         direction = game.currentcamera.direction / 2
  1111.        
  1112.         if exists(player.character.currentvehicle) andalso (player.character.currentvehicle.model.ishelicopter orelse _
  1113.             (player.character.currentvehicle.position.distanceto(player.character.currentvehicle.position.toground) > 3)) then
  1114.             direction.z += 0.12
  1115.             dist += 2
  1116.         else
  1117.             if exists(player.character.currentvehicle) andalso not player.character.currentvehicle.model.isbike then direction.z += 0.02
  1118.         end if
  1119.        
  1120.         if exists(player.character.currentvehicle) then        
  1121.             vecPl = game.currentcamera.position + (direction * 7)
  1122.         else
  1123.             vecPl = game.currentcamera.position + (direction)
  1124.         end if
  1125.        
  1126.         vecPl = game.currentcamera.position + direction
  1127.        
  1128.         while vecPl.distanceto(player.character.position) < distMax        
  1129.             vecPl += direction
  1130.            
  1131.             if (vecPl.distanceto(world.getgroundposition(vecPl, GroundType.highest)) < 1) andalso (vecPl.distanceto(player.character.position) > 10) andalso (world.getgroundz(vecPl) > 1) then
  1132.                 if bPreviewWarpPos then
  1133.                     chkWarp.position = vecPl
  1134.                     chkWarp.visible = true
  1135.                    
  1136.                     if vecPl.distanceto(player.character.position) > 200 then
  1137.                         chkWarp.diameter = 4
  1138.                     else
  1139.                         chkWarp.diameter = 2
  1140.                     end if
  1141.                 else       
  1142.                     if not exists(player.character.currentvehicle) then
  1143.                         direction *= 2
  1144.                     else
  1145.                         direction *= 4
  1146.                     end if
  1147.                    
  1148.                     vecPl.x += direction.x
  1149.                     vecPl.y += direction.y
  1150.                     vecPl.z += 2
  1151.                    
  1152.                     timeOut = 0
  1153.                    
  1154.                     player.character.invincible = true
  1155.                     player.character.freezeposition = false
  1156.                     if exists(player.character.currentvehicle) then player.character.currentvehicle.freezeposition = false
  1157.                    
  1158.                     if exists(player.character.currentvehicle) then player.character.currentvehicle.canBeDamaged = false
  1159.                    
  1160.                     msg("''myWarp'' to anywhere", 5000)
  1161.                    
  1162.                     vecAux.x = 0
  1163.                     vecAux.y = 0
  1164.                     vecAux.z = 10
  1165.                    
  1166.                     if player.character.isinvehicle then
  1167.                         player.character.currentvehicle.velocity = vecAux
  1168.                         waitEx(1000)
  1169.                     else   
  1170.                         if not player.character.isragdoll then
  1171.                             player.character.animation.play(animSetJump_Std, "jump_on_spot", 10.0, AnimationFlags.Unknown01)
  1172.                            
  1173.                             if GTAIVVersion then
  1174.                                 waitEx(800)
  1175.                             else
  1176.                                 waitEx(200)
  1177.                                 Native.Function.Call("Apply_Force_To_Ped", player.character, True, 0, 0, 7f, 0, 0, 0, False, False, False, True)
  1178.                                 waitEx(200)
  1179.                             end if                         
  1180.                         end if
  1181.                        
  1182.                         player.character.velocity = vecAux
  1183.                     end if
  1184.                    
  1185.                     player.character.forceragdoll(10000, true)
  1186.                      
  1187.                     ultDist = 10000
  1188.                      
  1189.                     while (player.character.position.distanceto(vecPl) >= 1) andalso (timeOut < 10000)                     
  1190.                         if ultDist < player.character.position.distanceto(vecPl) then
  1191.                             exit while
  1192.                         else
  1193.                             ultDist = player.character.position.distanceto(vecPl)
  1194.                         end if
  1195.                        
  1196.                         if player.character.isinvehicle then
  1197.                             player.character.currentvehicle.applyforce(vecPl - player.character.position)
  1198.                         else                           
  1199.                             vecAux = (vecPl - player.character.position) * 5
  1200.                            
  1201.                             if vecAux.distanceto(vecAux.zero) < 5 then
  1202.                                 vecAux *= 1.5
  1203.                             else
  1204.                                 while vecAux.distanceto(vecAux.zero) > 250
  1205.                                     vecAux /= 1.2
  1206.                                 end while
  1207.                             end if
  1208.                            
  1209.                             player.character.velocity = vecAux
  1210.                         end if
  1211.                        
  1212.                         timeOut += 120
  1213.                        
  1214.                         player.character.isragdoll = true
  1215.                        
  1216.                         wait(100)
  1217.                     end while                  
  1218.                    
  1219.                     if exists(player.character.currentvehicle) then                    
  1220.                         if player.character.currentvehicle.position.distanceto2d(vecPl + direction) >= 5 then  
  1221.                             player.character.currentvehicle.position = vecpl
  1222.                         else
  1223.                             player.character.currentvehicle.freezeposition = true
  1224.                             player.character.currentvehicle.freezeposition = false
  1225.                             player.character.currentvehicle.applyforce(player.character.currentvehicle.position.RelativeBottom)
  1226.                         end if
  1227.                     else
  1228.                         if player.character.position.distanceto(vecPl) >= 2 then                       
  1229.                             player.character.position = vecpl                  
  1230.                         else
  1231.                             player.character.velocity = player.character.velocity.zero
  1232.                         end if
  1233.                     end if
  1234.                    
  1235.                     chkWarp.visible = false
  1236.                    
  1237.                     player.character.isragdoll = false
  1238.                     player.character.invincible = false
  1239.                    
  1240.                     if exists(player.character.currentvehicle) then player.character.currentvehicle.canBeDamaged = true
  1241.                 end if
  1242.                
  1243.                 return true
  1244.             else
  1245.                 chkWarp.visible = false
  1246.             end if
  1247.         end while
  1248.        
  1249.         return false
  1250.     end function
  1251.        
  1252.     private sub targetedFloor
  1253.         if game.iskeypressed(keyAim) andalso exists(player.character.currentvehicle) andalso _
  1254.            (player.character.currentvehicle.model.ishelicopter orelse _
  1255.             player.character.currentvehicle.position.distanceto(player.character.currentvehicle.position.toground) > 3) then
  1256.             dim vecPl, direction as vector3
  1257.            
  1258.             direction = game.currentcamera.direction / 2
  1259.             direction.z += 0.12
  1260.            
  1261.             vecPl = game.currentcamera.position + direction
  1262.            
  1263.             while vecPl.distanceto(player.character.position) < 250            
  1264.                 vecPl += direction
  1265.                
  1266.                 if (vecPl.distanceto(world.getgroundposition(vecPl, GroundType.lowest)) < 1) orelse _
  1267.                    (vecPl.distanceto(world.getgroundposition(vecPl, GroundType.highest)) < 1) then 
  1268.                     vecPl.z -= 1
  1269.                     chkWarp.position = vecPl
  1270.                     chkWarp.visible = true
  1271.                     exit while
  1272.                 end if
  1273.             end while
  1274.         end if
  1275.     end sub
  1276.    
  1277.     Private Sub Geral_Tick(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Tick
  1278.         If Not SOn Then Exit Sub
  1279.  
  1280.         Dim vecAux, vecGround As Vector3
  1281.  
  1282.         targetedFloor()
  1283.  
  1284.         If Game.isKeyPressed(keySlowMotion) Then
  1285.             Game.TimeScale = 0.3
  1286.             msg("Hey, slow down...", 500)
  1287.         Else
  1288.             Game.TimeScale = 1.0
  1289.         End If
  1290.  
  1291.         'WarpToGround "tick"
  1292.         If bPreviewWarpPos Then WarpToGround(1.0F, 1000.0F, 1.0F)
  1293.        
  1294.         'ThrowThings "tick"
  1295.         Try
  1296.             If Game.isKeyPressed(hkThrowFloatThings) And Game.isKeyPressed(keyAim) Then ThrowThings()
  1297.         Catch
  1298.         End Try
  1299.  
  1300.         'float peds
  1301.         For Each pAux As Ped In pedFloatArray
  1302.             If Exists(pAux) AndAlso pAux.Metadata.float Then
  1303.                 If bFloatThingsFollowPl Then
  1304.                     vecAux = ((Player.Character.Position - pAux.Position) / pAux.Position.DistanceTo(Player.Character.Position)) * 1.5
  1305.                     vecGround = Player.Character.Position.ToGround
  1306.                     vecGround.X = pAux.Position.ToGround.X
  1307.                     vecGround.Y = pAux.Position.ToGround.Y
  1308.  
  1309.                     If (pAux.Position.DistanceTo(vecGround) < 10) Then
  1310.                         vecAux.Z += 3
  1311.                     ElseIf (pAux.Position.DistanceTo(vecGround) < 15) Then
  1312.                         vecAux.Z += 1.2
  1313.                     Else
  1314.                         If vecAux.Z < 0 Then
  1315.                             vecAux.Z = 1.1
  1316.                         ElseIf pAux.Position.Z < Player.Character.Position.Z Then
  1317.                             vecAux.Z = 1.2
  1318.                         End If
  1319.                     End If
  1320.                 Else
  1321.                     vecAux = (pAux.Metadata.pos - pAux.Position) / 2
  1322.                 End If
  1323.  
  1324.                 pAux.isRagdoll = True
  1325.  
  1326.                 If Not pAux.Metadata.ragDoll Then
  1327.                     pAux.Metadata.ragDoll = True
  1328.                 Else
  1329.                     If Not pAux.isRagdoll And pAux.isAlive Then pAux.Die()
  1330.                 End If
  1331.  
  1332.                 If bFloatThingsFollowPl Then
  1333.                     If (pAux.Position.DistanceTo2D(Player.Character.Position) > 30) AndAlso Not pAux.Metadata.freezewhenclose Then pAux.Metadata.freezewhenclose = True
  1334.  
  1335.                     If pAux.Metadata.freezewhenclose AndAlso (pAux.Position.DistanceTo2D(Player.Character.Position) < 10) Then
  1336.                         pAux.Metadata.freezewhenclose = False
  1337.                         pAux.FreezePosition = True
  1338.                         pAux.FreezePosition = False
  1339.                         pAux.ApplyForce(pAux.Position.RelativeTop)
  1340.                     End If
  1341.  
  1342.                     Native.Function.Call("Apply_Force_To_Ped", pAux, True, vecAux.X / 2, vecAux.Y / 2, vecAux.Z, 0, 0, 0, False, False, False, True)
  1343.                    
  1344.                     If ((pAux.Position.Z - Player.Character.Position.Z) > 3) AndAlso (pAux.Position.DistanceTo(vecGround) > 20) Then
  1345.                         pAux.ApplyForce((Player.Character.Position - pAux.Position) / 100)
  1346.                     End If
  1347.                 Else
  1348.                     If vecAux.Z < 0 Then
  1349.                         vecAux.Z = 1
  1350.                     ElseIf vecAux.Z > 2 Then
  1351.                         vecAux.Z = 1.5
  1352.                     End If
  1353.                     Native.Function.Call("Apply_Force_To_Ped", pAux, True, 0, 0, vecAux.Z, 0, 0, 0, False, False, False, True)
  1354.                 End If
  1355.             End If
  1356.         Next
  1357.  
  1358.         'float vehicles
  1359.         For Each vAux In vehFloatArray
  1360.             If Exists(vAux) AndAlso vAux.Metadata.float Then
  1361.                 If bFloatThingsFollowPl Then
  1362.                     vecAux = Player.Character.Position
  1363.                     vecAux.Z += 5
  1364.                     vecAux = (vecAux - vAux.Position) / 20
  1365.  
  1366.                     If Exists(Player.Character.CurrentVehicle) AndAlso Player.Character.CurrentVehicle.Model.isHelicopter Then
  1367.                         vecGround = Player.Character.Position
  1368.                     Else
  1369.                         vecGround = Player.Character.Position.ToGround
  1370.                     End If
  1371.  
  1372.                     vecGround.Z += 15
  1373.                     vecGround.X = vAux.Position.ToGround.X
  1374.                     vecGround.Y = vAux.Position.ToGround.Y
  1375.  
  1376.                     If (vAux.Position.Z - Player.Character.Position.Z < 4) AndAlso (vAux.Position.Z - Player.Character.Position.Z > -3) Then
  1377.                         vAux.FreezePosition = True
  1378.                         vAux.FreezePosition = False
  1379.                         vAux.ApplyForce(vAux.Position.RelativeTop)
  1380.                         vecAux.Z = 5
  1381.                     ElseIf vAux.Position.Z < vecGround.Z Then
  1382.                         vecAux.Z = 2
  1383.                     ElseIf vecAux.Z < 0 Then
  1384.                         vecAux.Z = 1
  1385.                     End If
  1386.  
  1387.                     If (vAux.Position.DistanceTo2D(Player.Character.Position) > 20) AndAlso Not vAux.Metadata.freezewhenclose Then vAux.Metadata.freezewhenclose = True
  1388.  
  1389.                     If vAux.Metadata.freezewhenclose AndAlso (vAux.Position.DistanceTo2D(Player.Character.Position) < 10) Then
  1390.                         vAux.Metadata.freezewhenclose = False
  1391.                         vAux.ApplyForceRelative(vAux.Direction * -15)
  1392.                     End If
  1393.  
  1394.                     Native.Function.Call("Apply_Force_To_Car", vAux, True, vecAux.X, vecAux.Y, vecAux.Z, 0.1, 0, 0, False, False, False, True)
  1395.  
  1396.                     vecAux = Player.Character.Position
  1397.                     vecAux.Z += 5
  1398.  
  1399.                     If ((vAux.Position.Z - vecAux.Z) > 3) AndAlso (vAux.Position.DistanceTo(vecGround) > 30) Then
  1400.                         vAux.ApplyForce((Player.Character.Position - vAux.Position) / 100)
  1401.                     End If
  1402.                 Else
  1403.                     vecAux = (vAux.Metadata.pos - vAux.Position) / 6
  1404.                     If vecAux.Z < 0 Then vecAux.Z = 0
  1405.                     Native.Function.Call("Apply_Force_To_Car", vAux, True, 0, 0, vecAux.Z, 0.1, 0, 0, False, False, False, True)
  1406.                 End If
  1407.  
  1408.                 If vAux.Metadata.pos.z < 40 Then
  1409.                     vecAux = vAux.Metadata.pos
  1410.                     vecAux.Z += 0.1
  1411.                     vAux.Metadata.pos = vecAux
  1412.                 End If
  1413.             End If
  1414.         Next
  1415.  
  1416.         'teleport to waypoint aux, when hold the button
  1417.         If Game.isKeyPressed(hkWarpWaypoint) And Exists(Game.GetWaypoint) And Not Game.isKeyPressed(keyAim) Then
  1418.             If Exists(Player.Character.CurrentVehicle) Then
  1419.                 Native.Function.Call("Apply_Force_To_Car", Player.Character.CurrentVehicle, True, 0, 0, 15.0F, 0, 0, 0, False, False, False, True)
  1420.             Else
  1421.                 Player.Character.isRagdoll = True
  1422.                 Player.Character.Invincible = True
  1423.                 Player.Character.ApplyForce(Game.CurrentCamera.Direction * 10)
  1424.  
  1425.                 If Not Player.Character.Metadata.freeze Then Player.Character.Metadata.freeze = True
  1426.             End If
  1427.         Else
  1428.             If Player.Character.Metadata.freeze Then
  1429.                 Player.Character.Metadata.freeze = False
  1430.                 Player.Character.FreezePosition = True
  1431.                 Player.Character.FreezePosition = False
  1432.             End If
  1433.         End If
  1434.  
  1435.         HealthAndArmorRegeneration()
  1436.  
  1437.         Nitro()
  1438.     End Sub
  1439.    
  1440.     Private Sub HealthAndArmorRegeneration()
  1441.         If bAutoHeal Then
  1442.             If Player.Character.Health < 100 Then Player.Character.Health += 1.0
  1443.             If Player.Character.Armor < 100 Then Player.Character.Armor += 1.0
  1444.         End If
  1445.     End Sub
  1446.        
  1447.     Private Sub Nitro()
  1448.         Try
  1449.             If Player.Character.isInVehicle AndAlso (Game.isKeyPressed(keyNitro) orelse game.iskeypressed(keyNitroBoatBike)) AndAlso Not Game.isKeyPressed(keyAim) AndAlso Player.Character.CurrentVehicle.isOnAllWheels Then
  1450.                 if (Player.Character.CurrentVehicle.model.isbike orelse Player.Character.CurrentVehicle.model.isboat) then
  1451.                     if not game.iskeypressed(keyNitroBoatBike) then exit sub
  1452.                    
  1453.                     if not Player.Character.CurrentVehicle.model.isbike then
  1454.                         Native.Function.Call("Apply_Force_To_car", Player.Character.CurrentVehicle, True, _
  1455.                             Player.Character.CurrentVehicle.Velocity.X / 6, Player.Character.CurrentVehicle.Velocity.Y / 6, 0, 0, 0, -1.0, False, False, False, True)
  1456.                     else
  1457.                         Native.Function.Call("Apply_Force_To_car", Player.Character.CurrentVehicle, True, _
  1458.                             Player.Character.CurrentVehicle.Velocity.X / 6, Player.Character.CurrentVehicle.Velocity.Y / 6, 0, 0, 0, 0, False, False, False, True)
  1459.                     end if
  1460.                 else
  1461.                     Native.Function.Call("Apply_Force_To_car", Player.Character.CurrentVehicle, True, _
  1462.                         Player.Character.CurrentVehicle.Velocity.X / 6, Player.Character.CurrentVehicle.Velocity.Y / 6, 0, 0, 0, -0.2, False, False, False, True)
  1463.                 end if
  1464.                
  1465.                 msg("Supernatural Nitro? Yeah", 250)
  1466.             End If
  1467.         Catch
  1468.         End Try
  1469.     End Sub
  1470.    
  1471.     Private Sub Draw(ByVal sender As Object, ByVal g As GTA.GraphicsEventArgs) Handles MyBase.PerFrameDrawing
  1472.         If Not SOn Then Exit Sub
  1473.  
  1474.         If bShowHelp Then
  1475.             g.Graphics.DrawText("Hold Aim key and press the skill key...", 10, 10)
  1476.             g.Graphics.DrawText("  Skill Key 1: Throw targeted ped/vehicle automatically", 10, 40)
  1477.             g.Graphics.DrawText("  Skill Key 2: Put ped/vehicle to float", 10, 65)
  1478.             g.Graphics.DrawText("  Skill Key 3: Throw floating things into a target", 10, 90)
  1479.             g.Graphics.DrawText("  Skill Key 4: Warp into targeted vehicle", 10, 115)
  1480.             g.Graphics.DrawText("  Skill Key 5: Hold to see the target, release to warp to targeted floor/ceil/whatever", 10, 140)
  1481.             g.Graphics.DrawText("  *Skill Key 6: Warp to waypoint, this don't need the Aim key pressed", 10, 165)
  1482.             g.Graphics.DrawText("To switch the float mode press Tab", 10, 200)
  1483.         End If
  1484.     End Sub
  1485.    
  1486. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement