UGX-Mods

Call of Duty: Black Ops 3 => Help Desk => Scripting => Topic started by: greeNTheBoyz on October 30, 2016, 11:46:26 am

Title: Give all players a perk.
Post by: greeNTheBoyz on October 30, 2016, 11:46:26 am
Hey!
I've used this line of code for my shootable EE so that it gives everyone Electric Cherry:
Code Snippet
Plaintext
players[i] zm_perks::give_perk( PERK_ELECTRIC_CHERRY, false );
but it gives me an error in the launcher.
Is there a different 'players' at the start or what?
Thanks.
Title: Re: Give all players a perk.
Post by: MakeCents on November 01, 2016, 06:39:20 pm
Your gonna have to show more of your code. players is a local variable for that function. And PERK_ELECTRIC_CHERRY comes from the perks gsh I think. Two possible different errors.

For players you use:
Code Snippet
Plaintext
players = GetPlayers();
foreach(player in players){
player zm_perks::give_perk( PERK_ELECTRIC_CHERRY, false );
}

You can also use a for loop with an iterative.
Code Snippet
Plaintext
players = GetPlayers();
for( i=0;i<players.size;i++ ){
players[i] zm_perks::give_perk( PERK_ELECTRIC_CHERRY, false );
}