//Checkpoints
new cps1;
new cps2;
new cps3;
new cps4;
new cps5;
new cps6;
new cps7;
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 0)
{
if(response == 1)
{
MoveObject(drivingschoolramp, 1620.647217, -1008.745483, 21.613716, 1);
SendClientMessage(playerid, 0xEF994300, "Slijedite checkpointe, pazite da se ne sudarite!");
cps1 = CreateCheckpoint(playerid, 1546.4567,-1018.0248,23.9063, 2, 500);
}
}
return 1;
}
public OnPlayerEnterStreamedCheckpoint(playerid, streamid)
{
if(streamid == cps1)
{
cps2 = CreateCheckpoint(playerid, 1558.6582,-1025.8751,23.9063, 2, 500);
DisablePlayerCheckpoint(playerid);
}
if(streamid == cps2)
{
cps3 = CreateCheckpoint(playerid, 1572.4071,-1017.6917,23.9140, 2, 500);
DisablePlayerCheckpoint(playerid);
}
if(streamid == cps3)
{
cps4 = CreateCheckpoint(playerid, 1578.5472,-1024.1747,23.9063, 2, 500);
DisablePlayerCheckpoint(playerid);
}
if(streamid == cps4)
{
cps5 = CreateCheckpoint(playerid, 1584.9760,-1018.5584,23.9063, 2, 500);
DisablePlayerCheckpoint(playerid);
}
if(streamid == cps5)
{
cps6 = CreateCheckpoint(playerid, 1592.5760,-1024.9053,23.9063, 2, 500);
DisablePlayerCheckpoint(playerid);
}
return 1;
}
public OnPlayerEnterStreamedCheckpoint(playerid, streamid)
{
if(streamid == cps1)
{
cps2 = CreateCheckpoint(playerid, 1558.6582,-1025.8751,23.9063, 2, 500);
DisablePlayerCheckpoint(playerid);
}
else if(streamid == cps2)
{
cps3 = CreateCheckpoint(playerid, 1572.4071,-1017.6917,23.9140, 2, 500);
DisablePlayerCheckpoint(playerid);
}
else if(streamid == cps3)
{
cps4 = CreateCheckpoint(playerid, 1578.5472,-1024.1747,23.9063, 2, 500);
DisablePlayerCheckpoint(playerid);
}
else if(streamid == cps4)
{
cps5 = CreateCheckpoint(playerid, 1584.9760,-1018.5584,23.9063, 2, 500);
DisablePlayerCheckpoint(playerid);
}
else if(streamid == cps5)
{
cps6 = CreateCheckpoint(playerid, 1592.5760,-1024.9053,23.9063, 2, 500);
DisablePlayerCheckpoint(playerid);
}
return 1;
}
The problem is simple, you're calling all of the if statements in a row, so it's all happening instantly. This is what I mean:
Player enters checkpoint 1, cps2 is created, check is run again straight away for cps2, and will go through. This will continue all the way down to the last checkpoint. How can you fix it? Like so: pawn Код:
|