23.08.2010, 01:31
i was wonder how to get hte highest score of ppl in game .. you know .. not by looking at the score board ..cuz i want to return a specifi function to the player wich has the highest score so can anyone help me ?
new highestid = INVALID_PLAYER_ID, highest = -1;
for(new i = 0; i < MAX_PLAYERS; ++i)
{
if(GetPlayerScore(i) > highest)
{
highestid = i;
highest = GetPlayerScore(i);
}
}
if(highestid != INVALID_PLAYER_ID)
{
//your function...
}
forward High();
public High()
{
new highestid = INVALID_PLAYER_ID, highest = -1;
for(new i = 0; i < MAX_PLAYERS; ++i)
{
if(GetPlayerScore(i) > highest)
{
highestid = i;
highest = GetPlayerScore(i);
}
}
for(new i = 0; i < MAX_PLAYERS; ++i)
{
if(highestid != INVALID_PLAYER_ID)
{
team[i] = 3;
}
}
return 1;
}
forward High();
public High()
{
static last; //it's static because it's like a global variable
new highestid = INVALID_PLAYER_ID, highest = -1;
for(new i = 0; i < MAX_PLAYERS; ++i)
{
if(GetPlayerScore(i) > highest)
{
highestid = i;
highest = GetPlayerScore(i);
}
}
if(highestid != INVALID_PLAYER_ID)
{
if(last != highestid)
{
//do something to remove the last one with highest score from the team
}
team[highestid] = 3;
}
last = highestid;
}
forward High(); public High() { static last; //it's static because it's like a global variable new highestid = INVALID_PLAYER_ID, highest = -1; for(new i = 0; i < MAX_PLAYERS; ++i) { if(GetPlayerScore(i) > highest) { highestid = i; highest = GetPlayerScore(i); } } if(highestid != INVALID_PLAYER_ID) { if(last != highestid) { team[last] = 0; } team[highestid] = 3; } last = highestid; }