[Ajuda] Top 5 posiзгo corrida
#1

Eu fundi dois modos de pegar a posiзгo dos jogadores em uma corrida, porйm me deparei com um problema, que й na hora de pegar o ID do jogador

PHP код:
    Foreach(iMAX_PLAYERS)
    {
        if(
EntrouRace[i] == true)
        {
            new 
RaceIndex;
            Foreach(
jMAX_PLAYERS)
            {
                if(
EntrouRace[j] == true)
                {
                    if(
!= i)
                    {
                        if(
ProgressoCP[i] < ProgressoCP[j])
                        {
                            
RaceIndex++;
                        }
                        
                        if(
ProgressoCP[i] == ProgressoCP[j])
                        {    
                            if(
GetPlayerDistanceFromPoint(iCoordenadasCP[ProgressoCP[i]][0], CoordenadasCP[ProgressoCP[i]][1], CoordenadasCP[ProgressoCP[i]][2]) > GetPlayerDistanceFromPoint(jCoordenadasCP[ProgressoCP[j]][0], CoordenadasCP[ProgressoCP[j]][1], CoordenadasCP[ProgressoCP[j]][2]))
                            {
                                
RaceIndex++;
                            }
                        }
                    }
                }
            }
            
            
RaceIndex RaceIndex 1;
            new 
ScoreText[256] = "~n~";
            for(new 
h5; ++h)
            {
                if(
RaceIndexformat(ScoreTextsizeof(ScoreText), "%s~n~~w~~h~%d| - ~y~%s"ScoreText1pNome(i));
                else 
format(ScoreTextsizeof(ScoreText), "%s~n~~w~~h~%d| - ~r~~h~Ninguem"ScoreText1);
            }
            
TextDrawSetString(TextRace[10], ScoreText);
        }
    } 
PHP код:
if(RaceIndexformat(ScoreTextsizeof(ScoreText), "%s~n~~w~~h~%d| - ~y~%s"ScoreText1pNome(i)); 
Queria saber como eu posso armazenar o ID do jogador em uma variбvel para que nгo tenha o problema de o pNome pegar o nome de todos (Foreach)

Exemplo do script do RyDeR`:

PHP код:
    new pScoreRace[MAX_PLAYERS][Enum_Race], RaceIndex;
    Foreach(
iMAX_PLAYERS)
    {
        if(
EntrouRace[i] == true)
        {
            
pScoreRace[RaceIndex][Race_PlayerScore] = ProgressoCP[i];
            
pScoreRace[RaceIndex++][Race_PlayerID] = i;
        }
    }
    
GetPlacarRace(pScoreRace0RaceIndex);
    new 
ScoreText[256] = "~n~";
    for(new 
h5; ++h)
    {
        if(
RaceIndexformat(ScoreTextsizeof(ScoreText), "%s~n~~w~~h~%d| - ~y~%s"ScoreText1pNome(pScoreRace[h][Race_PlayerID]));
        else 
format(ScoreTextsizeof(ScoreText), "%s~n~~w~~h~%d| - ~r~~h~Ninguem"ScoreText1);
    }
    
TextDrawSetString(TextRace[10], ScoreText); 
PHP код:
stock GetPlacarRace(array[][Enum_Race], leftright)
{
    new 
tempLeft lefttempRight rightpivot = array[(left right) / 2][Race_PlayerScore], tempVar;
    while(
tempLeft <= tempRight)
    {
        while(array[
tempLeft][Race_PlayerScore] > pivottempLeft++;
        while(array[
tempRight][Race_PlayerScore] < pivottempRight--;
        if(
tempLeft <= tempRight)
        {
            
tempVar = array[tempLeft][Race_PlayerScore], array[tempLeft][Race_PlayerScore] = array[tempRight][Race_PlayerScore], array[tempRight][Race_PlayerScore] = tempVar;
            
tempVar = array[tempLeft][Race_PlayerID], array[tempLeft][Race_PlayerID] = array[tempRight][Race_PlayerID], array[tempRight][Race_PlayerID] = tempVar;
            
tempLeft++, tempRight--;
        }
    }
    if(
left tempRightGetPlacarRace(array, lefttempRight);
    if(
tempLeft rightGetPlacarRace(array, tempLeftright);

Scripts usados:

https://sampforum.blast.hk/showthread.php?tid=462892 (by knackworst)
http://forum.sa-mp.com/showpost.php?...2&postcount=44 (by RyDeR`)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)