13.04.2015, 08:02
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.
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;
}