Hello guys, may you make me a script that does the following:
When the player presses the button, he get PlayerModifier properties.
I will be grateful for the help :^)
How to get PlayerModifier properties by using a button?
Forum rules
By using the forum you agree to the following rules.
By using the forum you agree to the following rules.
- Jovani
- Fighter
- Posts: 55
- Joined: Sun Sep 18, 2016 2:49 am
- Title: Heroe
- SFD Account: Jovani
- SFD Alias: Johnny
- Started SFD: 2014
- Location: Mexico
- Gender:
How to get PlayerModifier properties by using a button?
0 x
-I hope one day to have green ping on most servers...
-SFD is a good game that inspired people to make friends, be artists and "YouTubers". I hope one day SFD becomes famous and everyone recognizes it.
-SFD is a good game that inspired people to make friends, be artists and "YouTubers". I hope one day SFD becomes famous and everyone recognizes it.
- ebomb09
- Fighter
- Posts: 13
- Joined: Mon Apr 30, 2018 5:04 am
- SFD Account: ebomb09
- Location: Canada/BC
- Age: 22
You will need to set the button's script method to 'GiveMods' and set the string in the script 'ModifierCustomID' to your PlayerModifierInfo CustomID.
Code: Select all
public string ModifierCustomID = "YourModifierCustomID";
public void GiveMods(TriggerArgs args){
if(args.Sender is IPlayer){
IPlayer ply = args.Sender as IPlayer;
IObjectPlayerModifierInfo mods = (IObjectPlayerModifierInfo)Game.GetSingleObjectByCustomID(ModifierCustomID);
ply.SetModifiers(mods.GetModifiers());
}
}
2 x
- Jovani
- Fighter
- Posts: 55
- Joined: Sun Sep 18, 2016 2:49 am
- Title: Heroe
- SFD Account: Jovani
- SFD Alias: Johnny
- Started SFD: 2014
- Location: Mexico
- Gender:
Thanks for your helpebomb09 wrote: ↑Wed Mar 20, 2019 8:08 pmYou will need to set the button's script method to 'GiveMods' and set the string in the script 'ModifierCustomID' to your PlayerModifierInfo CustomID.
Code: Select all
public string ModifierCustomID = "YourModifierCustomID"; public void GiveMods(TriggerArgs args){ if(args.Sender is IPlayer){ IPlayer ply = args.Sender as IPlayer; IObjectPlayerModifierInfo mods = (IObjectPlayerModifierInfo)Game.GetSingleObjectByCustomID(ModifierCustomID); ply.SetModifiers(mods.GetModifiers()); } }
0 x
-I hope one day to have green ping on most servers...
-SFD is a good game that inspired people to make friends, be artists and "YouTubers". I hope one day SFD becomes famous and everyone recognizes it.
-SFD is a good game that inspired people to make friends, be artists and "YouTubers". I hope one day SFD becomes famous and everyone recognizes it.