Necesito ayuda
#1

Hola! mi nombre es Edugta. Necesito ayuda con mi filterscript:

El problema es que al hacer un checkpoint y que el judar se para ahi, ese checkpoint de destruya y haga otro, pero ahi serian 2 acciones diferentes, їcomo ago?

pawn Код:
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;
}
Yo quiero que al entrar en el segundo Checkpoint, cierre la puerta, pero їcomo pongo 2 acciones diferentes en OnPlayerEnterCheckpoint, no darнa error?
Reply
#2

usa variables para los checkpoint,
pawn Код:
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
}
Reply
#3

Quote:
Originally Posted by Mr.GeEk
Посмотреть сообщение
usa variables para los checkpoint,
pawn Код:
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
}
Explicate mejor
Reply
#4

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;
}
Eso fue lo que yo entendн.
Reply
#5

Quote:
Originally Posted by arturo clark
Посмотреть сообщение
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;
}
Eso fue lo que yo entendн.
Gracias, aclaraste el 90%

Solo necesito ayuda para el 100%

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;
}
En el 2є checkpoint, al pararme en el, no hace nada....
Reply
#6

Tienes que hacerlo como yo te dije:
pawn Код:
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;
}
Reply
#7

Quote:
Originally Posted by arturo clark
Посмотреть сообщение
Tienes que hacerlo como yo te dije:
pawn Код:
c2[playerid] = SetPlayerCheckpoint(playerid, 1952.4869,-1782.9430,13.3828,1.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 Код:
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;
    }
Reply
#8

Quote:
Originally Posted by Daniel-92
Посмотреть сообщение
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 Код:
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;
    }
Hasta el 2є Checkpoint me sirve, pero el checkpoint 2 se queda y hace las 2 acciones, cierra y abre.
Reply
#9

Habilita la variable que esta comentada
Reply
#10

Quote:
Originally Posted by Edugta.
Посмотреть сообщение
Hasta el 2є Checkpoint me sirve, pero el checkpoint 2 se queda y hace las 2 acciones, cierra y abre.
en realidad el segundo checkpoint no se queda, desaparece y apacere en el mismo lugar por que las coordenadas del CP son las misma para el case 1: y el case 2: yo pensй que tъ podias cambiarlas.
pawn Код:
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;
    }
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)