Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void SpawnGangDriveBy(Gang g, Ped victim)
- {
- if (!CanWeUse(victim)) return;
- victim.IsPersistent = true;
- if (Debug) UI.Notify("victim exists");
- Vector3 pos = GenerateSpawnPos(Game.Player.Character.Position.Around(100), Nodetype.Road, false);
- //if (pos == Vector3.Zero) pos = GenerateSpawnPos(Game.Player.Character.Position, Nodetype.Road, false);
- Vehicle veh = null;
- List<Ped> Peds = new List<Ped>();
- if (Debug) UI.Notify("setting rlgroups");
- int HateRLGroup = World.AddRelationshipGroup("hatetemp");
- int VictimRLGroup = World.AddRelationshipGroup("victimtemp");
- victim.RelationshipGroup = VictimRLGroup;
- foreach (Ped p in World.GetNearbyPeds(victim,40f))
- {
- World.SetRelationshipBetweenGroups(Relationship.Respect, VictimRLGroup, p.RelationshipGroup);
- World.SetRelationshipBetweenGroups(Relationship.Respect, p.RelationshipGroup, VictimRLGroup);
- }
- World.SetRelationshipBetweenGroups(Relationship.Hate, HateRLGroup, victim.RelationshipGroup);
- World.SetRelationshipBetweenGroups(Relationship.Hate, victim.RelationshipGroup, HateRLGroup);
- if (Debug) UI.Notify("checking king of gang");
- switch (g)
- {
- case Gang.Ballas:
- {
- veh = World.CreateVehicle("tornado", pos);
- veh.PrimaryColor = VehicleColor.MetallicPurple;
- veh.SecondaryColor = VehicleColor.MatteDesertBrown;
- for (int i= 0; i< veh.PassengerSeats+1; i++)
- {
- Ped ped = World.CreatePed(BallasModels[RandomInt(0,BallasModels.Count-1)], veh.Position.Around(5));
- ped.RelationshipGroup = HateRLGroup;
- ped.Weapons.Give(WeaponHash.Pistol, 99, true, true);
- Peds.Add(ped);
- }
- break;
- }
- case Gang.Lost:
- {
- veh = World.CreateVehicle("gburrito", pos);
- veh.PrimaryColor = VehicleColor.MatteBlack;
- for (int i = 0; i < veh.PassengerSeats+1; i++)
- {
- Ped ped = World.CreatePed(LostModels[RandomInt(0, LostModels.Count - 1)], veh.Position.Around(5));
- ped.RelationshipGroup = HateRLGroup;
- ped.Weapons.Give(WeaponHash.Pistol, 99, true, true);
- Peds.Add(ped);
- }
- break;
- }
- case Gang.Vagos:
- {
- veh = World.CreateVehicle("buccaneer", pos);
- veh.PrimaryColor = VehicleColor.MetallicTaxiYellow;
- veh.SecondaryColor = VehicleColor.MetallicTaxiYellow;
- for (int i = 0; i < veh.PassengerSeats+1; i++)
- {
- Ped ped = World.CreatePed(VagosModels[RandomInt(0, VagosModels.Count - 1)], veh.Position.Around(5));
- ped.RelationshipGroup = HateRLGroup;
- ped.Weapons.Give(WeaponHash.Pistol, 99, true, true);
- Peds.Add(ped);
- }
- break;
- }
- case Gang.Families:
- {
- veh = World.CreateVehicle("baller", pos);
- veh.PrimaryColor = VehicleColor.MetallicGreen;
- for (int i = 0; i < veh.PassengerSeats+1; i++)
- {
- Ped ped = World.CreatePed(FamiliesModels[RandomInt(0, FamiliesModels.Count - 1)], veh.Position.Around(5));
- ped.RelationshipGroup = HateRLGroup;
- ped.Weapons.Give(WeaponHash.Pistol, 99, true, true);
- Peds.Add(ped);
- }
- break;
- }
- }
- if (Debug) UI.Notify("setting up gang");
- if (DebugBlips)
- {
- veh.AddBlip();
- veh.CurrentBlip.Sprite = BlipSprite.GunCar;
- veh.CurrentBlip.IsShortRange = true;
- }
- SetPedsIntoVehicle(Peds, veh);
- Script.Wait(1000);
- Ped driver = veh.Driver;
- if (!CanWeUse(driver))
- {
- if (Debug) UI.Notify("No driver!");
- driver = Peds[0];
- }
- MoveEntitytoNearestRoad(veh,true,true);
- if (Debug) UI.Notify("tasking gang");
- TaskSequence seq = new TaskSequence();
- Function.Call(Hash.TASK_ENTER_VEHICLE, 0, veh, 20000, -1, 1f, 1, 0);
- Function.Call(Hash.TASK_VEHICLE_MISSION_PED_TARGET, 0, veh, victim, 4, 20f, 4 + 8 + 16 + 32, 20f, 10f, 2f, true, 1101004800);
- Function.Call(Hash.TASK_PAUSE, 0, RandomInt(2, 4) * 1000);
- Function.Call(Hash.TASK_VEHICLE_MISSION_PED_TARGET, 0, veh, victim, 8, 60f, 4 + 8 + 16 + 32, 20f, 10f, 2f, true, 1101004800);
- seq.Close();
- driver.Task.PerformSequence(seq);
- seq.Dispose();
- foreach (Ped ped in Peds) TemporalPersistence.Add(ped);
- TemporalPersistence.Add(veh);
- TemporalPersistence.Add(victim);
- if (!victim.CurrentBlip.Exists() && !victim.IsPlayer)
- {
- victim.AddBlip();
- victim.CurrentBlip.Color = BlipColor.White;
- victim.CurrentBlip.Scale = 0.7f;
- victim.CurrentBlip.Name = "Victim";
- victim.CurrentBlip.IsShortRange = true;
- }
- if (Debug) UI.Notify("finished");
- GangDrivebyCooldown = Game.GameTime + 60 * 1000 * (RandomInt(2, 5));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement