[Ajuda] Funзгo "SetPlayerRaceCheckpoint"
#1

Estou com dificuldades de entender a funзгo "SetPlayerRaceCheckpoint", estou procurando tutoriais brasileiros, e sу encontro na layer americana, mas nгo entendo.
Fiz da seguinte maneira:

PHP код:
CMD:iniciar(playerid)
{
    for(new 
0MAX_PLAYERSi++)
    {
        if(
IsPlayerConnected(i))
        {
            if(
pode[i] == 1)
            {
                
format(kksizeof(kk), "{00BFFF}[RACE SYSTEM] {FFFFFF}- O Administrador %s iniciou a corrida!"nome(playerid));
                
SetPlayerRaceCheckpoint(playerid01303.5809, -2057.358657.92391366.3331, -2052.776455.79474);
                
SendClientMessageToAll(-1kk);
                
GameTextForAll(kk20004);
            }
        }
    }
    return 
1;

Entгo, como faзo pra prosseguir os pontos?
Tentei fazer dessa forma:

PHP код:
public OnPlayerEnterRaceCheckpoint(playerid)
{
    
SetPlayerRaceCheckpoint(playerid01366.3331,-2052.7764,55.79471428.3735,-2016.2310,51.30064);    
    return 
1;

Foi indo tudo bem, mas quando coloco outro Checkpoint na Callback "OnPlayerEnterRaceCheckpoint", nгo vai, fica travado na primeira linha que fiz.

Me ajudem com a funзгo, pois tenho 2 dias tentando fazer isso, inclusive sem dormir!
Reply
#2

Vocк tem que destruir o checkpoint que o jogador(a) conseguiu pegar:

PHP код:
public OnPlayerEnterRaceCheckpoint(playerid)
{
    
DisablePlayerCheckpoint(playerid);
    
SetPlayerRaceCheckpoint(playerid01366.3331,-2052.7764,55.79471428.3735,-2016.2310,51.30064);
    return 
1;

Reply
#3

Quote:
Originally Posted by JoaoBorges
Посмотреть сообщение
Vocк tem que destruir o checkpoint que o jogador(a) conseguiu pegar:

PHP код:
public OnPlayerEnterRaceCheckpoint(playerid)
{
    
DisablePlayerCheckpoint(playerid);
    
SetPlayerRaceCheckpoint(playerid01366.3331,-2052.7764,55.79471428.3735,-2016.2310,51.30064);
    return 
1;

Mas se eu for destruindo todas, que ele pegar, nгo entra e conflito e desabilita tudo?
Reply
#4

Quote:
Originally Posted by fxckshzt
Посмотреть сообщение
Mas se eu for destruindo todas, que ele pegar, nгo entra e conflito e desabilita tudo?
Use arrays
Reply
#5

Quote:
Originally Posted by IlanZ
Посмотреть сообщение
Use arrays
Fiz assim
PHP код:
new ir[MAX_PLAYERS];
CMD:iniciar(playerid)
{
    for(new 
0MAX_PLAYERSi++)
    {
        if(
IsPlayerConnected(i))
        {
            if(
pode[i] == 1)
            {
                
format(kksizeof(kk), "{00BFFF}[RACE SYSTEM] {FFFFFF}- O Administrador %s iniciou a corrida!"nome(playerid));
                
SetPlayerRaceCheckpoint(playerid01303.5809, -2057.358657.92391366.3331, -2052.776455.79474);
                
SendClientMessageToAll(-1kk);
                
GameTextForAll(kk20004);
                
ir[i] = 1;
            }
        }
    }
    return 
1;
}
public 
OnPlayerEnterRaceCheckpoint(playerid)
{
    if(
ir[playerid] = 1)
    {
        
SetPlayerRaceCheckpoint(playerid01366.3331,-2052.7764,55.79471428.3735,-2016.2310,51.30064);
        
ir[playerid] = 2;
    }
    if(
ir[playerid] = 2)
    {
        
SetPlayerRaceCheckpoint(playerid01428.3736,-2016.2310,51.30061368.1945,-1966.1692,32.82604);
        
ir[playerid] = 3;
    }
    if(
ir[playerid] = 3)
    {
        
SetPlayerRaceCheckpoint(playerid01368.1945,-1966.1692,32.8260370.5504,-2012.4318,7.37624);
        
ir[playerid] = 4;
    }
    return 
1;

E Vem apresentando o aviso de que "a tarefa possivelmente nгo й intencional";
Код:
C:\Users\Dell\Desktop\org2.pwn(165) : warning 211: possibly unintended assignment
C:\Users\Dell\Desktop\org2.pwn(170) : warning 211: possibly unintended assignment
C:\Users\Dell\Desktop\org2.pwn(175) : warning 211: possibly unintended assignment
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Warnings.
Reply
#6

Quote:
Originally Posted by fxckshzt
Посмотреть сообщение
Fiz assim
PHP код:
new ir[MAX_PLAYERS];
CMD:iniciar(playerid)
{
    for(new 
0MAX_PLAYERSi++)
    {
        if(
IsPlayerConnected(i))
        {
            if(
pode[i] == 1)
            {
                
format(kksizeof(kk), "{00BFFF}[RACE SYSTEM] {FFFFFF}- O Administrador %s iniciou a corrida!"nome(playerid));
                
SetPlayerRaceCheckpoint(playerid01303.5809, -2057.358657.92391366.3331, -2052.776455.79474);
                
SendClientMessageToAll(-1kk);
                
GameTextForAll(kk20004);
                
ir[i] = 1;
            }
        }
    }
    return 
1;
}
public 
OnPlayerEnterRaceCheckpoint(playerid)
{
    if(
ir[playerid] = 1)
    {
        
SetPlayerRaceCheckpoint(playerid01366.3331,-2052.7764,55.79471428.3735,-2016.2310,51.30064);
        
ir[playerid] = 2;
    }
    if(
ir[playerid] = 2)
    {
        
SetPlayerRaceCheckpoint(playerid01428.3736,-2016.2310,51.30061368.1945,-1966.1692,32.82604);
        
ir[playerid] = 3;
    }
    if(
ir[playerid] = 3)
    {
        
SetPlayerRaceCheckpoint(playerid01368.1945,-1966.1692,32.8260370.5504,-2012.4318,7.37624);
        
ir[playerid] = 4;
    }
    return 
1;

E Vem apresentando o aviso de que "a tarefa possivelmente nгo й intencional";
Код:
C:\Users\Dell\Desktop\org2.pwn(165) : warning 211: possibly unintended assignment
C:\Users\Dell\Desktop\org2.pwn(170) : warning 211: possibly unintended assignment
C:\Users\Dell\Desktop\org2.pwn(175) : warning 211: possibly unintended assignment
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Warnings.
if(ir[playerid] = 1) mude para if(ir[playerid] == 1) e faзa o mesmo com as outras condiзхes.
Reply
#7

UP!
Comando nгo funcionou como o esperado!
Quando eu chego no ponto, simplesmente desabilita tudo.
Como estб a funзгo:
PHP код:
public OnPlayerEnterRaceCheckpoint(playerid)
{
    if(
ir[playerid] == 1)
    {
        
SetPlayerRaceCheckpoint(playerid01366.3331,-2052.7764,55.79471428.3735,-2016.2310,51.30064);
        
DisablePlayerRaceCheckpoint(playerid);
        
ir[playerid] = 2;
    }
    if(
ir[playerid] == 2)
    {
        
SetPlayerRaceCheckpoint(playerid01428.3736,-2016.2310,51.30061368.1945,-1966.1692,32.82604);
        
DisablePlayerRaceCheckpoint(playerid);
        
ir[playerid] = 3;
    }
    if(
ir[playerid] == 3)
    {
        
SetPlayerRaceCheckpoint(playerid01368.1945,-1966.1692,32.8260370.5504,-2012.4318,7.37624);
        
DisablePlayerRaceCheckpoint(playerid);
        
ir[playerid] = 4;
    }
    return 
1;

Reply
#8

Quote:
Originally Posted by fxckshzt
Посмотреть сообщение
UP!
Comando nгo funcionou como o esperado!
Quando eu chego no ponto, simplesmente desabilita tudo.
Como estб a funзгo:
PHP код:
public OnPlayerEnterRaceCheckpoint(playerid)
{
    if(
ir[playerid] == 1)
    {
        
SetPlayerRaceCheckpoint(playerid01366.3331,-2052.7764,55.79471428.3735,-2016.2310,51.30064);
        
DisablePlayerRaceCheckpoint(playerid);
        
ir[playerid] = 2;
    }
    if(
ir[playerid] == 2)
    {
        
SetPlayerRaceCheckpoint(playerid01428.3736,-2016.2310,51.30061368.1945,-1966.1692,32.82604);
        
DisablePlayerRaceCheckpoint(playerid);
        
ir[playerid] = 3;
    }
    if(
ir[playerid] == 3)
    {
        
SetPlayerRaceCheckpoint(playerid01368.1945,-1966.1692,32.8260370.5504,-2012.4318,7.37624);
        
DisablePlayerRaceCheckpoint(playerid);
        
ir[playerid] = 4;
    }
    return 
1;

Код:
public OnPlayerLeaveRaceCheckpoint(playerid)
{
    DisablePlayerRaceCheckpoint(playerid);
    return 1;
}
https://sampwiki.blast.hk/wiki/DisablePlayerRaceCheckpoint
Reply
#9

Quote:
Originally Posted by fxckshzt
Посмотреть сообщение
UP!
Comando nгo funcionou como o esperado!
Quando eu chego no ponto, simplesmente desabilita tudo.
Como estб a funзгo:
PHP код:
public OnPlayerEnterRaceCheckpoint(playerid)
{
    if(
ir[playerid] == 1)
    {
        
SetPlayerRaceCheckpoint(playerid01366.3331,-2052.7764,55.79471428.3735,-2016.2310,51.30064);
        
DisablePlayerRaceCheckpoint(playerid);
        
ir[playerid] = 2;
    }
    if(
ir[playerid] == 2)
    {
        
SetPlayerRaceCheckpoint(playerid01428.3736,-2016.2310,51.30061368.1945,-1966.1692,32.82604);
        
DisablePlayerRaceCheckpoint(playerid);
        
ir[playerid] = 3;
    }
    if(
ir[playerid] == 3)
    {
        
SetPlayerRaceCheckpoint(playerid01368.1945,-1966.1692,32.8260370.5504,-2012.4318,7.37624);
        
DisablePlayerRaceCheckpoint(playerid);
        
ir[playerid] = 4;
    }
    return 
1;

Usa isso!!
Код:
new ir[MAX_PLAYERS]; 
CMD:iniciar(playerid) 
{ 
    for(new i = 0; i < MAX_PLAYERS; i++) 
    { 
        if(IsPlayerConnected(i)) 
        { 
            if(pode[i] == 1) 
            { 
                format(kk, sizeof(kk), "{00BFFF}[RACE SYSTEM] {FFFFFF}- O Administrador %s iniciou a corrida!", nome(playerid)); 
                SetPlayerRaceCheckpoint(playerid, 0, 1303.5809, -2057.3586, 57.9239, 1366.3331, -2052.7764, 55.7947, 4); 
                SendClientMessageToAll(-1, kk); 
                GameTextForAll(kk, 2000, 4); 
                ir[i] = 1; 
                return 1;
            } 
        } 
    } 
    return 1; 
} 

public OnPlayerEnterRaceCheckpoint(playerid) 
{ 
    if(ir[playerid] == 1) 
    { 
        SetPlayerRaceCheckpoint(playerid, 0, 1366.3331,-2052.7764,55.7947, 1428.3735,-2016.2310,51.3006, 4); 
        ir[playerid] = 2;
        return 1; 
    } 
    if(ir[playerid] == 2) 
    { 
        SetPlayerRaceCheckpoint(playerid, 0, 1428.3736,-2016.2310,51.3006, 1368.1945,-1966.1692,32.8260, 4); 
        ir[playerid] = 3; 
        return 1; 
    } 
    if(ir[playerid] == 3) 
    { 
        SetPlayerRaceCheckpoint(playerid, 0, 1368.1945,-1966.1692,32.8260, 370.5504,-2012.4318,7.3762, 4); 
        ir[playerid] = 4; 
        return 1; 
    } 
    return 1; 
}  
public OnPlayerLeaveRaceCheckpoint(playerid)
{
    if(ir[playerid] == 1)
    {
	DisablePlayerRaceCheckpoint(playerid);
	return 1;
    }
    if(ir[playerid] == 2)
    {
	DisablePlayerRaceCheckpoint(playerid);
	return 1;
    }
    if(ir[playerid] == 3)
    {
	DisablePlayerRaceCheckpoint(playerid);
	return 1;
    }
    if(ir[playerid] == 4)
    {
	DisablePlayerRaceCheckpoint(playerid);
	return 1;
    }
    return 1;
}
Reply
#10

Quote:
Originally Posted by GustavoKarasek
Посмотреть сообщение
Usa isso!!
Код:
new ir[MAX_PLAYERS]; 
CMD:iniciar(playerid) 
{ 
    for(new i = 0; i < MAX_PLAYERS; i++) 
    { 
        if(IsPlayerConnected(i)) 
        { 
            if(pode[i] == 1) 
            { 
                format(kk, sizeof(kk), "{00BFFF}[RACE SYSTEM] {FFFFFF}- O Administrador %s iniciou a corrida!", nome(playerid)); 
                SetPlayerRaceCheckpoint(playerid, 0, 1303.5809, -2057.3586, 57.9239, 1366.3331, -2052.7764, 55.7947, 4); 
                SendClientMessageToAll(-1, kk); 
                GameTextForAll(kk, 2000, 4); 
                ir[i] = 1; 
                return 1;
            } 
        } 
    } 
    return 1; 
} 

public OnPlayerEnterRaceCheckpoint(playerid) 
{ 
    if(ir[playerid] == 1) 
    { 
        SetPlayerRaceCheckpoint(playerid, 0, 1366.3331,-2052.7764,55.7947, 1428.3735,-2016.2310,51.3006, 4); 
        ir[playerid] = 2;
        return 1; 
    } 
    if(ir[playerid] == 2) 
    { 
        SetPlayerRaceCheckpoint(playerid, 0, 1428.3736,-2016.2310,51.3006, 1368.1945,-1966.1692,32.8260, 4); 
        ir[playerid] = 3; 
        return 1; 
    } 
    if(ir[playerid] == 3) 
    { 
        SetPlayerRaceCheckpoint(playerid, 0, 1368.1945,-1966.1692,32.8260, 370.5504,-2012.4318,7.3762, 4); 
        ir[playerid] = 4; 
        return 1; 
    } 
    return 1; 
}  
public OnPlayerLeaveRaceCheckpoint(playerid)
{
    if(ir[playerid] == 1)
    {
	DisablePlayerRaceCheckpoint(playerid);
	return 1;
    }
    if(ir[playerid] == 2)
    {
	DisablePlayerRaceCheckpoint(playerid);
	return 1;
    }
    if(ir[playerid] == 3)
    {
	DisablePlayerRaceCheckpoint(playerid);
	return 1;
    }
    if(ir[playerid] == 4)
    {
	DisablePlayerRaceCheckpoint(playerid);
	return 1;
    }
    return 1;
}
Nгo funcionou.
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)