Ejemplo n.º 1
0
        private async Task DoTheAction(Ped ped, List <Ped> pedsToShoot)
        {
            Ped pedToShoot = pedsToShoot == null?Utilities.GetClosestPed(ped) : ped.GetClosestPedFromPedList(pedsToShoot);

            if (pedToShoot == null || pedToShoot.IsDead)
            {
                return;
            }

            int chance = Utils.rnd.Next(10);

            if (chance >= 0 && chance <= 5)
            {
                ped.Task.ShootAt(pedToShoot);
            }
            else
            {
                Vector3 pos = ped.GetOffsetPosition(Utils.GetRandomPosition(5, 25));
                ped.Task.RunTo(pos);
                while (World.GetDistance(pos, ped.Position) >= 3f)
                {
                    await BaseScript.Delay(10);
                }
                ped.Task.ShootAt(pedToShoot);
            }
        }
Ejemplo n.º 2
0
        private async Task Action()
        {
            Ped closest = (!victim.Exists() || victim.IsDead) ? suspect.GetClosestPedFromPedList(AssignedPlayers) : victim;

            if (closest == null || closest.IsDead)
            {
                return;
            }
            suspect.Task.ClearAll();
            if (World.GetDistance(closest.Position, suspect.Position) <= 20f)
            {
                suspect.Task.FightAgainst(closest);
            }
            await BaseScript.Delay(2000);
        }