OnApartmentRoomBreakInComplete
OnApartmentRoomBreakInComplete is called when a player finishes breaking into an apartment door, after the break-in timer reaches its threshold but before the game applies the result.
object OnApartmentRoomBreakInComplete(ApartmentRoom apartmentRoom, BasePlayer player, ApartmentDoor apartmentDoor)Parameters
| Parameter | Type | Description |
|---|---|---|
apartmentRoom | ApartmentRoom | The ApartmentRoom entity the door belongs to, resolved from the door's ApartmentId. Can be null if the room entity no longer exists, so null-check it before use. |
player | BasePlayer | The BasePlayer who finished the break-in on the apartment door. Use it to message, damage, or otherwise react to the actor. |
apartmentDoor | ApartmentDoor | The ApartmentDoor instance whose CompleteBreakIn method fired the hook. Useful for reading its position, owner, or flag state. |
Return value
Returning null lets the game continue and finish the break-in normally. Returning anything non-null makes the method exit early, so the break-in completion code below the hook (the rented-room check and subsequent door handling) does not run.
How it works
The hook fires inside ApartmentDoor.CompleteBreakIn once the accumulated break-in progress passes roughly 90% of ApartmentCommands.breakinseconds. It runs before the game checks whether the room is currently rented and before any door state change is applied, so it is the last point at which you can still alter the outcome.
The room is looked up from the door's stored ApartmentId, so apartmentRoom may be null if the room entity was removed; check it. player is the actor who completed the break-in, and apartmentDoor is the door that was breached. Because the hook fires on the door method, it triggers for break-ins on apartment doors only, not regular doors.
Declaring a narrower parameter type is possible but rarely useful here since the arguments are already the specific apartment types. Note the injection uses a non-null return to stop the original code path, so any object you return suppresses the normal break-in completion logic entirely.
Example plugin: Alert the owner and log apartment break-ins
using System.Collections.Generic;
using Oxide.Core;
using UnityEngine;
namespace Oxide.Plugins
{
[Info("ApartmentBreakInAlert", "RustPluginGenerator", "1.0.0")]
[Description("Alerts apartment owners and staff when a break-in on an apartment door completes.")]
public class ApartmentBreakInAlert : RustPlugin
{
private const string PermStaff = "apartmentbreakinalert.staff";
private void Init()
{
permission.RegisterPermission(PermStaff, this);
}
protected override void LoadDefaultMessages()
{
lang.RegisterMessages(new Dictionary<string, string>
{
["OwnerAlert"] = "{0} just broke into your apartment!",
["StaffAlert"] = "Apartment break-in: {0} ({1}) completed a break-in on room {2}."
}, this);
}
private string Msg(string key, string userId = null, params object[] args)
{
return string.Format(lang.GetMessage(key, this, userId), args);
}
private object OnApartmentRoomBreakInComplete(ApartmentRoom apartmentRoom, BasePlayer player, ApartmentDoor apartmentDoor)
{
if (apartmentRoom == null || player == null || apartmentDoor == null)
return null;
ulong ownerId = apartmentRoom.OwnerID;
ulong roomId = apartmentRoom.net != null ? apartmentRoom.net.ID.Value : 0UL;
if (ownerId != 0UL)
{
BasePlayer owner = BasePlayer.FindAwakeOrSleeping(ownerId.ToString());
if (owner != null && owner.IsConnected)
owner.ChatMessage(Msg("OwnerAlert", owner.UserIDString, player.displayName));
}
NotifyStaff(player, roomId);
return null;
}
private void NotifyStaff(BasePlayer breaker, ulong roomId)
{
foreach (BasePlayer staff in BasePlayer.activePlayerList)
{
if (staff == null || staff == breaker || !staff.IsConnected)
continue;
if (!permission.UserHasPermission(staff.UserIDString, PermStaff))
continue;
staff.ChatMessage(Msg("StaffAlert", staff.UserIDString, breaker.displayName, breaker.UserIDString, roomId));
}
}
}
}The plugin reacts to finished apartment break-ins by notifying the room owner and recording the event. On the hook it null-checks the room and player, looks up the room owner's ID, and sends the owner a localized chat message if they are online. It also broadcasts to staff with the apartmentbreakinalert.staff permission so admins see who broke in and where. All player-facing text goes through the language file, and the hook returns null so the game finishes the break-in exactly as it normally would. No timers or data files are needed, so the plugin stays small and safe.
Common use cases
Notify the room owner
Message the owner when someone breaks into their rented apartment so they can respond or check their stored items.
Staff audit trail
Send a detailed alert to admins with permission so suspicious break-in activity can be reviewed during an event or raid.
Log to console for records
Print a concise line for each completed break-in, with the player name and room, for later comparison with reports.
Pitfalls
apartmentRoom can be null
The room is resolved from the door's stored ID and may be missing if the entity was removed. Always null-check before reading owner or rental state.
Returning a value blocks the break-in
Because the injection stops the original path on any non-null return, do not return a value unless you deliberately want to suppress the normal completion logic.
Owner may be offline
The room owner is often offline; guard ChatMessage with an online check or route the notification through staff alerts instead.
Build a plugin with OnApartmentRoomBreakInComplete
Describe what should happen and get a compiled plugin that uses this hook.
Edit the prompt on the next screen. 2 free plugins a month, no card.
Last updated Oct 26, 2026. Found a mistake? Email support@rustplugingenerator.com.
Build a plugin with OnApartmentRoomBreakInComplete
Generate