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

[HELP] Difference between client_disconnect and client_disconnected?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
CrAzY MaN
Senior Member
Join Date: Mar 2017
Location: India
Old 08-08-2018 , 11:39   [HELP] Difference between client_disconnect and client_disconnected?
Reply With Quote #1

What is the difference between client_disconnect and client_disconnected?

I heard from some people that they both are same and from others they are different.
__________________
CrAzY MaN is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 08-08-2018 , 11:48   Re: [HELP] Difference between client_disconnect and client_disconnected?
Reply With Quote #2

Why don't you (and those saying there's no difference) simply read the documentation?
__________________
klippy is offline
Ghosted
Veteran Member
Join Date: Apr 2015
Location: Georgia
Old 08-08-2018 , 16:10   Re: [HELP] Difference between client_disconnect and client_disconnected?
Reply With Quote #3

As i know client_disconnected is not called on mapchange, it's called when player manually disconnects from the game. i dont recommend to use this but still dont understand why client_disconnect is deprecated in 1.8.3.

In API says:

Code:
This function has been deprecated, do NOT use it

Reason: This function does not catch all cases.
But works fine
__________________

[MOD] CS Weapon Mod V1.7.1
[MM] MetaMod-C V1.0
[MOD] CS NPC Mod (5%)


Probably Left AM

Last edited by Ghosted; 08-08-2018 at 16:13.
Ghosted is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-08-2018 , 17:14   Re: [HELP] Difference between client_disconnect and client_disconnected?
Reply With Quote #4

It's as the documentation says, it doesn't catch all the cases, such as timeout while connecting to the server.

it's the same as _disconnect but with some extra cases. The function is based directly on the SV_DropClient engine function. There are no known bugs around _disconnected.

The bug you're referring has been fixed in jul 2017... (#446). Please test before spreading wrong information.
__________________
Arkshine is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 08-09-2018 , 04:08   Re: [HELP] Difference between client_disconnect and client_disconnected?
Reply With Quote #5

Why does the forward have a new name? If it's superior why not simply replace it? I see no logic behind that choice.
__________________
Black Rose is offline
Old 08-09-2018, 05:32
Ghosted
This message has been deleted by Ghosted. Reason: ...
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-09-2018 , 06:31   Re: [HELP] Difference between client_disconnect and client_disconnected?
Reply With Quote #6

Quote:
Originally Posted by Black Rose View Post
Why does the forward have a new name? If it's superior why not simply replace it? I see no logic behind that choice.
The forward doesn't have the same header. It can tell you whether the game dropped you, and the disconnected message as well. Originally I think client_drop() was introduced but at the end after discussions, it was more appropriate/convenient to replace _disconnect() with another forward with those params.

Quote:
Originally Posted by Ghosted View Post
cause they are different, client_disconnected wont be called on mapchange and also on mapchange all plugin variables are reset and something like nvault wont work.
Why are you still saying that, what's wrong with you?

Quote:
The bug you're referring has been fixed in jul 2017... (#446). Please test before spreading wrong information.
__________________

Last edited by Arkshine; 08-09-2018 at 06:52.
Arkshine is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 08-09-2018 , 07:26   Re: [HELP] Difference between client_disconnect and client_disconnected?
Reply With Quote #7

Quote:
Originally Posted by Arkshine View Post
The forward doesn't have the same header. It can tell you whether the game dropped you, and the disconnected message as well. Originally I think client_drop() was introduced but at the end after discussions, it was more appropriate/convenient to replace _disconnect() with another forward with those params.
I don't see why it was worth breaking all compatibility between 1.8.2 and 1.8.3 for such a reason. Why not just add a native like get_drop_reason() or the ability to use read_argv() or similar function on that forward? I can't imagine anyone actually caring about the reason for the drop other than to print it out for amusement. I'm still gonna do the necessary actions because of that player leaving, data storage for example.
I mean compatibility is important, especially when there are two extremely different versions used wide and all these issues and possible bugs are left to the plugin authors which all have varying coding skill/experience.
I just don't get it. But I guess it's too late to change now.
__________________

Last edited by Black Rose; 08-09-2018 at 07:30.
Black Rose is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-09-2018 , 09:32   Re: [HELP] Difference between client_disconnect and client_disconnected?
Reply With Quote #8

There is no breaking change, client_disconnect() is still there. You will just get a warning if you try to compile with it.

One of the others reasons is that it uses gamedata. When the PR has been made, reHLDS was around but not officially supported yet (a lot were using it already). For such core forward, relying on gamedata by default at this point, it would create unnecessary issues with users. In the end, it was just safer and more convenient overall to create something new.

Well, I'm not saying that was the right answer, we just tried to figure out what would be the best in this context. The params are just extras because passed already in SV_DropClient. It could be useful for some people (someone actually made a plugin: https://forums.alliedmods.net/showth...=SV_DropClient).

I agree, though, replacing totally _disconnect() and having a native would have been an interesting solution. Back then, I'm not sure we (I and Nextra) thought about it, but it would not have been reasonable I believe. We lack people who can give their thoughts, sometimes weird things happen. Like _disconnected() should have been called _disconnecting() since you are still valid there, it's silly, but no one has been triggered, too late now. There are a lot of skilled people around the forum, but almost no ones contribute on Github.
__________________
Arkshine is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 08-09-2018 , 09:41   Re: [HELP] Difference between client_disconnect and client_disconnected?
Reply With Quote #9

The more functions that get deprecated, the more warning the compiler will output when using them. It's not exactly breaking the backwards compatibility, but it sure isn't nice to see all those errors. Maybe we can add an include file that will prevent these errors from happening by using #define to replace the deprecated function with the new one?
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 08-09-2018 , 14:18   Re: [HELP] Difference between client_disconnect and client_disconnected?
Reply With Quote #10

Quote:
Originally Posted by OciXCrom View Post
The more functions that get deprecated, the more warning the compiler will output when using them. It's not exactly breaking the backwards compatibility, but it sure isn't nice to see all those errors.
It's easy, use the 1.8.2 includes.

Quote:
Originally Posted by Arkshine View Post
There is no breaking change, client_disconnect() is still there. You will just get a warning if you try to compile with it.

One of the others reasons is that it uses gamedata. When the PR has been made, reHLDS was around but not officially supported yet (a lot were using it already). For such core forward, relying on gamedata by default at this point, it would create unnecessary issues with users. In the end, it was just safer and more convenient overall to create something new.

Well, I'm not saying that was the right answer, we just tried to figure out what would be the best in this context. The params are just extras because passed already in SV_DropClient. It could be useful for some people (someone actually made a plugin: https://forums.alliedmods.net/showth...=SV_DropClient).

I agree, though, replacing totally _disconnect() and having a native would have been an interesting solution. Back then, I'm not sure we (I and Nextra) thought about it, but it would not have been reasonable I believe. We lack people who can give their thoughts, sometimes weird things happen. Like _disconnected() should have been called _disconnecting() since you are still valid there, it's silly, but no one has been triggered, too late now. There are a lot of skilled people around the forum, but almost no ones contribute on Github.
Sorry for the accusations. If compatibility is not broken it is at least as good as 1.8.2, which is fine.
I know you are working hard to keep this project alive. Keep on keeping on.
__________________

Last edited by Black Rose; 08-09-2018 at 14:28.
Black Rose 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 02:08.


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