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.
I need a script for get player's profile info
Forum rules
By using the forum you agree to the following rules.
By using the forum you agree to the following rules.
- Elhombreserio
- Meatbag
- Posts: 4
- Joined: Mon Apr 27, 2020 5:41 pm
- Title: JoJo
- SFD Account: ELHOMBRESERIOYT
- SFD Alias: Jotaro
- Started SFD: February 2017
- Location: Peru
- Gender:
I need a script for get player's profile info
I'm noob in C#, if anybody has an script for get profile(refer to clothes, accessory) please share!!
Thanks in advance
Thanks in advance
0 x
You can't control the non--existent
- Odex64
- Superfighter
- Posts: 173
- Joined: Sat Jul 29, 2017 12:39 pm
- Title: Content Creator
- SFD Account: Odex64
- Started SFD: PreAlpha
- Location: Italy
- Gender:
- Age: 22
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.
With just a brief research on forums you can find some scripts about clothes and Skins, however since you're a newbie I'll slightly edit the code so you can use it almost anywhere.
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());
}
From now on, whenever you press that button you will get your custom profile.
1 x
- Elhombreserio
- Meatbag
- Posts: 4
- Joined: Mon Apr 27, 2020 5:41 pm
- Title: JoJo
- SFD Account: ELHOMBRESERIOYT
- SFD Alias: Jotaro
- Started SFD: February 2017
- Location: Peru
- Gender:
Thanks man!!, but I need the same but with multiple player spawn (For example 4 players )
0 x
You can't control the non--existent
- Odex64
- Superfighter
- Posts: 173
- Joined: Sat Jul 29, 2017 12:39 pm
- Title: Content Creator
- SFD Account: Odex64
- Started SFD: PreAlpha
- Location: Italy
- Gender:
- Age: 22
Here's a very simple script for 4 players
Just type "Button1" in Script Method for the first button, then "Button2" for the second and so on...
Remember to place 4 Profile Infos and assign them "skin1", "skin2" CustomID etc..
If you want to add more skins copy and paste the first piece of code and change its number, ex: Copy the Button1 code and change it to Button5 and skin5
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());
}
Remember to place 4 Profile Infos and assign them "skin1", "skin2" CustomID etc..
If you want to add more skins copy and paste the first piece of code and change its number, ex: Copy the Button1 code and change it to Button5 and skin5
0 x
- Elhombreserio
- Meatbag
- Posts: 4
- Joined: Mon Apr 27, 2020 5:41 pm
- Title: JoJo
- SFD Account: ELHOMBRESERIOYT
- SFD Alias: Jotaro
- Started SFD: February 2017
- Location: Peru
- Gender:
, the script gives me an error
look https://i.imgur.com/S2dVmBA.png
look https://i.imgur.com/S2dVmBA.png
0 x
You can't control the non--existent
- Odex64
- Superfighter
- Posts: 173
- Joined: Sat Jul 29, 2017 12:39 pm
- Title: Content Creator
- SFD Account: Odex64
- Started SFD: PreAlpha
- Location: Italy
- Gender:
- Age: 22
Use the following code:
Paste this code in your map, then place 4 Buttons and type "ButtonPressed" in Script Method for all the buttons; then type "1" in Object ID for the first button, "2" in Object ID for the second button, and so on..
and place 4 PlayerProfileInfo and type "Skin1" in Object ID (for the first ProfileInfo); type "Skin2" in Object ID for the second ProfileInfo, etc..
Now you're finally done. I hope..
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;
}
}
and place 4 PlayerProfileInfo and type "Skin1" in Object ID (for the first ProfileInfo); type "Skin2" in Object ID for the second ProfileInfo, etc..
Now you're finally done. I hope..
0 x
- Elhombreserio
- Meatbag
- Posts: 4
- Joined: Mon Apr 27, 2020 5:41 pm
- Title: JoJo
- SFD Account: ELHOMBRESERIOYT
- SFD Alias: Jotaro
- Started SFD: February 2017
- Location: Peru
- Gender:
Don't work For my Map But Thanks Anyway
0 x
You can't control the non--existent