Thanks in advance


JakSparro98 wrote: ↑Sat Jul 07, 2018 9:41 pmSince you're changing the entire player profile with a costum one you only need to add ScoutProfile.Skin=new IProfileClothingItem("Normal","Skin4"); before ply.SetProfile (ScoutProfile);MrWheatley wrote: ↑Wed Jul 04, 2018 8:44 pmSo I have to get they player's profile or the custom one, and what exactly do I have to change?JakSparro98 wrote: ↑Wed Jul 04, 2018 5:59 pm
The Skin attribute in the IProfile class can change the skin color, you need to copy the current player profile, change the copy and then re-assing the latter to the player with SetProfile. You will only get the skin color changed keeping the clothings.
Provide your current code if you need help about implementing this function.
This is what I came up with but it only changes the skin to the default color.Code: Select all
public void ButtonPressed (TriggerArgs args) { foreach (IPlayer ply in Game.GetPlayers ()) { if (args.Sender is IPlayer) { IObject a = Game.CreateObject ("PlayerProfileInfo", new Vector2 (0, 0)); a.CustomId = "a"; ply.SetProfile (((IObjectPlayerProfileInfo) Game.GetSingleObjectByCustomId ("a")).GetProfile ()); IProfile ScoutProfile = new IProfile (); ScoutProfile.Accesory = new IProfileClothingItem ("DogTag", "ClothingGray"); ScoutProfile.Head = new IProfileClothingItem ("Cap", "ClothingGray"); ScoutProfile.ChestUnder = new IProfileClothingItem ("TShirt", "ClothingRed"); ScoutProfile.Hands = new IProfileClothingItem ("FingerlessGloves", "ClothingLightGray"); ScoutProfile.Legs = new IProfileClothingItem ("Pants", "ClothingGray"); ScoutProfile.Feet = new IProfileClothingItem ("ShoesBlack", "ClothingLightGray"); ply.SetProfile (ScoutProfile); } } }
You can choose the skin type from Skin0 to Skin4.
Code: Select all
public void ButtonPressed(TriggerArgs args)
{
foreach(IPlayer ply in Game.GetPlayers())
if(args.Sender is IPlayer)
ply.SetProfile(((IObjectPlayerProfileInfo) Game.GetSingleObjectByCustomId("myskin")).GetProfile());
}
Code: Select all
public void Button1(TriggerArgs args)
{
IPlayer ply = (IPlayer) args.Sender;
ply.SetProfile(((IObjectPlayerProfileInfo) Game.GetSingleObjectByCustomId("skin1")).GetProfile());
}
public void Button2(TriggerArgs args)
{
IPlayer ply = (IPlayer) args.Sender;
ply.SetProfile(((IObjectPlayerProfileInfo) Game.GetSingleObjectByCustomId("skin2")).GetProfile());
}
public void Button3(TriggerArgs args)
{
IPlayer ply = (IPlayer) args.Sender;
ply.SetProfile(((IObjectPlayerProfileInfo) Game.GetSingleObjectByCustomId("skin3")).GetProfile());
}
public void Button4(TriggerArgs args)
{
IPlayer ply = (IPlayer) args.Sender;
ply.SetProfile(((IObjectPlayerProfileInfo) Game.GetSingleObjectByCustomId("skin4")).GetProfile());
}
Code: Select all
public void ButtonPressed(TriggerArgs args)
{
IPlayer ply = (IPlayer) args.Sender;
switch (((IObject) args.Caller).CustomId)
{
case "1":
ply.SetProfile(((IObjectPlayerProfileInfo) Game.GetSingleObjectByCustomId("Skin1")).GetProfile());
break;
case "2":
ply.SetProfile(((IObjectPlayerProfileInfo) Game.GetSingleObjectByCustomId("Skin2")).GetProfile());
break;
case "3":
ply.SetProfile(((IObjectPlayerProfileInfo) Game.GetSingleObjectByCustomId("Skin3")).GetProfile());
break;
case "4":
ply.SetProfile(((IObjectPlayerProfileInfo) Game.GetSingleObjectByCustomId("Skin4")).GetProfile());
break;
default:
Game.ShowChatMessage("Error", Color.Cyan);
break;
}
}