SA-MP Forums Archive
[Tutorial] CheckPoint Tutorial - 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: Tutorials (https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] CheckPoint Tutorial (/showthread.php?tid=306615)



CheckPoint Tutorial - Notis123 - 27.12.2011

In this tutorial i will teach you how to make checkpoints

First of all you need pawno
Second of all you need some basic pawno knowledge
Third of all you got tired of what i said :P

We include
pawn Code:
#include <a_samp>
#include <zcmd>
i will use zcmd
we define
pawn Code:
#define COLOR_WHITE 0xFFFFFFAA
White is the color that we will use but you can change it.

Now lets new some things
pawn Code:
new CP[MAX_PLAYERS];
Now lets start with making the command
pawn Code:
COMMAND:work(playerid, params[])
{
CP[playerid] =1; // this sets the checkpoint id
SetPlayerCheckpoint(playerid, 1577.3411,1504.8600,10.5608, 4.0); //LV Airport ||Note: 4.0 is the checkpoint size
SendClientMessage(playerid,COLOR_WHITE,"Deliver the damaged passengers from LVAP to SFAP"); // we send the message to the player which we give him info where to go
return 1;
}
as you see we set his checkpoint at LV Airport and we set an id
To take the checkpoint coordinates you do /save [name] in game and you can take first 6 numbers like we did there.
The basic thing is to understand this not copy paste it.

Now lets go on public OnPlayerEnterCheckpoint and there is the most work.(not for everyone)
pawn Code:
public OnPlayerEnterCheckpoint(playerid)
{
if (CP[playerid] ==1)
{
DisablePlayerCheckpoint(playerid); // disables his checkpoint since he/she reached it
SendClientMessage(playerid,COLOR_WHITE"You got 15000$ for transferring the damaged passengers from LVAP to SFAP"); // We send the message again
GivePlayerMoney(playerid, +15000); // we give him 15k for his work(i think you dont want to make him rich :P)
}
return 1;
}
Now Lets make the Stop work command its the easier thing.
pawn Code:
CMD:stopwork(playerid, params[])
{
DisablePlayerCheckpoint(playerid); // This fuction here disables the player checkpoint (ANY CHECKPOINT)
SendClientMessage(playerid, COLOR_WHITE, "You lost 1000$ for aborting a mission");
GivePlayerMoney(playerid, -1000); // We are getting his money
return 1;
}
Lemme show you the full code

pawn Code:
#include <a_samp>
#include <zcmd>
#define COLOR_WHITE 0xFFFFFFAA
new CP[MAX_PLAYERS];
COMMAND:work(playerid, params[])
{
CP[playerid] =1;
SetPlayerCheckpoint(playerid, 1577.3411,1504.8600,10.5608, 4.0);
SendClientMessage(playerid,COLOR_WHITE,"Deliver the damaged passengers from LVAP to SFAP");
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
if (CP[playerid] ==1)
{
DisablePlayerCheckpoint(playerid);
SendClientMessage(playerid,COLOR_WHITE"You got 15000$ for transferring the damaged passengers from LVAP to SFAP");
GivePlayerMoney(playerid, +15000);
}
return 1;
CMD:stopwork(playerid, params[])
{
DisablePlayerCheckpoint(playerid);
SendClientMessage(playerid, COLOR_WHITE, "You lost 1000$ for aborting a mission");
GivePlayerMoney(playerid, -1000);
return 1;
}
}
I hope you understood this tutorial and not just copy paste it.

You will also need ZCMD by Zeex
You can make this with any command processor it doesn't matter the work is the same.


Weesly's Tutorial is also useful: Weesly's CheckPointTutorial



Re: CheckPoint Tutorial - seanny - 27.12.2011

Good tutorial, But the indention aint great.


Re: CheckPoint Tutorial - James Coral - 27.12.2011

Nice 10/10


Re: CheckPoint Tutorial - #marcus. - 27.12.2011

Simple tutorial showing how to use CP-s, very nice, but, you should consider setting CP var back to 0 when player enters checkoint


Re: CheckPoint Tutorial - Infinity - 27.12.2011

Not a good tutorial. You tell us that we should understand the code, but you don't explain what the code does.
You also make some (rookie) mistakes, like
pawn Code:
SendClientMessage(playerid,COLOR_WHITE"You got 15000$ for transferring the damaged passengers from LVAP to SFAP
Not closing the string/argument, no comma between arguments.

The worst part is this:
Quote:

I will update this soon
I aint have the time now i will update this soon.
But everything is fine nothing is messed.

If you don't have the time to write a proper tutorial, then don't. A rushed tutorial almost always equals a bad tutorial.


Re: CheckPoint Tutorial - Notis123 - 27.12.2011

Quote:
Originally Posted by Infinity
View Post
Not a good tutorial. You tell us that we should understand the code, but you don't explain what the code does.
You also make some (rookie) mistakes, like
pawn Code:
SendClientMessage(playerid,COLOR_WHITE"You got 15000$ for transferring the damaged passengers from LVAP to SFAP
Not closing the string/argument, no comma between arguments.

The worst part is this:


If you don't have the time to write a proper tutorial, then don't. A rushed tutorial almost always equals a bad tutorial.
Thanks.>.<


Re: CheckPoint Tutorial - Deathlane - 28.12.2011

Thank you very much for this!


Re: CheckPoint Tutorial - Notis123 - 28.12.2011

Thank you too


Re: CheckPoint Tutorial - Notis123 - 28.12.2011

! Updated !


Re: CheckPoint Tutorial - Notis123 - 03.01.2012

3/1/2012 Updated!!!