public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
if(checkpointid == h[1])//Enter
{
SetPlayerPos(playerid, 238.727615, 138.634033, 1003.023437);
SetPlayerFacingAngle(playerid, 0);
SetPlayerInterior(playerid, 3);
}
if(checkpointid == h[2]) //Exit
{
SetPlayerPos(playerid, 2287.032958, 2432.367187, 10.820312);
SetPlayerFacingAngle(playerid, 0);
SetPlayerInterior(playerid, 0);
}
return 1;
}
public OnPlayerLeaveDynamicCP(playerid, checkpointid)
{
if(checkpointid == h[1])//Enter
{
}
if(checkpointid == h[2]) //Exit
{
}
return 1;
}
Yes, i know you can do that, but it'll take a lot of time for me to get all positions of all checkpoints and less efficient. I would rather prefer to spawn in the cp, and then be mathemathic and use some math to make it stop entering a loop, but whenever I try, it fucks up.
Any solution? ![]() |
new bool:StopCPLoop[MAX_PLAYERS] = false;
StopCPLoop[playerid] = true; //Use this to prevent the checkpoint loop. When true, the player cannot use checkpoints.
//Maybe use a timer to reallow the "checkpoint looping" after a certain time?
/*
forward ResetPlayerCheckpointLoop(playerid);
SetTimerEx("ResetPlayerCheckPointLoop", 5000, 0, "d"); //Set a timer to reallow the loop after '5 seconds'
public ResetPlayerCheckpointLoop(playerid)
{
StopCPLoop[playerid] = false;
return 1;
}
*/
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
//If we aren't going to prevent the checkpoint loop, continue..
if(StopCPLoop[playerid] == false && checkpointid == h[1]) //Enter
{
SetPlayerPos(playerid, 238.727615, 138.634033, 1003.023437);
SetPlayerFacingAngle(playerid, 0);
SetPlayerInterior(playerid, 3);
}
if(checkpointid == h[2]) //Exit
{
SetPlayerPos(playerid, 2287.032958, 2432.367187, 10.820312);
SetPlayerFacingAngle(playerid, 0);
SetPlayerInterior(playerid, 0);
}
return 1;
}
public OnPlayerLeaveDynamicCP(playerid, checkpointid)
{
if(checkpointid == h[1])//Enter
{
}
if(checkpointid == h[2]) //Exit
{
}
return 1;
}