21.11.2010, 07:02
I'm assuming you want to check who has the highest score on the server, no? If so, the following code can help you.
Read the comments to determine where to put the code that you wish. Please note that this is also not tested, so you will be responsible for doing so.
pawn Код:
GetHighestDMScore()
{
new highscore, highcount, highID = INVALID_PLAYER_ID;
for( new i = 0; i < MAX_PLAYERS; i ++ )
{
if( dmscore[ i ] > highscore )
{
highscore = dmscore[ i ];
highID = i;
highcount = 0;
}
else if( dmscore[ i ] == highscore )
{
highcount++;
highID = INVALID_PLAYER_ID;
}
}
if( count > 0 )
{
// Someone else, or more, had the same highest score
}
else if( highID == INVALID_PLAYER_ID )
{
// No one had a high score, or no players connected (most likely outcome)
}
else
{
// Person with the highest score is in the variable 'highID'
}
}