Plugin API
This document outlines the methods and hooks available in the plugin API for managing player actions and server events.
Methods
RA_BanPlayer
Bans a player from the server.
void RA_BanPlayer(string steam_id, string reason, string duration, bool global, bool ban_ip, string comment = "")
- Parameters:
steam_id
: The player's Steam ID.reason
: The reason for the ban.duration
: The duration of the ban (e.g., "1h", "1d", "permanent").global
: Whether the ban applies globally across servers.ban_ip
: Whether to ban the player's IP address.comment
: Optional comment for the ban (default: empty string).
RustApp_PlayerMuteCreate
Mutes a player in chat.
void RustApp_PlayerMuteCreate(string targetSteamId, string reason, string duration, string comment, string referenceMessageText, bool broadcast)
- Parameters:
targetSteamId
: The Steam ID of the player to mute.reason
: The reason for the mute.duration
: The duration of the mute (e.g., "1h", "1d").comment
: Additional comment for the mute.referenceMessageText
: Reference text for the muted message.broadcast
: Whether to broadcast the mute to other players.
RA_DirectMessageHandler
Saves a player's direct message.
void RA_DirectMessageHandler(string from, string to, string message)
- Parameters:
from
: The Steam ID of the sender.to
: The Steam ID of the recipient.message
: The content of the message.
RA_ReportSend
Submits a report against a player.
void RA_ReportSend(string initiator_steam_id, string target_steam_id, string reason, string message = "")
- Parameters:
initiator_steam_id
: The Steam ID of the player submitting the report.target_steam_id
: The Steam ID of the reported player.reason
: The reason for the report.message
: Optional additional details (default: empty string).
Hooks
RustApp_IsInRaid
Called to check if a player is raid-blocked.
object RustApp_IsInRaid(ulong userId)
{
// Implement logic to determine if the player is raid-blocked
return false; // Return true if raid-blocked, false otherwise
}
- Parameters:
userId
: The player's user ID.
- Returns:
true
if the player is raid-blocked,false
otherwise.
RustApp_CanIgnoreCheck
Called before displaying a check notification. If non-null
is returned, the notification is suppressed.
object RustApp_CanIgnoreCheck(BasePlayer player)
{
// Example: Prevent check notification for a specific player
if (player.UserIDString == "YourSteamID64")
{
return false; // Suppresses the notification
}
return null; // Allows the notification
}
- Parameters:
player
: The player being checked.
- Returns: Non-
null
to suppress the notification,null
to allow it.
RustApp_CanIgnoreReport
Called before processing a report. If non-null
is returned, the report is ignored.
object RustApp_CanIgnoreReport(string target_steam_id, string initiator_steam_id)
{
// Example: Prevent reports against a specific player
if (target_steam_id == "YourSteamID64")
{
return false; // Ignores the report
}
return null; // Allows the report
}
- Parameters:
target_steam_id
: The Steam ID of the reported player.initiator_steam_id
: The Steam ID of the player submitting the report.
- Returns: Non-
null
to ignore the report,null
to process it.
RustApp_CanIgnoreBan
Called before checking for bans. If non-null
is returned, ban checks are skipped.
object RustApp_CanIgnoreBan(string steam_id)
{
// Example: Allow a specific player to bypass ban checks
if (steam_id == "YourSteamID64")
{
return false; // Skips ban checks
}
return null; // Performs ban checks
}
- Parameters:
steam_id
: The Steam ID of the player.
- Returns: Non-
null
to skip ban checks,null
to perform them.
RustApp_CanOpenReportUI
Called before opening the report UI. If non-null
is returned, the UI is not opened.
object RustApp_CanOpenReportUI(BasePlayer player)
{
// Example: Open a custom report UI instead
// OpenMyOwnReportSystemUI(player);
return false; // Prevents default UI from opening
}
- Parameters:
player
: The player attempting to open the report UI.
- Returns: Non-
null
to prevent the default UI,null
to allow it.
RustApp_OnCheckNoticeShowed
Triggered when a check notification is displayed.
void RustApp_OnCheckNoticeShowed(BasePlayer player)
{
Server.Broadcast($"{player.displayName} has been called for a check!");
}
- Parameters:
player
: The player receiving the check notification.
RustApp_OnCheckNoticeHidden
Triggered when a check notification is hidden.
void RustApp_OnCheckNoticeHidden(BasePlayer player)
{
Server.Broadcast($"{player.displayName}'s check has been completed!");
}
- Parameters:
player
: The player whose check notification was hidden.
RustApp_OnPaidAnnounceBan
Triggered when a player is banned. Includes a list of players who reported them.
void RustApp_OnPaidAnnounceBan(BasePlayer player, string steam_id, List<string> initiators)
{
Server.Broadcast($"Player {player.displayName} has been banned! They had {initiators.Count} reports!");
}
- Parameters:
player
: The banned player.steam_id
: The Steam ID of the banned player.initiators
: List of Steam IDs of players who reported the banned player.
RustApp_OnPaidAnnounceClean
Triggered when a player is checked and found clean. Includes a list of players who reported them.
void RustApp_OnPaidAnnounceClean(BasePlayer player, string steam_id, List<string> initiators)
{
Server.Broadcast($"Player {player.displayName} was checked and found clean! They had {initiators.Count} reports!");
}
- Parameters:
player
: The checked player.steam_id
: The Steam ID of the checked player.initiators
: List of Steam IDs of players who reported the checked player.