Imports System 
Imports System.windows.forms
Imports GTA
Imports System.Drawing
Public Class police3

    Inherits Script

    Public Sub New()
        If Player.WantedLevel < 2 Then
            Me.Interval = 18000
        Else
            Me.Interval = 12000
        End If
    End Sub
    Private flag As Byte = 0
    Shadows Sub keyDown(ByVal sender As Object, ByVal e As GTA.KeyEventArgs) Handles MyBase.KeyDown
        If e.Key = Keys.U Then
            Player.WantedLevel = 4
        End If
        If e.Key = Keys.I Then
            Player.WantedLevel = 5
        End If
        If e.Key = Keys.O Then
            Player.WantedLevel = 6
        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
        Dim v As Vehicle, d As Ped, c As Ped
        If Player.WantedLevel < 4 Then 'VEHICULOS QUE APARECEN CON MENOS DE 4 GRADOS DE BUSQUEDA Y CAPTURA
            If flag = 0 Then
                v = World.CreateVehicle("police3", Player.Character.Position.Around(70.0F))
                d = v.CreatePedOnSeat(VehicleSeat.Driver, "M_M_Fatcop_01", RelationshipGroup.Cop)
                c = v.CreatePedOnSeat(VehicleSeat.RightFront, "M_M_Fatcop_01", RelationshipGroup.Cop)
                v.PlaceOnNextStreetProperly()
                v.Speed = 10
                d.SetPathfinding(True, True, True)
                c.SetPathfinding(True, True, True)
                v.NoLongerNeeded()
                d.NoLongerNeeded()
                If c.isOnScreen = False Then
                    c.NoLongerNeeded()
                End If
                flag += 1
            ElseIf flag = 1 Then
                v = World.CreateVehicle("police4", Player.Character.Position.Around(70.0F))
                d = v.CreatePedOnSeat(VehicleSeat.Driver, "M_Y_Cop_Traffic", RelationshipGroup.Cop)
                c = v.CreatePedOnSeat(VehicleSeat.RightFront, "M_Y_Cop_Traffic", RelationshipGroup.Cop)
                v.PlaceOnNextStreetProperly()
                v.Speed = 10
                d.SetPathfinding(True, True, True)
                c.SetPathfinding(True, True, True)
                v.NoLongerNeeded()
                d.NoLongerNeeded()
                If c.isOnScreen = False Then
                    c.NoLongerNeeded()
                End If
                flag += 1
            Else
                v = World.CreateVehicle("policeb", Player.Character.Position.Around(70.0F))
                d = v.CreatePedOnSeat(VehicleSeat.Driver, "M_Y_Cop_Traffic", RelationshipGroup.Cop)
                v.PlaceOnNextStreetProperly()
                v.Speed = 10
                d.SetPathfinding(True, True, True)
                d.NoLongerNeeded()
                v.NoLongerNeeded()
                flag = 0
            End If
        ElseIf Player.WantedLevel = 4 Then    'VEHICULOS QUE APARECEN A LOS 4 GRADOS DE BUSQUEDA Y CAPTURA
            Dim p1 As Ped
            If flag = 0 Then
                v = World.CreateVehicle("pstockade", Player.Character.Position.Around(70.0F))
                d = v.CreatePedOnSeat(VehicleSeat.Driver, "M_Y_Strooper", RelationshipGroup.Cop)
                c = v.CreatePedOnSeat(VehicleSeat.RightFront, "M_Y_Strooper", RelationshipGroup.Cop)
                p1 = v.CreatePedOnSeat(VehicleSeat.LeftRear, "M_Y_Strooper", RelationshipGroup.Cop)
                v.PlaceOnNextStreetProperly()
                v.Speed = 10
                d.SetPathfinding(True, True, True)
                c.SetPathfinding(True, True, True)
                p1.SetPathfinding(True, True, True)
                v.NoLongerNeeded()
                d.NoLongerNeeded()
                c.NoLongerNeeded()
                p1.NoLongerNeeded()
                flag += 1
            ElseIf flag = 1 Then
                v = World.CreateVehicle("noose", Player.Character.Position.Around(70.0F))
                d = v.CreatePedOnSeat(VehicleSeat.Driver, "M_Y_Cop", RelationshipGroup.Cop)
                c = v.CreatePedOnSeat(VehicleSeat.RightFront, "M_Y_Swat", RelationshipGroup.Cop)
                p1 = v.CreatePedOnSeat(VehicleSeat.RightRear, "M_Y_Swat", RelationshipGroup.Cop)
                v.PlaceOnNextStreetProperly()
                v.Speed = 10
                c.WillDoDrivebys = True
                p1.WillDoDrivebys = True
                d.SetPathfinding(True, True, True)
                c.SetPathfinding(True, True, True)
                p1.SetPathfinding(True, True, True)
                v.NoLongerNeeded()
                d.NoLongerNeeded()
                c.NoLongerNeeded()
                p1.NoLongerNeeded()
                flag += 1
            ElseIf flag = 2 Then
                v = World.CreateVehicle("polpatriot", Player.Character.Position.Around(70.0F))
                d = v.CreatePedOnSeat(VehicleSeat.Driver, "M_Y_Cop_Traffic", RelationshipGroup.Cop)
                c = v.CreatePedOnSeat(VehicleSeat.RightFront, "M_Y_Swat", RelationshipGroup.Cop)
                p1 = v.CreatePedOnSeat(VehicleSeat.LeftRear, "M_Y_Swat", RelationshipGroup.Cop)
                v.PlaceOnNextStreetProperly()
                v.Speed = 10
                c.WillDoDrivebys = True
                p1.WillDoDrivebys = True
                d.SetPathfinding(True, True, True)
                c.SetPathfinding(True, True, True)
                p1.SetPathfinding(True, True, True)
                v.NoLongerNeeded()
                d.NoLongerNeeded()
                c.NoLongerNeeded()
                p1.NoLongerNeeded()
                flag += 1
            ElseIf flag = 3 Then
                v = World.CreateVehicle("police3", Player.Character.Position.Around(70.0F))
                d = v.CreatePedOnSeat(VehicleSeat.Driver, "M_Y_Cop_Traffic", RelationshipGroup.Cop)
                c = v.CreatePedOnSeat(VehicleSeat.RightFront, "M_Y_Cop", RelationshipGroup.Cop)
                v.PlaceOnNextStreetProperly()
                v.Speed = 10
                c.WillDoDrivebys = True
                d.SetPathfinding(True, True, True)
                c.SetPathfinding(True, True, True)
                v.NoLongerNeeded()
                d.NoLongerNeeded()
                c.NoLongerNeeded()
                flag += 1
            Else
                v = World.CreateVehicle("police4", Player.Character.Position.Around(70.0F))
                d = v.CreatePedOnSeat(VehicleSeat.Driver, "M_M_Fatcop_01", RelationshipGroup.Cop)
                c = v.CreatePedOnSeat(VehicleSeat.RightFront, "M_Y_Cop", RelationshipGroup.Cop)
                v.PlaceOnNextStreetProperly()
                v.Speed = 10
                c.WillDoDrivebys = True
                d.SetPathfinding(True, True, True)
                c.SetPathfinding(True, True, True)
                v.NoLongerNeeded()
                d.NoLongerNeeded()
                c.NoLongerNeeded()
                flag = 0
            End If
        ElseIf Player.WantedLevel = 5 Then        'VEHICULOS QUE APARECEN A LOS 5 GRADOS DE BUSQUEDA Y CAPTURA
            Dim p2 As Ped, p1 As Ped
            If flag = 0 Then
                v = World.CreateVehicle("fbi", Player.Character.Position.Around(70.0F))
                d = v.CreatePedOnSeat(VehicleSeat.Driver, "M_M_FBI", RelationshipGroup.Cop)
                c = v.CreatePedOnSeat(VehicleSeat.RightFront, "M_M_FBI", RelationshipGroup.Cop)
                p1 = v.CreatePedOnSeat(VehicleSeat.LeftRear, "M_M_FBI", RelationshipGroup.Cop)
                p2 = v.CreatePedOnSeat(VehicleSeat.RightRear, "M_M_FBI", RelationshipGroup.Cop)
                v.PlaceOnNextStreetProperly()
                v.Speed = 10
                c.WillDoDrivebys = True
                p1.WillDoDrivebys = True
                p2.WillDoDrivebys = True
                d.SetPathfinding(True, True, True)
                c.SetPathfinding(True, True, True)
                p1.SetPathfinding(True, True, True)
                p2.SetPathfinding(True, True, True)
                v.NoLongerNeeded()
                d.NoLongerNeeded()
                c.NoLongerNeeded()
                p1.NoLongerNeeded()
                p2.NoLongerNeeded()
                flag += 1
            ElseIf flag = 1 Then
                v = World.CreateVehicle("nstockade", Player.Character.Position.Around(70.0F))
                d = v.CreatePedOnSeat(VehicleSeat.Driver, "M_Y_Swat", RelationshipGroup.Cop)
                c = v.CreatePedOnSeat(VehicleSeat.RightFront, "M_Y_Swat", RelationshipGroup.Cop)
                p1 = v.CreatePedOnSeat(VehicleSeat.LeftRear, "M_Y_Swat", RelationshipGroup.Cop)
                p2 = v.CreatePedOnSeat(VehicleSeat.RightRear, "M_Y_Swat", RelationshipGroup.Cop)
                v.PlaceOnNextStreetProperly()
                v.Speed = 10
                d.SetPathfinding(True, True, True)
                c.SetPathfinding(True, True, True)
                p1.SetPathfinding(True, True, True)
                p2.SetPathfinding(True, True, True)
                v.NoLongerNeeded()
                d.NoLongerNeeded()
                c.NoLongerNeeded()
                p1.NoLongerNeeded()
                p2.NoLongerNeeded()
                flag += 1
            ElseIf flag = 2 Then
                v = World.CreateVehicle("fbi", Player.Character.Position.Around(70.0F))
                d = v.CreatePedOnSeat(VehicleSeat.Driver, "M_M_FBI", RelationshipGroup.Cop)
                c = v.CreatePedOnSeat(VehicleSeat.RightFront, "M_M_FBI", RelationshipGroup.Cop)
                p1 = v.CreatePedOnSeat(VehicleSeat.LeftRear, "M_M_FBI", RelationshipGroup.Cop)
                v.PlaceOnNextStreetProperly()
                v.Speed = 10
                c.WillDoDrivebys = True
                p1.WillDoDrivebys = True
                d.SetPathfinding(True, True, True)
                c.SetPathfinding(True, True, True)
                p1.SetPathfinding(True, True, True)
                v.NoLongerNeeded()
                d.NoLongerNeeded()
                c.NoLongerNeeded()
                p1.NoLongerNeeded()
                flag += 1
            ElseIf flag = 3 Then
                v = World.CreateVehicle("apc", Player.Character.Position.Around(70.0F))
                d = v.CreatePedOnSeat(VehicleSeat.Driver, "M_Y_Swat", RelationshipGroup.Cop)
                c = v.CreatePedOnSeat(VehicleSeat.RightFront, "M_Y_Swat", RelationshipGroup.Cop)
                v.PlaceOnNextStreetProperly()
                v.Speed = 10
                d.SetPathfinding(True, True, True)
                c.SetPathfinding(True, True, True)
                v.NoLongerNeeded()
                d.NoLongerNeeded()
                c.NoLongerNeeded()
                flag += 1
            Else
                v = World.CreateVehicle("avan", Player.Character.Position.Around(70.0F))
                d = v.CreatePedOnSeat(VehicleSeat.Driver, "M_M_FBI", RelationshipGroup.Cop)
                c = v.CreatePedOnSeat(VehicleSeat.RightFront, "M_M_FBI", RelationshipGroup.Cop)
                v.PlaceOnNextStreetProperly()
                v.Speed = 10
                d.SetPathfinding(True, True, True)
                c.SetPathfinding(True, True, True)
                v.NoLongerNeeded()
                d.NoLongerNeeded()
                c.NoLongerNeeded()
                flag += 1
            End If
        Else            'TE VIENE EL EJÉRCITO (4 MILITARES A PIE+VEHICULO POR CICLO)
            Dim m2, m3, m4, m5, p1, p2 As Ped
            m2 = World.CreatePed("M_M_GunNut_01", Player.Character.Position.Around(60.0F), RelationshipGroup.Cop)
            m3 = World.CreatePed("M_M_GunNut_01", Player.Character.Position.Around(60.0F), RelationshipGroup.Cop)
            m4 = World.CreatePed("M_M_GunNut_01", Player.Character.Position.Around(60.0F), RelationshipGroup.Cop)
            m5 = World.CreatePed("M_M_GunNut_01", Player.Character.Position.Around(60.0F), RelationshipGroup.Cop)
            m2.Weapons(Weapon.Episodic_14).Ammo = 999
            m3.Weapons.AssaultRifle_M4.Ammo = 999
            m4.Weapons.AssaultRifle_M4.Ammo = 999
            m5.Weapons.AssaultRifle_M4.Ammo = 999
            m2.Armor = 100
            m3.Armor = 100
            m4.Armor = 100
            m5.Armor = 100
            m2.Weapons(Weapon.Episodic_14).Select()
            m3.Weapons.AssaultRifle_M4.Select()
            m4.Weapons.AssaultRifle_M4.Select()
            m5.Weapons.AssaultRifle_M4.Select()
            m2.SetPathfinding(True, True, True)
            m3.SetPathfinding(True, True, True)
            m4.SetPathfinding(True, True, True)
            m5.SetPathfinding(True, True, True)
            m2.NoLongerNeeded()
            m3.NoLongerNeeded()
            m4.NoLongerNeeded()
            m5.NoLongerNeeded()
            If flag = 0 Then
                v = World.CreateVehicle("milpatriot", Player.Character.Position.Around(70.0F))
                d = v.CreatePedOnSeat(VehicleSeat.Driver, "M_M_GunNut_01", RelationshipGroup.Cop)
                c = v.CreatePedOnSeat(VehicleSeat.RightFront, "M_M_GunNut_01", RelationshipGroup.Cop)
                p1 = v.CreatePedOnSeat(VehicleSeat.LeftRear, "M_M_GunNut_01", RelationshipGroup.Cop)
                p2 = v.CreatePedOnSeat(VehicleSeat.RightRear, "M_M_GunNut_01", RelationshipGroup.Cop)
                v.PlaceOnNextStreetProperly()
                v.Speed = 10
                d.Armor = 100
                c.Armor = 100
                p1.Armor = 100
                p2.Armor = 100
                d.Weapons.AssaultRifle_M4.Ammo = 999
                c.Weapons.AssaultRifle_M4.Ammo = 999
                p1.Weapons.AssaultRifle_M4.Ammo = 999
                p2.Weapons.BarettaShotgun.Ammo = 999
                c.WillDoDrivebys = True
                p1.WillDoDrivebys = True
                p2.WillDoDrivebys = True
                d.SetPathfinding(True, True, True)
                c.SetPathfinding(True, True, True)
                p1.SetPathfinding(True, True, True)
                p2.SetPathfinding(True, True, True)
                v.NoLongerNeeded()
                d.NoLongerNeeded()
                c.NoLongerNeeded()
                p1.NoLongerNeeded()
                p2.NoLongerNeeded()
                flag += 1
            ElseIf flag = 1 Then
                v = World.CreateVehicle("barracks", Player.Character.Position.Around(70.0F))
                d = v.CreatePedOnSeat(VehicleSeat.Driver, "M_M_GunNut_01", RelationshipGroup.Cop)
                c = v.CreatePedOnSeat(VehicleSeat.RightFront, "M_M_GunNut_01", RelationshipGroup.Cop)
                v.PlaceOnNextStreetProperly()
                v.Speed = 10
                d.Armor = 100
                c.Armor = 100
                d.Weapons(Weapon.Episodic_14).Ammo = 999
                c.Weapons.AssaultRifle_M4.Ammo = 999
                c.WillDoDrivebys = True
                d.SetPathfinding(True, True, True)
                c.SetPathfinding(True, True, True)
                v.NoLongerNeeded()
                d.NoLongerNeeded()
                c.NoLongerNeeded()
                v = World.CreateVehicle("milsanch", Player.Character.Position.Around(70.0F))
                p1 = v.CreatePedOnSeat(VehicleSeat.Driver, "M_M_GunNut_01", RelationshipGroup.Cop)
                p2 = v.CreatePedOnSeat(VehicleSeat.AnyPassengerSeat, "M_M_GunNut_01", RelationshipGroup.Cop)
                v.PlaceOnNextStreetProperly()
                v.Speed = 10
                p1.Armor = 100
                p2.Armor = 100
                p1.Weapons.MP5.Ammo = 999
                p2.Weapons.MP5.Ammo = 999
                p2.WillDoDrivebys = True
                p1.SetPathfinding(True, True, True)
                p2.SetPathfinding(True, True, True)
                v.NoLongerNeeded()
                p1.NoLongerNeeded()
                p2.NoLongerNeeded()
                flag += 1
            ElseIf flag = 2 Then
                v = World.CreateVehicle("fbi", Player.Character.Position.Around(70.0F))
                d = v.CreatePedOnSeat(VehicleSeat.Driver, "M_M_FBI", RelationshipGroup.Cop)
                c = v.CreatePedOnSeat(VehicleSeat.RightFront, "M_M_FBI", RelationshipGroup.Cop)
                p1 = v.CreatePedOnSeat(VehicleSeat.LeftRear, "M_M_FBI", RelationshipGroup.Cop)
                p2 = v.CreatePedOnSeat(VehicleSeat.RightRear, "M_M_FBI", RelationshipGroup.Cop)
                v.PlaceOnNextStreetProperly()
                v.Speed = 10
                c.WillDoDrivebys = True
                p1.WillDoDrivebys = True
                p2.WillDoDrivebys = True
                d.SetPathfinding(True, True, True)
                c.SetPathfinding(True, True, True)
                p1.SetPathfinding(True, True, True)
                p2.SetPathfinding(True, True, True)
                v.NoLongerNeeded()
                d.NoLongerNeeded()
                c.NoLongerNeeded()
                p1.NoLongerNeeded()
                p2.NoLongerNeeded()
                flag += 1
            ElseIf flag = 3 Then
                v = World.CreateVehicle("apc", Player.Character.Position.Around(70.0F))
                d = v.CreatePedOnSeat(VehicleSeat.Driver, "M_M_FBI", RelationshipGroup.Cop)
                c = v.CreatePedOnSeat(VehicleSeat.RightFront, "M_M_FBI", RelationshipGroup.Cop)
                v.PlaceOnNextStreetProperly()
                v.Speed = 10
                d.SetPathfinding(True, True, True)
                c.SetPathfinding(True, True, True)
                v.NoLongerNeeded()
                d.NoLongerNeeded()
                c.NoLongerNeeded()
                v = World.CreateVehicle("avan", Player.Character.Position.Around(70.0F))
                p1 = v.CreatePedOnSeat(VehicleSeat.Driver, "M_M_FBI", RelationshipGroup.Cop)
                p2 = v.CreatePedOnSeat(VehicleSeat.RightFront, "M_M_FBI", RelationshipGroup.Cop)
                v.PlaceOnNextStreetProperly()
                v.Speed = 10
                p1.SetPathfinding(True, True, True)
                p2.SetPathfinding(True, True, True)
                v.NoLongerNeeded()
                p1.NoLongerNeeded()
                p2.NoLongerNeeded()
                flag += 1
            Else
                v = World.CreateVehicle("airtug", Player.Character.Position.Around(70.0F))
                d = v.CreatePedOnSeat(VehicleSeat.Driver, "M_M_GunNut_01", RelationshipGroup.Cop)
                c = v.CreatePedOnSeat(VehicleSeat.RightFront, "M_M_GunNut_01", RelationshipGroup.Cop)
                p1 = v.CreatePedOnSeat(VehicleSeat.LeftRear, "M_M_GunNut_01", RelationshipGroup.Cop)
                p2 = v.CreatePedOnSeat(VehicleSeat.RightRear, "M_M_GunNut_01", RelationshipGroup.Cop)
                v.PlaceOnNextStreetProperly()
                v.Speed = 10
                d.Armor = 100
                c.Armor = 100
                p1.Armor = 100
                p2.Armor = 100
                d.Weapons.SniperRifle_M40A1.Ammo = 999
                c.Weapons.AssaultRifle_M4.Ammo = 999
                p1.Weapons.AssaultRifle_M4.Ammo = 999
                p2.Weapons.AssaultRifle_M4.Ammo = 999
                c.WillDoDrivebys = True
                p1.WillDoDrivebys = True
                p2.WillDoDrivebys = True
                d.SetPathfinding(True, True, True)
                c.SetPathfinding(True, True, True)
                p1.SetPathfinding(True, True, True)
                p2.SetPathfinding(True, True, True)
                v.NoLongerNeeded()
                d.NoLongerNeeded()
                c.NoLongerNeeded()
                p1.NoLongerNeeded()
                p2.NoLongerNeeded()
                flag = 0
            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
