RustTip

OnTeamKick

OxideCarbonTeam

Called when a team kicks.

object OnTeamKick(RelationshipManager.PlayerTeam local1, BasePlayer local0, ulong local2)
Works — the game method in this build is the one the hook was written for.

Parameters

local1
RelationshipManager.PlayerTeam
local0
BasePlayer
local2
ulong

Return value

objectReturn non-null to cancel the game action.

Example

object — you can affect the game: return a value to change or cancel the action.

private object OnTeamKick(RelationshipManager.PlayerTeam local1, BasePlayer local0, ulong local2)
{
    Puts("OnTeamKick");

    // change nothing — the game continues as usual
    return null;

    // to affect the game:
    // return false; // non-null cancels the game action
}

Works in both Oxide and Carbon: Carbon loads Oxide plugins as is.

Injection point

Rust.opj (Oxide)
void RelationshipManager.kickmember(ConsoleSystem.Arg)

Passes: RelationshipManager.PlayerTeam local1, BasePlayer local0, ulong local2

WorksReturnBehavior: ExitWhenValidTypeArgumentBehavior: UseArgumentString (l1, l0, l2)Assembly-CSharp.dll

Where it is called (this branch's game code)

// …
		return;
	}
	PlayerTeam playerTeam = ServerInstance.FindTeam(basePlayer.currentTeam);
	if (playerTeam != null && !(playerTeam.GetLeader() != basePlayer))
	{
		ulong uLong = arg.GetULong(0, 0uL);
		if ((ulong)basePlayer.userID != uLong)
		{
			if (Interface.CallHook("OnTeamKick", playerTeam, basePlayer, uLong) != null)
			{
				return;
			}
			playerTeam.RemovePlayer(uLong);
		}
	}
}

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.