Quote:
Originally Posted by Pierre-Marie Baty
@botmeister : don't forget that we are hooking the date when the messages are being SENT, not the date at which clients receive them. And such messages are all sent in a row in the same frame, for each client in the game. Thus you won't be triggering the round start several times but only ONCE provided all you do is raising a boolean flag that you will check later on in StartFrame.
|
OK, but for some reason in my tests the messages are being delayed, perhaps my code has a problem. No matter, I won't be considering the roundtime option anyway because it is not universal (requires players in game) and I don't want to deal with multiple messages if I don't have to.
Quote:
Also, as I explained, ServerActivate() DOES raise this flag too and since ServerActivate is the LAST function to be called before the first StartFrame(), I can hook map changes and server restarts like this as well. I don't find this "ugly", I find this very neat instead...
|
OK, I'll try ServerActivate(), that sounds like a good solution to the worldspawn delay. For it to work it has to get called on each map start, even if the same map is reloaded, and if the map is loaded manually using commands from the server console or from a timeout. Are you sure it will do this in every case?
I have to correct myself. The HLTV message check actually DOES appear to be the very best solution. I missed the obvious, and it's what Stephan's function points out, you have to look for a message that looks like this:
Message_Begin
MessageType: 125
MessageDest: 9
WriteByte : 0
WriteByte : 0
Message_End
This form of message appears to be sent only once after a round ends. The in round messages have nonzero values for each byte, although more tests are needed to confirm this. So using it, along with the ServerActivate() function hook (as PMB points out) should give us a fool proof and universal method of detecting a round start.
Quote:
...RoundTime is not sent when no players/bots are in game ? Sure, but nevermind for me, my code does strictly nothing when there are no bots or players in game. Anyway, as soon as a player will join, the round will immediately restart. So...
|
Yes, I agree the RoundTime solution may work for you, but it won't work for some other plugins. In your case, you may want to detect a roundstart only if there are bots in a game, so you could even check to see if the messages are being sent to bots or not. However, the tests I did gave me a long delay from when the last message was sent and when the round actually started, but if you don't have this same problem, then the problem may be with my code. In any case, I still like the HLTV message solution best
