Checkpoints
#1

Hi again ya'll.

So I am having a bit of another problem. You see I downloaded the Streamer (by Incognito) and I want to make some checkpoints that when you enter one, another one appears. So for such I need checkpoint ID's, and that's okay. I need the same style CreateDynamicCP as SetPlayerCheckpoint, meaning I need them to NOT stream, but just add one at a time. So why am I not using SetPlayerCheckpoint? Again, I need seperate checkpointid's. So how am I supposed to handle this? Help appreciated.
Reply
#2

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
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.0200.05.0 },   // 1-st checkpoint player should go to
    
200.0300.010.0 }, // 2-nd, which we'll show as soon as player enter first
    
...
}; 
2. Create an array where you'll store ID of current checkpoint for each player
PHP код:
new currentPlayerCheckpoint[MAX_PLAYERS]; 
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)
PHP код:
// Simply shows current checkpoint player has to go to
public ShowCurrentPlayerCheckpointplayerid ) {
    new 
idx currentPlayerCheckpointplayerid ];
    
SetPlayerCheckpointplayeridcheckpointPositionsidx ][ ], checkpointPositionsidx ][ ], checkpointPositionsidx ][ ], 5.0 );
}

// This public is called on event start
public WhenSomethingStartsplayerid ) {
    
currentPlayerCheckpointplayerid ] = 0;
    
ShowCurrentPlayerCheckpointplayerid );  // Show the first CP

4. Finaly, callback handling
PHP код:
public OnPlayerEnterCheckpointplayerid ) {
    new 
cpID currentPlayerCheckpointplayerid  ]; // 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 ) {
        
// 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
        
currentPlayerCheckpointplayerid  ]++;
        
ShowCurrentPlayerCheckpointplayerid );
    }

That's the idea. This code may have errors, you should use it as an example but not as completed working thing
Reply
#3

That might just be something I was looking for. Seems I need to learn a little bit more. Thanks for putting me on the right path.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)