SA-MP Forums Archive
My Checkpoint problem [HELP] +REP - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: My Checkpoint problem [HELP] +REP (/showthread.php?tid=570758)



My Checkpoint problem [HELP] +REP - Chausar - 12.04.2015

I used Streamer plugin to make the multiple checkpoint
like this..i want when the player touched the checkpoint. that marker will dissapear and the player will be teleported to the interior like the basic checkpoint function. i want when player touched the checkpoint.. the checkpoint goes dissapear and will reepear after player not touched it.. can you help me? heres my code.. kinda sleepy...

Код:
new LsGym;
new LsGymExit;
Код:
public OnGameModeInit()

LsGym = CreateDynamicCP(2229.5120, -1721.5774, 13.5642,3, -1,-1,-1,100.0);
    LsGymExit = CreateDynamicCP(772.2743, -5.5152, 1000.7284,3, -1,-1,-1,100.0);
Код:
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
   if(checkpointid == LsGym) //ls gym
	{
		SetPlayerInterior(playerid, 5);
		SetPlayerPos(playerid, 771.3447, -1.3051, 1000.7275);
		
	}
	if(checkpointid == LsGymExit) //ls gym exit
	{
	  SetPlayerInterior(playerid, 0);
	  SetPlayerPos(playerid, 2229.5120, -1721.5774, 13.5642);
	}
	return 1;
}



Re: My Checkpoint problem [HELP] +REP - MEW273 - 13.04.2015

Hi Chausar,

You never really specified exactly what the problem was. However I have looked over your code and made some adjustments and the tested end result is below. I changed some co-ordinates as the first error I experienced was that with your co-ordinates (positions at SetPlayerPos) that the player would continually spawn at both checkpoints therefore creating an endless loop of teleporting to and from both checkpoints.

I have also added under OnGameModeInit, DisableInteriorEnterExits(); which will disable all the interior entrances and exits in the game (the yellow arrows at doors). As I found that there was a yellow marker also at the location of your checkpoint which sometimes would interfere with the positioning of your SetPlayerPos.

pawn Код:
new LsGym;
new LsGymExit;

public OnGameModeInit()
{
    DisableInteriorEnterExits();
    LsGym = CreateDynamicCP(2229.5120, -1721.5774, 13.5642,3, -1,-1,-1,100.0);
        LsGymExit = CreateDynamicCP(772.2743, -5.5152, 1000.7284, 3, -1, 5, -1, 100.0);
    return 1;
}

public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
    if(checkpointid == LsGym)
    {
            SetPlayerInterior(playerid, 5);
            SetPlayerPos(playerid, 772.2174, -2.0610, 1000.7283);
            SetPlayerFacingAngle(playerid, 358.6013);
    }
    else if(checkpointid == LsGymExit)
    {
            SetPlayerInterior(playerid, 0);
        SetPlayerPos(playerid, 2226.8406, -1723.6810, 13.5517);
        SetPlayerFacingAngle(playerid, 132.9992);
    }
    return 1;
}