SA-MP Forums Archive
OnPlayerLeaveRaceCheckpoint - 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: OnPlayerLeaveRaceCheckpoint (/showthread.php?tid=280500)



OnPlayerLeaveRaceCheckpoint - Padarom - 01.09.2011

Hello,
I have created a small "race"-system or at least something similar. I wanted it to select the first free checkpoint (like position occupied -> use next position) as the next. This works 2 times in the script, but not on the third time.
pawn Код:
position[id] = "lv"; // id = GetPlayerVehicleID(playerid)
if(gatebelegt[5] == false)
{
    SetPlayerRaceCheckpoint(playerid, 1, checkpoint[8][0], checkpoint[8][1], checkpoint[8][2], checkpoint[8][0], checkpoint[8][1], checkpoint[8][2], 15);
    cp[playerid] = 2;
    gate[id] = 5;
    gatebelegt[5] = true;
}
else if(gatebelegt[5] == true && gatebelegt[6] == false)
{
    SetPlayerRaceCheckpoint(playerid, 1, checkpoint[9][0], checkpoint[8][1], checkpoint[9][2], checkpoint[9][0], checkpoint[9][1], checkpoint[1][2], 15);
    cp[playerid] = 2;
    gate[id] = 6;
    gatebelegt[6] = true;
}
else if(gatebelegt[6] == true)
{
    SetPlayerRaceCheckpoint(playerid, 1, checkpoint[10][0], checkpoint[10][1], checkpoint[10][2], checkpoint[10][0], checkpoint[10][1], checkpoint[10][2], 15);
    cp[playerid] = 2;
    gate[id] = 7;
    gatebelegt[7] = true;
}

// This is the function to start the checkpoints:
case 3:
{
if(gatebelegt[5] == true && gatebelegt[6] == true && gatebelegt[7] == true) return SendClientMessage(playerid, COLOR_RED, "Alle Positionen belegt.");
ziel[playerid] = 3;
ImRennen[playerid] = true;
cp[playerid] = 1;
SetPlayerRaceCheckpoint(playerid, 0, checkpoint[7][0], checkpoint[7][1], checkpoint[7][2], checkpoint[8][0], checkpoint[8][1], checkpoint[8][2], 30);
}
This is on OnPlayerLeaveRaceCheckpoint. As I said, this is the third case (the other 2 are scripted the same way, but they DO work). But here everytime checkpoint[8] is shown and I cannot understand why.

Regards
Padarom

edit: I've now printed out wether gabelegt[5] is true or not. And it changes from false to true as I wanted. But still the same checkpoint is shown.