Checkpoint
#1

Hello! I made some kind of a race system,not dynamic ,just 1 race.I have a little question.

How can I check who is the first player reaching the last race checkpoint and wins the race?
Reply
#2

Just as he enters the checkpoint,destroy it,and that's it(DESTROY only the last one and togheter with that the rest of the checkpoints).Get his name and congratulate him :P.If anyone did not reach the last checkpoint or not even the pre-last(as the other checkpoints have been destroyed togheter with the last one when the winner entered it,he cannot continue),show him a gametext you have lost the race.And also to all who did not enter the last checkpoint.That would be done using a for loop,but you have to exclude the winner's playerid.All this piece of code should be stored on your checkpoints streamer OnPlayerEnterDynamicCP(at least that's for Incognito's streamer).And that's it.
Reply
#3

Make a variable for entered checkpoints, and when a player enters a checkpoint, increase the variable by one.
Then, you can check if the variable's count is equal to the total race checkpoints and if it is, obviously that means the player has entered the last checkpoint.
To check the positions, make another variable and when a player finishes, increase it by one.
Reply
#4

Quote:
Originally Posted by [MWR]Blood
Посмотреть сообщение
Make a variable for entered checkpoints, and when a player enters a checkpoint, increase the variable by one.
Then, you can check if the variable's count is equal to the total race checkpoints and if it is, obviously that means the player has entered the last checkpoint.
To check the positions, make another variable and when a player finishes, increase it by one.
This might also work,in fact I am sure it works(good point Mr. Blood),and I don't want to mess up with your point of view(as you have more REP than me lol :P),but there are 2 different race checkpoints type,the one with arrows(the arrow shows where the next checkpoint is[points to the next location]),and the finish race checkpoint wich is just like a normal checkpoint,but a bit different(and it doesn't have an arrow anymore[obviusly,if it's called finish checkpoint]).So when the player enters the finish race checkpoint,then he should get the player ID and destroy the checkpoint(so the other players won't enter it anymore).Now,I am not saying that it's more efficient,but isn't that easier then messing up with variables?Anyway as you mentioned in your post(that the variable clearly says if he entered or no last checkpoint,and it's obvius),I think both ways are obvius.As he asked such a question,he might be a newbie,so he might not clearly understand how to initialize variable,and compare it every time for every player that netered a checkpoint,etc.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)