Hello, I am trying to script a new license test for my server and for some reason, Im having issues with it. The checkpoints are not disappearing when the player enters them. Here is my code:
pawn Код:
if(IsPlayerInAnyVehicle(playerid))
  {
    if(DrivingTest[playerid] == 1)
    {
      if(PlayerToPoint(5.0,playerid,95.3499,-1839.1188,-0.1401))
      {
        DrivingStep[playerid] = 2;
        SetPlayerCheckpoint(playerid, 1958.7378,-2078.0024,13.0875, 5.0);
      }
      else if(PlayerToPoint(5.0,playerid,1958.7378,-2078.0024,13.0875))
      {
        DrivingStep[playerid] = 3;
        SetPlayerCheckpoint(playerid, 2124.6372,-2116.1033,13.0379, 5.0);
      }
      else if(PlayerToPoint(5.0,playerid,2124.6372,-2116.1033,13.0379))
      {
        DrivingStep[playerid] = 4;
        SetPlayerCheckpoint(playerid, 2237.5308,-2129.1843,13.0497, 5.0);
      }
      else if(PlayerToPoint(5.0,playerid,2237.5308,-2129.1843,13.0497))
      {
        DrivingStep[playerid] = 5;
        SetPlayerCheckpoint(playerid, 2278.8250,-2087.8777,13.1134, 5.0);
      }
      else if(PlayerToPoint(5.0,playerid,2278.8250,-2087.8777,13.1134))//
      {
        DrivingStep[playerid] = 6;
        SetPlayerCheckpoint(playerid, 2220.8435,-2011.1965,13.0549, 5.0);
      }
      else if(PlayerToPoint(5.0,playerid,2220.8435,-2011.1965,13.0549))
      {
        DrivingStep[playerid] = 7;
        SetPlayerCheckpoint(playerid, 2222.1323,-1907.7750,13.0786, 5.0);
      }
      else if(PlayerToPoint(5.0,playerid,2222.1323,-1907.7750,13.0786))
      {
        DrivingStep[playerid] = 8;
        SetPlayerCheckpoint(playerid, 2095.5571,-1891.8268,13.0726, 5.0);
      }
      else if(PlayerToPoint(5.0,playerid,2095.5571,-1891.8268,13.0726))
      {
        DrivingStep[playerid] = 9;
        SetPlayerCheckpoint(playerid, 2056.0747,-1929.8429,13.0643, 5.0);
      }
      else if(PlayerToPoint(5.0,playerid,2056.0747,-1929.8429,13.0643))
      {
        new Float:health;
        new veh;
        veh = GetPlayerVehicleID(playerid);
        GetVehicleHealth(veh, health);
        if(health >= 600.0)
        {
          SendClientMessage(playerid,COLOR_GREEN,"STATUS: You kept the vehicle almost fully unharmed, Passed.");
          PlayerInfo[playerid][pCarLic] = 1;
          SetVehicleToRespawn(veh);
          DrivingTest[playerid] = 0;
          DisablePlayerCheckpoint(playerid);
        }
        else
        {
          SendClientMessage(playerid,COLOR_RED,"STATUS: You failed the test, better luck next time!");
          SetVehicleToRespawn(veh);
          DrivingTest[playerid] = 0;
          DisablePlayerCheckpoint(playerid);
        }
        DrivingStep[playerid] = 0;
      }
      return 1;
    }
  }
    if(IsPlayerInAnyVehicle(playerid))
  {
    if(SailingTest[playerid] == 1)
    {
      if(PlayerToPoint(5.0,playerid,112.0620,-1837.4271,-0.0493))
      {
        SailingStep[playerid] = 2;
        SetPlayerCheckpoint(playerid, 80.1778,-1854.0552,-0.2003, 5.0);
      }
      else if(PlayerToPoint(5.0,playerid,80.1778,-1854.0552,-0.2003))
      {
        SailingStep[playerid] = 3;
        SetPlayerCheckpoint(playerid, 93.5598,-1864.4868,-0.1559, 5.0);
      }
      else if(PlayerToPoint(5.0,playerid,93.5598,-1864.4868,-0.1559))
      {
        SailingStep[playerid] = 4;
        SetPlayerCheckpoint(playerid, 107.2377,-1861.7028,-0.1416, 5.0);
      }
      else if(PlayerToPoint(5.0,playerid,107.2377,-1861.7028,-0.1416))
      {
        SailingStep[playerid] = 5;
        SetPlayerCheckpoint(playerid,115.7098,-1863.3926,-0.1309, 5.0);
      }
      else if(PlayerToPoint(5.0,playerid,115.7098,-1863.3926,-0.1309))//
      {
        SailingStep[playerid] = 6;
        SetPlayerCheckpoint(playerid, 121.4901,-1850.9479,-0.1276, 5.0);
      }
      else if(PlayerToPoint(5.0,playerid,121.4901,-1850.9479,-0.1276))
      {
        SailingStep[playerid] = 7;
        SetPlayerCheckpoint(playerid, 117.6210,-1841.7025,-0.3721, 5.0);
      }
      else if(PlayerToPoint(5.0,playerid,117.6210,-1841.7025,-0.3721))
      {
        new Float:health;
        new veh;
        veh = GetPlayerVehicleID(playerid);
        GetVehicleHealth(veh, health);
        if(health >= 400.0)
        {
          SendClientMessage(playerid,COLOR_GREEN,"STATUS: You kept the vehicle almost fully unharmed, Passed.");
          PlayerInfo[playerid][pBoatLic] = 1;
          SetVehicleToRespawn(veh);
          SailingTest[playerid] = 0;
          DisablePlayerCheckpoint(playerid);
        }
        else
        {
          SendClientMessage(playerid,COLOR_RED,"STATUS: You failed the test, better luck next time!");
          SetVehicleToRespawn(veh);
          SailingTest[playerid] = 0;
          DisablePlayerCheckpoint(playerid);
        }
        SailingStep[playerid] = 0;
      }
      return 1;
    }
  }
Use an array of checkpoints so you don't have to resort to such bloated code.
Also, PlayerToPoint is outdated. See IsPlayerInRangeOfPoint instead.