Dynamic CP
#1

Hello,
Can I SetPlayerPos at exit checkpoint ?
I think I can't set the player pos at exit checkpoint while other gamemode can ..
I want something like when player enter entrance checkpoint then the player will spawn in the round of checkpoint. If i'm Set the player pos to exit checkpoint it will be go back to entrance checkpoint and loop each other.



pawn Код:
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;
}
Reply
#2

So you enter the "enter checkpoint", then the "exit checkpoint" teleports you back? If so, try setting the positions a little bit away from the checkpoints. It should work.
Reply
#3

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?
Reply
#4

Quote:
Originally Posted by CrazyChoco
Посмотреть сообщение
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?
I'm a bit confused on what exactly you are trying to do, if I'm not mistaken, try something like this?

pawn Код:
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;
}
Reply
#5

Use (a variation of) GetXYInFrontOfPlayer to move the player forwards a few meters. This requires that the angles be correctly set otherwise you might just spawn in a wall.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)