Esempio n. 1
0
        public void Process()
        {
            if (!StoleCar && Game.Player.Character.IsInVehicle(car))
            {
                StoleCar = true;

                if (GangDeal)
                {
                    Game.Player.Character.Weapons.Give(WeaponHash.SawnOffShotgun, 50, false, true);
                    Game.Player.Character.Weapons.Give(WeaponHash.AssaultRifle, 250, false, true);
                    Game.Player.Character.Weapons.Give(WeaponHash.Molotov, 8, false, true);

                    LivelyWorld.DisplayHelpTextThisFrame("You found some weapons inside the van.");
                }
                else
                {
                    int money = LivelyWorld.RandomInt(200, 1000);
                    Game.Player.Money += money;

                    LivelyWorld.DisplayHelpTextThisFrame("You found some money in the glove compartment.");
                }
            }

            if (!Ruined)
            {
                if (TimeAlive < Game.GameTime)
                {
                    TaskSequence seq = new TaskSequence();

                    Function.Call(Hash.TASK_ENTER_VEHICLE, 0, car, 20000, -1, 1f, 1, 0);

                    Function.Call(Hash.TASK_VEHICLE_DRIVE_WANDER, 0, car, 15f, 1 + 2 + 8 + 32 + 128 + 256);
                    seq.Close();
                    Dealer.Task.PerformSequence(seq);
                    seq.Dispose();
                    if (LivelyWorld.CanWeUse(car))
                    {
                        car.CloseDoor(VehicleDoor.Trunk, false);
                    }
                    Finished = true;
                }
                if (LivelyWorld.isCopInRange(Dealer.Position, 40) || LivelyWorld.isCopVehicleRange(Dealer.Position, 40))
                {
                    Dealer.Task.FightAgainst(Game.Player.Character);
                }
                if (Game.Player.Character.IsInRangeOf(Dealer.Position, 40f) && Dealer.IsOnScreen && World.GetRelationshipBetweenGroups(DealerRLGroup, Game.Player.Character.RelationshipGroup) != Relationship.Hate)
                {
                    World.SetRelationshipBetweenGroups(Relationship.Hate, DealerRLGroup, Function.Call <int>(GTA.Native.Hash.GET_HASH_KEY, "PLAYER"));
                    World.SetRelationshipBetweenGroups(Relationship.Hate, Function.Call <int>(GTA.Native.Hash.GET_HASH_KEY, "PLAYER"), DealerRLGroup);
                }
                if (Dealer.IsInCombat)
                {
                    if (!Buyer.IsFleeing)
                    {
                        Buyer.Task.ReactAndFlee(Dealer);
                    }
                    Ruined = true;
                    if (Goons.Count > 0 && LivelyWorld.CanWeUse(car))
                    {
                        TaskSequence seq = new TaskSequence();
                        Function.Call(Hash.TASK_VEHICLE_DRIVE_WANDER, 0, car, 30f, 4 + 8 + 16 + 32);
                        seq.Close();
                        Dealer.Task.PerformSequence(seq);
                        seq.Dispose();
                    }
                }
                if (!Game.Player.Character.IsInRangeOf(car.Position, Distance * 1.5f) || (!car.IsAlive || StoleCar))
                {
                    Finished = true;
                }
            }
            else if (!Game.Player.Character.IsInRangeOf(car.Position, 100f) || (!car.IsAlive || StoleCar))
            {
                Finished = true;
            }
        }