Open one of the sma files in the amxmodx/scripting folder and see how to loop through players[] array correctly.
But firstly i'd recommend to learn the Pawn array basics since you obviously is messing the meaning of "array element number" and "array element index".