RustTip

OnMapMarkerAdd

OxideCarbonPlayer

Called when a map marker is added.

object OnMapMarkerAdd(Network.NetRead read, object arg1)
Works — the game method in this build is the one the hook was written for.

Parameters

read
Network.NetRead
arg1
object

Return value

objectThe result is checked in a special way — see the call code below.

Example

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

private object OnMapMarkerAdd(Network.NetRead read, object arg1)
{
    Puts("OnMapMarkerAdd");

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

Passes: Network.NetRead read, object arg1

WorksReturnBehavior: CustomAssembly-CSharp.dll

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

[RPC_Server]
[RPC_Server.FromOwner]
[RPC_Server.CallsPerSecond(8uL)]
public void Server_AddMarker(RPCMessage msg)
{
	object result = Interface.CallHook("OnMapMarkerAdd", msg.read, null.Proto[Rust.Data());
	// … проверка результата (Modify-хук, см. Rust.opj)
	if (!CanUseMapMarkers)
	{
		return;
	}
	if (State.pointsOfInterest == null)
	{
		State.pointsOfInterest = Facepunch.Pool.Get<List<MapNote>>();
// …

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.