Advertisement
Johurt

[SCR] TOP 10 by Score

Oct 22nd, 2014
482
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 0.58 KB | None | 0 0
  1. new topID[10] = {-1, ...}, topXP[10], p, c, c2, xp;
  2. for(p = 0; p < MAX_PLAYERS; p++)
  3. {
  4.     if(!IsPlayerConnected(p) || IsPlayerNPC(p)) continue;
  5.     xp = GetPlayerScore(p);
  6.     for(c = 0; c < 10; c++)
  7.     {
  8.         if(topXP[c] < xp)
  9.         {
  10.             if(c != 9)
  11.                 {
  12.                 for(c2 = 8; c2 != c-1; c2--)
  13.                 {
  14.                                 topID[c2+1] = topID[c2];
  15.                                 topXP[c2+1] = topXP[c2];
  16.                 }
  17.             }
  18.             topID[c] = p;
  19.             topXP[c] = xp;
  20.             break;
  21.         }
  22.     }
  23. }
  24. new pName[21];
  25. for(c = 0; c < 10; c++)
  26. {
  27.     GetPlayerName(topID[c], pName, 21);
  28.     printf("%d. %s (%d)", c + 1, pName, topXP[c]);
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement