18.11.2014, 08:36
Hey guys, I started to create a Dynamic Entrance System, with checkpoints. And this is my code:
The problem is, if I enter an entrance, it will be automatically do enter-exit loop.
Does anyone know whats wrong with my code ?
pawn Код:
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
Loop(i, MAX_ENTRANCES)
{
if(checkpointid == Entrance[i][EnterCP])
{
Ent[playerid] = i;
SetPlayerPosEx(playerid, Entrance[i][Exit][0], Entrance[i][Exit][1], Entrance[i][Exit][2], Entrance[i][Interior], i);
break;
}
else if(checkpointid == Entrance[i][ExitCP])
{
Ent[playerid] = 0;
SetPlayerPosEx(playerid, Entrance[i][Enter][0], Entrance[i][Enter][1], Entrance[i][Enter][2], 0, 0);
break;
}
}
return 1;
}
Does anyone know whats wrong with my code ?