teleport checkpoint
#1

Ima newb at scripting in pawno, so i was trying to make a checkpoint but i couldnt do it at all. -.-'
So i was thinking if somebody could make me an example for this script:

So when you step on checkpoint (with coordinates ********...) you teleport on some coordinates {SetPlayerPos(playerid, *coordinates*);}

ty
Reply
#2

First, create a checkpoint.

For instance:
SetPlayerCheckpoint(playerid, 2287.3586,2413.1880,10.5111, 9.0);

Explanation:
SetPlayerCheckpoint(ID of the player to see it(only he will see it), X cord, Y cord, Z Cord, Radius in units.)

Radius of 10-11 is about the size of two lanes of a road.

Then,
Код:
public OnPlayerEnterCheckpoint(playerid)
{
	if(IsPlayerInRangeOfPoint(playerid, 9.0, 2287.3586,2413.1880,10.5111))
	{
		Code of what to happen here!
Correct me if I'm wrong
Reply
#3

pawn Код:
//on top
new
    gCheckpoint[ 1 ];
pawn Код:
//OnGameModeInit()
SetTimer( "CheckpointUpdate", 100, true );
pawn Код:
//OnPlayerEnterCheckpoint
if( GetPlayerCheckpoint( playerid ) == checkpoint[ 0 ] )
{
    SetPlayerPos( playerid, 0.0, 0.0, 0.0 ); //the teleport function
    return 1;
}
pawn Код:
//anywhere in script
forward CheckpointUpdate();
public CheckpointUpdate()
{
    if( IsPlayerInRangeOfPoint( playerid, 20.0, x, y, z )) //change x, y, z with the coords for the checkpoint
        gCheckpoint[ 0 ] = SetPlayerCheckpoint( playerid, x, y, z ); //equal with the coords above
}
Reply
#4

Im getting error:
error 021: symbol already defined: "SetPlayerCheckpoint"
i never knew what that means -.-'

for what crucix said
Reply
#5

Quote:
Originally Posted by nejc001
Посмотреть сообщение
Im getting error:
error 021: symbol already defined: "SetPlayerCheckpoint"
i never knew what that means -.-'

for what crucix said
No idea why that would happen.

Try the other guy's way of doing it. Mine is simpler and would cause less lag on a larger scale, yet not as functional of course.
Reply
#6

My code was a fail x)
If you tried mine, retry now with the updated code in my last post
Reply
#7

Ok Crucix script works. i didnt tryed larzis script cuz i wont need it now.
How i fixed?
This script *SetPlayerCheckpoint(playerid, );* needs to be under *public OnPlayerSpawn(playerid)* script line.
Ty all for help.
Reply
#8

Quote:
Originally Posted by nejc001
Посмотреть сообщение
Ok Crucix script works. i didnt tryed larzis script cuz i wont need it now.
How i fixed?
This script *SetPlayerCheckpoint(playerid, );* needs to be under *public OnPlayerSpawn(playerid)* script line.
Ty all for help.
Sure thing, have fun.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)