CheckPoint -
matheusspohr - 02.10.2015
Olб a todos, gostaria de pedir a ajuda de vocкs para fazer tipo uma rota com checkpoint's, Jб estou com as coordenadas dos CheckPoint's, gostaria de saber qual a funзгo que devo utilizar, e como fazer, se possнvel postar uma base com 3 CheckPoint's jб me ajuda bastante.
CheckPoint's:
PHP код:
{"CheckPoint01", -2045.86, -93.80, 34.89}, // ID = 0
{"CheckPoint02", -2016.70, -58.35, 35.04}, // ID = 0
{"CheckPoint03", -2006.94, 37.36, 32.45}, // ID = 0
{"CheckPoint04", -2005.71, 170.62, 27.26}, // ID = 0
{"CheckPoint05", -2003.12, 317.07, 34.74}, // ID = 0
{"CheckPoint06", -2103.12, 320.65, 34.70}, // ID = 0
{"CheckPoint07", -2265.43, 321.33, 35.20}, // ID = 0
{"CheckPoint08", -2390.33, 265.56, 29.53}, // ID = 0
{"CheckPoint09", -2577.12, 157.84, 3.90}, // ID = 0
{"CheckPoint10", -2706.26, 157.05, 3.99}, // ID = 0
{"CheckPoint11", -2706.28, 283.73, 4.00}, // ID = 0
{"CheckPoint12", -2712.87, 336.25, 3.88}, // ID = 0
{"CheckPoint13", -2749.15, 378.94, 3.85}, // ID = 0
{"CheckPoint14", -2712.39, 415.96, 3.86}, // ID = 0
{"CheckPoint15", -2727.24, 514.38, 8.80}, // ID = 0
{"CheckPoint16", -2729.97, 565.50, 14.12}, // ID = 0
{"CheckPoint17", -2613.63, 564.38, 14.18}, // ID = 0
{"CheckPoint18", -2604.98, 707.94, 27.50}, // ID = 0
{"CheckPoint19", -2476.38, 707.19, 34.69}, // ID = 0
{"CheckPoint20", -2385.00, 720.69, 34.74}, // ID = 0
{"CheckPoint21", -2310.69, 725.09, 49.18}, // ID = 0
{"CheckPoint22", -2257.23, 729.59, 49.02}, // ID = 0
{"CheckPoint23", -2148.45, 730.72, 69.14}, // ID = 0
{"CheckPoint24", -2144.08, 646.81, 51.99}, // ID = 0
{"CheckPoint25", -2142.34, 537.32, 34.74}, // ID = 0
{"CheckPoint26", -2145.77, 225.48, 34.89}, // ID = 0
{"CheckPoint27", -2145.55, 218.64, 34.90}, // ID = 0
{"CheckPoint28", -2158.27, 101.43, 34.89}, // ID = 0
{"CheckPoint29", -2167.45, -64.22, 34.90}, // ID = 0
{"CheckPoint30", -2047.51, -89.04, 34.89}, // ID = 0
Agradeзo desde jб, Obrigado.
Abraзos.
Re: CheckPoint -
garotin - 02.10.2015
Matheusspohr nunca fiz rota com checkpoints nгo, mas se nn me engano tem haver com isso aqui...
https://sampwiki.blast.hk/wiki/SetPlayerRaceCheckpoint
Cria o checkpoint com uma seta dentro apontando para a direзгo do prуximo checkpoint..
Qualquer coisa me avisa se precisar de ajuda
Re: CheckPoint -
matheusspohr - 03.10.2015
Bom, fiz assim atй agora, oque estб errado, oque estб certo, oque tenho que mudar galera?
PHP код:
if(dialogid==xXx)
{
if(response)
{
SetPlayerRaceCheckpoint(playerid, 0, -2042.54, -72.55, 34.89, -2042.54,-72.55,34.89, 3);//Primeiro CP apontado para o segundo CP
SetTimerEx("NoCP", 500, true, "i", playerid);
}
}
forward NoCP(playerid);
public NoCP(playerid)
{
if(IsPlayerInRangeOfPoint(playerid, 3, -2042.54,-72.55,34.89))//Se o jogador ta no primeiro CP:
{
SetPlayerRaceCheckpoint(playerid, 0, -2003.62, -40.15, 34.88, -2006.37, 25.15, 32.54, 3);//mostrar o segundo CP, apontando para o ъltimo
}
if(IsPlayerInRangeOfPoint(playerid, 3, -2003.62, -40.15, 34.88))//se o jogador ta no segundo CP:
{
SetPlayerCheckpoint(playerid, -2048.89, -89.01, 34.89, 3);//Cria o ъltimo CheckPoint
}
if(IsPlayerInRangeOfPoint(playerid, 3, -2048.89, -89.01, 34.89)//Se o jogador ta no ъltimo CP:
{
SendClientMessage(playerid, -1, "Vocк chegou ao seu destino");//Envia uma msg pra dizer que acabou
DisablePlayerCheckpoint(playerid);//Desabilita o CP
}
return 1;
}
Bom, foi isso que eu fiz, acho que nгo devo utilizar o SetTimerEx ali, mas nгo consegui pensar em outro modo, alguйm tem ideia de como fazer?, Se puder ajudar fico imensamente grato.
Abraзos.
Re: CheckPoint -
99fe3rnando - 03.10.2015
Ao invйs do timer porque nгo usa
OnPlayerEnterRaceCheckpoint
Re: CheckPoint -
#Luca[S]. - 04.10.2015
Como o 99fe3rnando disse, eu faria usando a public OnPlayerEnterRaceCheckpoint.
Faria desta maneira:
PHP код:
new PlayerInCheck[MAX_PLAYERS];
if(dialogid==xXx)
{
if(response)
{
SetPlayerRaceCheckpoint(playerid, 0, -2042.54, -72.55, 34.89, -2042.54,-72.55,34.89, 3);//Primeiro CP apontado para o segundo CP
PlayerInCheck[playerid] = 1;
}
}
public OnPlayerEnterRaceCheckpoint(playerid)
{
if(PlayerInCheck[playerid] == 1)
{
//Funзгo para o prуx. checkpoint.
PlayerInCheck[playerid]++; //Prуx. Checkpoint.
}
if(PlayerInCheck[playerid] == 2)
{
//Funзгo para o prуx. Checkpoint.
PlayerInCheck[playerid]++; //Prуx. Checkpoint.
}
return 1;
}
Re: CheckPoint -
matheusspohr - 04.10.2015
Bom, como vocк disse Lucas, fiz isto, mas, estб com problema, Para garantir que havia acabado os CheckPoints, no ъltimo eu adicionei uma mensagem, porйm, quando eu entro no primeiro CheckPoint, ele jб me retorna a mensagem e e nгo mostra mais nenhum CheckPoint.
Cуdigo(apenas uma parte, pois completo й meio grande):
PHP код:
if(dialogid==xXx)
{
if(response)
{
SetPlayerRaceCheckpoint(playerid, 0, -2042.54, -72.55, 34.89, -2042.54,-72.55,34.89, 3);//Cria o CheckPoint 01
APlayerData[playerid][InCP]=1;
}
}
//public OnPlayerEnterRaceCheckpoint:
if(APlayerData[playerid][InCP] == 1)//Verifica se й 1
{//Caso for:
SetPlayerRaceCheckpoint(playerid, 0, -2003.62, -40.15, 34.88, -2006.37, 25.15, 32.54, 3);//Cria o CheckPoint 02
APlayerData[playerid][InCP]++;//Adiciona 1
}
if(APlayerData[playerid][InCP]==2)
{
SetPlayerRaceCheckpoint(playerid, 0, -2006.37, 25.15, 32.54, -2085.26, 32.81, 34.89, 3);//Cria o CheckPoint 03
APlayerData[playerid][InCP]++;
}
//[...]//(todos os outros)
//ъltimo:
if(APlayerData[playerid][InCP]==24)
{
DisablePlayerRaceCheckpoint(playerid);
SendClientMessage(playerid, -1, "Pronto!");
APlayerData[playerid][InCP]=0;
}
Re: CheckPoint -
#Luca[S]. - 04.10.2015
Olб, matheusspohr.
Adicione o
return false; em cada
if.
PHP код:
if(APlayerData[playerid][InCP] == 1)//Verifica se й 1
{//Caso for:
SetPlayerRaceCheckpoint(playerid, 0, -2003.62, -40.15, 34.88, -2006.37, 25.15, 32.54, 3);//Cria o CheckPoint 02
APlayerData[playerid][InCP]++;//Adiciona 1
return false; // Adicione isto.
}
Se o caso for solucionado, lhe peзo que avise-me.
Re: CheckPoint -
matheusspohr - 04.10.2015
Wow, valeu
#Luca[S]. estб funcionando perfeitamente, agora vou arrumar um checkpoint que estб apontando para o lado errado, mas o resto estб tudo certo, obrigado a todos.