Dear forum users! In compliance with the new European GDPR regulations, we'd just like to inform you that if you have an account, your email address is stored in our database. We do not share your information with third parties, and your email address and password are encrypted for security reasons.
New to the forum? Say hello in this topic! Also make sure to read the rules.
New to the forum? Say hello in this topic! Also make sure to read the rules.
how to get a player gender?
Forum rules
By using the forum you agree to the following rules.
By using the forum you agree to the following rules.
how to get a player gender?
I need to make a script that determines the gender of the player and then executes the command. For example, if the player's gender is male, then he executes a command, if female, then executes another command.
0 x
Hello world
- Odex64
- Superfighter
- Posts: 172
- Joined: Sat Jul 29, 2017 12:39 pm
- Title: Content Creator
- SFD Account: Odex64
- Started SFD: PreAlpha
- Location: Italy
- Gender:
- Age: 22
Female skin and clothes end with "_fem" suffix. To check if a player is using a female or male skin, you can use the following code:
Let me know if it works; I haven't tested it.
Code: Select all
public void ButtonPressed(TriggerArgs args)
{
if (args.Sender is IPlayer)
{
IPlayer ply = (IPlayer)args.Sender;
if (ply.GetProfile().Skin.Name.Split('_').Length > 1)
{
//female
}
else
{
//male
}
}
}
2 x