Quantcast

Jump to content

» «
Photo

Task Stealth Kill [C#] ?

6 replies to this topic
Kolopsel
  • Kolopsel

    Player Hater

  • Members
  • Joined: 18 Jun 2017
  • Germany

#1

Posted 17 August 2017 - 09:36 AM Edited by Kolopsel, 17 August 2017 - 09:37 AM.

Hello,

Today i've searched for a Task Stealth Kill Native.

I've found it and tried to add it to my script with the code : 

Function.Call(Hash.TASK_STEALTH_KILL, Killer, Target, AR_stealth_kill_knife);

But now my problem is AR_stealth_kill_knife ( Stealth Kill Type ) is not recognized by ScriptHookVDotNet.

So, could anybody tell me how to properly include this Native into my code.

Thank you in advance!


elsewhat
  • elsewhat

    Rat

  • Members
  • Joined: 14 Aug 2015
  • Norway

#2

Posted 17 August 2017 - 04:18 PM

Have tried making it work recently, but couldn't get it to work.

 

My failed attempt used

AI::TASK_STEALTH_KILL(attacker->getPed(), defender->getPed(), GAMEPLAY::GET_HASH_KEY("AR_stealth_kill_a"), 10.0f, 1);

sollaholla
  • sollaholla

    C# Dev.

  • Members
  • Joined: 19 May 2016
  • United-States

#3

Posted 19 August 2017 - 02:42 PM

Just uncovered some new information on the native, will post some source code soon:
http://www.dev-c.com...a5dc05579d60bd9


sollaholla
  • sollaholla

    C# Dev.

  • Members
  • Joined: 19 May 2016
  • United-States

#4

Posted 20 August 2017 - 05:20 AM

I'm with elsewhat on this one. I can't seem to get it working either. Here's my code:

 

public class Core : Script
{
    public Core()
    {
        Tick += OnTick;
    }

    private void OnTick(object sender, System.EventArgs e)
    {
        if (Game.Player.Character.IsPerformingStealthKill)
            return;

        var peds = World.GetNearbyPeds(Game.Player.Character, 5);
        if (!peds?.Any() ?? false)
            return;

        Ped ped = peds[0];
        if (!Entity.Exists(ped) || ped.IsPlayer)
            return;

        Function.Call(Hash._0x8509B634FBE7DA11, "STRING");
        Function.Call(Hash._0x6C188BE134E074AA, "Press ~INPUT_SPECIAL_ABILITY_SECONDARY~ to perform stealth kill.");
        Function.Call(Hash._0x238FFE5C7B0498A6, 0, 0, 1, -1);

        if (Game.IsControlJustPressed(2, Control.SpecialAbilitySecondary))
        {
            if (!Game.Player.Character.Weapons.HasWeapon(WeaponHash.Knife))
                Game.Player.Character.Weapons.Give(WeaponHash.Knife, 1, false, true);

            Function.Call(Hash.TASK_STEALTH_KILL, Game.Player.Character, Game.GenerateHash("AR_stealth_kill_a"), 1.0, 0);
            ped.Task.ClearAll();

            UI.ShowSubtitle("Performing stealth kill...");
        }
    }
}

elsewhat
  • elsewhat

    Rat

  • Members
  • Joined: 14 Aug 2015
  • Norway

#5

Posted 21 August 2017 - 06:24 PM

For now then the only option is to fake is with synchronized animation. 

https://youtu.be/86E49no6lZ4?t=46m59s

 

This requires the mod to do the actual placement of the peds in the right distance from each other, and also to kill off the defender afterwards

  • sollaholla likes this

Kolopsel
  • Kolopsel

    Player Hater

  • Members
  • Joined: 18 Jun 2017
  • Germany

#6

Posted 22 August 2017 - 08:28 AM

Well you could attach the Peds to each other.


sollaholla
  • sollaholla

    C# Dev.

  • Members
  • Joined: 19 May 2016
  • United-States

#7

Posted 22 August 2017 - 11:49 AM

Well you could attach the Peds to each other.

Yes, our use TASK_PLAY_ANIM_ADVANCED to specify position and rotation of the animation, with some nice position blending to allow the peds to interact more smoothly.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users