Enterable checkpoint
#1

Greetings, I need some help,
I am at the moment experimenting a bit with Pawn again.

What i would like help with is;
Creating a checkpoint, if u walk in to it you get teleported to interior X
is this possible, and is this hard to make?

is there a dynamic way for doing this?

~yvoms
Reply
#2

pawn Code:
new TPCPActive[MAX_PLAYERS]
stock CreateTPCP(playerid)
{
SetPlayerCheckPoint(playerid, x, y, z, size);
TPCPActive[playerid] = true;
}

public OnPlayerDisconnect(playerid)
{
TPCPActive[playerid] = false;
}

public OnPlayerEnterCheckpoint(playerid)
{
if(TPCPActive[playerid] == true) {
SetPlayerPos(playerid, newx, newy, newz);
SendClientMessage(playerid, -1, "You have been teleported due to entering the TP checkpoint."); }
return 1;
}
Along with setting the checkpoint for the player we want to have a variable to know if the checkpoint is active for them. If they enter a checkpoint, whilist the TP variable is set to true it will teleport them to the coordinates you want. Obviously, replace details like x, y, z, and size with the ones you want. For more information,

https://sampwiki.blast.hk/wiki/OnPlayerEnterCheckpoint
https://sampwiki.blast.hk/wiki/SetPlayerCheckpoint
Reply
#3

Im making a small cops n robbers script.
in las venturas there are multiple stores,
I want a player to walk into a checkpoint get teleported to an interior,
In the interior i want a checkpoint to teleport them out.
Is this hard?
Reply
#4

Its not hard if you know what your doing, and have all your checkpoints in a variable to store things. For instance,
when you set a CP for a player, maybe you can have a system with checkpoint IDS. For instance use a variable CheckPointID for players.
Ex:

pawn Code:
if(CheckPointID[playerid] == 0)
Or another option is checking for the closest coordinates where checkpoints are set throughout your game-mode, how-ever I wouldn't recommend this option.
Reply
#5

no, if he's using the Stevo127 GameMode as a base, it's a little bit difficult !
Cause stevo uses a Checkpoint Streamer wich shows a checkpoints in a range of point, he use the Checkcoords tu use this,
look, you have to define the checkpoint at first, look after the others #define CP_XXX x
and add your checkpoint,
after that, you have two float,

search :
float:Checkcoord

at the end of this float, add the checkcoords of your checkpoint !

after that,
search :
float:Checkpoint

at the end, add the XYZ coordinates of your CheckPoint

then, at the bottom of this float, you will find multiple Lines with the CP names :
at the end, add the name of your checkpoint

THEN
go to the callback OnPlayerEnterCheckpoint

and add :

if(checkpointid == CP_YOURCP)
{
SetPlayerInterior(playerid,the id of the interior);
SetPlayerPos(playerid,the XYZ pos to TP);
SetCameraBehindThePlayer(playerid);
SendClientMessage(playerid, -1, "HERE YOU ARE ! CONGRATULATIONS !");
return 1;
}

hope you'll understand !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)