[HELP] Race checkpoints.
#1

Hi so i tryed to create a race. After first Checkpoint it gives me the last checkpoint and i cant understand why. Here's the script:
Код:
COMMAND:plenktynes(playerid, params[])
{
  new masinosid = GetPlayerVehicleID(playerid);
  new zaidejofailas[100], vardas[MAX_PLAYER_NAME];
  GetPlayerName(playerid, vardas, sizeof(vardas));
  format(zaidejofailas, sizeof(zaidejofailas), "FR/Saskaitos/%s.ini",vardas);
  if(dini_Int(zaidejofailas, "Smasina") != -1) DestroyVehicle(dini_Int(zaidejofailas, "Smasina"));
  if(IsPlayerInAnyVehicle(playerid) == 1)
  {
     if(dini_Int(zaidejofailas, "Smasina") != -1) DestroyVehicle(dini_Int(zaidejofailas, "Smasina"));
     SetVehicleToRespawn(masinosid);
     new i = GetPlayerInterior(playerid);
     new v = CreateVehicle(560,-2010.6499,387.8221,34.6782,1.4096, -1, -1, 0);
     LinkVehicleToInterior(v, i);
     SetPlayerRaceCheckpoint(playerid,0,-2004.8567,605.0294,34.6769,
     -1810.2356,605.7285,34.6789,20);
     dini_IntSet(zaidejofailas, "Smasina", v);
     PutPlayerInVehicle(playerid, v, 0);
	 lenktynes[playerid] = 1;
     
  }
  		
//		AddStaticVehicle(560,-2010.6499,387.8221,34.6782,1.4096,6,6); // masina1
		//AddStaticVehicle(541,-2008.0226,387.9178,34.6406,359.7637,68,8); // masina2
		//AddStaticVehicle(541,-2005.2972,387.9866,34.6407,358.4459,2,1); // masina3
		//AddStaticVehicle(541,-2002.6100,387.7462,34.6406,357.6168,13,8); // masina4
		//AddStaticVehicle(541,-1999.9409,387.6945,34.6406,358.6654,22,1); // masina5
		
  return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
    if(lenktynes[playerid] == 1)
    {
        DisablePlayerRaceCheckpoint(playerid);
        PlayerPlaySound(playerid, 1137, 0.0, 0.0, 0.0);
        SetPlayerRaceCheckpoint(playerid,0,-1810.2356,605.7285,34.6789,
     	-1718.6281,615.8502,24.3938,20);
     	lenktynes[playerid] = 2;
    }
    if(lenktynes[playerid] == 2)
    {
        DisablePlayerRaceCheckpoint(playerid);
        PlayerPlaySound(playerid, 1137, 0.0, 0.0, 0.0);
        SetPlayerRaceCheckpoint(playerid,0,-1718.6281,615.8502,24.3938,
     	-1714.7614,951.9296,24.4050,20);
     	lenktynes[playerid] = 3;
    }
    if(lenktynes[playerid] == 3)
    {
        DisablePlayerRaceCheckpoint(playerid);
        PlayerPlaySound(playerid, 1137, 0.0, 0.0, 0.0);
        SetPlayerRaceCheckpoint(playerid,0,-1714.7614,951.9296,24.4050,
     	-1712.7405,1185.8595,24.6389,20);
     	lenktynes[playerid] = 4;
    }
    if(lenktynes[playerid] == 4)
    {
        DisablePlayerRaceCheckpoint(playerid);
        PlayerPlaySound(playerid, 1137, 0.0, 0.0, 0.0);
        SetPlayerRaceCheckpoint(playerid,0,-1712.7405,1185.8595,24.6389,
     	-1605.6279,1197.0940,6.8424,20);
     	lenktynes[playerid] = 5;
    }
    if(lenktynes[playerid] == 5)
    {
        DisablePlayerRaceCheckpoint(playerid);
        PlayerPlaySound(playerid, 1137, 0.0, 0.0, 0.0);
        SetPlayerRaceCheckpoint(playerid,0,-1605.6279,1197.0940,6.8424,
     	-1707.9794,1305.0262,6.7030,20);
     	lenktynes[playerid] = 6;
    }
    if(lenktynes[playerid] == 6)
    {
        DisablePlayerRaceCheckpoint(playerid);
        PlayerPlaySound(playerid, 1137, 0.0, 0.0, 0.0);
        SetPlayerRaceCheckpoint(playerid,0,-1707.9794,1305.0262,6.7030,
     	-1871.2780,1240.8619,28.5323,20);
     	lenktynes[playerid] = 7;
    }
    if(lenktynes[playerid] == 7)
    {
        DisablePlayerRaceCheckpoint(playerid);
        PlayerPlaySound(playerid, 1137, 0.0, 0.0, 0.0);
        SetPlayerRaceCheckpoint(playerid,0,-1871.2780,1240.8619,28.5323,
     	-1884.1154,1182.2175,44.9554,20);
     	lenktynes[playerid] = 8;
    }
    if(lenktynes[playerid] == 8)
    {
        DisablePlayerRaceCheckpoint(playerid);
        PlayerPlaySound(playerid, 1137, 0.0, 0.0, 0.0);
        SetPlayerRaceCheckpoint(playerid,0,-1884.1154,1182.2175,44.9554,
     	-1900.9698,750.4354,44.9562,20);
     	lenktynes[playerid] = 9;
    }
    if(lenktynes[playerid] == 9)
    {
        DisablePlayerRaceCheckpoint(playerid);
        PlayerPlaySound(playerid, 1137, 0.0, 0.0, 0.0);
        SetPlayerRaceCheckpoint(playerid,0,-1900.9698,750.4354,44.9562,
     	-1902.2069,607.2336,34.6750,20);
     	lenktynes[playerid] = 10;
    }
    if(lenktynes[playerid] == 10)
    {
        DisablePlayerRaceCheckpoint(playerid);
        PlayerPlaySound(playerid, 1137, 0.0, 0.0, 0.0);
        SetPlayerRaceCheckpoint(playerid,0,-1902.2069,607.2336,34.6750,
     	-2004.0211,605.1536,34.6767,20);
     	lenktynes[playerid] = 11;
    }
    if(lenktynes[playerid] == 11)
    {
        DisablePlayerRaceCheckpoint(playerid);
        PlayerPlaySound(playerid, 1137, 0.0, 0.0, 0.0);
        SetPlayerRaceCheckpoint(playerid,0,-2004.0211,605.1536,34.6767,
     	-2003.8525,387.3824,34.6763,20);
     	lenktynes[playerid] = 12;
    }
    if(lenktynes[playerid] == 12)
    {
        DisablePlayerRaceCheckpoint(playerid);
        PlayerPlaySound(playerid, 1137, 0.0, 0.0, 0.0);
        SetPlayerRaceCheckpoint(playerid,0,-2003.8525,387.3824,34.6763,
     	-2003.8525,387.3824,34.6763,20);
     	lenktynes[playerid] = 13;
    }
    return 1;
}
Please help me.
Reply
#2

