ternary operator, increasing vars.
#1

pawn Code:
(PlayerI[i][Team] == 1) ? ServerI[PlayersInTeamA]++ : ServerI[PlayersInTeamB]++;
how could I make this without getting an warning: expression has no effect?

I want to increase Players in team A if player team == 1, or if its not, it will increase in team B
Reply
#2

EDIT: nevermind.
Reply
#3

What did you change? Everything's the same, except you changed the var from ServerI to server. Gives the warning still.
Reply
#4

Ternary operators are used to return values, not expressions.

Example
PHP Code:
new var;
printf("Variable is %s", var == ? ("Off") : ("On")); 
will print "Variable is Off"
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)