SA-MP Forums Archive
pls help me (chekpoint) - 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: pls help me (chekpoint) (/showthread.php?tid=249317)



pls help me (chekpoint) - bousla7e - 18.04.2011

hello here is it iam a new scripter lets say it a noob and i need ur help (detailed tutorial pls) for how to creat a chekpoint cuz i need to add a ammu nation and houses to my server , and pls if u can give a pic of the script too cuz iam not very good , finally if u need my msn ask me for , i will give it to u


Re : pls help me (chekpoint) - bousla7e - 18.04.2011

so no body can help me ?


Re: pls help me (chekpoint) - nemesis_567 - 18.04.2011

It seems that what you need is not to create a checkpoint, which you use SetPlayerCheckpoint for.
Well, to use these all you need is to create a new array at the beggining of your gamemode, just like:

pawn Код:
new CheckpointStatus[MAX_PLAYERS];
Then you use the function SetPlayerCheckpoint in whatever coordinates you want it to be:

[pawn]SetPlayerCheckpoint(playerid, X,Y,Z, size)
//CheckpointStatus[playerid]=1; Do this if you want this checkpoint to do some special action when you enter it such as teleporting your player,giving him money/guns, whatever you want to script later.
[/pawm]

Then you go under the callback OnPlayerEnterCheckpoint(playerid) and use it like this:

pawn Код:
OnPlayerEnterCheckpoint(playerid)
{
    switch(CheckpointStatus[playerid])
    {
        case 0: DisablePlayerCheckpoint(playerid); //Nothing happens and the checkpoint disappears.
        case 1:
        {
             //Write here whatever code you want. This is what will happen if the CheckpointStatus is 1 and the player enters a checkpoint.
        }
    }
    return 1;
}
About creating checkpoints for the entrance of shops and stuff, well for that you would need a streamer. I recommend Incognito's Streamer. After that you just add checkpoints in OnGameModeInit and use the callback given in the streamer