under OnPlayerEnterRaceCheckpoint(playerid)

leave the first statment a "if"
then chage the other "if's" to "else if"
it is working it just showing them all real fast as it reads down the code and incrementing your variable

enjoy

hell ill even do it
pawn Код:
public OnPlayerEnterRaceCheckpoint(playerid)
{
    if(lenktynes[playerid] == 1)
    {
        DisablePlayerRaceCheckpoint(playerid);
        PlayerPlaySound(playerid, 1137, 0.0, 0.0, 0.0);
        SetPlayerRaceCheckpoint(playerid,0,-1810.2356,605.7285,34.6789,
        -1718.6281,615.8502,24.3938,20);
        lenktynes[playerid] = 2;
    }
    else if(lenktynes[playerid] == 2)
    {
        DisablePlayerRaceCheckpoint(playerid);
        PlayerPlaySound(playerid, 1137, 0.0, 0.0, 0.0);
        SetPlayerRaceCheckpoint(playerid,0,-1718.6281,615.8502,24.3938,
        -1714.7614,951.9296,24.4050,20);
        lenktynes[playerid] = 3;
    }
    else if(lenktynes[playerid] == 3)
    {
        DisablePlayerRaceCheckpoint(playerid);
        PlayerPlaySound(playerid, 1137, 0.0, 0.0, 0.0);
        SetPlayerRaceCheckpoint(playerid,0,-1714.7614,951.9296,24.4050,
        -1712.7405,1185.8595,24.6389,20);
        lenktynes[playerid] = 4;
    }
    else if(lenktynes[playerid] == 4)
    {
        DisablePlayerRaceCheckpoint(playerid);
        PlayerPlaySound(playerid, 1137, 0.0, 0.0, 0.0);
        SetPlayerRaceCheckpoint(playerid,0,-1712.7405,1185.8595,24.6389,
        -1605.6279,1197.0940,6.8424,20);
        lenktynes[playerid] = 5;
    }
    else if(lenktynes[playerid] == 5)
    {
        DisablePlayerRaceCheckpoint(playerid);
        PlayerPlaySound(playerid, 1137, 0.0, 0.0, 0.0);
        SetPlayerRaceCheckpoint(playerid,0,-1605.6279,1197.0940,6.8424,
        -1707.9794,1305.0262,6.7030,20);
        lenktynes[playerid] = 6;
    }
    else if(lenktynes[playerid] == 6)
    {
        DisablePlayerRaceCheckpoint(playerid);
        PlayerPlaySound(playerid, 1137, 0.0, 0.0, 0.0);
        SetPlayerRaceCheckpoint(playerid,0,-1707.9794,1305.0262,6.7030,
        -1871.2780,1240.8619,28.5323,20);
        lenktynes[playerid] = 7;
    }
    else if(lenktynes[playerid] == 7)
    {
        DisablePlayerRaceCheckpoint(playerid);
        PlayerPlaySound(playerid, 1137, 0.0, 0.0, 0.0);
        SetPlayerRaceCheckpoint(playerid,0,-1871.2780,1240.8619,28.5323,
        -1884.1154,1182.2175,44.9554,20);
        lenktynes[playerid] = 8;
    }
    else if(lenktynes[playerid] == 8)
    {
        DisablePlayerRaceCheckpoint(playerid);
        PlayerPlaySound(playerid, 1137, 0.0, 0.0, 0.0);
        SetPlayerRaceCheckpoint(playerid,0,-1884.1154,1182.2175,44.9554,
        -1900.9698,750.4354,44.9562,20);
        lenktynes[playerid] = 9;
    }
    else if(lenktynes[playerid] == 9)
    {
        DisablePlayerRaceCheckpoint(playerid);
        PlayerPlaySound(playerid, 1137, 0.0, 0.0, 0.0);
        SetPlayerRaceCheckpoint(playerid,0,-1900.9698,750.4354,44.9562,
        -1902.2069,607.2336,34.6750,20);
        lenktynes[playerid] = 10;
    }
    else if(lenktynes[playerid] == 10)
    {
        DisablePlayerRaceCheckpoint(playerid);
        PlayerPlaySound(playerid, 1137, 0.0, 0.0, 0.0);
        SetPlayerRaceCheckpoint(playerid,0,-1902.2069,607.2336,34.6750,
        -2004.0211,605.1536,34.6767,20);
        lenktynes[playerid] = 11;
    }
    else if(lenktynes[playerid] == 11)
    {
        DisablePlayerRaceCheckpoint(playerid);
        PlayerPlaySound(playerid, 1137, 0.0, 0.0, 0.0);
        SetPlayerRaceCheckpoint(playerid,0,-2004.0211,605.1536,34.6767,
        -2003.8525,387.3824,34.6763,20);
        lenktynes[playerid] = 12;
    }
    else if(lenktynes[playerid] == 12)
    {
        DisablePlayerRaceCheckpoint(playerid);
        PlayerPlaySound(playerid, 1137, 0.0, 0.0, 0.0);
        SetPlayerRaceCheckpoint(playerid,0,-2003.8525,387.3824,34.6763,
        -2003.8525,387.3824,34.6763,20);
        lenktynes[playerid] = 13;
    }
    return 1;
}
Reply
#3

Thank you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)