SA-MP Forums Archive
[TUT] Criando Race-ChecksPoints - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [TUT] Criando Race-ChecksPoints (/showthread.php?tid=167377)



[TUT] Criando Race-ChecksPoints - ipsBruno - 12.08.2010

[TUT] Criando Race-ChecksPoints
Primeiramente Criamos uma 2 Arrays onde uma armazenarб todas coordenadas e a outra armazenara o nъmero do check do Player.

Topo GameMode:
pawn Код:
new ValorCheck[MAX_PLAYERS];
new Float:Check[3][3] =
{
    {1812.910522, -2072.539551, 14.226851},//Vнrgula atй o Penъltimo indicando mais Coordenadas
    {1679.7358,-2279.6406,13.5262}//Ъltima Coordenada sem Virgula
};
EXPLICAЗГO:
[3][3]
3 = Numero de Valores na Coordenadas (Separados por '.')
3 = Nъmeros de Coordenadas Totais (Adicionando uma a Mais Se for 2 Fica 3)
new Float: = Colocamos Float: pois dentro da Array Abrigamos nъmeros
new ValorCheck[MAX_PLAYERS] Criamos essa Array para armazenar o Check Point do Player que futuramente usaremos juntamente com 'Case', a constante MAX_PLAYERS que representa o valor 500 й para podermos usar com todos players,sendo ValorCheck[id_do_player]

Logo ao Final do Game Mode usaremos a public abaixo,claro que se ela ja estiver definida em seu Game Mode por favor exclua ou coloque a respectiva funзгo abrigada nesta abaixo:
pawn Код:
public OnPlayerEnterRaceCheckpoint(playerid)
{
    ValorCheck[playerid]++;    
    switch(ValorCheck[playerid])    
    {
        case 1:
        {
              DisablePlayerRaceCheckpoint(playerid);//Desabilita Check
              SetPlayerRaceCheckpoint(playerid,1,Check[1][0], Check[1][1], Check[1][2], Checkpoints[2][0], Check[2][1], Check[2][2], 10);//Mostra Check
              return 1;
         }
         case 2:
         {
              DisablePlayerRaceCheckpoint(playerid);
              SendClientMessage(playerid,0xDEEE20FF, "Vocк Venceu a Corrida");
              ValorCheck[playerid] = 0;//Reseta Variбvel para nova corrida
              return 1;
         }
    }  
    return 1;
}
EXPLICAЗГO:
++ = Colocamos Esse '++' para indicar que cada vez que o player passar ao Check Point de Race ele seja aumenta assim respectivamente mostrando o prуximo Check Point usando Case (Lуgica)
switch = Indica que faremos uma Seзгo de 'Cases',Isto й, podemos substituir por 'if(ValorCheck[playerid] == Caso)'
Quote:

Check[1][0] = Coordenada 1,Valor Numero 1
Check[1][1] = Coordenada 1,Valor Numero 2
Check[1][2] = Coordenada 1,Valor Numero 3
Check[2][0] = Coordenada 2,Valor Numero 1
Check[2][1] = Coordenada 2,Valor Numero 2
Check[2][2] = Coordenada 2,Valor Numero 3

EXPLICAЗГO DA FUNЗГO:

SetPlayerRaceCheckpoint

Й Algo simples de Se entender os argumentos dela sгo muitos simples Observe:

(playerid, TIPO, primeirocheckX, primeirocheckY,primeirocheckZ, proximocheckX, proximocheckY,proximocheckZ,tamanho)


Tutorial Criador por DraKoN

Obrigado.


Re: [TUT] Criando Race-ChecksPoints - Falcon. - 12.08.2010

Resultado =
pawn Код:
C:\Documents and Settings\Jonathan\Desktop\VirtuaLife.pwn(1010) : error 001: expected token: ":", but found ";"
C:\Documents and Settings\Jonathan\Desktop\VirtuaLife.pwn(1010) : error 036: empty statement
C:\Documents and Settings\Jonathan\Desktop\VirtuaLife.pwn(1014) : error 017: undefined symbol "Check"
C:\Documents and Settings\Jonathan\Desktop\VirtuaLife.pwn(1014) : warning 215: expression has no effect
C:\Documents and Settings\Jonathan\Desktop\VirtuaLife.pwn(1014) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\Jonathan\Desktop\VirtuaLife.pwn(1014) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Jonathan\Desktop\VirtuaLife.pwn(1014) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


