Rei_anami

NoExplosionOnCrash

Sep 26th, 2022
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using GTA;
  2. using GTA.Native;
  3. using System;
  4. using System.Windows.Forms;
  5.  
  6. public class NoExplosionOnCrash : Script
  7. {
  8.     public NoExplosionOnCrash()
  9.     {
  10.         Tick += OnTick;
  11.         Interval = 500;
  12.     }
  13.  
  14.     void OnTick(object sender, EventArgs e)
  15.     {
  16.         Vehicle veh = Game.Player.Character.CurrentVehicle;
  17.         if (CanWeUse(veh) && veh.Model.IsCar)
  18.         {
  19.             if(!veh.IsInvincible && veh.IsInAir)
  20.             {
  21.                 if (veh.Speed > 20f)
  22.                 {
  23.                     veh.IsInvincible = true;
  24.                 }
  25.             }
  26.             if (veh.IsInvincible && !veh.IsInAir)
  27.             {
  28.                 veh.IsInvincible = false;
  29.             }
  30.         }
  31.     }
  32.  
  33.     bool CanWeUse(Entity entity)
  34.     {
  35.         return entity != null && entity.Exists();
  36.     }
  37. }
Add Comment
Please, Sign In to add comment