SA-MP Forums Archive
Repeating Checkpoints - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Repeating Checkpoints (/showthread.php?tid=464197)



Repeating Checkpoints - mpio - 15.09.2013

Hello all, how I can make repeating checkpoint, such as I enter on the checkpoint and automatically appear another checkpoint. Sorry for my bad english.


Re: Repeating Checkpoints - Konstantinos - 15.09.2013

You need to use arrays; for example:
pawn Код:
enum CP_DATA
{
    Float: CP_X,
    Float: CP_Y,
    Float: CP_Z
};

new
    CP[ 50 ][ CP_DATA ],
    Player_CP[ MAX_PLAYERS ]
;

// OnGameModeInit: assign some coordinates to them.
// An example (random coordinates)
CP[ 0 ][ CP_X ] = 568.4641;
CP[ 0 ][ CP_Y ] = 688.4468;
CP[ 0 ][ CP_Z ] = 518.4441;

CP[ 1 ][ CP_X ] = 988.4641;
CP[ 1 ][ CP_Y ] = 641.4468;
CP[ 1 ][ CP_Z ] = 546.4441;

// OnPlayerConnect: reset it.
Player_CP[ playerid ] = -1;

// Where you set the FIRST checkpoint:
Player_CP[ playerid ] = 0;

// OnPlayerEnterRaceCheckpoint (I guess for racing system)
Player_CP[ playerid ]++;
new
    cp = Player_CP[ playerid ]
;
SetPlayerRaceCheckpoint( playerid, CP[ cp ][ CP_X ], CP[ cp ][ CP_Y ], CP[ cp ][ CP_Z ], CP[ cp ][ CP_X + 1 ], CP[ cp ][ CP_Y + 1 ], CP[ cp ][ CP_Z + 1 ], 9 );
This is just an example, if you want for a racing system, you will need to add another array that stores the raceid.

Anyways, you got an idea.


Re: Repeating Checkpoints - mpio - 15.09.2013

Thank you!