16.12.2015, 16:39
Well, if you need to show another checkpoint and hide the old one, you can do that without Streamer, using only SetPlayerCheckpoint
1. Store checkpoint positions in prefered order into an array
2. Create an array where you'll store ID of current checkpoint for each player
3. When player starts doing something (I don't know what you are going to do with checkpoints), set that ID to 0 and show the first checkpoint (whick has index 0 in positions array)
4. Finaly, callback handling
That's the idea. This code may have errors, you should use it as an example but not as completed working thing
1. Store checkpoint positions in prefered order into an array
PHP код:
#define NUMBER_OF_CP_POSITIONS (16) // Number of different positions for checkpoints
enum Vector3 {
Float:X,
Float:Y,
Float:Z
}
checkpointPositions[NUMBER_OF_CP_POSITIONS][Vector3] = {
{ 100.0, 200.0, 5.0 }, // 1-st checkpoint player should go to
{ 200.0, 300.0, 10.0 }, // 2-nd, which we'll show as soon as player enter first
...
};
PHP код:
new currentPlayerCheckpoint[MAX_PLAYERS];
PHP код:
// Simply shows current checkpoint player has to go to
public ShowCurrentPlayerCheckpoint( playerid ) {
new idx = currentPlayerCheckpoint[ playerid ];
SetPlayerCheckpoint( playerid, checkpointPositions[ idx ][ X ], checkpointPositions[ idx ][ Y ], checkpointPositions[ idx ][ Z ], 5.0 );
}
// This public is called on event start
public WhenSomethingStarts( playerid ) {
currentPlayerCheckpoint[ playerid ] = 0;
ShowCurrentPlayerCheckpoint( playerid ); // Show the first CP
}
PHP код:
public OnPlayerEnterCheckpoint( playerid ) {
new cpID = currentPlayerCheckpoint[ playerid ]; // That's the ID of CP player entered
// To get CP position, use checkpointPositions[ cpID ][ X / Y / Z ]
// Now lets show him the next CP or do something else if he entered the last one
if ( cpID == NUMBER_OF_CP_POSITIONS - 1 ) {
// That was the last CP, player walked through all of them and now we can give him something / finish event / start it again etc.
} else {
// That checkpoint was not last, let's show the next one
currentPlayerCheckpoint[ playerid ]++;
ShowCurrentPlayerCheckpoint( playerid );
}
}