Esempio n. 1
0
 public static void Recruit(this Ped ped, Ped leader)
 {
     if (leader != null)
     {
         PedGroup currentPedGroup = leader.CurrentPedGroup;
         ped.LeaveGroup();
         InputArgument[] arguments = new InputArgument[] { ped.Handle, false };
         Function.Call(Hash._0xF0A4F1BBF4FA7497, arguments);
         ped.Task.ClearAll();
         currentPedGroup.SeparationRange = 2.147484E+09f;
         if (!currentPedGroup.Contains(leader))
         {
             currentPedGroup.Add(leader, true);
         }
         if (!currentPedGroup.Contains(ped))
         {
             currentPedGroup.Add(ped, false);
         }
         ped.IsPersistent      = true;
         ped.RelationshipGroup = leader.RelationshipGroup;
         ped.NeverLeavesGroup  = true;
         Blip currentBlip = ped.CurrentBlip;
         if (currentBlip.Type != 0)
         {
             currentBlip.Remove();
         }
         Blip blip2 = ped.AddBlip();
         blip2.Color = BlipColor.Green;
         blip2.Scale = 0.65f;
         blip2.Name  = "Group";
         PlayerGroup.SetPedTasks(ped, PedTasks.Follow);
     }
 }
Esempio n. 2
0
 public static void Recruit(this Ped ped, Ped leader)
 {
     if (!(leader == null))
     {
         PedGroup group = leader.CurrentPedGroup;
         ped.LeaveGroup();
         Function.Call(Hash.SET_PED_RAGDOLL_ON_COLLISION, ped.Handle, false);
         ped.Task.ClearAll();
         group.SeparationRange = 2.14748365E+09f;
         if (!group.Contains(leader))
         {
             group.Add(leader, true);
         }
         if (!group.Contains(ped))
         {
             group.Add(ped, false);
         }
         ped.IsPersistent      = true;
         ped.RelationshipGroup = leader.RelationshipGroup;
         ped.NeverLeavesGroup  = true;
         Blip currentBlip = ped.CurrentBlip;
         if (currentBlip.Type != 0)
         {
             currentBlip.Remove();
         }
         Blip blip = ped.AddBlip();
         blip.Color = BlipColor.Green;
         blip.Scale = 0.65f;
         blip.Name  = "Group";
         PlayerGroup.SetPedTasks(ped, PedTasks.Follow);
     }
 }
Esempio n. 3
0
 public static void Recruit(this Ped ped, Ped leader, bool canBeTargeted, bool invincible, int accuracy)
 {
     if (!(leader == null))
     {
         ped.LeaveGroup();
         ped.SetRagdollOnCollision(false);
         ped.Task.ClearAll();
         PedGroup group = leader.CurrentPedGroup;
         group.SeparationRange = 2.14748365E+09f;
         if (!group.Contains(leader))
         {
             group.Add(leader, true);
         }
         if (!group.Contains(ped))
         {
             group.Add(ped, false);
         }
         ped.CanBeTargetted    = canBeTargeted;
         ped.Accuracy          = accuracy;
         ped.IsInvincible      = invincible;
         ped.IsPersistent      = true;
         ped.RelationshipGroup = leader.RelationshipGroup;
         ped.NeverLeavesGroup  = true;
         Blip currentBlip = ped.CurrentBlip;
         if (currentBlip.Type != 0)
         {
             currentBlip.Remove();
         }
         Blip blip = ped.AddBlip();
         blip.Color = GTA.BlipColor.Blue;
         blip.Scale = 0.7f;
         blip.Name  = "Friend";
         EntityEventWrapper wrapper = new EntityEventWrapper(ped);
         wrapper.Died += delegate(EntityEventWrapper sender, Entity entity)
         {
             Blip currentBlip2 = entity.CurrentBlip;
             if (currentBlip2.Type != 0)
             {
                 currentBlip2.Remove();
             }
             wrapper.Dispose();
         };
         ped.PlayAmbientSpeech("GENERIC_HI", SpeechModifier.Standard);
     }
 }
        public static void Recruit(this Ped ped, Ped leader, bool canBeTargeted, bool invincible, int accuracy)
        {
            if (Entity.op_Equality((Entity)leader, (Entity)null))
            {
                return;
            }
            ped.LeaveGroup();
            ped.SetRagdollOnCollision(false);
            ped.get_Task().ClearAll();
            PedGroup currentPedGroup = leader.get_CurrentPedGroup();

            currentPedGroup.set_SeparationRange((float)int.MaxValue);
            if (!currentPedGroup.Contains(leader))
            {
                currentPedGroup.Add(leader, true);
            }
            if (!currentPedGroup.Contains(ped))
            {
                currentPedGroup.Add(ped, false);
            }
            ped.set_CanBeTargetted(canBeTargeted);
            ped.set_Accuracy(accuracy);
            ((Entity)ped).set_IsInvincible(invincible);
            ((Entity)ped).set_IsPersistent(true);
            ped.set_RelationshipGroup(leader.get_RelationshipGroup());
            ped.set_NeverLeavesGroup(true);
            ((Entity)ped).get_CurrentBlip()?.Remove();
            Blip blip = ((Entity)ped).AddBlip();

            blip.set_Color((BlipColor)3);
            blip.set_Scale(0.7f);
            blip.set_Name("Friend");
            EntityEventWrapper wrapper = new EntityEventWrapper((Entity)ped);

            wrapper.Died += (EntityEventWrapper.OnDeathEvent)((sender, entity) =>
            {
                entity.get_CurrentBlip()?.Remove();
                wrapper.Dispose();
            });
            ped.PlayAmbientSpeech("GENERIC_HI", SpeechModifier.Standard);
        }