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

[New] client_disconnected forward


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 10-26-2016 , 16:38   [New] client_disconnected forward
Reply With Quote #1

PHP Code:
/**
 * Called when a client is disconnected from the server.
 *
 * @note This will be called in some additional cases that client_disconnect doesn't cover, 
 *       most notably when a client aborts the connection process. It is guaranteed to pair 
 *       with the client_connect() forward.
 * @note By this point it is already too late to do anything that directly
 *       affects the client.
 *
 * @param id         Client index
 * @param drop       If true, client has been explicitly dropped by game
 * @param message    If drop is true, a disconnected message or buffer to copy a new message to
 * @param maxlen     Maximum size of buffer
 *
 * @noreturn
 */
forward client_disconnected(idbool:dropmessage[], maxlen); 
Witch are the possible reasons messages given by this forward?

And what is the diference by drop parameter (Client kicked or not?) Someone can clarify this?

n1ce new forward anyway. Thanks
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
Depresie
Veteran Member
Join Date: Nov 2013
Old 10-26-2016 , 17:43   Re: [New] client_disconnected forward
Reply With Quote #2

I also noticed client_connected, but didn't check the documentation ( if there is any, but i doubt )

A topic with the changes in the dev version would be nice ( idk how many times i said this already ) lol
__________________
Depresie is offline
Solokiller
Senior Member
Join Date: Sep 2015
Old 10-26-2016 , 17:58   Re: [New] client_disconnected forward
Reply With Quote #3

I checked the AMX source, it's called for these reasons:

Server is deactivating, players not disconnecting at this point are disconnected: https://github.com/alliedmodders/amx...a_api.cpp#L684
For listen servers, the host normally doesn't trigger this, so this catches that edge case.

Client has disconnected, engine notifies server: https://github.com/alliedmodders/amx...a_api.cpp#L874

Client is being dropped: https://github.com/alliedmodders/amx...a_api.cpp#L907

The last one uses a hack to override the engine's SV_DropClient function so AMX Mod is informed of it. IIRC, it's called when players are dropped by the engine for any reason not covered by the former 2, like ClientConnect rejecting the connection.

The message that is passed in is the message that will be presented to the client, but from what i'm seeing here you can modify that message in the forward.
Solokiller is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 10-26-2016 , 18:04   Re: [New] client_disconnected forward
Reply With Quote #4

Quote:
Originally Posted by Depresie View Post
I also noticed client_connected, but didn't check the documentation ( if there is any, but i doubt )

A topic with the changes in the dev version would be nice ( idk how many times i said this already ) lol
https://github.com/alliedmodders/amx...%3Acreated-asc
Here is every branch merged into 1.8.3, sorted from oldest to newest. You just needed to do a quick search.
klippy is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 10-26-2016 , 20:22   Re: [New] client_disconnected forward
Reply With Quote #5

Quote:
Originally Posted by KliPPy View Post
https://github.com/alliedmodders/amx...%3Acreated-asc
Here is every branch merged into 1.8.3, sorted from oldest to newest. You just needed to do a quick search.
Bro you need to remember that we have a community here, my doubt can be the same from all other users that use this function.

not all people here understand developer discussion anyway.

Update: I will try on hlds and test what happens in every situation.

Thanks.
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 

Last edited by ^SmileY; 10-26-2016 at 20:28.
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 10-26-2016 , 20:34   Re: [New] client_disconnected forward
Reply With Quote #6

Quote:
Originally Posted by ^SmileY View Post
Bro you need to remember that we have a community here, my doubt can be the same from all other users that use this function.

not all people here understand developer discussion anyway.
I didn't particularly talk about this function. This is what I specifically replied to:
Quote:
A topic with the changes in the dev version would be nice ( idk how many times i said this already ) lol

Last edited by klippy; 10-26-2016 at 20:34.
klippy is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 10-26-2016 , 21:18   Re: [New] client_disconnected forward
Reply With Quote #7

Quote:
Originally Posted by KliPPy View Post
I didn't particularly talk about this function. This is what I specifically replied to:
Yes i know

I tested on local hlds, forward did not called when player close the game window directly for example (ALT + F4), since the player still online in server O.o

Edit: Look that, seems to be when the player close the game window server will call Time Out after pass sv_timeout seconds

[IMG]
http://i.imgur.com/qIhT52A.png
[/IMG]
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 

Last edited by ^SmileY; 10-26-2016 at 21:20.
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
Solokiller
Senior Member
Join Date: Sep 2015
Old 10-27-2016 , 03:33   Re: [New] client_disconnected forward
Reply With Quote #8

Alt F4 is supposed to shut down programs without doing normal shutdown stuff, so that makes sense.
Solokiller 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 23:10.


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