Quote:
Yes, but it does at least get displayed and you can see it for a few seconds on the screen right after you are disconnected. So this is better then nothing.
|
I guess you're still using CS 1.5. It's a lot worse in CS 1.6 because you don't see any of the connection messages like you do in CS 1.5.
Quote:
I actually do this. The code I posted was simplified. I call a function that counts the number of bots and humans on the server right before I do the check.
The problem is still as described.
In ClientConnect() If more then 1 human tries to connect within a few seconds of each other, they can exceed the allowed maxhumans, because the code that counts the players doesn't take into consideration players who are in the process of connecting but not actually in the game yet.
|
Yes, you are indeed correct, here's why
Assume MaxHumans = 5 AND there are 4 humans in the game.
If a human tries to connect, ClientConnect() will get called, and the count will return 4 humans in game allowing the player to connect as the 5th human. If another human tries to connect before the first one becomes "valid" and counted, then this human will be allowed in as the 6th human.
The real problem here is that there is no corresponding ClientDisconnect() function to hook onto when a connection attempt is refused. Only Valve can solve this one, so you're left with doing silly coding to solve the problem.
I think the best "solution" is to leave your existing code in place but to also kick out extra humans as soon as they can be detected. Most of the time people will be refused at ClientConnect(), and only the few who slip through the first check will get kicked. These guys can still get a console message informing them why they were kicked just as they do with the refusal.