Checkpoint Help - 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: Checkpoint Help (
/showthread.php?tid=564383)
Checkpoint Help -
Xenforox - 21.02.2015
Hello guys, I was working on a race system and i wanted to make a dynamic system, i was wondering how to save checkpoints coords into a variable (multiple).
Re: Checkpoint Help -
Smileys - 21.02.2015
use an array, like:
pawn Код:
#define MAX_CHECKPOINTS 1337 // set this to your desired amount of max checkpoints.
enum E_CP_DATA
{
race_id, // ID of the race.
Float:cp_x, // x coordinate of the cp
Float:cp_y, // y coordinate of the cp
Float:cp_z // z coordinate of the cp
};
new gCheckpointCoords[ MAX_CHECKPOINTS ][ E_CP_DATA ];
now you could save/load checkpoints from a file/database and store them into this array.
like:
pawn Код:
gCheckpointCoords[ 0 ][ race_id ] = 0;
gCheckpointCoords[ 0 ][ cp_x ] = 13.37;
gCheckpointCoords[ 0 ][ cp_y ] = 1000.69;
gCheckpointCoords[ 0 ][ cp_z ] = 15134.1243;
etc.