Raised This Month: $51 Target: $400
 12% 

Detect real player disconnects (not map change)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
StevoTVR
Senior Member
Join Date: Oct 2008
Old 11-29-2010 , 16:19   Detect real player disconnects (not map change)
Reply With Quote #1

I have a situation that calls for saving data at the end of a map, but before all the clients are disconnected. OnMapEnd() occurs too late for this. The reason I need to do this is because I am incrementing a counter on OnClientDisconnect() and I want to ignore those disconnects due to a map change.

I've searched these forums for a while and haven't found a satisfactory solution to this specific situation.

The only thing I can think of is to take into account all the possible things that can lead to a map ending (time limit, round limit, admin change, vote, changelevel) and hooking them all to set a variable. Or is there a single point of attack for this?

Has anyone solved this problem before? Any help would be appreciated.

Last edited by StevoTVR; 11-29-2010 at 16:31. Reason: Better title
StevoTVR is offline
exvel
SourceMod Donor
Join Date: Jun 2006
Location: Russia
Old 11-29-2010 , 16:20   Re: Detect map ending before OnMapEnd()?
Reply With Quote #2

If you want to track when people have actually disconnected (without mapchange disconnects) you have to use "player_disconnect" event instead of OnClientDisconnect() forward.
__________________
For admins: My plugins

For developers: Colors library
exvel is offline
Send a message via ICQ to exvel
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 11-29-2010 , 16:21   Re: Detect map ending before OnMapEnd()?
Reply With Quote #3

I'm pretty sure OnClientDisconnect() fires on every map change, however the "player_disconnect" event only fires when a client truly disconnects.

[edit]

Beaten. Damn you, exvel.
bl4nk is offline
StevoTVR
Senior Member
Join Date: Oct 2008
Old 11-29-2010 , 16:24   Re: Detect map ending before OnMapEnd()?
Reply With Quote #4

Well that was easy. Thanks for the tip.
StevoTVR is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:34.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode