RustTip

OnMapMarkerRemove

OxideCarbonPlayer

Called when a map marker is removed.

object OnMapMarkerRemove(BasePlayer basePlayer, List<ProtoBuf.MapNote> pointsOfInterest, int int32)
Works — the game method in this build is the one the hook was written for.

Parameters

basePlayer
BasePlayer
pointsOfInterest
List<ProtoBuf.MapNote>
int32
int

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 OnMapMarkerRemove(BasePlayer basePlayer, List<ProtoBuf.MapNote> pointsOfInterest, int int32)
{
    Puts("OnMapMarkerRemove");

    // 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 BasePlayer.Server_RemovePointOfInterest(BaseEntity.RPCMessage)

Passes: BasePlayer basePlayer, List<ProtoBuf.MapNote> pointsOfInterest, int int32

WorksReturnBehavior: ExitWhenValidTypeArgumentBehavior: UseArgumentString (this, this.State.pointsOfInterest, l0)Assembly-CSharp.dll

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

[RPC_Server]
[RPC_Server.FromOwner]
[RPC_Server.CallsPerSecond(10uL)]
public void Server_RemovePointOfInterest(RPCMessage msg)
{
	int num = msg.read.Int32();
	if (State.pointsOfInterest != null && State.pointsOfInterest.Count > num && num >= 0)
	{
		if (Interface.CallHook("OnMapMarkerRemove", this, this.State.pointsOfInterest, num) != null)
		{
			return;
		}
		State.pointsOfInterest[num].Dispose();
		State.pointsOfInterest.RemoveAt(num);
		DirtyPlayerState();
		SendMarkersToClient();
		TeamUpdate();
// …

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.