Quote:
Originally Posted by De4dpOol
pawn Код:
GetMostPlayedPlayer() { new toptime = 0;//creating a variable with 0 value new topid = -1;//creating a variable with -1 value (as playerid can be 0 too so we are using -1)
for(new i=0; i < MAX_PLAYERS; i++)//looping through all players { if(toptime < YourTimeStoringVariable[i])//comparing if player's time is more than toptime. { toptime = YourTimeStoringVariable[i];//if it is more set the toptime to the player's time so that in the next loop only players with more kills than already looped player will be counted. topid = i;//setting him the topid. } } return topid;//returning topid. } //the topid is the playerid with most time played.
I don't understnd what do you want but I explained it more. You can use it globally just replace YourTimeVariable with the variable in which player's time is stored. It will return -1 if no one found else it will return the playerid. You can use same code for detecting top killer, top scorer etc.
EDIT: Ooh! now I got it, my code will return the result from connected players only :P Thanks kaliber.
|
Yes, but how about other stats? For example most killed players? You just showed me, the DONE example for time. But i dont wanted it like this, i wanted explanation for it, that i can make ALL stats showed in top.
Right now, i can just rewrite this script, and i wont understand anything, because it is specified on time, which has nothing to do, with for example "most killed players". So i need to get explained everything, that in the future, i can do it myself.
Kaliber: I dont have any webpage, to store this data in.