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 :^)
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 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.
- 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