Advertisement
Guest User

recruitfunction

a guest
Nov 23rd, 2017
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.42 KB | None | 0 0
  1.     //////////////////// RECRUIT SQUADS
  2.  
  3.     void RecruitSquad1()
  4.     {
  5.         float maxDistance = 25f;
  6.         pedsGroup = World.GetNearbyPeds(player.Character, maxDistance);
  7.         Ped Squad1Leader = null;
  8.         float lastDistance = maxDistance;
  9.         foreach (Ped ped in pedsGroup)
  10.         {
  11.             float distance = ped.Position.DistanceTo(player.Character.Position);
  12.             if (distance < lastDistance)
  13.             {
  14.                 Squad1Leader = ped;
  15.                 lastDistance = distance;
  16.             }
  17.         }
  18.         if (Squad1Leader != null && Squad1Leader != player.Character)
  19.         {
  20.             if (Squad1.Count == 0)
  21.             {
  22.                 Function.Call(Hash.SET_PED_AS_GROUP_LEADER, Squad1Leader, Squad1Group);
  23.             }
  24.             else
  25.             {
  26.                 Function.Call(Hash.SET_PED_AS_GROUP_MEMBER, Squad1Leader, Squad1Group);
  27.             }
  28.             Function.Call(GTA.Native.Hash.SET_GROUP_FORMATION, Squad1Group, 1);
  29.             Function.Call(GTA.Native.Hash.SET_GROUP_FORMATION_SPACING, Squad1Group, 1.0f, 1.0f, 1.0f);
  30.             if (Squad1Followplayer.Checked)
  31.             {
  32.                 Squad1Followplayer.Checked = false;
  33.             }
  34.             Squad1.Add(Squad1Leader);
  35.             foreach (Ped recruit in Squad1)
  36.             {
  37.                 recruit.RelationshipGroup = Squad1RelationshipGroup;
  38.                 Function.Call(Hash.SET_PED_SHOOT_RATE, recruit, 1000);
  39.                 Function.Call(Hash.SET_PED_COMBAT_ABILITY, recruit, 100);
  40.                 if (recruit != Squad1[0])
  41.                 {
  42.                     Function.Call(Hash.SET_PED_AS_GROUP_MEMBER, recruit, Squad1Group);
  43.                 }
  44.                 recruit.AddBlip();
  45.                 recruit.RelationshipGroup = Squad1RelationshipGroup;
  46.                 Function.Call(Hash.SET_PED_SHOOT_RATE, recruit, 1000);
  47.                 Function.Call(Hash.REMOVE_PED_FROM_GROUP, recruit.Handle);
  48.                 recruit.CurrentBlip.Color = BlipColor.Blue;
  49.                 recruit.CurrentBlip.Scale = 0.7f;
  50.                 SetBlipName(recruit.CurrentBlip, "Squad Member");
  51.                 PreparePed(recruit, MainWeaponSquad1, SecondaryWeaponSquad1);
  52.                 recruit.Task.StandStill(-1);
  53.                 recruit.Task.ClearAll();
  54.                 recruit.AlwaysKeepTask = true;
  55.                 recruit.IsPersistent = true;
  56.             }
  57.             Squad1GroupFix();
  58.         }
  59.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement