Garry's Mod Wiki

client_disconnect

Description

Called when the client is disconnecting from the server.

Only called clientside for the disconnecting Player.
message - will be an empty String if the client intentionally disconnects from the server.
This is called multiple times in the Menu state when connecting to a server.

Members

string message
The disconnecting reason. Can be an empty String

Examples

Example

This is a basic template with the purpose of including all arguments / table variables to make it easily known which values can be accessed.

gameevent.Listen( "client_disconnect" ) hook.Add( "client_disconnect", "client_disconnect_example", function( data ) local message = data.message // The reason of the // Called when the client is disconnecting from the server. end )