new AttList[256], AttKills[256], AttScore[256], AttDamage[256], DefList[256], DefKills[256], DefScore[256], DefDamage[256], TopScore[256];
CMD:list(playerid, params[]) { new playerScores[MAX_PLAYERS][rankingEnum], index, p; foreach(new i : Player) { if(PlayerInfo[i][pWasInArena]) { playerScores[index][player_Score] = floatround(PlayerInfo[i][pDamage]); playerScores[index++][player_ID] = i; p++; } } GetPlayerHighestScores(playerScores, 0, (index-1)); new AttList[256], AttKills[256], AttScore[256], AttDamage[256], DefList[256], DefKills[256], DefScore[256], DefDamage[256], TopScore[256]; for(new i = 0; i != p; i++) { if(IsPlayerAttacker(playerScores[i][player_ID])) { format(AttList, sizeof(AttList), "%s~r~~h~%s~n~", AttList, GetPlayerNameEx(playerScores[i][player_ID])); format(AttKills, sizeof(AttKills), "%s~w~~h~~h~%d~n~", AttKills, PlayerInfo[playerScores[i][player_ID]][pRoundKills]); format(AttScore, sizeof(AttScore), "%s~w~~h~~h~%d~n~", AttScore, PlayerInfo[playerScores[i][player_ID]][pRoundPoints]); format(AttDamage, sizeof(AttDamage), "%s~w~~h~~h~%d~n~", AttDamage, playerScores[i][player_Score]); } else if(IsPlayerDefender(playerScores[i][player_ID])) { format(DefList, sizeof(DefList), "%s~b~~h~%s~n~", DefList, GetPlayerNameEx(playerScores[i][player_ID])); format(DefKills, sizeof(DefKills), "%s~w~~h~~h~%d~n~", DefKills, PlayerInfo[playerScores[i][player_ID]][pRoundKills]); format(DefScore, sizeof(DefScore), "%s~w~~h~~h~%d~n~", DefScore, PlayerInfo[playerScores[i][player_ID]][pRoundPoints]); format(DefDamage, sizeof(DefDamage), "%s~w~~h~~h~%d~n~", DefDamage, playerScores[i][player_Score]); } if(i == 0) format(TopScore, sizeof(TopScore), "%s%s1. %s~n~", TopScore, IsPlayerAttacker(playerScores[i][player_ID]) ? ("~r~") : ("~b~"), GetPlayerNameEx(playerScores[i][player_ID])); else if(i == 1) format(TopScore, sizeof(TopScore), "%s%s2. %s~n~", TopScore, IsPlayerAttacker(playerScores[i][player_ID]) ? ("~r~") : ("~b~"), GetPlayerNameEx(playerScores[i][player_ID])); else if(i == 2) format(TopScore, sizeof(TopScore), "%s%s3. %s~n~", TopScore, IsPlayerAttacker(playerScores[i][player_ID]) ? ("~r~") : ("~b~"), GetPlayerNameEx(playerScores[i][player_ID])); } TextDrawSetString(attackerText[0], AttList); TextDrawSetString(attackerText[2], AttKills); TextDrawSetString(attackerText[1], AttScore); TextDrawSetString(attackerText[3], AttDamage); TextDrawSetString(defenderText[0], DefList); TextDrawSetString(defenderText[2], DefKills); TextDrawSetString(defenderText[1], DefScore); TextDrawSetString(defenderText[3], DefDamage); TextDrawSetString(topList, TopScore); for(new i = 0; i < 15; i++) { TextDrawShowForAll(endText[i]); } for(new i = 0; i < 4; i++) { TextDrawShowForAll(attackerText[i]); } for(new i = 0; i < 4; i++) { TextDrawShowForAll(defenderText[i]); } TextDrawShowForAll(topList); return 1; }
Do you mind giving an example? I don't see another way besides looping 16 times instead of the one, if you could help me that would be very appreciated and it's the reason I posted here
|
Giving you an example isn't how scripting works, learn from documentation. This is a scripting 'help' forum, not a scripting 'request' forum. Read the PAWN3 PDF language documentation.
|
for(new i = 0; i != p; i++) { if(IsPlayerAttacker(playerScores[i][player_ID])) { format(AttList, sizeof(AttList), "%s~r~~h~%s~n~", AttList, GetPlayerNameEx(playerScores[i][player_ID])); format(AttKills, sizeof(AttKills), "%s~w~~h~~h~%d~n~", AttKills, PlayerInfo[playerScores[i][player_ID]][pRoundKills]); format(AttScore, sizeof(AttScore), "%s~w~~h~~h~%d~n~", AttScore, PlayerInfo[playerScores[i][player_ID]][pRoundPoints]); format(AttDamage, sizeof(AttDamage), "%s~w~~h~~h~%d~n~", AttDamage, playerScores[i][player_Score]); } else if(IsPlayerDefender(playerScores[i][player_ID])) { format(DefList, sizeof(DefList), "%s~b~~h~%s~n~", DefList, GetPlayerNameEx(playerScores[i][player_ID])); format(DefKills, sizeof(DefKills), "%s~w~~h~~h~%d~n~", DefKills, PlayerInfo[playerScores[i][player_ID]][pRoundKills]); format(DefScore, sizeof(DefScore), "%s~w~~h~~h~%d~n~", DefScore, PlayerInfo[playerScores[i][player_ID]][pRoundPoints]); format(DefDamage, sizeof(DefDamage), "%s~w~~h~~h~%d~n~", DefDamage, playerScores[i][player_Score]); } }
string[0] = EOS;