public static void MakePedFollowPlayer()
        {
            Blip PedBlip;

            GameFiber.StartNew(delegate
            {
                FollowingPed = GetNearestValidPed();
                if (!FollowingPed)
                {
                    return;
                }
                PedBlip       = FollowingPed.AttachBlip();
                PedBlip.Color = System.Drawing.Color.Yellow;

                PedBlip.Flash(400, -1);
                IsFollowingEnabled   = true;
                itemFollow.Title     = "Ask to Stop Following";
                itemCallTaxi.Enabled = false;
                itemGrab.Enabled     = false;

                if (EntryPoint.IsLSPDFRPlusRunning)
                {
                    API.LspdfrPlusFunctions.AddCountToStatistic(Main.PluginName, "People made to follow you");
                }
                while (FollowingPed.Exists())
                {
                    GameFiber.Yield();
                    if (!FollowingPed.Exists())
                    {
                        break;
                    }
                    if (IsFollowingEnabled)
                    {
                        if (Vector3.Distance(Game.LocalPlayer.Character.Position, FollowingPed.Position) > 2.3f)
                        {
                            var follow = FollowingPed.Tasks.FollowNavigationMeshToPosition(Game.LocalPlayer.Character.GetOffsetPosition(Vector3.RelativeBack * 1.5f), FollowingPed.Heading, 1.6f);
                            follow.WaitForCompletion(600);
                        }
                    }
                    else
                    {
                        break;
                    }
                }
                if (FollowingPed.Exists())
                {
                    FollowingPed.Tasks.StandStill(7000);
                }
                IsFollowingEnabled = false;
                itemFollow.Title   = "Ask to Follow";
                if (PedBlip.Exists())
                {
                    PedBlip.Delete();
                }
                itemCallTaxi.Enabled = true;
                itemGrab.Enabled     = true;
            });
        }
        public static void GrabPed()
        {
            Blip pedBlip;

            GameFiber.StartNew(() =>
            {
                FollowingPed = GetNearestValidPed();
                if (!FollowingPed)
                {
                    return;
                }

                IsGrabEnabled        = true;
                itemGrab.Title       = "Release Grabbed Ped";
                itemCallTaxi.Enabled = false;
                itemFollow.Enabled   = false;
                pedBlip                  = FollowingPed.AttachBlip();
                pedBlip.Color            = System.Drawing.Color.Yellow;
                grabShortcutMessageShown = true;
                pedBlip.Flash(400, -1);
                FollowingPed.Rotation = Game.LocalPlayer.Character.Rotation;
                Game.LocalPlayer.Character.Tasks.PlayAnimation("doors@", "door_sweep_r_hand_medium", 9f, AnimationFlags.StayInEndFrame | AnimationFlags.SecondaryTask | AnimationFlags.UpperBodyOnly).WaitForCompletion(2000);

                if (EntryPoint.IsLSPDFRPlusRunning)
                {
                    API.LspdfrPlusFunctions.AddCountToStatistic(Main.PluginName, "People grabbed");
                }
                FollowingPed.Tasks.ClearImmediately();

                NativeFunction.Natives.ATTACH_ENTITY_TO_ENTITY(FollowingPed, Game.LocalPlayer.Character, (int)PedBoneId.RightHand, 0.2f, 0.4f, 0f, 0f, 0f, 0f, true, true, false, false, 2, true);
                API.Functions.OnPlayerGrabbedPed(FollowingPed);
                while (true)
                {
                    GameFiber.Yield();
                    if (!FollowingPed.Exists())
                    {
                        break;
                    }
                    NativeFunction.Natives.ATTACH_ENTITY_TO_ENTITY(FollowingPed, Game.LocalPlayer.Character, (int)PedBoneId.RightHand, 0.2f, 0.4f, 0f, 0f, 0f, 0f, true, true, false, false, 2, true);
                    if (Game.LocalPlayer.Character.GetNearbyVehicles(1).Length > 0 && Functions.IsPedArrested(FollowingPed))
                    {
                        var nearestveh = Game.LocalPlayer.Character.GetNearbyVehicles(1)[0];

                        if (Game.LocalPlayer.Character.DistanceTo(nearestveh.Position) < 3.9f && nearestveh.PassengerCapacity >= 3)
                        {
                            int SeatToPutInto = 1;
                            if (Game.LocalPlayer.Character.DistanceTo(nearestveh.GetOffsetPosition(Vector3.RelativeLeft * 1.5f)) > Game.LocalPlayer.Character.DistanceTo(nearestveh.GetOffsetPosition(Vector3.RelativeRight * 1.5f)))
                            {
                                SeatToPutInto = 2;
                            }
                            if (nearestveh.IsSeatFree(SeatToPutInto))
                            {
                                Game.DisplayHelp("Press ~b~" + EntryPoint.KeyConvert.ConvertToString(PlacePedInVehicleKey) + "~s~ to place the suspect in the vehicle.");
                                if (Game.IsKeyDown(PlacePedInVehicleKey))
                                {
                                    if (nearestveh.GetDoors().Length > SeatToPutInto + 1)
                                    {
                                        NativeFunction.Natives.TASK_OPEN_VEHICLE_DOOR(Game.LocalPlayer.Character, nearestveh, 6000f, SeatToPutInto, 1.47f);
                                        int waitCount = 0;
                                        while (true)
                                        {
                                            GameFiber.Wait(1000);
                                            waitCount++;

                                            if (nearestveh.Doors[SeatToPutInto + 1].IsOpen || waitCount >= 6 || FollowingPed.IsInVehicle(nearestveh, false))
                                            {
                                                FollowingPed.Detach();
                                                GameFiber.Sleep(500);
                                                break;
                                            }
                                            if (FollowingPed.Exists() && !FollowingPed.IsDead)
                                            {
                                                NativeFunction.Natives.TASK_OPEN_VEHICLE_DOOR(Game.LocalPlayer.Character, nearestveh, 6000f, SeatToPutInto, 1.47f);
                                            }
                                        }
                                    }

                                    FollowingPed.Detach();
                                    FollowingPed.Tasks.EnterVehicle(nearestveh, 4000, SeatToPutInto).WaitForCompletion();
                                    if (!FollowingPed.IsInVehicle(nearestveh, false))
                                    {
                                        if (Game.LocalPlayer.Character.IsInVehicle(nearestveh, false) && Game.LocalPlayer.Character.SeatIndex == SeatToPutInto)
                                        {
                                            Game.LocalPlayer.Character.Tasks.ClearImmediately();
                                        }
                                        FollowingPed.WarpIntoVehicle(nearestveh, SeatToPutInto);
                                    }
                                    break;
                                }
                            }
                        }
                    }

                    if (!NativeFunction.Natives.IS_ENTITY_PLAYING_ANIM <bool>(Game.LocalPlayer.Character, "doors@", "door_sweep_r_hand_medium", 3))
                    {
                        Game.LocalPlayer.Character.Tasks.PlayAnimation("doors@", "door_sweep_r_hand_medium", 9f, AnimationFlags.StayInEndFrame | AnimationFlags.SecondaryTask | AnimationFlags.UpperBodyOnly);
                    }
                    if (!IsGrabEnabled || Game.LocalPlayer.Character.IsInAnyVehicle(false) || FollowingPed.IsInAnyVehicle(true) || Game.LocalPlayer.Character.DistanceTo(FollowingPed) > 4f)
                    {
                        break;
                    }
                }

                if (FollowingPed.Exists() && !FollowingPed.IsInAnyVehicle(false))
                {
                    FollowingPed.Detach();
                    FollowingPed.Tasks.StandStill(7000);
                }

                Game.LocalPlayer.Character.Tasks.ClearSecondary();
                IsGrabEnabled  = false;
                itemGrab.Title = "Grab Nearest Ped";
                if (pedBlip.Exists())
                {
                    pedBlip.Delete();
                }
                itemCallTaxi.Enabled = true;
                itemFollow.Enabled   = true;
            });
        }