❔ Please help with a simple train reservation simulator (I'm a beginner).

In this train reservation simulator it's supposed to have a maximum capacity of 40 passengers on board. Let's say 50 people wants to hop on the train, it should say 40 on board, 10 has to stay. Well it does that, but the next input (Station 2), let's say another 10 people wants to hop on, then it should say 40 on board 10 has to say, but it says 20 has to stay. So it's adding the previous 10 with the 10 on station 2. (Sending a screenshot in the comments of how it looks in the console). If anyone can help it would be very much appreciated! My code is mostly written in Swedish but hopefully you'll understand by my comments in the code, if not let me know and I'll change everything. (I've been stuck in this problem for a few hours now). If anyone who's a beginner as well and want's to connect in PM, feel free.
No description
5 Replies
𝓕𝓡𝓾𝓢 β™₯
Here's how it looks in the console. marked with blue (100 has to stay at station 2, 170 has to stay at station 3 when it should be 70 has to stay at station 3).
No description
𝓕𝓡𝓾𝓢 β™₯
added more comments
No description
Iron
Ironβ€’9mo ago
Testa sΓ€tt ΓΆvriga till 0 efter varje gΓ₯ng du skrivit ut ΓΆvriga
𝓕𝓡𝓾𝓢 β™₯
Tack, men funkade inte (om jag gjorde rΓ€tt). Svarade dig i PM.
Accord
Accordβ€’9mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server
More Posts