public DrugDeal(Vector3 place, bool gangs) { if (LivelyWorld.DebugOutput) { File.AppendAllText(@"scripts\LivelyWorldDebug.txt", "\n" + DateTime.Now + " - Called for DrugDeal Event"); } center = place; TimeAlive = Game.GameTime + 60000; //Distance = place.DistanceTo(Game.Player.Character.Position); GangDeal = gangs; if (LivelyWorld.Debug >= DebugLevel.EventsAndScenarios) { UI.Notify("~b~Deal spawned"); } //LivelyWorld.BlacklistedImportantEvents.Add(EventType.Deal); Vector3 carpos = World.GetSafeCoordForPed(center, false); float Heading = LivelyWorld.AngleBetweenVectors(place, carpos); OutputArgument outArgA = new OutputArgument(); OutputArgument outArgB = new OutputArgument(); if (Function.Call <bool>(Hash.GET_CLOSEST_VEHICLE_NODE_WITH_HEADING, place.X, place.Y, place.Z, outArgA, outArgB, 0, 1077936128, 0)) { Heading = outArgB.GetResult <float>(); } if (gangs) { car = World.CreateVehicle("gburrito", carpos, Heading + LivelyWorld.RandomInt(-20, 20));// LivelyWorld.AngleBetweenVectors(place, carpos)); if (!LivelyWorld.CanWeUse(car)) { Finished = true; return; } if (!LivelyWorld.CarCanSeePos(car, car.Position + (car.ForwardVector * -10), 0)) { car.Position = car.Position + (car.ForwardVector * 3); } //Dealer Ped newped = World.CreatePed("G_M_Y_Lost_01", car.Position + (car.ForwardVector * -4)); if (!LivelyWorld.CanWeUse(newped)) { Finished = true; return; } newped.RelationshipGroup = LivelyWorld.NeutralRLGroup; newped.Weapons.Give(WeaponHash.Pistol, 30, false, true); newped.AlwaysKeepTask = true; Function.Call(Hash.TASK_START_SCENARIO_IN_PLACE, newped, "WORLD_HUMAN_STAND_IMPATIENT", 1000, true); newped.Heading = car.Heading + 180f;//LivelyWorld.AngleBetweenVectors(carpos, place); Dealer = newped; //Goons newped = World.CreatePed("G_M_Y_Lost_01", car.Position + (car.ForwardVector * -3) + (car.RightVector * -2)); if (!LivelyWorld.CanWeUse(newped)) { Finished = true; return; } newped.RelationshipGroup = LivelyWorld.NeutralRLGroup; newped.Weapons.Give(WeaponHash.AssaultRifle, 30, true, true); newped.AlwaysKeepTask = true; newped.Heading = LivelyWorld.AngleBetweenVectors(carpos, place); //Function.Call(Hash.TASK_START_SCENARIO_IN_PLACE, newped, "PROP_HUMAN_STAND_IMPATIENT", 5000, true); Goons.Add(newped); newped = World.CreatePed("G_M_Y_Lost_01", car.Position + (car.ForwardVector * -3) + (car.RightVector * 2)); if (!LivelyWorld.CanWeUse(newped)) { Finished = true; return; } newped.RelationshipGroup = LivelyWorld.NeutralRLGroup; newped.Weapons.Give(WeaponHash.AssaultRifle, 30, true, true); newped.AlwaysKeepTask = true; newped.Heading = LivelyWorld.AngleBetweenVectors(carpos, place); //Function.Call(Hash.TASK_START_SCENARIO_IN_PLACE, newped, "WORLD_HUMAN_SMOKING", 5000, true); Goons.Add(newped); //Buyer newped = null; newped = World.CreateRandomPed(car.Position + (car.ForwardVector * -7)); if (!LivelyWorld.CanWeUse(newped)) { Finished = true; return; } newped.RelationshipGroup = LivelyWorld.NeutralRLGroup; //newped.SetConfigFlag(17, true); newped.AlwaysKeepTask = true; Function.Call(Hash.TASK_START_SCENARIO_IN_PLACE, newped, "CODE_HUMAN_CROSS_ROAD_WAIT", 1000, true); newped.Heading = car.Heading;//LivelyWorld.AngleBetweenVectors(place, carpos); car.OpenDoor(VehicleDoor.Trunk, false, false); Buyer = newped; //PedsInvolved.Add(newped); } else { center = place; Model model = LivelyWorld.DrugCars[LivelyWorld.RandomInt(0, LivelyWorld.DrugCars.Count - 1)]; while (!model.IsVehicle) { model = LivelyWorld.DrugCars[LivelyWorld.RandomInt(0, LivelyWorld.DrugCars.Count - 1)]; } car = World.CreateVehicle(model, carpos, LivelyWorld.AngleBetweenVectors(place, carpos)); if (!LivelyWorld.CanWeUse(car)) { Finished = true; return; } if (!LivelyWorld.CarCanSeePos(car, car.Position + (car.ForwardVector * -10), 0)) { car.Position = car.Position + (car.ForwardVector * 3); } Ped newped = World.CreatePed("s_m_y_dealer_01", car.Position + (car.ForwardVector * -4)); if (!LivelyWorld.CanWeUse(newped)) { Finished = true; return; } newped.RelationshipGroup = LivelyWorld.NeutralRLGroup; newped.Weapons.Give(WeaponHash.Pistol, 30, false, true); newped.AlwaysKeepTask = true; //newped.Task.StartScenario("WORLD_HUMAN_SMOKING", newped.Position); newped.Heading = car.Heading + 180f; //LivelyWorld.AngleBetweenVectors(carpos, place); Dealer = newped; // PedsInvolved.Add(newped); newped = null; newped = World.CreateRandomPed(car.Position + (car.ForwardVector * -7)); if (!LivelyWorld.CanWeUse(newped)) { Finished = true; return; } newped.RelationshipGroup = LivelyWorld.NeutralRLGroup; //newped.SetConfigFlag(17, true); newped.AlwaysKeepTask = true; //newped.Task.StartScenario("WORLD_HUMAN_SMOKING", newped.Position); newped.Heading = car.Heading;//LivelyWorld.AngleBetweenVectors(place, carpos); Buyer = newped; car.OpenDoor(VehicleDoor.Trunk, false, false); // PedsInvolved.Add(newped); } Dealer.RelationshipGroup = DealerRLGroup; foreach (Ped ped in Goons) { ped.RelationshipGroup = DealerRLGroup; } if (LivelyWorld.DebugBlips) { Dealer.AddBlip(); Dealer.CurrentBlip.Scale = 0.7f; Dealer.CurrentBlip.IsShortRange = true; Dealer.CurrentBlip.Name = "Deal"; } if (LivelyWorld.Debug >= DebugLevel.EventsAndScenarios) { UI.Notify("~b~Spawned Deal"); } }