SA-MP Forums

Go Back   SA-MP Forums > Non-English > Languages > Português/Portuguese

Reply
 
Thread Tools Display Modes
Old 15/06/2017, 09:43 PM   #1
GSFBart
Big Clucker
 
Join Date: Apr 2017
Location: Brazil
Posts: 94
Reputation: 6
Default Top 5 posição corrida

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 Code:
    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 Code:
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 Code:
    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 Code:
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:

http://forum.sa-mp.com/showthread.php?t=462892 (by knackworst)
http://forum.sa-mp.com/showpost.php?...2&postcount=44 (by RyDeR`)

Last edited by GSFBart; 15/06/2017 at 10:42 PM.
GSFBart is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Ajuda] Corrida Ts3 Português/Portuguese 11 01/11/2014 06:15 PM
[Pedido] Corrida 1 x 1. Ley Português/Portuguese 5 24/04/2014 06:09 AM
[Ajuda] Corrida caption Português/Portuguese 3 28/01/2014 08:12 AM
[FilterScript] [FS] Pista de Corrida! lordwallybr Lançamentos/Releases 12 05/03/2012 09:13 PM
[Filterscript] Salvar posição e para a posição salva ! .Skool_. Português/Portuguese 13 19/02/2012 12:47 PM


All times are GMT. The time now is 03:09 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.