IOnUserApprove
OxidePlayerInternal Oxide/Carbon core hook — in a plugin use CanClientLogin, CanUserLogin, OnUserApprove, OnUserApproved
object IOnUserApprove(Network.Connection connection)Method changed — check — the game method differs from the one the hook is recorded for in Oxide. The hook is still called, but its place may have shifted — worth checking after an update.
Parameters
- connection
- Network.Connection
Return value
objectReturn a value of the method's result type and the game returns it immediately; null continues as usual.
Example
object — you can affect the game: return a value to change or cancel the action.
private object IOnUserApprove(Network.Connection connection)
{
Puts("IOnUserApprove");
// change nothing — the game continues as usual
return null;
// to affect the game:
// return null; // null — the game continues as usual
}Works in both Oxide and Carbon: Carbon loads Oxide plugins as is.
Injection point
Rust.opj (Oxide)
void ConnectionAuth.OnNewConnection(Network.Connection)
Passes: Network.Connection connection
Method changed — checkReturnBehavior: 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.