31.10.2017, 00:45
I would like to know how to make the distance from the checkpoint to the player and put in that small system of rank to see who is closest to the checkpoint is first
motogate is the variable that shows which player has the most number
so when the player passes the checkpoint he has one more number when one player has more number than the other one he gets first and what he does not have gets second
motogate is the variable that shows which player has the most number
so when the player passes the checkpoint he has one more number when one player has more number than the other one he gets first and what he does not have gets second
Код:
stock ShowTopTenScoreForPlayer() { new MaxData[14]; new MaxDataID[14]; new bool:OnTheRank[MAX_PLAYERS]; new DataSource[MAX_PLAYERS]; new Ranking[570]; foreach(Player, i) { if(IsPlayerConnected(i)) DataSource[i] = MotoGate[i];//The MotoGate } for(new i; i < 14; i++){MaxData[i] = -1 ;MaxDataID[i] = -1;} //Preparar variбveis foreach(Player, i) { if(IsPlayerConnected(i)) { if(DataSource[i] > MaxData[1]) { MaxData[1] = DataSource[i]; MaxDataID[1] = i; } } } if(MaxDataID[1] != -1) OnTheRank[MaxDataID[1]] = true; foreach(Player, i) // Posiзгo 2є { if(IsPlayerConnected(i)) { if(DataSource[i] > MaxData[2] && DataSource[i] <= MaxData[1] && MaxDataID[1] != i && OnTheRank[i] == false) { MaxData[2] = DataSource[i]; MaxDataID[2] = i; } } } if(MaxDataID[2] != -1) OnTheRank[MaxDataID[2]] = true; foreach(Player, i) // Posiзгo 3є { if(IsPlayerConnected(i)) { if(DataSource[i] > MaxData[3] && DataSource[i] <= MaxData[2] && MaxDataID[2] != i && OnTheRank[i] == false) { MaxData[3] = DataSource[i]; MaxDataID[3] = i; } } } if(MaxDataID[3] != -1) OnTheRank[MaxDataID[3]] = true; foreach(Player, i)// Posiзгo 4є { if(IsPlayerConnected(i)) { if(DataSource[i] > MaxData[4] && DataSource[i] <= MaxData[3] && MaxDataID[3] != i && OnTheRank[i] == false) { MaxData[4] = DataSource[i]; MaxDataID[4] = i; } } } if(MaxDataID[4] != -1) OnTheRank[MaxDataID[4]] = true; foreach(Player, i) // Posiзгo 5є { if(IsPlayerConnected(i)) { if(DataSource[i] > MaxData[5] && DataSource[i] <= MaxData[4] && MaxDataID[4] != i && OnTheRank[i] == false) { MaxData[5] = DataSource[i]; MaxDataID[5] = i; } } } if(MaxDataID[5] != -1) OnTheRank[MaxDataID[5]] = true; foreach(Player, i) // Posiзгo 6є { if(IsPlayerConnected(i)) { if(DataSource[i] > MaxData[6] && DataSource[i] <= MaxData[5] && MaxDataID[5] != i && OnTheRank[i] == false) { MaxData[6] = DataSource[i]; MaxDataID[6] = i; } } } if(MaxDataID[6] != -1) OnTheRank[MaxDataID[6]] = true; foreach(Player, i) // Posiзгo 7є { if(IsPlayerConnected(i)) { if(DataSource[i] > MaxData[7] && DataSource[i] <= MaxData[6] && MaxDataID[6] != i && OnTheRank[i] == false) { MaxData[7] = DataSource[i]; MaxDataID[7] = i; } } } if(MaxDataID[7] != -1) OnTheRank[MaxDataID[7]] = true; foreach(Player, i) // Posiзгo 8є { if(IsPlayerConnected(i)) { if(DataSource[i] > MaxData[8] && DataSource[i] <= MaxData[7] && MaxDataID[7] != i && OnTheRank[i] == false) { MaxData[8] = DataSource[i]; MaxDataID[8] = i; } } } if(MaxDataID[8] != -1) OnTheRank[MaxDataID[8]] = true; foreach(Player, i) // Posiзгo 9є { if(IsPlayerConnected(i)) { if(DataSource[i] > MaxData[9] && DataSource[i] <= MaxData[8] && MaxDataID[8] != i && OnTheRank[i] == false) { MaxData[9] = DataSource[i]; MaxDataID[9] = i; } } } if(MaxDataID[9] != -1) OnTheRank[MaxDataID[9]] = true; foreach(Player, i) // Posiзгo 10є { if(IsPlayerConnected(i)) { if(DataSource[i] > MaxData[10] && DataSource[i] <= MaxData[9] && MaxDataID[9] != i && OnTheRank[i] == false) { MaxData[10] = DataSource[i]; MaxDataID[10] = i; } } } if(MaxDataID[10] != -1) OnTheRank[MaxDataID[10]] = true; foreach(Player, i) // Posiзгo 10є { if(IsPlayerConnected(i)) { if(DataSource[i] > MaxData[11] && DataSource[i] <= MaxData[10] && MaxDataID[10] != i && OnTheRank[i] == false) { MaxData[11] = DataSource[i]; MaxDataID[11] = i; } } } if(MaxDataID[11] != -1) OnTheRank[MaxDataID[11]] = true; foreach(Player, i) // Posiзгo 10є { if(IsPlayerConnected(i)) { if(DataSource[i] > MaxData[12] && DataSource[i] <= MaxData[11] && MaxDataID[11] != i && OnTheRank[i] == false) { MaxData[11] = DataSource[i]; MaxDataID[11] = i; } } } if(MaxDataID[12] != -1) OnTheRank[MaxDataID[13]] = true; for(new i; i < 13; i++) { if(MaxDataID[i] != -1) { new Name[MAX_PLAYER_NAME]; GetPlayerName(MaxDataID[i], Name, sizeof(Name)); format(Ranking, sizeof(Ranking), "%s~n~ ~w~ %s (%i/%i) %i", Ranking,Name,MaxData[i],gMaxCheckpoints,i); } } format(DialogString, sizeof(DialogString), "%s~n~~n~",Ranking); ConverterTexto(DialogString); return 1;}