check each player score
#1

Hi, folks!
How to do that after a while (I've already made a timer[timer's named "Winner"]) the score of players get checked. Then the player with the highest score should win the round. (Show the name and score with GameTextForAll.)
Thanks in advance!
Marc_307
Reply
#2

pawn Код:
#define NO_WINNER -1

GetWinner()
{
  new winner=NO_WINNER, maxscore, score;
  for(new i=0; i<MAX_PLAYERS; i++)
  {
    if(score=GetPlayerScore(i) > maxscore)
    {
      maxscore=score; winner=i;
    }
  }
  return winner;
}
should work.
Reply
#3

warning 203: symbol is never used: "GetWinner"
Reply
#4

Quote:
Originally Posted by Marc_307
warning 203: symbol is never used: "GetWinner"
You can't just add some code to the script and expect it to work, you need to use the function.
Reply
#5

Doesn't matter anymore, I fixed the problem but thank you for helping.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)