Gamemode.PlayerDisconnected

From GMod Wiki

Jump to: navigation, search
Event Hook
Hook NamePlayerDisconnected
SyntaxGM:PlayerDisconnected( Player Player )
DescriptionCalled whenever a player disconnects.
ReturnsNil
Lua StateNewerServer.png
BBCode[b][url=wiki.garrysmod.com/?title=Gamemode.PlayerDisconnected]Gamemode.PlayerDisconnected [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]


DescriptionNotifies all players that the disconnected player has left the server.
Used onNewerServer.png
Code
function fPlayerDisconnect( ply )
	// Print to chat that a player has disconnected from the server.
	PrintMessage( HUD_PRINTTALK, ply:GetName() .. " has left the server." )
end
// Add PlayerDisconnected hook that calls our function.
hook.Add( "PlayerDisconnected", "playerdisconnected", fPlayerDisconnect )
Output"FatBoBo has left the server" in chat.


Additional Notes

See Also


Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox