SA-MP Forums Archive
Doubt with a checkpoint thing - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Doubt with a checkpoint thing (/showthread.php?tid=139663)



Doubt with a checkpoint thing - RoamPT - 05.04.2010

Well my doubt is, how can i make an checkpoint appear at an custom position when the the player is near that position, example:

X player approach an entrance at x,y,z pos using 2.0 range, when i enteres that range a checkpoint appears, and after he leaves that range the same checkpoint destroys.


Re: Doubt with a checkpoint thing - dice7 - 05.04.2010

Use a timer and IsPlayerInRangeOfPoint and then create the checkpoint


Re: Doubt with a checkpoint thing - RoamPT - 06.04.2010

But can you or someone show me an example?


Re: Doubt with a checkpoint thing - dice7 - 06.04.2010

pawn Код:
public OnGameModeInit()
{
    SetTimer("AreaCheck", 1000, 1);
    return 0;
}

forward AreaCheck();
public AreaCheck()
{
    for (new playerid = 0, max = GetMaxPlayers(); playerid < m; playerid++)
    {
        if (IsPlayerConnected(playerid))
        {
            if (IsPlayerInRangeOfPoint(playerid, 2.0, x, y, z))
            {
                SetPlayerCheckpoint(playerid, x, y, z, 3.0);
            }
            else //lets disable it if he's to far away
            {
                DisablePlayerCheckpoint(playerid);
            }
        }
    }
}
Note that this will only work if this checkpoint is the only one on your server


Re: Doubt with a checkpoint thing - RoamPT - 06.04.2010

How so?