Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'https://www.youtube.com/user/GTAScripting
- 'http://gtaxscripting.blogspot.com/
- 'http://www.facebook.com/GtaIVScripting
- 'https://twitter.com/julionib
- Imports System
- Imports GTA
- Imports System.Drawing
- Imports System.Windows.Forms
- Public Class Targetting
- Inherits Script
- Private pedsToTarget As Ped() = Nothing
- Private vehiclesToTarget As Vehicle() = Nothing
- Private objectsToTarget As GTA.Object() = Nothing
- Public Sub New()
- Me.Interval = 10
- End Sub
- Shadows Sub keyDown(ByVal sender As Object, ByVal e As GTA.KeyEventArgs) Handles MyBase.KeyDown
- If e.Key = Keys.RButton Then
- pedsToTarget = World.GetAllPeds
- vehiclesToTarget = World.GetVehicles(Player.Character.Position, 100)
- objectsToTarget = World.GetAllObjects
- End If
- End Sub
- Shadows Sub keyUp(ByVal sender As Object, ByVal e As GTA.KeyEventArgs) Handles MyBase.KeyUp
- End Sub
- Private Sub general_tick(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Tick
- If Game.isGameKeyPressed(GameKey.Aim) Then
- Dim dist As Double
- Dim comparePosition As Vector3
- Dim vComparePos As Vector3
- If Exists(pedsToTarget) Then
- For Each p As Ped In pedsToTarget
- If Exists(p) AndAlso (p <> Player.Character) Then
- dist = p.Position.DistanceTo(Game.CurrentCamera.Position)
- comparePosition = Game.CurrentCamera.Position + Game.CurrentCamera.Direction * dist
- If p.Position.DistanceTo(comparePosition) < 0.5 Then
- p.ForceRagdoll(2000, True)
- p.ApplyForce(Vector3.WorldUp * 0.5, Vector3.WorldNorth)
- msg("detected", 10)
- End If
- End If
- Next
- End If
- If Exists(vehiclesToTarget) Then
- For Each v As Vehicle In vehiclesToTarget
- If Exists(v) AndAlso (v <> Player.Character.CurrentVehicle) AndAlso v.isOnScreen Then
- ' compare with vehicle center posistion
- dist = v.Position.DistanceTo(Game.CurrentCamera.Position)
- comparePosition = Game.CurrentCamera.Position + Game.CurrentCamera.Direction * dist
- If v.Position.DistanceTo(comparePosition) < 0.5 Then
- v.ApplyForce(Vector3.WorldUp)
- Continue For
- End If
- ' compare with vehicle front posistion
- vComparePos = v.GetOffsetPosition(Vector3.RelativeFront * v.Model.GetDimensions.Y * 0.5)
- dist = vComparePos.DistanceTo(Game.CurrentCamera.Position)
- comparePosition = Game.CurrentCamera.Position + Game.CurrentCamera.Direction * dist
- If vComparePos.DistanceTo(comparePosition) < 0.5 Then
- v.ApplyForce(Vector3.WorldUp)
- Continue For
- End If
- ' compare with vehicle back posistion
- vComparePos = v.GetOffsetPosition(Vector3.RelativeBack * v.Model.GetDimensions.Y * 0.5)
- dist = vComparePos.DistanceTo(Game.CurrentCamera.Position)
- comparePosition = Game.CurrentCamera.Position + Game.CurrentCamera.Direction * dist
- If vComparePos.DistanceTo(comparePosition) < 0.5 Then
- v.ApplyForce(Vector3.WorldUp)
- Continue For
- End If
- ' compare with vehicle left posistion
- vComparePos = v.GetOffsetPosition(Vector3.RelativeLeft * v.Model.GetDimensions.X * 0.5)
- dist = vComparePos.DistanceTo(Game.CurrentCamera.Position)
- comparePosition = Game.CurrentCamera.Position + Game.CurrentCamera.Direction * dist
- If vComparePos.DistanceTo(comparePosition) < 0.5 Then
- v.ApplyForce(Vector3.WorldUp)
- Continue For
- End If
- ' compare with vehicle right posistion
- vComparePos = v.GetOffsetPosition(Vector3.RelativeRight * v.Model.GetDimensions.X * 0.5)
- dist = vComparePos.DistanceTo(Game.CurrentCamera.Position)
- comparePosition = Game.CurrentCamera.Position + Game.CurrentCamera.Direction * dist
- If vComparePos.DistanceTo(comparePosition) < 0.5 Then
- v.ApplyForce(Vector3.WorldUp)
- Continue For
- End If
- ' compare with vehicle top posistion
- vComparePos = v.GetOffsetPosition(Vector3.RelativeTop * v.Model.GetDimensions.Z * 0.5)
- dist = vComparePos.DistanceTo(Game.CurrentCamera.Position)
- comparePosition = Game.CurrentCamera.Position + Game.CurrentCamera.Direction * dist
- If vComparePos.DistanceTo(comparePosition) < 0.5 Then
- v.ApplyForce(Vector3.WorldUp)
- Continue For
- End If
- End If
- Next
- End If
- If Exists(objectsToTarget) Then
- For Each o As GTA.Object In objectsToTarget
- If Exists(o) Then
- dist = o.Position.DistanceTo(Game.CurrentCamera.Position)
- comparePosition = Game.CurrentCamera.Position + Game.CurrentCamera.Direction * dist
- If o.Position.DistanceTo(comparePosition) < 0.5 Then
- o.Detach()
- o.ApplyForce(Vector3.WorldUp)
- End If
- End If
- Next
- End If
- End If
- End Sub
- Private Sub console_CMD(ByVal sender As Object, ByVal e As ConsoleEventArgs) Handles MyBase.ConsoleCommand
- End Sub
- Private Sub GraphicsEventHandler(ByVal sender As Object, ByVal e As GTA.GraphicsEventArgs) Handles MyBase.PerFrameDrawing
- End Sub
- Private Sub msg(ByVal sMsg As String, ByVal time As Int32)
- Native.Function.Call("PRINT_STRING_WITH_LITERAL_STRING_NOW", "STRING", sMsg, time, 1)
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement