Checkpoint Help
#1

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).
Reply
#2

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)