Clean up objects from forcefully disconnected player

In my multiplayer game, I use OnPlayerDisconnected to detect when a player quits, then clean up their objects. However, when a player loses connection or forcefully quits with alt+F4, OnPlayerDisconnected is not called. How can I detect when a player is forcefully disconnected?

I want to say that I never worked with online games.

However, would it be possible to make each player communicate to a server, setting according variable in a script to “true” every 5 seconds?

Server flushes this variable to false every 5 seconds and resets the timer

At the end, if server sees that the variable is not changed to true within 10 seconds - clean up the respecting player’s character?

You might need several variables for each player and for loops.