6 Errors.
Linha
pawn Код:
1010:         case 1;
1014: SetPlayerRaceCheckpoint(playerid,1,Check[1][1], Check[1][2], Check[1][3], Checkpoints[2][1], Check[2][2], Check[2][3], 10);//Mostra Check
Minha public inteira esta assim
pawn Код:
public OnPlayerEnterRaceCheckpoint(playerid)
{
    ValorCheck[playerid]++;
    switch(ValorCheck[playerid])
    {
        case 1;
        {
              DisablePlayerRaceCheckpoint(playerid);//Desabilita Check
              SendClientMessage(playerid,COR_LARANJA,"Espera Concluida, Siga para o proximo ponto");
              SetPlayerRaceCheckpoint(playerid,1,Check[1][1], Check[1][2], Check[1][3], Checkpoints[2][1], Check[2][2], Check[2][3], 10);//Mostra Check
              return 1;
         }
         case 2;
         {
              DisablePlayerRaceCheckpoint(playerid);
              SendClientMessage(playerid,0xDEEE20FF, "Vocк Venceu a Corrida");
              ValorCheck[playerid] = 0;//Reseta Variбvel para nova corrida
              return 1;
         }
    }
    return 1;
}
rsrssrsr...RaceCheckpoint nгo й a mina maior habilidade em pawno


Re: [TUT] Criando Race-ChecksPoints - zSuYaNw - 12.08.2010

Mais DraKoN, Nгo й ?
pawn Код:
SetPlayerRaceCheckpoint(playerid,1,Check[1][0], Check[1][1], Check[1][2], Checkpoints[2][0], Check[2][1], Check[2][2], 10);//Mostra Check

Porque ele conta do ' 0 '.


Re: [TUT] Criando Race-ChecksPoints - Falcon. - 12.08.2010

Coloquei desta forma Garfiled , mas continuo com os mesmos erros !!


Re: [TUT] Criando Race-ChecksPoints - zSuYaNw - 12.08.2010

nгo й :
pawn Код:
case 2;
e sim
pawn Код:
case 2://aqui й DOIS PONTOS



Re: [TUT] Criando Race-ChecksPoints - Falcon. - 12.08.2010

pawn Код:
C:\Documents and Settings\Jonathan\Desktop\VirtuaLife.pwn(1013) : error 017: undefined symbol "Check"
C:\Documents and Settings\Jonathan\Desktop\VirtuaLife.pwn(1013) : warning 215: expression has no effect
C:\Documents and Settings\Jonathan\Desktop\VirtuaLife.pwn(1013) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\Jonathan\Desktop\VirtuaLife.pwn(1013) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Jonathan\Desktop\VirtuaLife.pwn(1013) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
Linha
pawn Код:
SetPlayerRaceCheckpoint(playerid,1,Check[1][0], Check[1][1], Check[1][2], Checkpoints[2][0], Check[2][1], Check[2][2], 10);//Mostra Check



Re: [TUT] Criando Race-ChecksPoints - Falcon. - 12.08.2010

pawn Код:
C:\Documents and Settings\Jonathan\Desktop\VirtuaLife.pwn(1013) : error 017: undefined symbol "Check"
C:\Documents and Settings\Jonathan\Desktop\VirtuaLife.pwn(1013) : warning 215: expression has no effect
C:\Documents and Settings\Jonathan\Desktop\VirtuaLife.pwn(1013) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\Jonathan\Desktop\VirtuaLife.pwn(1013) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Jonathan\Desktop\VirtuaLife.pwn(1013) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
Linha
pawn Код:
SetPlayerRaceCheckpoint(playerid,1,Check[1][0], Check[1][1], Check[1][2], Checkpoints[2][0], Check[2][1], Check[2][2], 10);//Mostra Check



Re: [TUT] Criando Race-ChecksPoints - ipsBruno - 12.08.2010

@Falcon
Desculpa o Erro nгo vi o momento que errei,ja arrumei,pode tentar novamente

@Garfield
Nгo й isso..


Re: [TUT] Criando Race-ChecksPoints - Falcon. - 12.08.2010

Quote:

@Falcon
Desculpa o Erro nгo vi o momento que errei,ja arrumei,pode tentar novamente

que isso cara todo mundo erra..

depois da sua atualizaзгo ta dando isso:
Quote:

C:\Documents and Settings\Jonathan\Desktop\VirtuaLife.pwn(71) : error 052: multi-dimensional arrays must be fully initialized
C:\Documents and Settings\Jonathan\Desktop\VirtuaLife.pwn(1012) : warning 213: tag mismatch
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.

LINHA
pawn Код:
1012: SetPlayerRaceCheckpoint(playerid,1,Check[1][0], Check[1][1], Check[1][2], Checkpoints[2][0], Check[2][1], Check[2][2], 10);//Mostra Check
71: };
Eu fiz double post ali em cima mesmo ou й imprenssao minha ..se fiz Roam Apaga por favor..nao fiz por querer..agora que fui notar


Re: [TUT] Criando Race-ChecksPoints - zSuYaNw - 12.08.2010

pawn Код:
SetPlayerRaceCheckpoint(playerid,1,Check[1][0], Check[1][1], Check[1][2], Check[2][0], Check[2][1], Check[2][2], 10);//Mostra Check
 }