Won't Spawn back to CP
#1

Hello, I made a CP where you spawn in a new pos, and then can get TP'ed back but I probably made an error which i can't find.. Any help?

pawn Код:
new SpawnCP[MAX_PLAYERS][2];
new EnterCheckpoint[80];
new ExitCheckpoint[80];

//OnGameModeInit
    EnterCheckpoint[0] = CreateDynamicCP(2194.9414,1991.0286,12.2969, 1.0, 0, 0, -1, 25.0); //24/7 Shop enter
    ExitCheckpoint[0] = CreateDynamicCP(-25.8452,-188.2372,1003.5469, 1.0, 1, 17, -1, 25.0); //24/7 Shop Exit

public OnPlayerSpawn(playerid)
{
    SpawnCP[playerid][0] = 0;
    SpawnCP[playerid][1] = 0;
}

public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
    /*Enters*/
    if(checkpointid == EnterCheckpoint[0]) //24/7
    {
        if(SpawnCP[playerid][0] == 0)
        {
            SetPlayerVirtualWorld(playerid, 1);
            SetPlayerInterior(playerid, 17);
            SetPlayerPos(playerid, -25.8452,-188.2372,1003.5469);
            SetCameraBehindPlayer(playerid);
            SpawnCP[playerid][1] = 1;
            return 1;
        }
    }

    if(checkpointid == ExitCheckpoint[0]) //24/7
    {
        if(SpawnCP[playerid][1] == 0)
        {
            SetPlayerVirtualWorld(playerid, 0);
            SetPlayerInterior(playerid, 0);
            SetPlayerPos(playerid, 2194.9414,1991.0286,12.2969);
            SetCameraBehindPlayer(playerid);
            SpawnCP[playerid][0] = 0;
            return 1;
        }
    }

}

public OnPlayerLeaveDynamicCP(playerid, checkpointid)
{
    if(checkpointid == EnterCheckpoint[0])
    {
        SpawnCP[playerid][0] = 0;
        return 1;
    }
   
    if(checkpointid == ExitCheckpoint[0])
    {
        SpawnCP[playerid][1] = 0;
        return 1;
    }
    return 1;
}
Reply
#2

i would like to learn what is this?
SpawnCP[playerid][0] = 0;
are you trying to use a boolean?
Reply
#3

Well more like a variable, so it wouldn't loop me in the checkpoints, when i enter it at the beginning..

EDIT: Kinda like a boolean i suppose..
Reply
#4

Any ideas.. anybode?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)