rehlds / ReGameDLL_CS

Enhanced server-side GameDLL for Counter-Strike 1.6 (and CS: Condition Zero), offering new features and fixes.
https://rehlds.dev/docs/regamedll-cs
GNU General Public License v3.0
585 stars 203 forks source link

PlayerKilled Executes after RoundEnd Event when last alive player is killed #790

Open SmileYzn opened 1 year ago

SmileYzn commented 1 year ago

The order of gamerules now is:

PlayerKilled > DeathNotice > CheckWinConditions > TeamExterminationCheck > OnRoundEnd_Intercept

But DeathNotice is called at begin of Playerkilled, That will execute OnRoundEnd before PlayerKilled function ends.

DeathNotice maybe do not need to be the last thing to be called in PlayerKilled function or something else?

Ps. In game logic itself is OK.

But the problem is that RoundEnd always execute Before PlayerKilled in API function if round is won by elimination.

I solved this hokking PlayerKilled as PRE function, but is not a good approach anyway

hajimura commented 1 year ago

https://github.com/s1lentq/ReGameDLL_CS/blob/master/regamedll/dlls/multiplay_gamerules.cpp#L4169-L4170. I think, it could be removed

SmileYzn commented 1 year ago

Removed? No, I think only put at end of playerkilled func

hajimura commented 1 year ago

CheckWinConditions() already calls in CBasePlayer::Killed. So, it calls twice at now

SmileYzn commented 1 year ago

That is to check m_iRoundWinStatus and do a InitializePlayerCounts, the twice calls do two different things.

Th3-822 commented 1 year ago

Maybe you should look at https://github.com/alliedmodders/amxmodx/issues/713

SmileYzn commented 1 year ago

I knows that is how game works as explained here.

To fix it, i hooked PlayerKilled as PRE. But in some plugins that do something in PlayerKilled that will be a problem hook it as PRE no?

Also make sense execute CheckWinConditions only after all OnPlayerKilled was executed not only deathMessage itself

Th3-822 commented 1 year ago

how it would do then? checking all the players after playerkilled and then call CheckWinConditions?... CheckWinConditions already does that

I think that the best moment to run that check if after announcing player's death, which it what already does... Trying it to do it later may get weird interactions, like, lets say, another win condition gets called

if you need a better hook when player is "100% dead" and before calling CheckWinConditions, just use the DeathMsg

SmileYzn commented 1 year ago

No, just need call RoundEnd after Player Killed, As said before. I'm using directly reAPI in a metamod plugin.

Anyway i just hooked PlayerKilled as PRE and RoundEnd as POST events, this works

axl303 commented 1 year ago

Guys, I am trying to record the damage (hits, dmg, hp) Example: https://forums.alliedmods.net/attachment.php?attachmentid=61669&d=1268878741 via amxx and CBasePlayer_TakeDamage I am hooking it as a POST and everything works okay, but when last enemy dies it doesn't record the dmg like something is called after. Just like smiley said.

If I hook it like a PRE it works, but records incorrect damage sometimes.

I confirm that smiley is right and also I have red all information about how it is called, but when I use it as a PRE the damage is not correctly displayed. Do you guys have some suggestions? Sorry for spam and the bump.

dystopm commented 1 year ago

Guys, I am trying to record the damage (hits, dmg, hp) Example: https://forums.alliedmods.net/attachment.php?attachmentid=61669&d=1268878741 via amxx and CBasePlayer_TakeDamage I am hooking it as a POST and everything works okay, but when last enemy dies it doesn't record the dmg like something is called after. Just like smiley said.

If I hook it like a PRE it works, but records incorrect damage sometimes.

I confirm that smiley is right and also I have red all information about how it is called, but when I use it as a PRE the damage is not correctly displayed. Do you guys have some suggestions? Sorry for spam and the bump.

it doesn't record the dmg like something is called after

So, get help on scripting forums because you're having coding issues instead of an specific issue due to the project rewriting.

The behavior of the game is how you can see it right now, in this version and the original one, and it wont be changed in view of not breaking compatibility with 3rd party plugins.

You just need to code the exception to the case when a player is "killed" when round is over, and that's it.

I emphasize with the first point that I explained.