RustTip

OnPlayerKicked

OxideCarbonPlayer

Called when a player is kicked.

void OnPlayerKicked(BasePlayer basePlayer, string reason, bool reserveSlot)
void OnPlayerKicked(Network.Connection connection, object ToString())
Работает — метод игры в этой сборке тот же, под который написан хук.

Параметры

basePlayer
BasePlayer
reason
string
reserveSlot
bool

Возвращаемое значение

voidВозвращаемое значение игнорируется — хук только уведомляет.

Пример

private void OnPlayerKicked(BasePlayer basePlayer, string reason, bool reserveSlot)
{
    Puts("OnPlayerKicked");
}

Работает и в Oxide, и в Carbon: Carbon загружает плагины Oxide без изменений.

Место встраивания 1

Rust.opj (Oxide)
void BasePlayer.Kick(string, bool)

Передаёт: BasePlayer basePlayer, string reason, bool reserveSlot

РаботаетReturnBehavior: ContinueArgumentBehavior: AllAssembly-CSharp.dll

Место встраивания 2

Rust.opj (Oxide)
void EACServer.OnClientActionRequired(ref Epic.OnlineServices.AntiCheatCommon.OnClientActionRequiredCallbackInfo)

Передаёт: Network.Connection connection, object ToString()

РаботаетReturnBehavior: ContinueArgumentBehavior: UseArgumentString (l2, l3.ToString())Assembly-CSharp.dll

Где вызывается (код игры этой ветки)

// …
if (connection.IsDevelopmentBuild())
{
	Debug.LogWarning("[EAC] Remove player action skipped for unprotected client: " + connection.ToString());
	return;
}
Debug.Log($"[EAC] Kicking {connection.userid} / {connection.username} ({actionReasonDetailsString})");
connection.authStatusEAC = "eac";
Network.Net.sv.Kick(connection, "EAC: " + actionReasonDetailsString);
Interface.CallHook("OnPlayerKicked", connection, actionReasonDetailsString.ToString());
if (data.ActionReasonCode == AntiCheatCommonClientActionReason.PermanentBanned || data.ActionReasonCode == AntiCheatCommonClientActionReason.TemporaryBanned)
{
	connection.authStatusEAC = "eacbanned";
	ConsoleNetwork.BroadcastToAllClients("chat.add", 2, 0, "<color=#fff>SERVER</color> Kicking " + connection.username + " (banned by anticheat)");
	if (data.ActionReasonCode == AntiCheatCommonClientActionReason.PermanentBanned)
	{
		Entity.DeleteBy(connection.userid);
	}
// …

Источники: Rust.opj из OxideMod/Oxide.Rust (MIT) и метаданные хуков документации Carbon (MIT). Код методов — декомпиляция сервера этой ветки.