Hello again! I been trying to figure out how could i only show players in specific level to the scoreboard
like
var TestValue = 1;
for( var i = 0; i < Players; i++ )
{
if( TestValue in Player_Level[i] )
{
//Name
GUI.Label( Rect( Screen.width/2 - 100, 230 + 20*i, 100, 30 ), "" + Player_Name[i] );
//Score
GUI.Label( Rect( Screen.width/2 - 20, 230 + 20*i, 100, 30 ), "" + Player_Score[i] );
//Level
GUI.Label( Rect( Screen.width/2 + 60, 230 + 20*i, 100, 30 ), "" + Player_Level[i] );
}
}
Hi,
why do you need the Testvalue?
Try to do something like this:
var Players[2] = new Players {"player1", "player2"};
for( var i = 0; i < Players.count; i++ )
{
Gui.Label( Rect( Screen.width/2 -100, 230 + 20*i, 100, 30), Players[i]);
}
Its just an example, i did not test it.
And i am not sure i did understand your question properly
greetings, Michael
Ah ok.
What does Player_Level return? An integer?
If yes. Try to write your previous code and change line 5 like this.
javascript* *if( TestValue == Player_Level[i])* *
Could you show some more of your Script pls. Since you are using JS, i can not figure out what you expect your variables to have inside.
I will read through it tomorrow morning. Have to get up early for work and it is 0.45 at my place hehe
I think the problem will bei somewhere with the variable-types.
1 Like
EDIT: All works now! Thank you for help!