OnClientDisconnected
OxideCarbonPlayerCalled when a client disconnects.
void OnClientDisconnected(Network.Connection cn, string strReason)Works — the game method in this build is the one the hook was written for.
Parameters
- cn
- Network.Connection
- strReason
- string
Return value
voidThe return value is ignored — the hook only notifies.
Example
private void OnClientDisconnected(Network.Connection cn, string strReason)
{
Puts("OnClientDisconnected");
}Works in both Oxide and Carbon: Carbon loads Oxide plugins as is.
Injection point
Rust.opj (Oxide)
void Network.Server.OnDisconnected(string, Network.Connection)
Passes: Network.Connection cn, string strReason
WorksReturnBehavior: ContinueArgumentBehavior: UseArgumentString (a1, a0)Facepunch.Network.dll
Where it is called (this branch's game code)
// …
if (cn != null)
{
cn.connected = false;
cn.active = false;
if (callbackHandler != null)
{
callbackHandler.OnDisconnected(strReason, cn);
}
Interface.CallHook("OnClientDisconnected", cn, strReason);
RemoveConnection(cn);
}
}Sources: Rust.opj from OxideMod/Oxide.Rust (MIT) and hook metadata of the Carbon documentation (MIT). Method code is decompiled from this branch's server.