Пример #1
0
        private bool AddToGroup(Ped p)
        {
            if (!Exists(p)) return false; // check if the ped is valid
            Player.Group.AddMember(p);
            p.CurrentRoom = Player.Character.CurrentRoom; // required, or ped won't be visible when spawned inside a building
            p.WillDoDrivebys = true;
            p.PriorityTargetForEnemies = true;
            p.DuckWhenAimedAtByGroupMember = false;
            p.AlwaysDiesOnLowHealth = true;
            p.SetPathfinding(true, true, true);
            p.CanSwitchWeapons = true;
             //   p.isRequiredForMission = false;
            p.Money = 500;
            p.Health = 300;
            p.Invincible = false;
            p.Weapons.Uzi.Ammo = 30000;
            switch (rnd.Next(6))
            {
                case 0:
                    p.Weapons.MP5.Ammo = 30000;
                    p.Weapons.Select(Weapon.SMG_MP5);
                    break;
                case 1:
                    p.Weapons.AssaultRifle_M4.Ammo = 30000;
                    p.Weapons.Select(Weapon.Rifle_M4);
                    break;
                case 2:
                    p.Weapons.RocketLauncher.Ammo = 30000;
                    p.Weapons.Select(Weapon.Heavy_RocketLauncher);
                    break;
                case 3:
                    p.Weapons.MolotovCocktails.Ammo = 30000;
                    p.Weapons.Select(Weapon.Thrown_Molotov);
                    break;
                case 4:
                    p.Weapons.DesertEagle.Ammo = 30000;
                    p.Weapons.Select(Weapon.Handgun_DesertEagle);
                    break;
                case 5:
                    p.Weapons.RocketLauncher.Ammo = 30000;
                    p.Weapons.Select(Weapon.Heavy_RocketLauncher);
                    break;

                default:

                    p.Weapons.BaseballBat.Ammo = 2000;
                    p.Weapons.Select(Weapon.Melee_BaseballBat);
                    break;

            }
            p.RelationshipGroup = RelationshipGroup.Player;
            p.ChangeRelationship(RelationshipGroup.Player, Relationship.Companion);
            p.CantBeDamagedByRelationshipGroup(RelationshipGroup.Player, true);
            p.DuckWhenAimedAtByGroupMember = true;

            Blip B = p.AttachBlip();
            B.Color = BlipColor.Green;
            AddG(p);

            Game.DisplayText(index+"");

            return true;
        }