Quote:
Originally Posted by -Prodigy-
This will get the player with the highest score:
pawn Код:
new iHighest;
for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { if(GetPlayerScore(i) > GetPlayerScore(iHighest)) iHighest = i; } }
// The variable: "iHighest" now contains the player id holding the highest score.
|
tested, doesnt work.
Quote:
Originally Posted by DarkScripter
The function was tested and working.
#You can replace:
pawn Код:
#include <a_samp>
public OnPlayerCommandText(playerid, cmdtext[]) { if(!strcmp(cmdtext, "/rankScore", true)) { static Scores[MAX_PLAYERS], String[128], Nome[24], IntVar, ; for(IntVar = 0; IntVar != MAX_PLAYERS; ++IntVar) Scores[IntVar] = GetPlayerScore(IntVar); BubbleSort(Scores, sizeof(Scores)); for(IntVar = 0; IntVar < 10; ++i) { GetPlayerName(IntVar, Nome, 24); format(String, sizeof(String),"%i є Name: %s Score: %s", IntVar+1, Nome, Scores[IntVar]); SendClientMessage(playerid, -1, String); } return 1; } return 0; }
static stock BubbleSort(v[], size) { #if !defined swap #define swap(%0,%1) (%0 ^= %1, %1 ^= %0, %0 ^= %1) #endif for(new i = 1; i != size; ++i) { for(new q = 0; (q != size - i); ++q)if(v[i] > v[q]) swap(v[q],v[i]); } }
|
i got 2 errors:
Код:
error 001: expected token: "-identifier-", but found ";"
error 017: undefined symbol "i"
well can you make it become SetTimer and forward please.. it is easier for me to look up, thanks.