SA-MP Forums Archive
Necesito ayuda - 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: Español/Spanish (https://sampforum.blast.hk/forumdisplay.php?fid=29)
+---- Thread: Necesito ayuda (/showthread.php?tid=260232)



Necesito ayuda - EduGTA - 07.06.2011

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?



Re: Necesito ayuda - Mr.GeEk - 07.06.2011

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
}



Re: Necesito ayuda - EduGTA - 08.06.2011

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


Re: Necesito ayuda - arturo clark - 08.06.2011

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н.


Re: Necesito ayuda - EduGTA - 08.06.2011

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....



Re: Necesito ayuda - arturo clark - 08.06.2011

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;
}



Respuesta: Re: Necesito ayuda - Daniel-92 - 08.06.2011

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;
    }



Re: Respuesta: Re: Necesito ayuda - EduGTA - 08.06.2011

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.


Respuesta: Necesito ayuda - Lunnatiicz - 08.06.2011

Habilita la variable que esta comentada


Respuesta: Re: Respuesta: Re: Necesito ayuda - Daniel-92 - 09.06.2011

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;
    }