Hello! I've learned a lot in C++ over the past few weeks but I've hit a wall. Here is how my program works:
A player registers then logs in. The program saves the players names and passwords in a file. I have a player class with two vectors, one for the name and one for the password of each player. Sure, it detects whether that player already exists by comparing the players name and pass entered on login by the one in the file, of course.. But what if a player then types 'stats'? How can C++ possibly know the vector index to retrieve information for that particular player? No one seems to understand my question elsewhere and it is frustrating to know this isn't possible for me at this point.
Player 1 logs in. Vector pushes back player name and password.
Player 2 logs in. Vector pushes back player name and password.
I like your layout. What if the second player logs in afterwards, then the first player types 'stats'?
The index int will then be applied to the second player instead, showing the second players stats to the first.
If there are two players logged in, and someone types in "stats", how would you know which one typed it in?
Clearly, you can't have more users logged in than you have consoles, because you have no other way to tell them apart.
Well, I've never played one, but if we're talking about a multiplayer game, that usually would be implemented with multiple computers talking to each other through a network, therefore you'd have multiple consoles, not just one.