1. I'd like to add Reactive Target dink sound to players who get killed with a headshot while wearing a metal helmet. I know we can get the entity's base protection, but the value you get is dependent on what the player is wearing all over, not only on the bodypart that's getting hit.

    Is there a way?
     
  2. In HitInfo i believe there is a variable called something like IsHeadshot, might want to use that (nvm, didn't read the question properly)
     
    Last edited by a moderator: Aug 24, 2017
  3. Yes - that's not a problem. The issue lies with finding out what helmet the player is wearing. I'd like to avoid checking strings if possible, since that can be taxing on the server if done too often.
     
  4. First thought of mind is checking the items in the players containerWear. I’m sure a .Contains or .Equals would make hardly a difference to server perf there. I’d presume something like that takes nanoseconds.

    Besides, you should ideally focus on performance last. Tweaking code as you find there’s an issue. Working around things that you’re not even sure would make a difference would most likely cause more issues in the future than it would by avoiding it now. At least from my experience anyway. Don’t get paranoid on what is laggy and what’s not. If you’re really uncertain add some debug timers. Spawn loads of player models and shoot them all within like 5 seconds.
     
  5. I'm pretty sure you can check the players inventory slots. With that you could do something like:
    Code:
    public bool IsWearingHelmet(BasePlayer player) => (player.inventory.containerWear.GetSlot(3).amount == 0) ? false : true;
    If your wanting to check for individual helmets I assume you would have to check the id of the helmet. For example:
    Code:
            public int HelmetType(BasePlayer player)
            {
                if (player.inventory.containerWear.GetSlot(3).amount == 0) return 0; //Return 0 meaning no helmet.
                List<int> armored = new List<int>()
                {
                    999,
                    1000,
                    1001,
                };
                if (armored.Contains(player.inventory.containerWear.GetSlot(3).info.itemid)) return 1; //This will check if his/her helmet is armored, if so return 1 meaning  it is armored.
                else return 2; //Return 2, meaning not armored. The armored list will contains things like facemasks.
            }
    Going on what @Ryan said with the containerWear. Could be tweaked for performance. I wrote this real quick.
    Also, itemSlot 3 might not be right.
     
  6. Yea, the helmet can be in any of the slots unless modified differently via the plugin which is also not a bad possibility / solution.
     
  7. Thanks for the info, everyone!
    [DOUBLEPOST=1503544630][/DOUBLEPOST]Upon looking further into it, I've found that you can get the damage multiplier by doing the following:

    info.damageProperties.GetMultiplier(info.boneArea)

    EDIT: God damn it. I'm very wrong.
     
    Last edited by a moderator: Aug 24, 2017