[Tutorial] Creating checkpoint(s) for beginners.
#1

Hello.
This is my first tutorial.
------------------------------------------------------------------------------------------------------------------
I would like to create this for the newbies out there (like me), because I was originally having
issues with creating multiple checkpoints.
__________________________________________________ __________________________________________________

Let's start out by downloading Incognito's Streamer Plugin (which we will use for the checkpoints duh)

Next at the very top of your script add:
pawn Code:
#include <streamer>
This is just telling the script to use this streamer.


Now onto creating the checkpoint.

First add
pawn Code:
new Checkpoint [MAX_PLAYERS];
So you can later identify multiple checkpoints


Next you will have to get your cords for your actual checkpoint.
Go to the position you want your checkpoint ingame, and use /save.
Go to your documents and you will find savedpositions.txt, open
that up and find your saved coordinates.

Here are mine:
AddPlayerClass(179,-1392.8824,2641.5508,55.9545,272.0198,0,0,0,0,0,0); //

Now you will want to copy the first 6 numbers you see. (as bold above)

Now FINALLY, we will define the actual checkpoint.


Under "OnPlayerSpawn", add this:
pawn Code:
Checkpoint[0] = CreateDynamicCP(-1392.8824,2641.5508,55.9545, 2, -1, -1, -1, 100);
This is the syntax:
pawn Code:
CreateDynamicCP(Float:x, Float:y, Float:z, Float:size, worldid = -1, interiorid = -1, playerid = -1,Float:distance = 100.0);
Put the 2nd to first six numbers for float, float:y, and float:z.

You have created the checkpoint, but it is not assigned to anything. So if you enter it nothing will happen.

pawn Code:
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
    if(checkpointid == Checkpoint[0]) //This checks what checkpoint it is before it continues
    {
        GameTextForPlayer(playerid, "You have entered this checkpoint", 4000, 5); //It will show this if a player steps in the checkpoint
    }
}
So there you go! The most basic tutorial about checkpoints.
Reply
#2

Quote:
Originally Posted by AgentBacon
View Post
Hello.

First add
pawn Code:
new Checkpoint [MAX_PLAYERS];
So you can later identify multiple checkpoints

Under "OnPlayerSpawn", add this:
pawn Code:
Checkpoint[0] = CreateDynamicCP(-1392.8824,2641.5508,55.9545, 2, -1, -1, -1, 100);
Wait, what. You create the variable Checkpoint to use 1 cell? I don't see the reasoning in that. Why MAX_PLAYERS? Why do you create a checkpoint overriding the previous person's checkpoint's variable?
Reply
#3

Quote:
Originally Posted by [HiC]TheKiller
View Post
Wait, what. You create the variable Checkpoint to use 1 cell? I don't see the reasoning in that. Why MAX_PLAYERS? Why do you create a checkpoint overriding the previous person's checkpoint's variable?
Ouch that hurt!
Reply
#4

When someone spawns, it will create the checkpoint over and over again for EVERY player which spawns. If its a global checkpoint, just create it once at OnGame/FilterScriptInit(). And then disable it for everyone in OnGame/FilterScriptInit() again. Then when someone spawns, just activate it for just that player, so it wont create a new checkpoint for EVERY player when they spawn...
Also dont forget to disable it when the player dies..
Reply
#5

i get this

C:\Users\Parent\Desktop\backup123\gamemodes\trd.pw n(6104) : error 010: invalid function or declaration
C:\Users\Parent\Desktop\backup123\gamemodes\trd.pw n(6107) : error 021: symbol already defined: "OnPlayerEnterDynamicCP"
C:\Users\Parent\Desktop\backup123\gamemodes\trd.pw n(6112) : warning 209: function "OnPlayerEnterDynamicCP" should return a value
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Reply
#6

Quote:
Originally Posted by Mr.Dexter
View Post
i get this

C:\Users\Parent\Desktop\backup123\gamemodes\trd.pw n(6104) : error 010: invalid function or declaration
C:\Users\Parent\Desktop\backup123\gamemodes\trd.pw n(6107) : error 021: symbol already defined: "OnPlayerEnterDynamicCP"
C:\Users\Parent\Desktop\backup123\gamemodes\trd.pw n(6112) : warning 209: function "OnPlayerEnterDynamicCP" should return a value
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.
You have possibly added OnPlayerEnterDynamicCP 2 times.
Reply
#7

Good for beginner's
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)