baso88 / SC_AngelScript

Sven Co-op AngelScript documentation, tutorials, sample code and tools
41 stars 4 forks source link

[Hook::Player::PlayerCanRespawn] &bCanRespawn does not prevent respawn #49

Open MrOats opened 7 years ago

MrOats commented 7 years ago

Reference Code: https://github.com/MrOats/AngelScript_SC_Plugins/releases/tag/SM_v4.0

In my plugin listed above, I left notes and ability to test trying to stay in Observer mode through setting &bCanRespawn for specific players. From what I found is that with bCanRespawn set to false, instead of when the timer counts to 0 on your screen and changes to "You can respawn now!", you are forcefully respawned with your gun not showing but able to shoot. With it set to true, it shows "You can respawn now!" and awaits for input like it should.

SamVanheer commented 7 years ago

This hook is called in CHalfLifeMultiplay::FPlayerCanRespawn, all code that processes player respawn logic should call g_pGameRules->FPlayerCanRespawn to verify that they can respawn first. Some refactoring may be required to ensure that all respawn logic uses the same code.

Disclaimer: info obtained through reverse engineering.