Add CS2-SimpleAdmin documentation site

Introduces a new documentation site for CS2-SimpleAdmin using Docusaurus, including developer API references, tutorials, user guides, and module documentation. Removes the CleanModule example and updates FunCommands and ExampleModule. Also updates main plugin and API files to support new documentation and module structure.
This commit is contained in:
Dawid Bepierszcz
2025-10-20 01:27:01 +02:00
parent 21a5de6b3d
commit b0d8696756
74 changed files with 32732 additions and 279 deletions

View File

@@ -0,0 +1,799 @@
---
sidebar_position: 3
---
# Module Development
Learn how to create your own CS2-SimpleAdmin modules.
## Introduction
Creating modules for CS2-SimpleAdmin allows you to extend the plugin's functionality while keeping your code separate and maintainable.
:::tip Reference Implementation
The **[Fun Commands Module](https://github.com/daffyyyy/CS2-SimpleAdmin/tree/main/Modules/CS2-SimpleAdmin_FunCommands)** serves as a complete reference implementation. Study its code to learn best practices!
:::
---
## Prerequisites
### Knowledge Required
- C# programming (intermediate level)
- .NET 8.0
- CounterStrikeSharp basics
- Understanding of CS2-SimpleAdmin structure
### Tools Needed
- Visual Studio 2022 or VS Code
- .NET 8.0 SDK
- CS2 server for testing
---
## Quick Start
### 1. Create Project
```bash
dotnet new classlib -n YourModuleName -f net8.0
cd YourModuleName
```
### 2. Add References
Edit your `.csproj` file:
```xml
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<!-- CounterStrikeSharp -->
<Reference Include="CounterStrikeSharp.API">
<HintPath>path/to/CounterStrikeSharp.API.dll</HintPath>
<Private>false</Private>
</Reference>
<!-- CS2-SimpleAdmin API -->
<Reference Include="CS2-SimpleAdminApi">
<HintPath>path/to/CS2-SimpleAdminApi.dll</HintPath>
<Private>false</Private>
</Reference>
</ItemGroup>
</Project>
```
### 3. Create Main Plugin Class
```csharp
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Core.Capabilities;
using CS2_SimpleAdminApi;
namespace YourModuleName;
public class YourModule : BasePlugin, IPluginConfig<Config>
{
public override string ModuleName => "Your Module Name";
public override string ModuleVersion => "1.0.0";
public override string ModuleAuthor => "Your Name";
public override string ModuleDescription => "Description";
private ICS2_SimpleAdminApi? _api;
private readonly PluginCapability<ICS2_SimpleAdminApi> _pluginCapability = new("simpleadmin:api");
public Config Config { get; set; } = new();
public override void OnAllPluginsLoaded(bool hotReload)
{
// Get SimpleAdmin API
_api = _pluginCapability.Get();
if (_api == null)
{
Logger.LogError("CS2-SimpleAdmin API not found!");
return;
}
// Register your commands and menus
RegisterCommands();
_api.OnSimpleAdminReady += RegisterMenus;
RegisterMenus(); // Fallback for hot reload
}
public void OnConfigParsed(Config config)
{
Config = config;
}
private void RegisterCommands()
{
// Register commands here
}
private void RegisterMenus()
{
// Register menus here
}
}
```
---
## Module Structure
### Recommended File Organization
```
YourModuleName/
├── YourModule.cs # Main plugin class
├── Config.cs # Configuration
├── Commands.cs # Command handlers (partial class)
├── Menus.cs # Menu creation (partial class)
├── Actions.cs # Core logic (partial class)
├── lang/ # Translations
│ ├── en.json
│ ├── pl.json
│ └── ...
└── YourModuleName.csproj
```
### Using Partial Classes
Split your code for better organization:
```csharp
// YourModule.cs
public partial class YourModule : BasePlugin, IPluginConfig<Config>
{
// Plugin initialization
}
// Commands.cs
public partial class YourModule
{
private void OnMyCommand(CCSPlayerController? caller, CommandInfo command)
{
// Command logic
}
}
// Menus.cs
public partial class YourModule
{
private object CreateMyMenu(CCSPlayerController player, MenuContext context)
{
// Menu creation
}
}
```
---
## Configuration
### Create Config Class
```csharp
using CounterStrikeSharp.API.Core;
using System.Text.Json.Serialization;
public class Config : IBasePluginConfig
{
[JsonPropertyName("Version")]
public int Version { get; set; } = 1;
[JsonPropertyName("MyCommands")]
public List<string> MyCommands { get; set; } = ["css_mycommand"];
[JsonPropertyName("EnableFeature")]
public bool EnableFeature { get; set; } = true;
[JsonPropertyName("MaxValue")]
public int MaxValue { get; set; } = 100;
}
```
### Config Best Practices
1. **Use command lists** - Allow users to add aliases or disable features
2. **Provide defaults** - Sensible default values
3. **Version your config** - Track config changes
4. **Document settings** - Clear property names
---
## Registering Commands
### Basic Command Registration
```csharp
private void RegisterCommands()
{
if (_api == null) return;
foreach (var cmd in Config.MyCommands)
{
_api.RegisterCommand(cmd, "Command description", OnMyCommand);
}
}
[CommandHelper(1, "<#userid or name>")]
[RequiresPermissions("@css/generic")]
private void OnMyCommand(CCSPlayerController? caller, CommandInfo command)
{
// Get target players
var targets = _api!.GetTarget(command);
if (targets == null) return;
// Filter for valid players
var players = targets.Players
.Where(p => p.IsValid && !p.IsBot)
.ToList();
// Process each player
foreach (var player in players)
{
if (caller!.CanTarget(player))
{
DoSomething(caller, player);
}
}
// Log the command
_api.LogCommand(caller, command);
}
```
### Command Cleanup
Always unregister commands when unloading:
```csharp
public override void Unload(bool hotReload)
{
if (_api == null) return;
foreach (var cmd in Config.MyCommands)
{
_api.UnRegisterCommand(cmd);
}
}
```
---
## Creating Menus
### Register Menu Category
```csharp
private void RegisterMenus()
{
if (_api == null || _menusRegistered) return;
// Register category
_api.RegisterMenuCategory(
"mycategory",
Localizer?["category_name"] ?? "My Category",
"@css/generic"
);
// Register menu
_api.RegisterMenu(
"mycategory",
"mymenu",
Localizer?["menu_name"] ?? "My Menu",
CreateMyMenu,
"@css/generic",
"css_mycommand" // For permission override
);
_menusRegistered = true;
}
```
### Menu with Player Selection (NEW API)
```csharp
private object CreateMyMenu(CCSPlayerController admin, MenuContext context)
{
// Context contains: CategoryId, MenuId, MenuTitle, Permission, CommandName
// No need to repeat "mycategory" and "My Menu" here!
return _api!.CreateMenuWithPlayers(
context, // ← Automatically uses menu title and category
admin,
player => player.IsValid && admin.CanTarget(player),
(admin, target) => DoSomethingToPlayer(admin, target)
);
}
```
### Menu with Custom Options
```csharp
private object CreateValueSelectionMenu(CCSPlayerController admin, MenuContext context)
{
var menu = _api!.CreateMenuWithBack(context, admin);
var values = new[] { 10, 25, 50, 100, 200 };
foreach (var value in values)
{
_api.AddMenuOption(menu, $"{value} points", player =>
{
GivePoints(player, value);
});
}
return menu;
}
```
### Nested Menus
```csharp
private object CreatePlayerSelectionMenu(CCSPlayerController admin, MenuContext context)
{
var menu = _api!.CreateMenuWithBack(context, admin);
var players = _api.GetValidPlayers()
.Where(p => admin.CanTarget(p));
foreach (var player in players)
{
_api.AddSubMenu(menu, player.PlayerName, admin =>
{
return CreateValueMenu(admin, player);
});
}
return menu;
}
private object CreateValueMenu(CCSPlayerController admin, CCSPlayerController target)
{
var menu = _api!.CreateMenuWithBack($"Select value for {target.PlayerName}", "mycategory", admin);
// Add options...
return menu;
}
```
---
## Translations
### Create Translation Files
Create `lang/en.json`:
```json
{
"command_success": "{green}Success! {default}Action performed on {lightred}{0}",
"command_failed": "{red}Failed! {default}Could not perform action",
"menu_title": "My Custom Menu"
}
```
### Use Translations in Code
```csharp
// In commands
private void OnMyCommand(CCSPlayerController? caller, CommandInfo command)
{
// Using module's own localizer for per-player language
if (Localizer != null)
{
_api!.ShowAdminActivityLocalized(
Localizer,
"command_success",
caller?.PlayerName,
false,
target.PlayerName
);
}
}
```
### Multiple Language Support
Create files for each language:
- `lang/en.json` - English
- `lang/pl.json` - Polish
- `lang/ru.json` - Russian
- `lang/de.json` - German
- etc.
---
## Working with API
### Issue Penalties
```csharp
// Ban online player
_api!.IssuePenalty(
player,
admin,
PenaltyType.Ban,
"Cheating",
1440 // 1 day in minutes
);
// Ban offline player by SteamID
_api!.IssuePenalty(
new SteamID(76561198012345678),
admin,
PenaltyType.Ban,
"Ban evasion",
0 // Permanent
);
// Other penalty types
_api!.IssuePenalty(player, admin, PenaltyType.Gag, "Chat spam", 30);
_api!.IssuePenalty(player, admin, PenaltyType.Mute, "Mic spam", 60);
_api!.IssuePenalty(player, admin, PenaltyType.Silence, "Total abuse", 120);
_api!.IssuePenalty(player, admin, PenaltyType.Warn, "Rule break");
```
### Get Player Information
```csharp
// Get player info with penalty data
var playerInfo = _api!.GetPlayerInfo(player);
Console.WriteLine($"Player: {playerInfo.PlayerName}");
Console.WriteLine($"SteamID: {playerInfo.SteamId}");
Console.WriteLine($"Warnings: {playerInfo.Warnings}");
// Get player mute status
var muteStatus = _api!.GetPlayerMuteStatus(player);
if (muteStatus.ContainsKey(PenaltyType.Gag))
{
Console.WriteLine("Player is gagged");
}
```
### Check Admin Status
```csharp
// Check if admin is in silent mode
if (_api!.IsAdminSilent(admin))
{
// Don't broadcast this action
}
// Get all silent admins
var silentAdmins = _api!.ListSilentAdminsSlots();
```
---
## Events
### Subscribe to Events
```csharp
public override void OnAllPluginsLoaded(bool hotReload)
{
_api = _pluginCapability.Get();
// Subscribe to events
_api.OnSimpleAdminReady += OnSimpleAdminReady;
_api.OnPlayerPenaltied += OnPlayerPenaltied;
_api.OnPlayerPenaltiedAdded += OnPlayerPenaltiedAdded;
_api.OnAdminShowActivity += OnAdminShowActivity;
}
private void OnSimpleAdminReady()
{
Logger.LogInformation("SimpleAdmin is ready!");
RegisterMenus();
}
private void OnPlayerPenaltied(PlayerInfo player, PlayerInfo? admin,
PenaltyType type, string reason, int duration, int? penaltyId, int? serverId)
{
Logger.LogInformation($"{player.PlayerName} received {type} for {reason}");
}
private void OnPlayerPenaltiedAdded(SteamID steamId, PlayerInfo? admin,
PenaltyType type, string reason, int duration, int? penaltyId, int? serverId)
{
Logger.LogInformation($"Offline ban added to {steamId}");
}
private void OnAdminShowActivity(string messageKey, string? callerName,
bool dontPublish, object messageArgs)
{
// React to admin activity
}
```
### Unsubscribe on Unload
```csharp
public override void Unload(bool hotReload)
{
if (_api == null) return;
_api.OnSimpleAdminReady -= OnSimpleAdminReady;
_api.OnPlayerPenaltied -= OnPlayerPenaltied;
// ... unsubscribe all events
}
```
---
## Best Practices
### 1. Always Check for Null
```csharp
if (_api == null)
{
Logger.LogError("API not available!");
return;
}
```
### 2. Validate Player State
```csharp
if (!player.IsValid || !player.PawnIsAlive)
{
return;
}
```
### 3. Check Target Permissions
```csharp
if (!caller.CanTarget(target))
{
// caller can't target this player (immunity)
return;
}
```
### 4. Log Commands
```csharp
_api.LogCommand(caller, command);
// or
_api.LogCommand(caller, $"css_mycommand {player.PlayerName}");
```
### 5. Use Per-Player Translations
```csharp
// Each player sees message in their language!
_api.ShowAdminActivityLocalized(
Localizer,
"translation_key",
callerName,
false,
args
);
```
### 6. Clean Up Resources
```csharp
public override void Unload(bool hotReload)
{
// Unregister commands
// Unregister menus
// Unsubscribe events
// Dispose resources
}
```
---
## Common Patterns
### Player Targeting Helper
```csharp
private List<CCSPlayerController> GetTargets(CommandInfo command, CCSPlayerController? caller)
{
var targets = _api!.GetTarget(command);
if (targets == null) return new List<CCSPlayerController>();
return targets.Players
.Where(p => p.IsValid && !p.IsBot && caller!.CanTarget(p))
.ToList();
}
```
### Menu Context Pattern (NEW!)
```csharp
// ✅ NEW: Use context to avoid duplication
private object CreateMenu(CCSPlayerController player, MenuContext context)
{
// context.MenuTitle, context.CategoryId already set!
return _api!.CreateMenuWithPlayers(context, player, filter, action);
}
// ❌ OLD: Had to repeat title and category
private object CreateMenu(CCSPlayerController player)
{
return _api!.CreateMenuWithPlayers("My Menu", "mycategory", player, filter, action);
}
```
### Action with Activity Message
```csharp
private void DoAction(CCSPlayerController? caller, CCSPlayerController target)
{
// Perform action
// ...
// Show activity
if (caller == null || !_api!.IsAdminSilent(caller))
{
_api!.ShowAdminActivityLocalized(
Localizer,
"action_message",
caller?.PlayerName,
false,
target.PlayerName
);
}
// Log action
_api!.LogCommand(caller, $"css_action {target.PlayerName}");
}
```
---
## Testing Your Module
### 1. Build
```bash
dotnet build -c Release
```
### 2. Copy to Server
```
game/csgo/addons/counterstrikesharp/plugins/YourModuleName/
```
### 3. Test
- Start server
- Check console for load messages
- Test commands
- Test menus
- Check translations
### 4. Debug
Enable detailed logging:
```csharp
Logger.LogInformation("Debug: ...");
Logger.LogWarning("Warning: ...");
Logger.LogError("Error: ...");
```
---
## Example: Complete Mini-Module
Here's a complete working example:
```csharp
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Core.Capabilities;
using CounterStrikeSharp.API.Modules.Commands;
using CS2_SimpleAdminApi;
namespace ExampleModule;
public class ExampleModule : BasePlugin, IPluginConfig<Config>
{
public override string ModuleName => "Example Module";
public override string ModuleVersion => "1.0.0";
private ICS2_SimpleAdminApi? _api;
private readonly PluginCapability<ICS2_SimpleAdminApi> _pluginCapability = new("simpleadmin:api");
public Config Config { get; set; } = new();
public override void OnAllPluginsLoaded(bool hotReload)
{
_api = _pluginCapability.Get();
if (_api == null)
{
Logger.LogError("CS2-SimpleAdmin API not found!");
return;
}
// Register command
if (Config.ExampleCommands.Count > 0)
{
foreach (var cmd in Config.ExampleCommands)
{
_api.RegisterCommand(cmd, "Example command", OnExampleCommand);
}
}
}
public void OnConfigParsed(Config config)
{
Config = config;
}
[CommandHelper(1, "<#userid or name>")]
[RequiresPermissions("@css/generic")]
private void OnExampleCommand(CCSPlayerController? caller, CommandInfo command)
{
var targets = _api!.GetTarget(command);
if (targets == null) return;
foreach (var target in targets.Players.Where(p => p.IsValid && caller!.CanTarget(p)))
{
// Do something to target
caller?.PrintToChat($"Performed action on {target.PlayerName}");
}
_api.LogCommand(caller, command);
}
public override void Unload(bool hotReload)
{
if (_api == null) return;
foreach (var cmd in Config.ExampleCommands)
{
_api.UnRegisterCommand(cmd);
}
}
}
public class Config : IBasePluginConfig
{
public int Version { get; set; } = 1;
public List<string> ExampleCommands { get; set; } = ["css_example"];
}
```
---
## Next Steps
- **[Study Fun Commands Module](https://github.com/daffyyyy/CS2-SimpleAdmin/tree/main/Modules/CS2-SimpleAdmin_FunCommands)** - Complete reference
- **[Read API Documentation](../developer/api/overview)** - Full API reference
- **[Check Examples](../developer/module/examples)** - More code examples
---
## Resources
- **[CS2-SimpleAdmin GitHub](https://github.com/daffyyyy/CS2-SimpleAdmin)** - Source code
- **[CounterStrikeSharp Docs](https://docs.cssharp.dev/)** - CSS documentation
- **[Module Development Guide](../developer/module/getting-started)** - Detailed guide
---
## Need Help?
- **Issues:** [GitHub Issues](https://github.com/daffyyyy/CS2-SimpleAdmin/issues)
- **Discussions:** [GitHub Discussions](https://github.com/daffyyyy/CS2-SimpleAdmin/discussions)
- **Examples:** Study official modules for reference

View File

@@ -0,0 +1,691 @@
---
sidebar_position: 2
---
# Fun Commands Module
Add entertaining and powerful player manipulation commands to your server.
## Overview
The Fun Commands module extends CS2-SimpleAdmin with commands for god mode, noclip, freeze, respawn, weapon management, and player attribute modification.
**Module Name:** `CS2-SimpleAdmin_FunCommands`
---
## Features
- ⭐ God Mode - Make players invincible
- 👻 No Clip - Allow players to fly through walls
- 🧊 Freeze/Unfreeze - Freeze players in place
- 🔄 Respawn - Bring dead players back
- 🔫 Give Weapons - Provide any weapon to players
- 🗑️ Strip Weapons - Remove all weapons
- ❤️ Set HP - Modify player health
- ⚡ Set Speed - Change movement speed
- 🌙 Set Gravity - Modify gravity
- 💰 Set Money - Adjust player money
- 📏 Resize Player - Change player model size
---
## Installation
### Prerequisites
- CS2-SimpleAdmin installed and working
- CS2-SimpleAdminApi.dll in shared folder
### Install Steps
1. **Download** the module from releases
2. **Extract** to your server:
```
game/csgo/addons/counterstrikesharp/plugins/CS2-SimpleAdmin_FunCommands/
```
3. **Restart** your server or reload plugins:
```
css_plugins reload
```
4. **Verify** the module loaded:
- Check server console for load message
- Try `css_admin` and look for "Fun Commands" menu
---
## Commands
### God Mode
Toggle god mode (invincibility) for a player.
```bash
css_god <#userid or name>
css_godmode <#userid or name>
```
**Permission:** `@css/cheats`
**Examples:**
```bash
css_god #123
css_god PlayerName
css_god @all # Toggle god mode for everyone
```
**Effects:**
- Player takes no damage
- Toggles on/off with each use
---
### No Clip
Enable noclip mode (fly through walls).
```bash
css_noclip <#userid or name>
```
**Permission:** `@css/cheats`
**Examples:**
```bash
css_noclip #123
css_noclip PlayerName
```
**Effects:**
- Player can fly
- Can pass through walls
- Gravity disabled
- Toggles on/off with each use
---
### Freeze
Freeze a player in place.
```bash
css_freeze <#userid or name> [duration]
```
**Permission:** `@css/slay`
**Parameters:**
- `duration` - Freeze duration in seconds (optional, default: permanent until unfreeze)
**Examples:**
```bash
css_freeze #123 # Freeze permanently
css_freeze PlayerName 30 # Freeze for 30 seconds
css_freeze @t 10 # Freeze all terrorists for 10 seconds
```
**Effects:**
- Player cannot move
- Player cannot shoot
- Auto-unfreezes after duration (if specified)
---
### Unfreeze
Unfreeze a frozen player.
```bash
css_unfreeze <#userid or name>
```
**Permission:** `@css/slay`
**Examples:**
```bash
css_unfreeze #123
css_unfreeze PlayerName
css_unfreeze @all # Unfreeze everyone
```
---
### Respawn
Respawn a dead player at last death position.
```bash
css_respawn <#userid or name>
```
**Permission:** `@css/cheats`
**Examples:**
```bash
css_respawn #123
css_respawn PlayerName
css_respawn @dead # Respawn all dead players
```
**Effects:**
- Player spawns at death point
- Gets default weapons
- Joins their team
---
### Give Weapon
Give a weapon to a player.
```bash
css_give <#userid or name> <weapon>
```
**Permission:** `@css/cheats`
**Weapon names:**
**Rifles:**
- `weapon_ak47` or `ak47`
- `weapon_m4a1` or `m4a1`
- `weapon_m4a1_silencer` or `m4a1_silencer`
- `weapon_awp` or `awp`
- `weapon_aug` or `aug`
- `weapon_sg556` or `sg556`
- `weapon_ssg08` or `ssg08` (Scout)
- `weapon_g3sg1` or `g3sg1`
- `weapon_scar20` or `scar20`
**SMGs:**
- `weapon_mp5sd` or `mp5sd`
- `weapon_mp7` or `mp7`
- `weapon_mp9` or `mp9`
- `weapon_mac10` or `mac10`
- `weapon_p90` or `p90`
- `weapon_ump45` or `ump45`
- `weapon_bizon` or `bizon`
**Heavy:**
- `weapon_nova` or `nova`
- `weapon_xm1014` or `xm1014`
- `weapon_mag7` or `mag7`
- `weapon_sawedoff` or `sawedoff`
- `weapon_m249` or `m249`
- `weapon_negev` or `negev`
**Pistols:**
- `weapon_deagle` or `deagle`
- `weapon_elite` or `elite` (Dual Berettas)
- `weapon_fiveseven` or `fiveseven`
- `weapon_glock` or `glock`
- `weapon_hkp2000` or `hkp2000`
- `weapon_p250` or `p250`
- `weapon_usp_silencer` or `usp_silencer`
- `weapon_tec9` or `tec9`
- `weapon_cz75a` or `cz75a`
- `weapon_revolver` or `revolver`
**Grenades:**
- `weapon_flashbang` or `flashbang`
- `weapon_hegrenade` or `hegrenade`
- `weapon_smokegrenade` or `smokegrenade`
- `weapon_molotov` or `molotov`
- `weapon_incgrenade` or `incgrenade`
- `weapon_decoy` or `decoy`
**Equipment:**
- `weapon_knife` or `knife`
- `weapon_taser` or `taser`
- `item_defuser` or `defuser`
- `item_kevlar` or `kevlar`
- `item_assaultsuit` or `assaultsuit`
**Examples:**
```bash
css_give #123 awp
css_give PlayerName ak47
css_give @ct m4a1
css_give @all deagle
```
---
### Strip Weapons
Remove all weapons from a player.
```bash
css_strip <#userid or name>
```
**Permission:** `@css/slay`
**Examples:**
```bash
css_strip #123
css_strip PlayerName
css_strip @t # Disarm all terrorists
```
---
### Set HP
Set a player's health.
```bash
css_hp <#userid or name> <health>
```
**Permission:** `@css/slay`
**Parameters:**
- `health` - Health amount (1-999+)
**Examples:**
```bash
css_hp #123 100 # Full health
css_hp PlayerName 200 # 200 HP
css_hp @all 1 # 1 HP everyone
```
**Common values:**
- `1` - 1 HP (one-shot mode)
- `100` - Normal health
- `200` - Double health
- `500` - Tank mode
---
### Set Speed
Modify a player's movement speed.
```bash
css_speed <#userid or name> <speed>
```
**Permission:** `@css/slay`
**Parameters:**
- `speed` - Speed multiplier (0.1 - 10.0)
- `1.0` = Normal speed
- `2.0` = Double speed
- `0.5` = Half speed
**Examples:**
```bash
css_speed #123 1.5 # 50% faster
css_speed PlayerName 0.5 # Slow motion
css_speed @all 2.0 # Everyone fast
css_speed #123 1.0 # Reset to normal
```
**Common values:**
- `0.5` - Slow motion mode
- `1.0` - Normal (reset)
- `1.5` - Fast mode
- `2.0` - Super fast
- `3.0` - Extremely fast
---
### Set Gravity
Modify a player's gravity.
```bash
css_gravity <#userid or name> <gravity>
```
**Permission:** `@css/slay`
**Parameters:**
- `gravity` - Gravity multiplier (0.1 - 10.0)
- `1.0` = Normal gravity
- `0.5` = Moon jump
- `2.0` = Heavy
**Examples:**
```bash
css_gravity #123 0.5 # Moon jump
css_gravity PlayerName 0.1 # Super jump
css_gravity @all 2.0 # Heavy gravity
css_gravity #123 1.0 # Reset to normal
```
**Common values:**
- `0.1` - Super high jumps
- `0.5` - Moon gravity
- `1.0` - Normal (reset)
- `2.0` - Heavy/fast falling
---
### Set Money
Set a player's money amount.
```bash
css_money <#userid or name> <amount>
```
**Permission:** `@css/slay`
**Parameters:**
- `amount` - Money amount (0-65535)
**Examples:**
```bash
css_money #123 16000 # Max money
css_money PlayerName 0 # Remove all money
css_money @ct 10000 # Give all CTs $10,000
```
---
### Resize Player
Change a player's model size.
```bash
css_resize <#userid or name> <scale>
```
**Permission:** `@css/slay`
**Parameters:**
- `scale` - Size scale (0.1 - 10.0)
- `1.0` = Normal size
- `0.5` = Half size
- `2.0` = Double size
**Examples:**
```bash
css_resize #123 0.5 # Tiny player
css_resize PlayerName 2.0 # Giant player
css_resize #123 1.0 # Reset to normal
```
**Common values:**
- `0.5` - Tiny mode
- `1.0` - Normal (reset)
- `1.5` - Big
- `2.0` - Giant
---
## Configuration
Configuration file location:
```
addons/counterstrikesharp/configs/plugins/CS2-SimpleAdmin_FunCommands/CS2-SimpleAdmin_FunCommands.json
```
### Default Configuration
```json
{
"Version": 1,
"GodCommands": ["css_god", "css_godmode"],
"NoclipCommands": ["css_noclip"],
"FreezeCommands": ["css_freeze"],
"UnfreezeCommands": ["css_unfreeze"],
"RespawnCommands": ["css_respawn"],
"GiveCommands": ["css_give"],
"StripCommands": ["css_strip"],
"HpCommands": ["css_hp"],
"SpeedCommands": ["css_speed"],
"GravityCommands": ["css_gravity"],
"MoneyCommands": ["css_money"],
"ResizeCommands": ["css_resize"]
}
```
### Customizing Commands
**Add aliases:**
```json
"GodCommands": ["css_god", "css_godmode", "css_immortal"]
```
**Disable feature:**
```json
"GodCommands": []
```
**Rename command:**
```json
"NoclipCommands": ["css_fly"]
```
---
## Admin Menu Integration
The module automatically adds a "Fun Commands" category to the admin menu with these options:
- God Mode
- No Clip
- Freeze
- Respawn
- Give Weapon
- Strip Weapons
- Set HP
- Set Speed
- Set Gravity
- Set Money
- Resize Player
**Access menu:**
```bash
css_admin # Navigate to "Fun Commands"
```
---
## Permission System
### Permission Override
Admins can override command permissions using CounterStrikeSharp's admin system.
**Example:**
If you want VIPs to use god mode:
1. **In admin config**, add permission override for `css_god`:
```json
{
"css_god": ["@css/vip"]
}
```
2. **VIPs will now see God Mode** in the menu
---
## Permissions Required
| Command | Default Permission | Description |
|---------|------------------|-------------|
| `css_god` | `@css/cheats` | God mode |
| `css_noclip` | `@css/cheats` | No clip |
| `css_freeze` | `@css/slay` | Freeze players |
| `css_unfreeze` | `@css/slay` | Unfreeze players |
| `css_respawn` | `@css/cheats` | Respawn players |
| `css_give` | `@css/cheats` | Give weapons |
| `css_strip` | `@css/slay` | Strip weapons |
| `css_hp` | `@css/slay` | Set health |
| `css_speed` | `@css/slay` | Set speed |
| `css_gravity` | `@css/slay` | Set gravity |
| `css_money` | `@css/slay` | Set money |
| `css_resize` | `@css/slay` | Resize player |
---
## Use Cases
### Fun Rounds
```bash
# Low gravity, high speed round
css_gravity @all 0.3
css_speed @all 1.5
# One-shot mode
css_hp @all 1
css_give @all deagle
# Tiny players
css_resize @all 0.5
```
### Admin Events
```bash
# Hide and seek (seekers)
css_speed @ct 1.5
css_hp @ct 200
# Hide and seek (hiders)
css_resize @t 0.5
css_speed @t 0.8
```
### Testing & Debug
```bash
# Test map navigation
css_noclip @me
css_god @me
# Test weapon balance
css_give @me awp
css_hp @me 100
```
---
## Best Practices
### Competitive Balance
1. **Don't use during serious matches** - Breaks game balance
2. **Announce fun rounds** - Let players know it's for fun
3. **Reset after use** - Return to normal settings
4. **Save for appropriate times** - End of night, special events
### Reset Commands
Always reset modifications after fun rounds:
```bash
css_speed @all 1.0
css_gravity @all 1.0
css_resize @all 1.0
```
### Permission Management
1. **Limit @css/cheats** - Only trusted admins
2. **@css/slay is safer** - For HP/speed/gravity
3. **Monitor usage** - Check logs for abuse
---
## Troubleshooting
### Speed/Gravity not persisting
**Solution:**
- These are maintained by a repeating timer
- If they reset, reapply them
- Check server console for timer errors
### God mode not working
**Check:**
- Is player alive?
- Check console for errors
- Try toggling off and on
### Can't give weapons
**Check:**
- Correct weapon name
- Player is alive
- Player has inventory space
### Noclip doesn't work
**Check:**
- Player must be alive
- sv_cheats doesn't need to be enabled
- Check console for errors
---
## Module Development
This module serves as a **reference implementation** for creating CS2-SimpleAdmin modules.
**Key concepts demonstrated:**
- Command registration from configuration
- Menu creation with SimpleAdmin API
- Per-player translation support
- Proper cleanup on module unload
- Code organization using partial classes
**[View source code](https://github.com/daffyyyy/CS2-SimpleAdmin/tree/main/Modules/CS2-SimpleAdmin_FunCommands)** for implementation details.
---
## Translations
The module includes translations for 13 languages:
- English (en)
- Polish (pl)
- Russian (ru)
- Portuguese (pt)
- And 9 more...
Translation files location:
```
plugins/CS2-SimpleAdmin_FunCommands/lang/
```
---
## Related Documentation
- **[Player Commands](../user/commands/playercommands)** - Core player commands
- **[Module Development](development)** - Create your own modules
- **[API Reference](../developer/api/overview)** - CS2-SimpleAdmin API
---
## Version History
**v1.0.0** - Initial release
- God mode
- Noclip
- Freeze/Unfreeze
- Respawn
- Give/Strip weapons
- HP/Speed/Gravity/Money
- Resize player
- Admin menu integration
- 13 language support
---
## Support
**Issues:** [GitHub Issues](https://github.com/daffyyyy/CS2-SimpleAdmin/issues)
**Questions:** [GitHub Discussions](https://github.com/daffyyyy/CS2-SimpleAdmin/discussions)

View File

@@ -0,0 +1,260 @@
---
sidebar_position: 1
---
# Modules Introduction
Extend CS2-SimpleAdmin functionality with powerful modules.
## What are Modules?
Modules are extensions that add new features to CS2-SimpleAdmin. They use the CS2-SimpleAdmin API to integrate seamlessly with the core plugin.
## Official Modules
### Fun Commands Module
Adds entertainment and player manipulation commands like god mode, noclip, freeze, and more.
**[Learn more →](funcommands)**
---
## Benefits of Modules
### 🔌 Easy Integration
- Built on CS2-SimpleAdmin API
- Automatic menu registration
- Command system integration
### 🎨 Feature Separation
- Keep core plugin lightweight
- Add only features you need
- Easy to enable/disable
### 🔧 Customizable
- Configure each module independently
- Disable unwanted commands
- Customize permissions
### 📦 Simple Installation
- Drop module files in folder
- Restart server
- Module auto-loads
---
## Installing Modules
### Standard Installation
1. **Download the module** from releases or build from source
2. **Extract to plugins folder:**
```
game/csgo/addons/counterstrikesharp/plugins/ModuleName/
```
3. **Restart server** or reload plugins:
```
css_plugins reload
```
4. **Configure** (if needed):
```
addons/counterstrikesharp/configs/plugins/ModuleName/
```
---
## Module Structure
Typical module structure:
```
plugins/
└── CS2-SimpleAdmin_ModuleName/
├── CS2-SimpleAdmin_ModuleName.dll
├── CS2-SimpleAdmin_ModuleName.json (config)
└── lang/ (translations)
├── en.json
├── pl.json
└── ...
```
---
## Module Configuration
Each module has its own configuration file:
```
addons/counterstrikesharp/configs/plugins/ModuleName/ModuleName.json
```
### Common Configuration Pattern
```json
{
"Version": 1,
"CommandName": ["css_command", "css_alias"],
"OtherSettings": {
"EnableFeature": true
}
}
```
**Key Features:**
- Command lists allow multiple aliases
- Empty command list = feature disabled
- Module-specific settings
---
## Available Modules
### Core Modules
| Module | Description | Status |
|--------|-------------|--------|
| **[Fun Commands](funcommands)** | God mode, noclip, freeze, speed, gravity | ✅ Official |
### Community Modules
Check the [GitHub repository](https://github.com/daffyyyy/CS2-SimpleAdmin) for community-contributed modules.
---
## Developing Modules
Want to create your own module?
**[See Module Development Guide →](development)**
**[See Developer Documentation →](../developer/intro)**
---
## Module vs Core Plugin
### When to use Core Plugin:
- Essential admin functions
- Punishment system
- Permission management
- Database operations
### When to use Modules:
- Optional features
- Server-specific functionality
- Experimental features
- Custom integrations
---
## Module Dependencies
### Required for All Modules:
- CS2-SimpleAdmin (core plugin)
- CS2-SimpleAdminApi.dll
### Module-Specific:
Check each module's documentation for specific requirements.
---
## Troubleshooting Modules
### Module doesn't load
**Check:**
1. Is CS2-SimpleAdmin loaded?
2. Is CS2-SimpleAdminApi.dll in shared folder?
3. Check server console for errors
4. Verify module files are complete
### Module commands not working
**Check:**
1. Is command enabled in module config?
2. Do you have required permissions?
3. Check Commands.json for conflicts
4. Verify module loaded successfully
### Module conflicts
**Check:**
- Multiple modules providing same command
- Check server console for warnings
- Disable conflicting module
---
## Best Practices
### Module Management
1. **Use only needed modules** - Don't overload server
2. **Keep modules updated** - Check for updates regularly
3. **Test before production** - Test modules on dev server first
4. **Review permissions** - Understand what each module can do
### Performance
1. **Monitor resource usage** - Some modules may impact performance
2. **Configure wisely** - Disable unused features
3. **Check logs** - Monitor for errors
---
## Module Updates
### Updating Modules
1. **Backup current version**
2. **Download new version**
3. **Replace files** in plugins folder
4. **Check configuration** - New config options may exist
5. **Restart server**
### Breaking Changes
Some updates may have breaking changes:
- Check module changelog
- Review new configuration options
- Test thoroughly
---
## Community Contributions
### Sharing Modules
Created a module? Share it with the community!
1. **Publish on GitHub**
2. **Document thoroughly**
3. **Provide examples**
4. **Include README**
### Using Community Modules
1. **Review code** - Ensure it's safe
2. **Check compatibility** - Verify CS2-SimpleAdmin version
3. **Test thoroughly** - Don't trust blindly
4. **Report issues** - Help improve modules
---
## Next Steps
- **[Explore Fun Commands Module](funcommands)** - Add entertainment features
- **[Learn Module Development](development)** - Create your own modules
- **[Read API Documentation](../developer/intro)** - Understand the API
---
## Need Help?
- **Issues** - [GitHub Issues](https://github.com/daffyyyy/CS2-SimpleAdmin/issues)
- **Discussions** - [GitHub Discussions](https://github.com/daffyyyy/CS2-SimpleAdmin/discussions)
- **Examples** - Check official modules for reference