AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [HELP] Difference between client_disconnect and client_disconnected? (https://forums.alliedmods.net/showthread.php?t=309823)

CrAzY MaN 08-08-2018 11:39

[HELP] Difference between client_disconnect and client_disconnected?
 
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.

klippy 08-08-2018 11:48

Re: [HELP] Difference between client_disconnect and client_disconnected?
 
Why don't you (and those saying there's no difference) simply read the documentation?

Ghosted 08-08-2018 16:10

Re: [HELP] Difference between client_disconnect and client_disconnected?
 
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

Arkshine 08-08-2018 17:14

Re: [HELP] Difference between client_disconnect and client_disconnected?
 
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.

Black Rose 08-09-2018 04:08

Re: [HELP] Difference between client_disconnect and client_disconnected?
 
Why does the forward have a new name? If it's superior why not simply replace it? I see no logic behind that choice.

Arkshine 08-09-2018 06:31

Re: [HELP] Difference between client_disconnect and client_disconnected?
 
Quote:

Originally Posted by Black Rose (Post 2609223)
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 (Post 2609234)
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.

Black Rose 08-09-2018 07:26

Re: [HELP] Difference between client_disconnect and client_disconnected?
 
Quote:

Originally Posted by Arkshine (Post 2609240)
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.

Arkshine 08-09-2018 09:32

Re: [HELP] Difference between client_disconnect and client_disconnected?
 
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.

OciXCrom 08-09-2018 09:41

Re: [HELP] Difference between client_disconnect and client_disconnected?
 
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?

Black Rose 08-09-2018 14:18

Re: [HELP] Difference between client_disconnect and client_disconnected?
 
Quote:

Originally Posted by OciXCrom (Post 2609273)
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 (Post 2609271)
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.


All times are GMT -4. The time now is 12:19.

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