OnUserApprove
OxideCarbonPlayerCalled when user approve occurs.
void OnUserApprove(Network.Connection connection)Works — the game method in this build is the one the hook was written for.
Parameters
- connection
- Network.Connection
Return value
voidBehaviour is not described.
Example
private void OnUserApprove(Network.Connection connection)
{
Puts("OnUserApprove");
}Works in both Oxide and Carbon: Carbon loads Oxide plugins as is.
Where it is called
Oxide core (Oxide.Rust)
RustCore::IOnUserApprove(Connection connection)
Oxide core code — the hook is called from here
// …
object canLogin = loginSpecific is null ? loginCovalence : loginSpecific;
if (canLogin is string || canLogin is bool loginBlocked && !loginBlocked)
{
ConnectionAuth.Reject(connection, canLogin is string ? canLogin.ToString() : lang.GetMessage("ConnectionRejected", this, connectionId));
return true;
}
// Call hooks for plugins
object approvedSpecific = Interface.CallHook("OnUserApprove", connection);
object approvedCovalence = Interface.CallHook("OnUserApproved", playerName, connectionId, connectionIp);
return approvedSpecific is null ? approvedCovalence : approvedSpecific;
}Injection point
Rust.opj (Oxide)
void ConnectionAuth.OnNewConnection(Network.Connection)
Injected internal hook IOnUserApprove — this hook is called by its handler in the Oxide/Carbon core
WorksReturnBehavior: ExitWhenValidTypeArgumentBehavior: UseArgumentString (a0)Assembly-CSharp.dll
Where it is called (this branch's game code)
// …
DebugEx.Log(connection.ToString() + " has auth level 2");
connection.authLevel = 2u;
}
if (DeveloperList.Contains(connection.userid))
{
DebugEx.Log(connection.ToString() + " is a developer");
connection.authLevel = 3u;
}
if (Interface.CallHook("IOnUserApprove", connection) != null)
{
return;
}
m_AuthConnection.Add(connection);
StartCoroutine(AuthorisationRoutine(connection));
}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.