SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 15/05/2014, 11:44 PM   #1
yvoms
Huge Clucker
 
yvoms's Avatar
 
Join Date: Nov 2009
Location: Las Venturas
Posts: 454
Reputation: 26
Default Enterable checkpoint

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
__________________

yvoms is offline   Reply With Quote
Old 15/05/2014, 11:51 PM   #2
Abagail
High-roller
 
Join Date: Dec 2013
Location: GetPlayerPos(playerid, pos); Scripter/Mapper.
Posts: 3,133
Reputation: 445
Default Re: Enterable checkpoint

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,

http://wiki.sa-mp.com/wiki/OnPlayerEnterCheckpoint
http://wiki.sa-mp.com/wiki/SetPlayerCheckpoint
Abagail is offline   Reply With Quote
Old 15/05/2014, 11:55 PM   #3
yvoms
Huge Clucker
 
yvoms's Avatar
 
Join Date: Nov 2009
Location: Las Venturas
Posts: 454
Reputation: 26
Default Re: Enterable checkpoint

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?
__________________

yvoms is offline   Reply With Quote
Old 16/05/2014, 12:01 AM   #4
Abagail
High-roller
 
Join Date: Dec 2013
Location: GetPlayerPos(playerid, pos); Scripter/Mapper.
Posts: 3,133
Reputation: 445
Default Re: Enterable checkpoint

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.
Abagail is offline   Reply With Quote
Old 16/05/2014, 12:11 AM   #5
Ramoboss
Big Clucker
 
Ramoboss's Avatar
 
Join Date: Nov 2012
Location: Algerien et Fier ^^
Posts: 115
Reputation: 24
Default Re : Enterable checkpoint

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 !
__________________
Ramoboss is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Enterable Checkpoints San1 Scripting Help 0 16/06/2012 08:46 AM
[HELP]Enterable Tram bug? Nexotronix Scripting Help 3 02/02/2012 05:57 PM
Enterable Tram Andy_McKinley Help Archive 2 18/04/2010 10:24 AM
[HELP] Making a car non enterable Tito_Johnson Help Archive 12 10/02/2009 02:46 AM


All times are GMT. The time now is 04:43 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.