Skip to content

RemoveSpawnProtection() little fix#695

Merged
wopox1337 merged 2 commits intorehlds:masterfrom
aleeperezz16:spawn-protection-fix
Mar 13, 2022
Merged

RemoveSpawnProtection() little fix#695
wopox1337 merged 2 commits intorehlds:masterfrom
aleeperezz16:spawn-protection-fix

Conversation

@aleeperezz16
Copy link
Contributor

So the actual problem of this happens when you hold any of the IN_ACTIVE buttons while you're dead and respawn afterwards. The icon from StatusIcon set doesn't get removed and even if you don't have protection anymore, the icon still stands on your HUD.
These commands can help replicate the issue:
mp_respawn_immunitytime 3.0
mp_respawn_immunity_effects 1
mp_respawn_immunity_force_unset 1
mp_forcerespawn 1

The "fix" I found is changing MSG_ONE_UNRELIABLE to MSG_ONE once it is set from SetSpawnProtection().

I tried to replicate the same problem and never ever occured.

@wopox1337 wopox1337 self-requested a review October 25, 2021 17:35
@wopox1337 wopox1337 added Priority: 🕒 low Low priority tasks that can be postponed for the future. Status: ✅ done The issue done and closed. Type: 🐞 bug An error that needs fixing. labels Oct 25, 2021
@wopox1337
Copy link
Member

I can't trace the exact origin of the bug. My assumptions were wrong, or at least not accurate. I am not sure that the suggested changes will help to get rid of the problem 100%. I need a more detailed explanation.

@aleeperezz16
Copy link
Contributor Author

aleeperezz16 commented Oct 26, 2021

You mean that the bug's happening to you but don't know why? I don't know how reliable and unreliable channels work, like if one is faster than the other or has an order of execution. Maybe MSG_ONE messages get executed first than unreliable ones so that's why is unreliable (check if messsage can be sent, then do it else don't). As PreThink is called by the engine on every Sv_RunCmd, sending MSG_ONE to remove the icon is queued before the MSG_ONE_UNRELIABLE on the removal of the icon. I'm not 100% sure about this, just tried to change the msg_type and the icon always got rid of the HUD.
That's why on the comment I said "fix", maybe it can still happen but haven't to me since that change. Maybe making it reliable can crash some players and kick them for Reliable channel overflowed. The other fix that I thought about is to save the time the player spawned, make like a gap of 0.1 seconds after he spawned and on CBasePlayer::UpdateClientData send this icon if it is not shown, idk

@justgo97
Copy link

Have you tried instead changing this https://github.com/s1lentq/ReGameDLL_CS/blob/c30fe01f8e60ea1a6a4896bc9e0beb09ae0db580/regamedll/dlls/player.cpp#L10239 to MSG_ONE_UNRELIABLE , maybe they work better when in the same channel?

@aleeperezz16
Copy link
Contributor Author

Yeah, I tested using that channel and sometimes got removed, others didn't or even not showed up the icon

@wopox1337 wopox1337 merged commit f050be7 into rehlds:master Mar 13, 2022
yohimik pushed a commit to yohimik/ReGameDLL_CS that referenced this pull request Jun 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Priority: 🕒 low Low priority tasks that can be postponed for the future. Status: ✅ done The issue done and closed. Type: 🐞 bug An error that needs fixing.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants