Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RemoveSpawnProtection() little fix #695

Merged
merged 2 commits into from
Mar 13, 2022

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
Copy link
Collaborator

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
Contributor

Have you tried instead changing this

MESSAGE_BEGIN(MSG_ONE, gmsgStatusIcon, nullptr, pev);
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 s1lentq:master Mar 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants