18.12.2011, 05:48
Hi. Recently I have done some testing and found an odd sequence of callbacks. Before that I supposed that when a player is damaged, the update is sent to the server so OnPlayerUpdate is called first, OnPlayerTakeDamage then and only in that order (as a script works in a single thread).
But I have got very strange results from my tests - see the server log below. "OnPlayerUpdate" message is written in the very start of the callback with data from GetPlayerHealth. "OnPlayerTakeDamage_Tek" and "OnPlayerTakeDamage_Dal" are written in the start and end of the OnPlayerTakeDamage respectively.
So at the start everything is looking fine, we have some OnPlayerUpdate calls before getting shooted and then one OnPlayerTakeDamage call after each Update. But after some time OnPlayerTakeDamage is called twice with no OnPlayerUpdate between. And again. And then a whole six times! How this could happen? I'm confused.
Also wanted to note that there is SetPlayerHealth call between _Tek and _Dal, but I can't imagine how it could affect the sequence of callbacks.
So could someone explain me why this is happen please? Maybe I have suggested wrong and taken damage is sent separately from regular updates? Or something else I have missed?
But I have got very strange results from my tests - see the server log below. "OnPlayerUpdate" message is written in the very start of the callback with data from GetPlayerHealth. "OnPlayerTakeDamage_Tek" and "OnPlayerTakeDamage_Dal" are written in the start and end of the OnPlayerTakeDamage respectively.
Quote:
Originally Posted by Server log
[16:49:29] OnPlayerUpdate: Health:100.000000
[16:49:29] OnPlayerUpdate: Health:100.000000 [16:49:30] OnPlayerUpdate: Health:100.000000 [16:49:30] OnPlayerTakeDamage_Tek: 100.000000 hp, damage: 8.250000 hp [16:49:30] OnPlayerTakeDamage_Dal: 100.000000 hp, damage: 8.250000 hp [16:49:30] OnPlayerUpdate: Health:91.000000 [16:49:30] OnPlayerTakeDamage_Tek: 91.000000 hp, damage: 8.250000 hp [16:49:30] OnPlayerTakeDamage_Dal: 91.000000 hp, damage: 8.250000 hp [16:49:30] OnPlayerUpdate: Health:100.000000 [16:49:30] OnPlayerTakeDamage_Tek: 100.000000 hp, damage: 8.250000 hp [16:49:30] OnPlayerTakeDamage_Dal: 100.000000 hp, damage: 8.250000 hp ... [16:49:33] OnPlayerUpdate: Health:73.000000 [16:49:33] OnPlayerTakeDamage_Tek: 73.000000 hp, damage: 8.250000 hp [16:49:33] OnPlayerTakeDamage_Dal: 73.000000 hp, damage: 8.250000 hp [16:49:33] OnPlayerUpdate: Health:64.000000 [16:49:33] OnPlayerTakeDamage_Tek: 64.000000 hp, damage: 8.250000 hp [16:49:33] OnPlayerTakeDamage_Dal: 64.000000 hp, damage: 8.250000 hp [16:49:33] OnPlayerTakeDamage_Tek: 64.000000 hp, damage: 8.250000 hp [16:49:33] OnPlayerTakeDamage_Dal: 64.000000 hp, damage: 8.250000 hp ... [16:49:34] OnPlayerUpdate: Health:46.000000 [16:49:34] OnPlayerTakeDamage_Tek: 46.000000 hp, damage: 8.250000 hp [16:49:34] OnPlayerTakeDamage_Dal: 46.000000 hp, damage: 8.250000 hp [16:49:34] OnPlayerTakeDamage_Tek: 46.000000 hp, damage: 8.250000 hp [16:49:34] OnPlayerTakeDamage_Dal: 46.000000 hp, damage: 8.250000 hp ... [16:49:35] OnPlayerUpdate: Health:19.000000 [16:49:35] OnPlayerTakeDamage_Tek: 19.000000 hp, damage: 8.250000 hp [16:49:35] OnPlayerTakeDamage_Dal: 19.000000 hp, damage: 8.250000 hp [16:49:35] OnPlayerTakeDamage_Tek: 19.000000 hp, damage: 8.250000 hp [16:49:35] OnPlayerTakeDamage_Dal: 19.000000 hp, damage: 8.250000 hp [16:49:35] OnPlayerTakeDamage_Tek: 19.000000 hp, damage: 8.250000 hp [16:49:35] OnPlayerTakeDamage_Dal: 19.000000 hp, damage: 8.250000 hp [16:49:36] OnPlayerTakeDamage_Tek: 19.000000 hp, damage: 8.250000 hp [16:49:36] OnPlayerTakeDamage_Dal: 19.000000 hp, damage: 8.250000 hp [16:49:36] OnPlayerTakeDamage_Tek: 19.000000 hp, damage: 8.250000 hp [16:49:36] OnPlayerTakeDamage_Dal: 19.000000 hp, damage: 8.250000 hp [16:49:36] OnPlayerTakeDamage_Tek: 19.000000 hp, damage: 8.250000 hp [16:49:36] OnPlayerTakeDamage_Dal: 19.000000 hp, damage: 8.250000 hp ... |
Also wanted to note that there is SetPlayerHealth call between _Tek and _Dal, but I can't imagine how it could affect the sequence of callbacks.
So could someone explain me why this is happen please? Maybe I have suggested wrong and taken damage is sent separately from regular updates? Or something else I have missed?