Log in to reply
 

[C#] LAST_DAMAGE_BONE



  • in this code if you headshote a ped show the string Headshot, but when i activate the mod the game still crashing, any idea? thanks

    Ped[] nearPeds = World.GetAllPeds();
    foreach (Ped p in nearPeds)
    {
    if (p != player)
    {
    if (Function.Call<bool>(Hash.GET_PED_LAST_DAMAGE_BONE, p, 31086))
    {
    UI.ShowSubtitle("HeadShot");
    }
    }
    }



  • Please use code tags so your code doesn't become all mangled. It's three backticks before and after the code.

    Also take a look at the Native DB to see what the function does. It (probably) returns true if that ped is damaged and puts the damaged bone in the second argument.
    http://www.dev-c.com/nativedb/func/info/d75960f6bd9ea49c

    Something like this might work.

        // Unknown Modder made a neat list: https://pastebin.com/3pz17QGd
        // SKEL_Head = 0x796e
        Ped[] nearPeds = World.GetAllPeds();
        foreach(Ped p in nearPeds)
        {
            if (p != player)
            {
                OutputArgument outBone = new OutputArgument();
                if (Function.Call<bool>(Hash.GET_PED_LAST_DAMAGE_BONE, p, outBone))
                {
                    if (outBone.GetResult<int>() == SKEL_Head)
                        UI.ShowSubtitle("HeadShot");
                }
            }
        }
    
    

Log in to reply
 

Looks like your connection to GTA5-Mods.com Forums was lost, please wait while we try to reconnect.