{"id":41487058,"url":"https://github.com/imi-tat0r/cssharputils","last_synced_at":"2026-01-23T18:02:58.834Z","repository":{"id":250565250,"uuid":"834808650","full_name":"imi-tat0r/CSSharpUtils","owner":"imi-tat0r","description":"CSSharpUtils is an extension library for CounterStrikeSharp (CSSharp) that simplifies player management, message formatting, configuration updates, and more.","archived":false,"fork":false,"pushed_at":"2025-06-03T07:57:04.000Z","size":30,"stargazers_count":30,"open_issues_count":1,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-03T19:42:20.422Z","etag":null,"topics":["counter-strike-2","counterstrikesharp","cssharp","extension","utilities"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/imi-tat0r.png","metadata":{"files":{"readme":"README.MD","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-07-28T12:31:31.000Z","updated_at":"2025-06-03T07:56:28.000Z","dependencies_parsed_at":"2024-07-31T07:56:42.480Z","dependency_job_id":"fa3390ad-e949-4306-88b8-f454df9f2f54","html_url":"https://github.com/imi-tat0r/CSSharpUtils","commit_stats":null,"previous_names":["imi-tat0r/cssharputils"],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/imi-tat0r/CSSharpUtils","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imi-tat0r%2FCSSharpUtils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imi-tat0r%2FCSSharpUtils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imi-tat0r%2FCSSharpUtils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imi-tat0r%2FCSSharpUtils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imi-tat0r","download_url":"https://codeload.github.com/imi-tat0r/CSSharpUtils/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imi-tat0r%2FCSSharpUtils/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28697425,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T17:25:48.045Z","status":"ssl_error","status_checked_at":"2026-01-23T17:25:47.153Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["counter-strike-2","counterstrikesharp","cssharp","extension","utilities"],"created_at":"2026-01-23T18:02:56.990Z","updated_at":"2026-01-23T18:02:58.829Z","avatar_url":"https://github.com/imi-tat0r.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Copyright ev0lve Digital](https://img.shields.io/badge/Copyright-ev0lve%20Digital-blue) ![GitHub License](https://img.shields.io/github/license/imi-tat0r/CSSharpUtils) ![Issues](https://img.shields.io/github/issues/imi-tat0r/CSSharpUtils) ![Stars](https://img.shields.io/github/stars/imi-tat0r/CSSharpUtils)\n\n# CSSharpUtils\nCSSharpUtils is an extension library for CounterStrikeSharp that simplifies player management, message formatting, configuration updates, and more. It provides a set of extensions and utilities to enhance the development experience for CounterStrikeSharp game mods.\n\n# Installation\nRun `dotnet add package CSSharpUtils` or download the latest release from the [releases page](https://github.com/imi-tat0r/CSSharpUtils/releases) and add it as a reference to your project.\n\n## Extensions\n- **Config**: Simplifies the process of updating and managing plugin configurations by automatically handling version updates and serialization.\n- **Player**: Offers methods for common player actions such as kicking, moving to a team, setting armor, and getting the eye position.\n- **GameRules**: Enhances game rule interactions, including calculating the remaining time in the current round.\n\n## Utils\n- **Chat**: Provides methods for formatting chat messages with predefined color codes and sending messages to specific teams.\n- **CsTeam**: Utilities for team management, including counting players, alive players, combined health, and selecting random teams.\n- **Game**: Contains methods for managing game states such as starting and ending warmup, pausing, and unpausing matches, and retrieving game rules.\n- **Server**: Utilities for retrieving server information such as the IP.\n\n## Examples\n\n### Config\n\n```csharp\nusing CSSharpUtils.Extensions;\n\n// updates the config file on disk, backup = true creates a backup, checkVersion = true stops overwriting if configs are the same version\nconfig.Update(backup: true, checkVersion: true);\n\n// reloads the config file from disk\nOnConfigParsed(new MyPluginConfig().Reload());\n\n// get the plugin config path\nConsole.WriteLine($\"Config path: {new MyPluginConfig().ConfigPath()}\");\n```\n\n### Player\n```csharp\nusing CSSharpUtils.Extensions;\n\n// this is true for connected, valid, human players\nif (!playerController.IsPlayer())\n    return;\n\n// name and clan tag\nplayerController.SetName(\"imi-tat0r\");\nplayerController.SetClantag(\"imi-tat0r.net\");\nplayerController.SetClantag(); // removes the clantag\n\n// setting armor + helmet\nplayerController.SetArmor(100, true);\n\n// setting health\nplayerController.SetHealth(69); // sets health to 69 \nplayerController.SetHealth(420); // sets health to 420\nplayerController.SetHealth(1337, false); // sets health to 100 (clamped)\n\n// setting money\nplayerController.SetMoney(1337);\n\n// checking for permission\nplayerController.HasPermission(\"@css/generic\");\n\n// freeze and unfreeze the player\nplayerController.Freeze();\nplayerController.Unfreeze();\n\n// NOTE: CS2 does not display the kick message to the player\nplayerController.Kick(\"You have been kicked.\");\n\nplayerController.MoveToTeam(CsTeam.Terrorists);\n\nvar EyePos = playerController.GetEyePosition();\n```\n\n### GameRules\n```csharp\nusing CSSharpUtils.Utils;\nusing CSSharpUtils.Extensions;\n\nvar gameRules = GameUtils.GetGameRules(); // this should be cached appropriately\nvar remainingRoundTime = gameRules.GetRemainingRoundTime();\n```\n\n### Chat\n```csharp\nusing CSSharpUtils.Utils;\n\nvar message = \"Hello {LightBlue}World.\"\n\nplayer.PrintToChat(ChatUtils.FormatMessage(message)); // will print \"Hello World\" as a colored message\nplayer.PrintToChat(ChatUtils.CleanMessage(message)); // will print \"Hello World\" in full white\n\n// Send a message to all players in the Terrorist team\nChatUtils.PrintToTeam(CsTeam.Terrorist, \"This message is for Terrorists only.\");\n\n// Send a message to all players\nChatUtils.PrintToAll(\"This message is for all players.\")\n```\n\n### Team\n```csharp\nusing CSSharpUtils.Utils;\n\n// Get the number of alive players in the Counter-Terrorist team\nint aliveCTs = CsTeamUtils.GetAlivePlayerCount(CsTeam.CounterTerrorist);\nConsole.WriteLine($\"Alive Counter-Terrorists: {aliveCTs}\");\n\n// Select a random team\nCsTeam randomTeam = CsTeamUtils.GetRandomTeam();\nConsole.WriteLine($\"Randomly selected team: {randomTeam}\");\n```\n\n### Workshop\n```csharp\nusing CSSharpUtils.Utils;\n\n// Get the workshop id\nstring workshopId = WorkshopUtils.GetID();\n```\n\n### Game\n```csharp\nusing CSSharpUtils.Utils;\n\n// Start a warmup period of 30 seconds\nGameUtils.StartWarmup(30);\n\n// End the warmup\nGameUtils.EndWarmup(10); // in 10 seconds\nGameUtils.EndWarmup(); // immediately\n\n// Pause the match\nGameUtils.PauseMatch();\n\n// Unpause the match\nGameUtils.UnpauseMatch();\n\n// Retrieve the current game rules\nvar gameRules = GameUtils.GetGameRules();\nif (gameRules != null)\n{\n    Console.WriteLine(\"Game rules retrieved.\");\n}\nelse\n{\n    Console.WriteLine(\"Failed to retrieve game rules.\");\n}\n```\n\n### Server\n```csharp\nusing CSSharpUtils.Utils;\n\nConsole.WriteLine($\"Server IP: {ServerUtils.GetServerIp()}\");\n```\n\n## Credits\n- [CounterStrikeSharp](https://github.com/roflmuffin/CounterStrikeSharp)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimi-tat0r%2Fcssharputils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimi-tat0r%2Fcssharputils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimi-tat0r%2Fcssharputils/lists"}