[Tutorial] CheckPoint Tutorial
#1

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
Reply
#2

Good tutorial, But the indention aint great.
Reply
#3

Nice 10/10
Reply
#4

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

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.
Reply
#6

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.>.<
Reply
#7

Thank you very much for this!
Reply
#8

Thank you too
Reply
#9

! Updated !
Reply
#10

3/1/2012 Updated!!!
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)