OnPlayerLeaveRaceCheckpoint
#1

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)