Solved Find gender of player?

Discussion in 'Rust Development' started by *VIC, May 17, 2016.

  1. My goal here is to try to identify the gender of a player. I saw some code that DylanSMR posted where he/she claims they are able to ID gender using the following code. However, the part of their code that I'm confused about is "this.gender". I do not see at all where they have defined "this.gender" and that is a pretty critical part of this.

    Code:
            [ChatCommand("test")]
            void PleaseTest(BasePlayer player)
            {
                if(IsMale(player))
                {
                    SendReply(player, "MALE!");
                }
                else if(IsFemale(player))
                {
                    SendReply(player, "FEMALE!");           
                }
                else
                {
                    return;
                }
            }        public bool IsMale(BasePlayer player)
            {
                return (this.gender & EntityLink.Gender.Male) != (EntityLink.Gender) 0;
            }        public bool IsFemale(BasePlayer player)
            {
                return (this.gender & EntityLink.Gender.Female) != (EntityLink.Gender) 0;
            }
    Besides this, I've tried using BasePlayer.GetEntityLinks(), but it seems like I'm not returning anything upon calling this. I'm not entirely sure what the function of GetEntityLinks is in the first place. Thanks for any help here.
     
  2. the SkinSet/SkinType the only way to get this:
    Code:
    // PlayerModel
    public bool IsFemale
    {
        get
        {
            return this.skinType == 1;
        }
    }
    Code:
    // PlayerModel
    public SkinSetCollection SkinSet
    {
        get
        {
            if (this.IsFemale)
            {
                return this.FemaleSkin;
            }
            return this.MaleSkin;
        }
    }
     
  3. Yeah I found that code in the Assembly found in your files/server files. I don't have my decompiler installed currently but if you search gender and do some digging for a few minutes you should be able to find where "gender" is