SHARE
TWEET

Driveby

Eddlm Dec 10th, 2017 257 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.     public void SpawnGangDriveBy(Gang g, Ped victim)
  3.     {
  4.  
  5.         if (!CanWeUse(victim)) return;
  6.         victim.IsPersistent = true;
  7.  
  8.         if (Debug) UI.Notify("victim exists");
  9.  
  10.         Vector3 pos = GenerateSpawnPos(Game.Player.Character.Position.Around(100), Nodetype.Road, false);
  11.         //if (pos == Vector3.Zero) pos = GenerateSpawnPos(Game.Player.Character.Position, Nodetype.Road, false);
  12.         Vehicle veh = null;
  13.         List<Ped> Peds = new List<Ped>();
  14.  
  15.         if (Debug) UI.Notify("setting rlgroups");
  16.  
  17.         int HateRLGroup = World.AddRelationshipGroup("hatetemp");
  18.         int VictimRLGroup = World.AddRelationshipGroup("victimtemp");
  19.         victim.RelationshipGroup = VictimRLGroup;
  20.        foreach (Ped p in World.GetNearbyPeds(victim,40f))
  21.         {
  22.             World.SetRelationshipBetweenGroups(Relationship.Respect, VictimRLGroup, p.RelationshipGroup);
  23.             World.SetRelationshipBetweenGroups(Relationship.Respect, p.RelationshipGroup, VictimRLGroup);
  24.         }
  25.  
  26.  
  27.         World.SetRelationshipBetweenGroups(Relationship.Hate, HateRLGroup, victim.RelationshipGroup);
  28.         World.SetRelationshipBetweenGroups(Relationship.Hate, victim.RelationshipGroup, HateRLGroup);
  29.         if (Debug) UI.Notify("checking king of gang");
  30.  
  31.         switch (g)
  32.         {
  33.             case Gang.Ballas:
  34.                 {
  35.                     veh = World.CreateVehicle("tornado", pos);
  36.                     veh.PrimaryColor = VehicleColor.MetallicPurple;
  37.                     veh.SecondaryColor = VehicleColor.MatteDesertBrown;
  38.  
  39.                     for (int i= 0; i< veh.PassengerSeats+1; i++)
  40.                     {                        
  41.                         Ped ped = World.CreatePed(BallasModels[RandomInt(0,BallasModels.Count-1)], veh.Position.Around(5));
  42.                         ped.RelationshipGroup = HateRLGroup;
  43.                         ped.Weapons.Give(WeaponHash.Pistol, 99, true, true);
  44.  
  45.                         Peds.Add(ped);
  46.                     }
  47.                     break;
  48.                 }
  49.             case Gang.Lost:
  50.                 {
  51.                     veh = World.CreateVehicle("gburrito", pos);
  52.                     veh.PrimaryColor = VehicleColor.MatteBlack;
  53.                     for (int i = 0; i < veh.PassengerSeats+1; i++)
  54.                     {
  55.                         Ped ped = World.CreatePed(LostModels[RandomInt(0, LostModels.Count - 1)], veh.Position.Around(5));
  56.                         ped.RelationshipGroup = HateRLGroup;
  57.                         ped.Weapons.Give(WeaponHash.Pistol, 99, true, true);
  58.                         Peds.Add(ped);
  59.                     }
  60.                     break;
  61.                 }
  62.             case Gang.Vagos:
  63.                 {
  64.                     veh = World.CreateVehicle("buccaneer", pos);
  65.                     veh.PrimaryColor = VehicleColor.MetallicTaxiYellow;
  66.                     veh.SecondaryColor = VehicleColor.MetallicTaxiYellow;
  67.  
  68.                     for (int i = 0; i < veh.PassengerSeats+1; i++)
  69.                     {
  70.                         Ped ped = World.CreatePed(VagosModels[RandomInt(0, VagosModels.Count - 1)], veh.Position.Around(5));
  71.                         ped.RelationshipGroup = HateRLGroup;
  72.                         ped.Weapons.Give(WeaponHash.Pistol, 99, true, true);
  73.                         Peds.Add(ped);
  74.                     }
  75.                     break;
  76.                 }
  77.             case Gang.Families:
  78.                 {
  79.                     veh = World.CreateVehicle("baller", pos);
  80.                     veh.PrimaryColor = VehicleColor.MetallicGreen;
  81.                     for (int i = 0; i < veh.PassengerSeats+1; i++)
  82.                     {
  83.                         Ped ped = World.CreatePed(FamiliesModels[RandomInt(0, FamiliesModels.Count - 1)], veh.Position.Around(5));
  84.                         ped.RelationshipGroup = HateRLGroup;
  85.                         ped.Weapons.Give(WeaponHash.Pistol, 99, true, true);
  86.                         Peds.Add(ped);
  87.                     }
  88.                     break;
  89.                 }
  90.         }
  91.         if (Debug) UI.Notify("setting up gang");
  92.  
  93.         if (DebugBlips)
  94.         {
  95.             veh.AddBlip();
  96.             veh.CurrentBlip.Sprite = BlipSprite.GunCar;
  97.             veh.CurrentBlip.IsShortRange = true;
  98.         }
  99.              SetPedsIntoVehicle(Peds, veh);
  100.  
  101.         Script.Wait(1000);
  102.             Ped driver = veh.Driver;
  103.             if (!CanWeUse(driver))
  104.         {
  105.             if (Debug) UI.Notify("No driver!");
  106.             driver = Peds[0];
  107.         }
  108.         MoveEntitytoNearestRoad(veh,true,true);
  109.         if (Debug) UI.Notify("tasking gang");
  110.  
  111.         TaskSequence seq = new TaskSequence();
  112.         Function.Call(Hash.TASK_ENTER_VEHICLE, 0, veh, 20000, -1, 1f, 1, 0);
  113.         Function.Call(Hash.TASK_VEHICLE_MISSION_PED_TARGET, 0, veh, victim, 4, 20f, 4 + 8 + 16 + 32, 20f, 10f, 2f, true, 1101004800);
  114.         Function.Call(Hash.TASK_PAUSE, 0, RandomInt(2, 4) * 1000);
  115.         Function.Call(Hash.TASK_VEHICLE_MISSION_PED_TARGET, 0, veh, victim, 8, 60f, 4 + 8 + 16 + 32, 20f, 10f, 2f, true, 1101004800);
  116.         seq.Close();
  117.         driver.Task.PerformSequence(seq);
  118.         seq.Dispose();
  119.  
  120.         foreach (Ped ped in Peds) TemporalPersistence.Add(ped);
  121.         TemporalPersistence.Add(veh);
  122.         TemporalPersistence.Add(victim);
  123.  
  124.         if (!victim.CurrentBlip.Exists() && !victim.IsPlayer)
  125.         {
  126.             victim.AddBlip();
  127.             victim.CurrentBlip.Color = BlipColor.White;
  128.             victim.CurrentBlip.Scale = 0.7f;
  129.             victim.CurrentBlip.Name = "Victim";
  130.             victim.CurrentBlip.IsShortRange = true;
  131.         }
  132.         if (Debug) UI.Notify("finished");
  133.         GangDrivebyCooldown = Game.GameTime + 60 * 1000 * (RandomInt(2, 5));
  134.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top