SA-MP Forums Archive
check each player score - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: check each player score (/showthread.php?tid=101048)



check each player score - Marc_307 - 08.10.2009

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


Re: check each player score - Bpb - 08.10.2009

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.


Re: check each player score - Marc_307 - 08.10.2009

warning 203: symbol is never used: "GetWinner"


Re: check each player score - Correlli - 08.10.2009

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.


Re: check each player score - Marc_307 - 09.10.2009

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