ParticleDemo is a CounterStrikeSharp plugin for CS2 that demonstrates spawning particle effects in various positions (in front, at feet, above, circle, line). It’s an educational tool for plugin developers.
- Spawn particles in five different ways: in front, at feet, above, in a circle, or along a line.
- Configurable via a JSON file (
particle_config.json). - Reload config in-game with a command—no server restart needed for most changes.
- Debug mode for detailed logs and in-game feedback.
- Simple, commented code to help beginners understand particle spawning.
- Counter-Strike 2 Server: A running CS2 server.
- Metamod:Source: Installed on your server for plugin support. Download from sourcemm.net.
- CounterStrikeSharp: The plugin framework installed on your server. Get it from CounterStrikeSharp GitHub.
- .NET SDK: Required to build the plugin (e.g., .NET 8.0).
-
Clone or Download:
- Clone this repository or download the ZIP:
git clone https://github.com/<your-username>/ParticleDemo.git
- Or download from the Releases tab (if you add releases later).
- Clone this repository or download the ZIP:
-
Build the Plugin:
- Open a terminal in the
ParticleDemofolder. - Run:
dotnet build
- Find the compiled DLL in
bin/Debug/net8.0/ParticleDemo.dll.
- Open a terminal in the
-
Deploy to Server:
- Copy
ParticleDemo.dllto your CS2 server’s plugin folder:- Typically:
csgo/addons/counterstrikesharp/plugins/ParticleDemo/.
- Typically:
- Ensure the folder is named
ParticleDemoto match the plugin’s expected structure.
- Copy
-
Config Setup:
- On first load, the plugin creates
particle_config.jsonin the plugin folder. - Edit it to customize (see Configuration section below).
- On first load, the plugin creates
-
Start Server:
- Launch your CS2 server. The plugin will load automatically.
The plugin uses particle_config.json for settings. It’s created with defaults on first load. Here’s the structure:
{
"ParticleFile": "particles/explosions_fx/explosion_c4_short.vpcf",
"SpawnMethod": 1, // Choose: 1=In Front, 2=At Feet, 3=Above, 4=Circle, 5=Line
"Debug": true // Set to false to disable extra logs and chat messages
}-
ParticleFile:- Path to the particle file (
.vpcf) to spawn. - Default:
particles/explosions_fx/explosion_c4_short.vpcf(a built-in CS2 explosion effect). - Change to any valid particle file in your CS2 installation.
- Path to the particle file (
-
SpawnMethod:- Integer selecting where the particle spawns:
1: 100 units in front of the player.2: At the player’s exact position (feet).3: 50 units above the player.4: Circle around the player (100-unit radius, 5 particles).5: Line in front (100 units, 5 particles).
- Default:
1.
- Integer selecting where the particle spawns:
-
Debug:- Boolean (
true/false) enabling extra console logs and in-game chat messages. - Default:
true(recommended for testing).
- Boolean (
- Changing
ParticleFilerequires a map restart or server reload to precache the new file. SpawnMethodandDebugchanges apply instantly after reloading (see Commands).
-
!pcfire:- Spawns the configured particle using the selected
SpawnMethod. - Usage: Type
!pcfirein chat orcss_pcfirein console. - Example: Spawns an explosion 100 units in front if
SpawnMethodis 1.
- Spawns the configured particle using the selected
-
!pcreload:- Reloads
particle_config.jsonwithout restarting the server. - Usage: Type
!pcreloadin chat orcss_pcreloadin console. - Note: New particle files need a map restart to take effect.
- Reloads
-
Edit
particle_config.json:{ "ParticleFile": "particles/explosions_fx/explosion_c4_short.vpcf", "SpawnMethod": 3, "Debug": true } -
In-game:
- Type
!pcreloadto load the updated config. - Type
!pcfireto spawn the particle 50 units above you. - Check console for logs like
[ParticleDemo] Spawned at (x, y, z).
- Type
-
See chat messages (with
Debug: true):- “Particle spawned!” on success.
- “Failed to spawn particle!” if something goes wrong.
- Open the project in VS Code or any C# IDE.
- Run:
dotnet build
- Output DLL is in
bin/Debug/net8.0/.
- Edit
ParticleDemo.csto tweak spawn distances, add new methods, or change behavior. - Comments in the code explain each function (e.g.,
SpawnInFront,SpawnCircleAroundPlayer).
- Set
Debug: truein the config. - Watch server console for logs.
- Check in-game chat for immediate feedback.
- Particle Precache: Changing
ParticleFilerequires a map restart or server reload to precache properly. - Single Particle: Only one particle type can be configured at a time.
- Hardcoded Values: Distances (e.g., 100 units) and counts (e.g., 5 particles) are fixed in code—edit the source to adjust.
Feel free to fork this repo, make improvements, and submit pull requests! Suggestions:
- Add configurable distances or particle counts.
- Support multiple particle files.
- Improve error handling.
- Author: qazlll456, with assistance from xAI’s Grok.
- Framework: CounterStrikeSharp team.
Big thanks to the CounterStrikeSharp Discord community for their guidance and debugging help! Special shoutouts to:
- AquaVadis: Main mentor who taught me the ropes.
- fifty Shucks: For valuable support and insights.
- exkludera: For assisting with troubleshooting. This plugin wouldn’t be here without their patience and expertise!
This project is open-source under the MIT License. Feel free to use, modify, and distribute it.
If you enjoy it and find it helpful, consider donating to me! Every bit helps me keep developing. Money, Steam games, or any valuable contribution is welcome.
- Ko-fi: Support on Ko-fi
- Patreon: Become a Patron
- Streamlabs: Tip via Streamlabs