Shadoww5

Top 10 Score - Shadoww5

Jul 16th, 2011
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.74 KB | None | 0 0
  1. public OnPlayerCommandText(playerid, cmdtext[])
  2. {
  3.     if(strcmp(cmdtext, "/top10", true) == 0)
  4.     {
  5.         new top, str[64], lugar;
  6.         for(new i = 0; i < GetMaxPlayers(); i ++)
  7.             if(GetPlayerScore(i) > top)
  8.                 top = GetPlayerScore(i);
  9.         if(!top)
  10.             return SendClientMessage(playerid, 0xFF0000FF, "Nenhum jogador online possui score acima de 0.");
  11.         for(new t = top; t >= 0; t--)
  12.         {
  13.             for(new i = 0; i < GetMaxPlayers(); i ++)
  14.             {
  15.                 if(!IsPlayerConnected(i) || GetPlayerScore(i) != t) continue;
  16.                 GetPlayerName(i, str, 24);
  17.                 lugar++;
  18.                 format(str, sizeof str, " %dº >> %s - Score: %d", lugar, str, GetPlayerScore(i));
  19.                 SendClientMessage(playerid, 0xFFFF00FF, str);
  20.             }
  21.             if(lugar >= 10) break;
  22.         }
  23.         return 1;
  24.     }
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment