### CedMod Server Setup Command Source: https://context7.com/cedmodv2/cedmod/llms.txt Configures the server connection to the CedMod panel using an API key. It contacts the CedMod API, retrieves a QuerySystemKey, saves these credentials, and restarts the server to establish a WebSocket connection. This command is executed from the server console. ```csharp // Execute setup command from server console // Command format: setupcedmod {apikey} [optional_token] // In-game console usage: // setupcedmod abc123def456ghi789 // With optional token for multi-server setup: // setupcedmod abc123def456ghi789 servertoken123 // Command flow: // 1. Contacts CedMod API with provided key // 2. Retrieves QuerySystemKey for WebSocket authentication // 3. Saves API key to plugin config (config.yml or EXILED config) // 4. Saves QuerySystemKey to CedMod/QuerySystemSecretKey-{port}.txt // 5. Restarts server to establish WebSocket connection // Response example: // "CedMod has been setup, using the identifier: Server-Production-01 // The server will now be restarted" ``` -------------------------------- ### Admin Sit System - Create Isolated Admin-Player Interaction (C#) Source: https://context7.com/cedmodv2/cedmod/llms.txt Demonstrates how to create isolated virtual rooms for admin-player interactions using the AdminSitSystem. This example shows setting up an admin sit, associating it with a report, managing player states, and teleporting players to the isolated location. It includes options for automatically banning offenders upon leaving the sit. ```csharp // Admin sits are virtual rooms for handling reports and moderation using CedMod.Addons.AdminSitSystem; using UnityEngine; public class AdminSitExample { public void CreateAdminSit(Player staff, Player offender) { // Get available sit location var location = AdminSitHandler.Singleton.AdminSitLocations .FirstOrDefault(l => !l.InUse); if (location == null) { // All 3 sit locations occupied return; } location.InUse = true; var sit = new AdminSit { Id = System.Guid.NewGuid().ToString(), AssociatedReportId = 12345, // Report ID from panel InitialDuration = 0, InitialReason = "Investigation", Location = location, // Isolated position in sky Type = AdminSitType.BanOffenderOnLeave, // Auto-ban if offender leaves Players = new List { new AdminSitPlayer { Player = staff, PlayerType = AdminSitPlayerType.Handler, UserId = staff.UserId, // Original state saved for restoration Position = staff.Position, Role = staff.Role, Health = staff.Health, Items = new Dictionary(staff.ReferenceHub.inventory.UserInventory.Items), Ammo = new Dictionary(staff.ReferenceHub.inventory.UserInventory.ReserveAmmo) }, new AdminSitPlayer { Player = offender, PlayerType = AdminSitPlayerType.Offender, UserId = offender.UserId, Position = offender.Position, Role = offender.Role, Health = offender.Health, Items = new Dictionary(offender.ReferenceHub.inventory.UserInventory.Items), Ammo = new Dictionary(offender.ReferenceHub.inventory.UserInventory.ReserveAmmo) } } }; AdminSitHandler.Singleton.Sits.Add(sit); // Both players teleported to sit location (sky positions) // Set to Tutorial role to prevent interference staff.SetRole(RoleTypeId.Tutorial, RoleChangeReason.RemoteAdmin); offender.SetRole(RoleTypeId.Tutorial, RoleChangeReason.RemoteAdmin); staff.Position = location.SpawnPosition; offender.Position = location.SpawnPosition + new Vector3(3, 0, 0); // If offender leaves before sit resolution and Type is BanOffenderOnLeave: // Automatic ban issued with duration and reason from InitialDuration/InitialReason } } // Available sit locations (isolated sky positions): // 1. Vector3(38.558f, 314.676f, -32.289f) // 2. Vector3(130.847f, 294.308f, 21.027f) // 3. Vector3(161.468f, 319.952f, -13.727f) ``` -------------------------------- ### Make Authenticated GET Request to CedMod API Source: https://context7.com/cedmodv2/cedmod/llms.txt This C# function demonstrates how to make an authenticated GET request to the CedMod API to retrieve player ban status. It automatically includes necessary headers like server IP and API key. The function expects a dictionary containing 'success', 'vpn', 'isbanned', and 'preformattedmessage' in its response. ```csharp using CedMod; using System.Collections.Generic; using System.Threading.Tasks; public async Task> GetPlayerBanStatus(string userId) { // API automatically includes server IP and API key headers var response = await API.APIRequest( endpoint: "Auth/", arguments: $"{userId}", returnstring: false, type: "GET" ); // Returns dictionary with keys: success, vpn, isbanned, preformattedmessage if (response is Dictionary result) { return result; } return null; } ``` -------------------------------- ### Issue Synchronized Player Bans Source: https://context7.com/cedmodv2/cedmod/llms.txt This C# function shows how to ban a player using CedMod's API, ensuring the ban is synchronized across multiple servers and reflected in the CedMod panel. It supports specifying duration, reason, and whether to broadcast the ban to all players. It also includes an example for banning offline players by UserID. ```csharp // Ban player with duration, reason, and automatic broadcast using CedMod; using LabApi.Features.Wrappers; using System.Threading.Tasks; public async Task BanPlayerExample(Player target) { // Duration in seconds (7 days = 604800 seconds) long durationSeconds = 604800; string adminName = "AdminUsername"; string reason = "Repeated teamkilling"; bool broadcastBan = true; // Automatically syncs to CedMod panel and disconnects player await API.Ban( player: target, duration: durationSeconds, sender: adminName, reason: reason, bc: broadcastBan ); // Player is killed, disconnected, and ban is written to panel // Falls back to local cache if API unavailable // Broadcasts configured message to all players if bc is true } // Ban offline player by UserID public async Task BanOfflinePlayer(string userId) { await API.BanId( UserId: userId, duration: 2592000, // 30 days in seconds sender: "System", reason: "Alt account abuse", bc: false ); } ``` -------------------------------- ### Send WebSocket Commands to CedMod Panel (C#) Source: https://context7.com/cedmodv2/cedmod/llms.txt This C# code demonstrates how to send commands to the CedMod panel via the WebSocket Query System. It requires the QuerySystemKey file and establishes a real-time communication channel for actions like issuing bans. ```csharp // WebSocket connection automatically established on server start // Requires QuerySystemKey file present in CedMod folder using CedMod.Addons.QuerySystem.WS; using System.Collections.Generic; public class WebSocketExample { public void SendCommandToPanel(string message, Dictionary data) { var command = new QueryCommand { Recipient = "PANEL", // Target: PANEL, QUERYSERVER, or specific identifier Data = data }; // Enqueue for transmission over WebSocket WebSocketSystem.Enqueue(command); // Example: Notify panel of ban issued WebSocketSystem.Enqueue(new QueryCommand { Recipient = "PANEL", Data = new Dictionary { { "Message", "BANISSUED" }, { "UserId", "76561198123456789@steam" } } }); } // WebSocket connection details: // - Uses SSL by default (configurable via QuerySystem.UseSSL) // - Connects to QuerySystem.CurrentMaster (panelapi.cedmod.nl) // - Authenticated via QuerySystemKey from setup command // - Auto-reconnects on connection loss (unless Reconnect = false) // - Sends heartbeats to maintain connection } // Panel can send commands to server via WebSocket: // - Player kick/ban/mute commands // - Server configuration updates // - Permission refreshes // - Event management commands ``` -------------------------------- ### Audio Broadcasting System Commands (C#) Source: https://context7.com/cedmodv2/cedmod/llms.txt Provides a set of commands for managing server-wide audio playback. These commands allow for the creation of virtual players, attaching them to real players, enqueuing audio files, controlling playback, adjusting volume, toggling looping, changing broadcast channels, and destroying audio players. ```csharp // Create fake player for audio broadcasting // Command from remote admin: audio fake 1000 // Creates dummy player with ID 1000 // Attach audio player to real player // Command: audio attach {playerId} // Uses existing player as audio source // Enqueue audio file from CedMod panel // Command: audio enqueue 1000 alarm_sound // Adds "alarm_sound" to playback queue // Play audio at queue index // Command: audio play 1000 0 // Starts playback at index 0 // Set volume (0-100) // Command: audio volume 1000 75 // Toggle looping // Command: audio loop 1000 // Enables/disables loop mode // Change broadcast channel // Command: audio audiochannel 1000 Intercom // Options: Proximity, Radio, ScpChat, Spectator, RoundSummary, Intercom // Destroy audio player // Command: audio destroy 1000 // Removes dummy player and stops playback ``` -------------------------------- ### CedMod In-Game Event Management Commands Source: https://context7.com/cedmodv2/cedmod/llms.txt Provides commands for the remote admin console to manage custom server events. These commands allow listing available events, enabling or disabling them, queuing them for the next round, and bumping them to the front of the queue. ```text // List all available events // Command: events list // Output: // Available Events: // 1. Zombie Apocalypse by ServerOwner (ZOMBIE) - Status: Enabled // 2. Hide and Seek by ModTeam (HNS) - Status: Disabled // Enable event // Command: events enable ZOMBIE // Output: "Zombie Apocalypse event has been enabled" // Queue event for next round // Command: events queue ZOMBIE // Output: "Zombie Apocalypse queued for next round" // Event automatically starts when round begins // Bump event to front of queue // Command: events bump ZOMBIE // Output: "Zombie Apocalypse moved to front of queue" // Disable event // Command: events disable ZOMBIE // Output: "Zombie Apocalypse event has been disabled" ``` -------------------------------- ### CedMod Plugin Configuration Structure (C#) Source: https://context7.com/cedmodv2/cedmod/llms.txt This C# code defines the structure for CedMod plugin configuration, including API settings, friendly fire autoban options, mute system parameters, anti-cheat features, update settings, and miscellaneous options. Configuration files are located at LabAPI: {PluginConfigFolder}/config.yml or EXILED: {Configs}/EXILED/Configs/{port}-config.yml. ```csharp // Configuration file location: // LabAPI: {PluginConfigFolder}/config.yml // EXILED: {Configs}/EXILED/Configs/{port}-config.yml // Example configuration structure: public class CedModConfig { // API Configuration public string CedModApiKey { get; set; } = "None"; // From cedmod.nl panel // Friendly Fire Autoban public bool AutobanEnabled { get; set; } = false; public int AutobanThreshold { get; set; } = 3; // Teamkills before ban public int AutobanDuration { get; set; } = 4320; // Minutes (3 days) public string AutobanReason { get; set; } = "Automatic ban for teamkilling"; public string AutobanVictimHint { get; set; } = "You were teamkilled by {attackerName}"; public string AutobanPerpetratorHint { get; set; } = "Continued teamkilling will result in a ban"; // Mute System public bool UseMuteDurationAndReason { get; set; } = false; public bool OnlyAllowPanelMutes { get; set; } = false; public long DefaultMuteDuration { get; set; } = 143998560; // Minutes (~200 years) public string MuteMessage { get; set; } = "You have been {type} muted. Duration: {duration} Reason: {reason}"; // Anti-Cheat Features public bool DisableFakeSyncing { get; set; } = false; // ESP prevention public bool PrimitiveTransparancyDetection { get; set; } = true; public bool PreventBulletHolesWhenMuted { get; set; } = true; // Updates public bool AutoUpdate { get; set; } = true; public bool AutoUpdateRoundEnd { get; set; } = true; // Update at round end public int AutoUpdateWait { get; set; } = 5; // Minutes empty before update // Miscellaneous public bool KickSameName { get; set; } = true; // Prevent name duplicates public bool EnableIngameReports { get; set; } = true; public bool ShowDebug { get; set; } = false; } // Access configuration: // CedModMain.Singleton.Config.CedMod.AutobanEnabled // CedModMain.Singleton.Config.CedMod.CedModApiKey ``` -------------------------------- ### Configure Server Ban Lists (C#) Source: https://context7.com/cedmodv2/cedmod/llms.txt This C# code snippet illustrates how to configure server ban lists for reading and writing mutes and bans within the CedMod environment. It leverages the ServerPreferences class to manage these settings, allowing for integration with shared ban lists managed via the CedMod panel. ```csharp // Server preferences are automatically resolved from CedMod panel using CedMod.Addons.QuerySystem; public class BanListExample { public void ConfigureBanLists() { // ServerPreferences.Prefs contains server-specific settings // Resolved via ServerPreferences.ResolvePreferences(true) // Ban list configuration: // ServerPreferences.Prefs.BanListReadBans - Lists to check for bans // ServerPreferences.Prefs.BanListWriteBans - Lists to write bans to // ServerPreferences.Prefs.BanListReadMutes - Lists to check for mutes // ServerPreferences.Prefs.BanListWriteMutes - Lists to write mutes to // Example API call with ban lists: var banListsParam = string.Join(",", ServerPreferences.Prefs.BanListWriteBans.Select(s => s.Id)); // API.Ban() and API.BanId() automatically use configured write lists // BanSystem.HandleJoin() automatically uses configured read lists // Panel allows creating shared ban lists across multiple servers // Server groups can share moderation state while maintaining independence } } ``` -------------------------------- ### CedMod Custom Event System Implementation Source: https://context7.com/cedmodv2/cedmod/llms.txt Enables the creation and management of scripted server events by implementing the IEvent interface. Custom events are discovered automatically when their DLLs are placed in the correct plugin configuration folder. Event states can be controlled via server console commands. ```csharp // Implement IEvent interface for custom game modes using CedMod.Addons.Events.Interfaces; using PluginAPI.Events; public class MyCustomEvent : IEvent { public string EventName => "Zombie Apocalypse"; public string EvenAuthor => "ServerOwner"; public string EventDescription { get; set; } = "All players spawn as zombies"; public string EventPrefix => "ZOMBIE"; public IEventConfig EventConfig => myConfig; private Config myConfig = new Config { IsEnabled = true }; public void PrepareEvent() { // Called when event is queued to start // Register event handlers EventManager.RegisterEvents(this); // Modify server settings RoundSummary.RoundLength.MaxValue = 1200; // 20 minute rounds } public void StopEvent() { // Called when event ends or is disabled EventManager.UnregisterEvents(this); // Restore default settings } } // Event DLL placement: {PluginConfigFolder}/CedModEvents/MyEvent.dll // Event is automatically discovered and registered on server start // Control via commands: events enable ZOMBIE, events disable ZOMBIE, events queue ZOMBIE ``` -------------------------------- ### CedMod Ban System Player Join Handler Source: https://context7.com/cedmodv2/cedmod/llms.txt Handles player authentication and ban checks upon joining the server. It automatically queries the CedMod API with player details and configured ban lists. Based on the API response, it disconnects banned or VPN-detected players, applies voice chat restrictions to muted players, or allows clean players to join, with retries and fallback to a local cache. ```csharp // Automatically called on player join via event handler using CedMod; using LabApi.Features.Wrappers; using System.Threading.Tasks; public class JoinHandler { public async Task HandlePlayerJoin(Player player) { // System automatically queries CedMod API with: // - Player UserID // - Player IP address // - Authentication token (signed by Northwood) // - Configured ban lists from ServerPreferences await BanSystem.HandleJoin(player); // Automatic actions based on API response: // - If banned: disconnect with formatted ban message // - If VPN/proxy detected: disconnect with VPN block message // - If muted: apply voice chat restrictions and show notification // - If clean: allow join and cache authentication state // Retries up to 5 times on API failure // Falls back to local cache if API unavailable } } // Example API response handling: // Banned player: Disconnected with "You are banned: {reason} - Duration: {time}" // VPN detected: Disconnected with "{configured vpn message}" // Muted player: Allowed to join, voice chat disabled, shown mute notification // Clean player: Allowed to join normally ``` -------------------------------- ### API Request System Source: https://context7.com/cedmodv2/cedmod/llms.txt Provides functions for making authenticated HTTP requests to CedMod backend services to retrieve information such as player ban status. ```APIDOC ## GET /Auth/ ### Description Retrieves the ban status for a given player UserID, including whether they are banned, if they are using a VPN, and a preformatted message detailing the ban. ### Method GET ### Endpoint `/Auth/{userId}` ### Parameters #### Path Parameters - **userId** (string) - Required - The unique identifier of the player. ### Request Example ```json { "endpoint": "Auth/", "arguments": "steam:1234567890abcdef1234567890abcdef", "returnstring": false, "type": "GET" } ``` ### Response #### Success Response (200) - **success** (string) - Indicates if the request was successful ('true' or 'false'). - **vpn** (string) - Indicates if the player is detected as using a VPN ('true' or 'false'). - **isbanned** (string) - Indicates if the player is currently banned ('true' or 'false'). - **preformattedmessage** (string) - A message detailing the ban status, reason, and expiration. #### Response Example ```json { "success": "true", "vpn": "false", "isbanned": "true", "preformattedmessage": "You are banned: Cheating - Expires: 2024-12-31" } ``` ``` -------------------------------- ### Apply and Remove Player Voice Mutes Source: https://context7.com/cedmodv2/cedmod/llms.txt This C# snippet demonstrates how to mute a player using CedMod's API, specifying the duration, reason, and type of mute (global or intercom). It also includes a function to unmute a player. Mutes are persisted across reconnects via panel synchronization. ```csharp // Mute player globally or on intercom using CedMod; using LabApi.Features.Wrappers; using System.Threading.Tasks; public async Task MutePlayerExample(Player target) { string adminName = "ModeratorName"; double durationSeconds = 3600; // 1 hour string reason = "Mic spam"; MuteType muteType = MuteType.Global; // or MuteType.Intercom // Minimum duration is 3 minutes (180 seconds) await API.Mute( player: target, adminname: adminName, duration: durationSeconds, reason: reason, Type: muteType ); // Player receives console message and broadcast notification // Mute persists across reconnects via panel sync } // Unmute player public async Task UnmutePlayerExample(Player target) { await API.UnMute(player: target); // Removes mute from panel and local cache } ``` -------------------------------- ### Player Ban Function Source: https://context7.com/cedmodv2/cedmod/llms.txt Enables issuing synchronized bans for players across multiple servers, with options for duration, reason, and broadcast notifications. Supports banning both online and offline players. ```APIDOC ## POST /Ban ### Description Applies a ban to a specified player, synchronizing the ban status across the CedMod panel and potentially broadcasting the ban to all players. ### Method POST ### Endpoint `/Ban` ### Parameters #### Request Body - **player** (Player) - Required - The player object to ban. - **duration** (long) - Required - The duration of the ban in seconds. - **sender** (string) - Required - The name of the administrator issuing the ban. - **reason** (string) - Required - The reason for the ban. - **bc** (bool) - Optional - If true, the ban will be broadcast to all players. ### Request Example ```json { "player": { /* Player object details */ }, "duration": 604800, "sender": "AdminUsername", "reason": "Repeated teamkilling", "bc": true } ``` ### Response #### Success Response (200) - The player will be killed, disconnected, and the ban will be recorded in the CedMod panel. Local cache is used if the API is unavailable. ## POST /BanId ### Description Applies a ban to an offline player using their UserID. ### Method POST ### Endpoint `/BanId` ### Parameters #### Request Body - **UserId** (string) - Required - The UserID of the player to ban. - **duration** (long) - Required - The duration of the ban in seconds. - **sender** (string) - Required - The name of the administrator issuing the ban. - **reason** (string) - Required - The reason for the ban. - **bc** (bool) - Optional - If true, the ban will be broadcast to all players. ### Request Example ```json { "UserId": "steam:1234567890abcdef1234567890abcdef", "duration": 2592000, "sender": "System", "reason": "Alt account abuse", "bc": false } ``` ### Response #### Success Response (200) - The ban will be recorded in the CedMod panel. Local cache is used if the API is unavailable. ``` -------------------------------- ### Player Mute Function Source: https://context7.com/cedmodv2/cedmod/llms.txt Manages voice chat restrictions for players, allowing for global or intercom mutes with specified durations and reasons. Includes functionality to unmute players. ```APIDOC ## POST /Mute ### Description Mutes a player, restricting their voice chat capabilities either globally or on intercom. ### Method POST ### Endpoint `/Mute` ### Parameters #### Request Body - **player** (Player) - Required - The player object to mute. - **adminname** (string) - Required - The name of the administrator applying the mute. - **duration** (double) - Required - The duration of the mute in seconds (minimum 180 seconds). - **reason** (string) - Required - The reason for the mute. - **Type** (MuteType) - Required - The type of mute ('Global' or 'Intercom'). ### Request Example ```json { "player": { /* Player object details */ }, "adminname": "ModeratorName", "duration": 3600, "reason": "Mic spam", "Type": "Global" } ``` ### Response #### Success Response (200) - The player will receive a console message and a broadcast notification. The mute status persists across reconnects via panel synchronization. ## POST /UnMute ### Description Removes a mute restriction from a player. ### Method POST ### Endpoint `/UnMute` ### Parameters #### Request Body - **player** (Player) - Required - The player object to unmute. ### Request Example ```json { "player": { /* Player object details */ } } ``` ### Response #### Success Response (200) - The mute status is removed from the CedMod panel and local cache. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.