19.10.2014, 10:19
pawn Код:
enum CP_INFO {
bool:set = false,
Float:x,
Float:y,
Float:z,
Float:size
};
#define CHECKPOINT_STREAMER_DISTANCE 200.0
new Checkpoints [ 500 ] [ CP_INFO ];
stock AddCheckpoint ( Float:cord_x, Float:cord_y, Float:cord_z, Float:cp_size ) {
for ( new i; i < sizeof ( Checkpoints ); i++ ) {
if ( Checkpoints [ i ] [ set ] == true && i == ( sizeof ( Checkpoints ) - 1 ) ) return 0;
if ( Checkpoints [ i ] [ set ] == true ) continue;
Checkpoints [ i ] [ x ] = cord_x;
Checkpoints [ i ] [ y ] = cord_y;
Checkpoints [ i ] [ z ] = cord_z;
Checkpoints [ i ] [ size ] = cp_size;
}
return 1;
}
// AddCheckpoint
// return -->
// 1 -> successfully
// 0 -> problem
public OnPlayerUpdate ( playerid ) {
for ( new i; i < sizeof ( Checkpoints ); i++ ) {
if ( Checkpoints [ i ] [ set ] == false ) continue;
if ( IsPlayerInRangeOfPoint ( playerid, CHECKPOINT_STREAMER_DISTANCE, Checkpoints [ i ] [ x ], Checkpoints [ i ] [ y ], Checkpoints [ i ] [ z ] ) ) {
DisablePlayerCheckpoint ( playerid );
SetPlayerCheckpoint ( playerid, Checkpoints [ i ] [ x ], Checkpoints [ i ] [ y ], Checkpoints [ i ] [ z ], Checkpoints [ i ] [ size ] );
} else DisablePlayerCheckpoint ( playerid );
}
return 1;
}
but you can use one checkpoint at CHECKPOINT_STREAMER_DISTANCE (range)