public OnPlayerSpawn(playerid)
{
SetPlayerCheckpoint(playerid,1951.7402,-1781.0177,13.8347,1.0);
DisablePlayerCheckpoint(playerid);
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
MoveObject(puerta1,1951.6599121094, -1797.134, 14.057502746582, 5);
SetPlayerCheckpoint(playerid,1952.4869,-1782.9430,13.3828);
return 1;
}
new checkpoint1 = SetPlayerCheckpoint(playerid,1951.7402,-1781.0177,13.8347,1.0);
public OnPlayerEnterCheckpoint(playerid)
{
aqui puedes usar if o switcht para preguntar que checkpoint es
}
|
usa variables para los checkpoint,
pawn Код:
|
new checkpoint1[MAX_PLAYERS];
new checkpoint2[MAX_PLAYERS];
new checkpoint3[MAX_PLAYERS];
//Aquн agrega mas si quieres
public OnPlayerSpawn(playerid)
{
DisablePlayerCheckpoint(playerid);
checkpoint1[playerid] = SetPlayerCheckpoint(playerid, 1951.7402, -1781.0177, 13.8347,1.0);
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
if(checkpoint1[playerid]) //Si el jugador esta en el checkpoint 1:
{
DisablePlayerCheckpoint(playerid);
checkpoint2[playerid] = SetPlayerCheckpoint(playerid, PosiciуnX, PosiciуnY, PosiciуnZ,1.0);
MoveObject(puerta1,1951.6599121094, -1797.134, 14.057502746582, 5);
SetPlayerCheckpoint(playerid,1952.4869,-1782.9430,13.3828);
}
else if(checkpoint2[playerid]) //Si el jugador esta en el checkpoint 2:
{
DisablePlayerCheckpoint(playerid);
checkpoint3[playerid] = SetPlayerCheckpoint(playerid, PosiciуnX, PosiciуnY, PosiciуnZ,1.0);
MoveObject(puerta1,1951.6599121094, -1797.134, 14.057502746582, 5);
SetPlayerCheckpoint(playerid,1952.4869,-1782.9430,13.3828);
}
//Y asн sucesivamente vas poniendo mas
return 1;
}
|
pawn Код:
|
public OnPlayerSpawn(playerid)
{
DisablePlayerCheckpoint(playerid);
c1 = SetPlayerCheckpoint(playerid, 1951.7402, -1781.0177, 13.8347,1.0);
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
if(c1)
{
DisablePlayerCheckpoint(playerid);
c2 = SetPlayerCheckpoint(playerid, 1952.4869,-1782.9430,13.3828,1.0);
MoveObject(puerta1,1951.6599121094, -1797.134, 14.057502746582, 5);
SetPlayerCheckpoint(playerid,1952.4869,-1782.9430,13.3828, 1.0);
}
else if(c2)
{
DisablePlayerCheckpoint(playerid);
MoveObject(puerta1,1951.6599121094, -1788.134, 14.057502746582, 5);
c1 = SetPlayerCheckpoint(playerid,1952.4869,-1782.9430,13.3828, 1.0);
SetPlayerCheckpoint(playerid,1952.4869,-1782.9430,13.3828, 1.0);
}
return 1;
}
new c1[MAX_PLAYERS];
new c2[MAX_PLAYERS];
public OnPlayerEnterCheckpoint(playerid)
{
if(c1[playerid])
{
DisablePlayerCheckpoint(playerid);
c2[playerid] = SetPlayerCheckpoint(playerid, 1952.4869,-1782.9430,13.3828,1.0);
MoveObject(puerta1,1951.6599121094, -1797.134, 14.057502746582, 5);
SetPlayerCheckpoint(playerid,1952.4869,-1782.9430,13.3828, 1.0);
}
else if(c2[playerid])
{
DisablePlayerCheckpoint(playerid);
MoveObject(puerta1,1951.6599121094, -1788.134, 14.057502746582, 5);
c1[playerid] = SetPlayerCheckpoint(playerid,1952.4869,-1782.9430,13.3828, 1.0);
SetPlayerCheckpoint(playerid,1952.4869,-1782.9430,13.3828, 1.0);
}
return 1;
}
|
Tienes que hacerlo como yo te dije:
pawn Код:
|
new CheckPoint[MAX_PLAYERS]; //Variable global
public OnPlayerSpawn(playerid)
{
DisablePlayerCheckpoint(playerid);
SetPlayerCheckpoint(playerid, 1951.7402, -1781.0177, 13.8347,1.0);
CheckPoint[playerid] = 1;
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
switch(CheckPoint[playerid])
{
case 1: {
DisablePlayerCheckpoint(playerid);
SetPlayerCheckpoint(playerid, 1952.4869,-1782.9430,13.3828,1.0);
MoveObject(puerta1,1951.6599121094, -1797.134, 14.057502746582, 5);
SetPlayerCheckpoint(playerid,1952.4869,-1782.9430,13.3828, 1.0);
CheckPoint[playerid] = 2;
}
case 2: {
DisablePlayerCheckpoint(playerid);
MoveObject(puerta1,1951.6599121094, -1788.134, 14.057502746582, 5);
SetPlayerCheckpoint(playerid,1952.4869,-1782.9430,13.3828, 1.0);
SetPlayerCheckpoint(playerid,1952.4869,-1782.9430,13.3828, 1.0);
//CheckPoint[playerid] = 3;
CheckPoint[playerid] = 1;
}
}
return 0;
}
|
eso no causaria ningun efecto porque la funcion SetPlayerCheckpoint no retorna nada en especifico (si fuera un objeto estaria bien pero en este caso no funciona por que siempre c2[playerid] tomaria el valor 0).
Esta es una forma para hacer lo que quieres. pawn Код:
|
|
Hasta el 2є Checkpoint me sirve, pero el checkpoint 2 se queda y hace las 2 acciones, cierra y abre.
|
public OnPlayerSpawn(playerid)
{
SetPlayerCheckpoint(playerid, 1951.7402, -1781.0177, 13.8347,1.0);
CheckPoint[playerid] = 1;
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
switch(CheckPoint[playerid])
{
case 1: {
MoveObject(puerta1,1951.6599121094, -1797.134, 14.057502746582, 5);
SetPlayerCheckpoint(playerid,1952.4869,-1782.9430,13.3828, 1.0);
CheckPoint[playerid] = 2;
}
case 2: {
//ESTAS COORDENADAS DEBES CAMBIARLAS POR QUE MOVERAN LA PUERTA AL MISMO SITIO
MoveObject(puerta1,1951.6599121094, -1788.134, 14.057502746582, 5);
//LAS COORDENADAS LAS TOME DE ONPLAYERSPAWN (ESTO ES LO QUE HACIA CREAR EL CP EN EL MISMO LUGAR)
SetPlayerCheckpoint(playerid, 1951.7402, -1781.0177, 13.8347,1.0);
CheckPoint[playerid] = 1;
}
}
return 0;
}