SA-MP Forums Archive
Running only 48 out of 49 checkpoints - 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: Running only 48 out of 49 checkpoints (/showthread.php?tid=442043)



Running only 48 out of 49 checkpoints - rhds - 05.06.2013

Code is running only 48 out of 49 created checkpoints, could someone take a look, please?

pawn Код:
new Float:Driving1[49][3] =
{
    {1589.3202,-1637.1918,13.2311},
    {1532.7225,-1606.8074,13.1047},
    {1656.8669,-1583.9178,13.1021},
    {1649.9752,-1437.7181,13.1029},
    {1608.8871,-1424.6847,13.1944},
    {1615.2065,-1306.2471,17.0014},
    {1851.8651,-1250.8950,13.1718},
    {1877.3811,-1088.0193,23.5573},
    {1978.0142,-1087.3455,24.8233},
    {1997.1777,-1060.4236,24.1480},
    {2067.2612,-1104.4509,24.3220},
    {2087.1682,-1222.8027,23.5343},
    {2172.3030,-1234.1444,23.5421},
    {2183.5979,-1258.4603,23.6862},
    {2267.3904,-1267.5779,23.5387},
    {2278.4395,-1386.7997,23.6826},
    {2388.9902,-1397.5000,23.5670},
    {2385.5359,-1470.4326,23.6777},
    {2428.0881,-1480.9982,23.5466},
    {2411.8750,-1744.8971,13.0993},
    {2427.5251,-1775.3319,13.2655},
    {2521.5376,-1799.0380,13.1046},
    {2528.7424,-1935.7214,13.0556},
    {2710.7954,-1939.7665,13.0224},
    {2728.5483,-1995.7617,13.1218},
    {2772.0925,-1976.5128,13.1027},
    {2782.4517,-1893.7803,10.6083},
    {2836.2664,-1876.5315,10.6568},
    {2867.8157,-1661.4583,10.5968},
    {2739.3806,-1641.9584,12.7005},
    {2711.3101,-1505.7385,30.0142},
    {2645.8230,-1390.0750,30.0032},
    {2630.1196,-1253.8853,49.3685},
    {2449.4153,-1270.6641,23.5379},
    {2437.6924,-1441.7518,23.5500},
    {2428.0139,-1465.0068,23.5499},
    {2416.5923,-1521.1411,23.5504},
    {2344.9871,-1512.4327,23.5590},
    {2323.8330,-1480.9094,23.3609},
    {2199.3579,-1497.5059,23.7013},
    {2133.3977,-1492.6177,23.5789},
    {2099.9294,-1460.6208,23.5500},
    {1846.6016,-1471.7780,13.1157},
    {1811.2999,-1728.9082,13.1032},
    {1803.5272,-1718.0675,13.2563},
    {1751.7310,-1685.7561,13.1041},
    {1735.1766,-1595.0424,13.0977},
    {1526.8044,-1604.5043,13.1032},
    {1571.1270,-1627.5754,13.1047}
};
pawn Код:
public OnPlayerEnterRaceCheckpoint(playerid)
{
    if(course[playerid] == 2)
    {
        if(IsRaceRunning == true)
        {
            Driving1_CP[playerid]++;
        }
        if(Driving1_CP[playerid] < 48 && IsRaceRunning == true)
        {
            DisablePlayerRaceCheckpoint(playerid);
            SetPlayerRaceCheckpoint(playerid,0,Driving1[Driving1_CP[playerid]][0],Driving1[Driving1_CP[playerid]][1],Driving1[Driving1_CP[playerid]][2],
                                               Driving1[Driving1_CP[playerid]+1][0],Driving1[Driving1_CP[playerid]+1][1],Driving1[Driving1_CP[playerid]+1][2], 4);
            return 1;
        }
        if(Driving1_CP[playerid] == 48 && IsRaceRunning == true)
        {
            DisablePlayerRaceCheckpoint(playerid);
            SetPlayerRaceCheckpoint(playerid,0,Driving1[Driving1_CP[playerid]][0],Driving1[Driving1_CP[playerid]][1],Driving1[Driving1_CP[playerid]][2],
                                               Driving1[Driving1_CP[playerid]+1][0],Driving1[Driving1_CP[playerid]+1][1],Driving1[Driving1_CP[playerid]+1][2], 4);
            return 1;
        }
        if(Driving1_CP[playerid] == 49 && IsRaceRunning == true)
        {
            DisablePlayerRaceCheckpoint(playerid);
            IsRaceRunning = false;
            return 1;
        }
    }
    return 1;
}



Re: Running only 48 out of 49 checkpoints - HuSs3n - 05.06.2013

try this
pawn Код:
public OnPlayerEnterRaceCheckpoint(playerid)
{
    if(course[playerid] == 2)
    {
        if(IsRaceRunning == true)
        {
            Driving1_CP[playerid]++;
        }
        if(Driving1_CP[playerid] < 47 && IsRaceRunning == true)
        {
            DisablePlayerRaceCheckpoint(playerid);
            SetPlayerRaceCheckpoint(playerid,0,Driving1[Driving1_CP[playerid]][0],Driving1[Driving1_CP[playerid]][1],Driving1[Driving1_CP[playerid]][2],
                                               Driving1[Driving1_CP[playerid]+1][0],Driving1[Driving1_CP[playerid]+1][1],Driving1[Driving1_CP[playerid]+1][2], 4);
            return 1;
        }
        if(Driving1_CP[playerid] == 47 && IsRaceRunning == true)
        {
            DisablePlayerRaceCheckpoint(playerid);
            SetPlayerRaceCheckpoint(playerid,0,Driving1[Driving1_CP[playerid]][0],Driving1[Driving1_CP[playerid]][1],Driving1[Driving1_CP[playerid]][2],
                                               Driving1[Driving1_CP[playerid]+1][0],Driving1[Driving1_CP[playerid]+1][1],Driving1[Driving1_CP[playerid]+1][2], 4);
            return 1;
        }
        if(Driving1_CP[playerid] == 48 && IsRaceRunning == true)
        {
            DisablePlayerRaceCheckpoint(playerid);
            IsRaceRunning = false;
            return 1;
        }
    }
    return 1;
}