Garry's Mod Wiki

Revision Difference

GM:PlayerDisconnected#511092

<function name="PlayerDisconnected" parent="GM" type="hook">⤶ <ishook>yes</ishook>⤶ <description>⤶ Called when a player leaves the server. See the [player_disconnect gameevent](/gmod/Game_Events) for a shared version of this hook.⤶ ⤶ <bug issue="3523">This is not called in single-player or listen servers for the host.</bug>⤶ </description>⤶ <realm>Server</realm>⤶ <predicted>No</predicted>⤶ <args>⤶ <arg name="ply" type="Player">the player</arg>⤶ </args>⤶ </function>⤶ ⤶ <example>⤶ <description>Print a message to the chatbox upon player disconnect</description>⤶ <code>⤶ function GM:PlayerDisconnected( ply )⤶ PrintMessage( HUD_PRINTTALK, ply:Name().. " has left the server." )⤶ end⤶ </code>⤶ <output>Garry :D has left the server.</output>⤶ ⤶ </example>