Reliable player disconnect check

Please post any questions about developing your plugin here. Please use the search function before posting!
User avatar
Doldol
Senior Member
Posts: 192
Joined: Sat Jul 07, 2012 7:09 pm
Location: Belgium

Reliable player disconnect check

Postby Doldol » Tue Jun 26, 2018 6:10 pm

I'm trying to find some way to reliably listen for a player disconnecting from the server, and get either their SteamID or (base)client pointer. Every single way I've found so far has at least one issue, I'll list the ones I remember:
    OnClientDisconnect listener: Fires when the client deactivates (on map changes)
    OnClientDisconnect listener and checking CBaseClient::IsConnected: IsConnected is always True, also tried delaying by one tick, same result.
    player_disconnect event: Doesn't fire when the client disconnects early before a certain point, for example due to not having the current map.
(This is mainly for CSS but something as compatible as possible would be nice.)

To be clear I would like to capture every time a user is no longer connected to the server in any way after passing CBaseServer::CheckChallengeType and then capture either SteamID or (base)client object/pointer.
User avatar
Doldol
Senior Member
Posts: 192
Joined: Sat Jul 07, 2012 7:09 pm
Location: Belgium

Re: Reliable player disconnect check

Postby Doldol » Wed Jun 27, 2018 9:45 pm

I'm going to try a hook on CBaseClient::Clear, it seems like that will work for my purposes

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 1 guest