SA-MP Forums Archive
Why this function it's not working? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Why this function it's not working? (/showthread.php?tid=591850)



Why this function it's not working? - nGen.SoNNy - 17.10.2015

When i use it for the first time it's working but when i'm reaching the destination this script will not set the next checkpoint...

pawn Код:
stock SelectNextAirport( playerid )
{
    if( IsPlayerInRangeOfPoint( playerid, 500.0, 1931.3154, -2428.1130, 13.7668 ) ) // Los Santos
    {
        DisablePlayerCheckpoint( playerid );
        switch( random( 3 ) )
        {
            case 0: SetPlayerCheckpointGPS( playerid, "LV Airport", 1322.7965, 1338.9646, 10.9210 ); // LV
            case 1: SetPlayerCheckpointGPS( playerid, "SF Airport", -1335.5999, -221.0418, 14.1484 ); // SF
            case 2: SetPlayerCheckpointGPS( playerid, "AA Airport", 414.7618, 2508.5496, 16.4844 ); // AA
        }
    }
    else if( IsPlayerInRangeOfPoint( playerid, 500.0, -1335.5999, -221.0418, 14.1484 ) ) // Las Ventura
    {
        DisablePlayerCheckpoint( playerid );
        switch( random( 3 ) )
        {
            case 0: SetPlayerCheckpointGPS( playerid, "LS Airport", 1931.3154, -2428.1130, 13.7668 ); // LS
            case 1: SetPlayerCheckpointGPS( playerid, "SF Airport", -1335.5999, -221.0418,14.1484 ); // SF
            case 2: SetPlayerCheckpointGPS( playerid, "AA Airport", 414.7618, 2508.5496, 16.4844 ); // AA
        }
    }
    else if( IsPlayerInRangeOfPoint( playerid, 500.0, 414.7618, 2508.5496, 16.4844 ) ) // San Fierro
    {
        DisablePlayerCheckpoint( playerid );
        switch( random( 3 ) )
        {
            case 0: SetPlayerCheckpointGPS( playerid, "LS Airport", 1931.3154, -2428.1130, 13.7668 ); // LS
            case 1: SetPlayerCheckpointGPS( playerid, "LV Airport", 1322.7965, 1338.9646, 10.9210 ); // LV
            case 2: SetPlayerCheckpointGPS( playerid, "AA Airport", 414.7618, 2508.5496, 16.4844 ); // AA
        }
    }
    else if( IsPlayerInRangeOfPoint( playerid, 500.0, 1322.7965, 1338.9646, 10.9210 ) ) // Abandoned
    {
        DisablePlayerCheckpoint( playerid );
        switch( random( 3 ) )
        {
            case 0: SetPlayerCheckpointGPS( playerid, "LS Airport", 1931.3154, -2428.1130, 13.7668 ); // LS
            case 1: SetPlayerCheckpointGPS( playerid, "LV Airport", 1322.7965, 1338.9646, 10.9210 ); // LV
            case 2: SetPlayerCheckpointGPS( playerid, "SF Airport", -1335.5999, -221.0418, 14.1484 ); // SF
        }
    }
    playerVariables[ playerid ][ pCheckpoint ] = 3001;
}



Re: Why this function it's not working? - nGen.SoNNy - 18.10.2015

BUMP?


Re: Why this function it's not working? - Kevln - 18.10.2015

Does "SetPlayerCheckpointGPS()" set a race checkpoint?

If so, use "DisablePlayerRaceCheckpoint(playerid);" instead of "DisablePlayerCheckpoint(playerid);".


Re: Why this function it's not working? - nGen.SoNNy - 19.10.2015

pawn Код:
stock SetPlayerCheckpointGPS( playerid, gpsName[ ], Float:gpsX, Float:gpsY, Float:gpsZ )
{
    GpsLocation( playerid, gpsName, gpsX, gpsY, gpsZ );
    SetPlayerCheckpoint( playerid, gpsX, gpsY, gpsZ, 20.0 );
}
If so.. should i use the RaceCheckpoint instead of playercheckpoint because i'm using it with a plane.


Re: Why this function it's not working? - Sew_Sumi - 19.10.2015

Quote:
Originally Posted by nGen.SoNNy
Посмотреть сообщение
If so.. should i use the RaceCheckpoint instead of playercheckpoint because i'm using it with a plane.
Probably. You could however use race checkpoints also to make them approach on the right angles. Very interesting idea you have there, and could work out nicely.


Re: Why this function it's not working? - nGen.SoNNy - 19.10.2015

I changed few things and i'm using now PlayerRaceCheckpoints and everything it's ok thx guys for help