Jump to content
SimuNews

Ped Stuck in Arrest Animation

Recommended Posts

Hi there,

In my Callout Plugin I have a Ped who is fight against me.

But when I will arrest them it stucks in a unusual way like this: http://sendvid.com/kmpv1jdu

 

Can anyone help me pls?

 

My Code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Rage;
using LSPD_First_Response.Mod.API;
using LSPD_First_Response.Mod.Callouts;
using LSPD_First_Response.Engine.Scripting.Entities;
using System.Drawing;
using System.Threading;

namespace HotCallouts.Callouts
{
    [CalloutInfo("PersonWithAKnife", CalloutProbability.Medium)]
    class PersonWithAKnife : Callout
    {

        private Ped Suspect;
        private Vector3 SpawnPoint;
        private Blip SuspectBlip;

        public override bool OnBeforeCalloutDisplayed()
        {

            SpawnPoint = new Vector3(-(609f), -(388f), 34f);

            ShowCalloutAreaBlipBeforeAccepting(SpawnPoint, 40f);
            AddMinimumDistanceCheck(10f, SpawnPoint);

            CalloutMessage = "Person with a Knife";
            CalloutPosition = SpawnPoint;

            Functions.PlayScannerAudioUsingPosition("CITIZENS_REPORT CRIME_PERSONCARRYINGKNIFE IN_OR_ON_POSITION UNITS_RESPOND_CODE_02", SpawnPoint);

            return base.OnBeforeCalloutDisplayed();
        }

        public override bool OnCalloutAccepted()
        {

            Suspect = new Ped(SpawnPoint);
            Suspect.IsPersistent = true;
            Suspect.Inventory.GiveNewWeapon("WEAPON_KNIFE", 1, true);
            Suspect.RandomizeVariation();
            Suspect.CanAttackFriendlies = true;
            Suspect.BlockPermanentEvents = true;
            Suspect.RelationshipGroup = "RED";

            Game.LocalPlayer.Character.RelationshipGroup = "BLUE";

            Game.SetRelationshipBetweenRelationshipGroups("RED", "BLUE", Relationship.Hate);
            Game.SetRelationshipBetweenRelationshipGroups("BLUE", "RED", Relationship.Hate);

            SuspectBlip = Suspect.AttachBlip();
            SuspectBlip.Color = Color.Yellow;
            SuspectBlip.EnableRoute(Color.Yellow);

            return base.OnCalloutAccepted();
        }

        public override void Process()
        {
            base.Process();
            
            switch (Game.LocalPlayer.Character.Position.DistanceTo(Suspect.Position) < 30)
            {
                case true:
                Game.DisplayNotification("True");
                Suspect.Tasks.FightAgainstClosestHatedTarget(50);
                break;

                case false:
                Game.DisplayNotification("False");
                Suspect.Tasks.Wander().WaitForCompletion();
                break;
            }

            if (Suspect.IsDead || Suspect.IsCuffed)
            {
                Functions.PlayScannerAudio("WE_ARE_CODE FOUR NO_FURTHER_UNITS_REQUIRED");
                End();
            }
        }

        public override void End()
        {
            base.End();
            if (Suspect.Exists()) { Suspect.Dismiss(); }
            if (SuspectBlip.Exists()) { SuspectBlip.Delete(); }
        }

    }
}

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×