using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using GTA;
using GTA.Native;
using GTA.Math;
using System.Windows.Forms;
 
namespace carrape
{
    public class carrape : Script
    {
        public bool activatecarrape = false;
        public carrape()
        {
            Tick += OnTick;
            KeyDown += OnKeyDown;
        }
        private void OnKeyDown(object sender, KeyEventArgs e)
        {
                       
        if(e.KeyCode == Keys.I) { activatecarrape = !activatecarrape; }
 
        }
        private void OnTick(object sender, EventArgs e)
        {  
            Ped player = Game.Player.Character;
                        Vehicle[] arrVehicle = World.GetNearbyVehicles(player, 1000); //Get arrays
           
                        for(int i = 0; i < arrVehicle.Length; i++) {
                                for(int i1 = 0; i1 < 6; i1++) // Do work for vehicles here.    
                                {
                                        if (activatecarrape)
                                        {
                                                arrVehicle[i].BurstTire(i1);
                                        }
                                }
                        }
        }
    }
}