Compare commits

..

4 Commits

Author SHA1 Message Date
Dawid Bepierszcz
129b34f5c0 Merge pull request #472 from JonneKahvila/main
Update CounterStrikeSharp.API package version to 1.0.358
2026-01-23 16:59:14 +01:00
Erik Mende
fbf473b893 Update CounterStrikeSharp.API package version to 1.0.358 2026-01-23 16:38:15 +02:00
Dawid Bepierszcz
10a4691429 Merge pull request #456 from daffyyyy/main
Recompile, small change in ontick
2025-10-18 00:57:08 +02:00
Dawid Bepierszcz
ae8fb3b677 Recompile, small change in ontick 2025-10-18 00:55:05 +02:00
6 changed files with 64 additions and 149 deletions

View File

@@ -59,6 +59,8 @@ namespace WeaponPaints
catch
{
}
Players.Add(player);
return HookResult.Continue;
}
@@ -114,6 +116,7 @@ namespace WeaponPaints
_temporaryPlayerWeaponWear.TryRemove(player.Slot, out _);
CommandsCooldown.Remove(player.Slot);
Players.Remove(player);
return HookResult.Continue;
}
@@ -239,7 +242,7 @@ namespace WeaponPaints
if (steamid != null && steamid.IsValid())
{
player = Utilities.GetPlayers().FirstOrDefault(p => p.IsValid && p.SteamID == steamid.SteamId64);
player = Players.FirstOrDefault(p => p.IsValid && p.SteamID == steamid.SteamId64);
if (player == null)
player = Utilities.GetPlayerFromSteamId(weapon.OriginalOwnerXuidLow);
@@ -266,11 +269,7 @@ namespace WeaponPaints
{
if (!Config.Additional.ShowSkinImage) return;
foreach (var player in Utilities.GetPlayers().Where(p =>
p is { IsValid: true, PlayerPawn.IsValid: true, IsBot: false } and
{ Connected: PlayerConnectedState.PlayerConnected }
)
)
foreach (var player in Players)
{
if (_playerWeaponImage.TryGetValue(player.Slot, out var value) && !string.IsNullOrEmpty(value))
{

153
README.md
View File

@@ -1,36 +1,20 @@
```
# CS2 Weapon Paints
__ __ ___ _ _
/ / /\ \ \___ __ _ _ __ ___ _ __ / _ \__ _(_)_ __ | |_ ___
\ \/ \/ / _ \/ _` | '_ \ / _ \| '_ \ / /_)/ _` | | '_ \| __/ __|
\ /\ / __/ (_| | |_) | (_) | | | / ___/ (_| | | | | | |_\__ \
\/ \/ \___|\__,_| .__/ \___/|_| |_\/ \__,_|_|_| |_|\__|___/
|_|
```
<p align="center">
<a href="https://github.com/Nereziel/cs2-WeaponPaints/releases">📖 Releases</a> •
<a href="https://discord.gg/d9CvaYPSFe">💬 Discord</a>
<br /><br />
</p>
<hr />
## 📝 Description
## Description
Unfinished, unoptimized and not fully functional ugly demo weapon paints plugin for **[CSSharp](https://docs.cssharp.dev/docs/guides/getting-started.html)**.
## Created [Discord server](https://discord.gg/d9CvaYPSFe) where you can discuss about plugin.
### 💸 Consider to donate instead of buying from unknown sources.
### Consider to donate instead of buying from unknown sources.
[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/E1E2G0P2O) or [![Donate on Steam](https://github.com/Nereziel/cs2-WeaponPaints/assets/32937653/a0d53822-4ca7-4caf-83b4-e1a9b5f8c94e)](https://steamcommunity.com/tradeoffer/new/?partner=41515647&token=gW2W-nXE)
## Features
## Features
- Changes only paint, seed and wear on weapons, knives, gloves and agents
- MySQL based
- Data syncs on player connect
- Added command **`!wp`** to refresh skins ***(with cooldown in seconds can be configured)***
- Added command **`!ws`** to show website
- Added command **`!knife`** to show menu with knives
- Added command **`!stattrak`** to enable stattrak on weapon
- Added command **`!gloves`** to show menu with gloves
- Added command **`!agents`** to show menu with agents
- Added command **`!pins`** to show menu with pins
@@ -45,7 +29,7 @@ Unfinished, unoptimized and not fully functional ugly demo weapon paints plugin
- [MenuManagerCS2](https://github.com/NickFox007/MenuManagerCS2)
- MySQL database
## 🗄️ CS2 Server
## CS2 Server
- Have working CounterStrikeSharp (**with RUNTIME!**)
- Download from Release and copy plugin to plugins
- Run server with plugin, **it will generate config if installed correctly!**
@@ -53,72 +37,49 @@ Unfinished, unoptimized and not fully functional ugly demo weapon paints plugin
- In `addons/counterstrikesharp/configs/`**`core.json`** set **FollowCS2ServerGuidelines** to **`false`**
- Copy from plugins folder gamedata file **`weaponpaints.json`** to folder **`addons/counterstrikesharp/gamedata/`**
## 🛠️ Plugin Configuration
## Plugin Configuration
<details>
<summary>Click to expand</summary>
<code><pre>{
"ConfigVersion": 10, // Don't touch
"SkinsLanguage": "en", // Language
"DatabaseHost": "", // MySQL host
"DatabasePort": 3306, // MySQL Port
"DatabaseUser": "", // MySQL Username
"DatabasePassword": "", // MySQL User password
"DatabaseName": "", // MySQL Database name
"CmdRefreshCooldownSeconds": 3, // Cooldown time in refreshing skins (!wp command)
"Website": "example.com/skins", // Website used in WebsiteMessageCommand (!ws command)
"Additional": {
"KnifeEnabled": true, // If knives are enabled
"GloveEnabled": true, // If gloves are enabled
"MusicEnabled": true, // If music kits are enabled
"AgentEnabled": true, // If agents are enabled
"SkinEnabled": true, // If skins are enabled
"PinsEnabled": true, // If pins are enabled
"CommandWpEnabled": true, // If command !wp is enabled
"CommandKillEnabled": true, // If command !kill is enabled
"CommandKnife": [ // Command for knives
"knife"
],
"CommandMusic": [ // Command for music kits
"music"
],
"CommandPin": [ // Command for pins
"pin",
"pins",
"coin",
"coins"
],
"CommandGlove": [ // Command for gloves
"gloves"
],
"CommandAgent": [ // Command for agents
"agents"
],
"CommandStattrak": [ // Command for stattrak
"stattrak",
"st"
],
"CommandSkin": [ // Command for skins
"ws"
],
"CommandSkinSelection": [ // Command for skin selection
"skins"
],
"CommandRefresh": [ // Command for refreshing your skins
"wp"
],
"CommandKill": [ // Command for death
"kill"
],
"GiveRandomKnife": false, // If it should give you Random Knife
"GiveRandomSkin": false, // If it should give you Random Skin
"ShowSkinImage": true // When you select a skin if it should show skins image
},
"MenuType": "selectable" // Menu type commands. Can be: selectable, dynamic, center, chat, console
}
"Version": 4, // Don't touch
"DatabaseHost": "", // MySQL host
"DatabasePort": 3306, // MySQL port
"DatabaseUser": "", // MySQL username
"DatabasePassword": "", // MySQL user password
"DatabaseName": "", // MySQL database name
"CmdRefreshCooldownSeconds": 60, // Cooldown time in refreshing skins (!wp command)
"Prefix": "[WeaponPaints]", // Prefix every chat message
"Website": "example.com/skins", // Website used in WebsiteMessageCommand (!ws command)
"Messages": {
"WebsiteMessageCommand": "Visit {WEBSITE} where you can change skins.", // Information about website where player can change skins (!ws command) Set to empty to disable
"SynchronizeMessageCommand": "Type !wp to synchronize chosen skins.", // Information about skins refreshing (!ws command) Set to empty to disable
"KnifeMessageCommand": "Type !knife to open knife menu.", // Information about knife menu (!ws command) Set to empty to disable
"CooldownRefreshCommand": "You can\u0027t refresh weapon paints right now.", // Cooldown information (!wp command) Set to empty to disable
"SuccessRefreshCommand": "Refreshing weapon paints.", // Information about refreshing skins (!wp command) Set to empty to disable
"ChosenKnifeMenu": "You have chosen {KNIFE} as your knife.", // Information about choosen knife (!knife command) Set to empty to disable
"ChosenSkinMenu": "You have chosen {SKIN} as your skin.", // Information about choosen skin (!skins command) Set to empty to disable
"ChosenKnifeMenuKill": "To correctly apply skin for knife, you need to type !kill.", // Information about suicide after knife selection (!knife command) Set to empty to disable
"KnifeMenuTitle": "Knife Menu.", // Menu title (!knife menu)
"WeaponMenuTitle": "Weapon Menu.", // Menu title (!skins menu)
"SkinMenuTitle": "Select skin for {WEAPON}" // Menu title (!skins menu, after weapon select)
},
"Additional": {
"KnifeEnabled": true, // Enable or disable knife feature
"SkinEnabled": true, // Enable or disable skin feature
"CommandWpEnabled": true, // Enable or disable refreshing command
"CommandKillEnabled": true, // Enable or disable kill command
"CommandKnife": "knife", // Name of knife menu command, u can change to for e.g, knives
"CommandSkin": "ws", // Name of skin information command, u can change to for e.g, skins
"CommandSkinSelection": "skins", // Name of skins menu command, u can change to for e.g, weapons
"CommandRefresh": "wp", // Name of skin refreshing command, u can change to for e.g, refreshskins
"CommandKill": "kill", // Name of kill command, u can change to for e.g, suicide
"GiveRandomKnife": false, // Give random knife to players if they didn't choose
"GiveRandomSkins": false // Give random skins to players if they didn't choose
},
</pre></code>
</details>
## 🖥️ Web install
## Web install
- Requires PHP >= 7.4 with curl and pdo_mysql ***(Tested on php ver **`8.2.3`** and nginx webserver)***
- **Before using website, make sure the plugin is correctly loaded in cs2 server!** Mysql tables are created by plugin not by website.
- Copy website to web server ***(Folder `img` not needed)***
@@ -126,44 +87,22 @@ Unfinished, unoptimized and not fully functional ugly demo weapon paints plugin
- Fill in database credentials and api key in `class/config.php`
- Visit website and login via steam
## 🧩 Web Features
> [!WARNING]
> We recommend you to use any third-party website for WeaponPaints. Website by us doesn't get updated!
## Web Features
- Basic website
- Steam login/logout
- Change knife, paint, seed and wear
## 🌐 Third-party websites
- **[CSS-Bans](https://github.com/counterstrikesharp-panel/css-bans)**
- **[CS2-WeaponPaints-Website](https://github.com/LielXD/CS2-WeaponPaints-Website)**
- **[cs2-WeaponPaints-website](https://github.com/L1teD/cs2-WeaponPaints-website)** > This webiste is different from the one above!
- **[CS2-WeaponPaints-Web](https://github.com/rogeraabbccdd/CS2-WeaponPaints-Web)**
## 🤔 Troubleshooting
## Troubleshooting
<details>
**Skins are not changing:**
Set FollowCSGOGuidelines to false in cssharps core.jcon config
**Database error table does not exists:**
Plugin is not loaded or configured with mysql credentials. Tables are auto-created by plugin.
**An error occured in Get....FromDatabase:**
If you used WeaponPaints and you update to newer version you could get this error. You need to add this queries to Database:
```
ALTER TABLE wp_player_skins
ADD COLUMN weapon_nametag VARCHAR(128) DEFAULT NULL,
ADD COLUMN weapon_stattrak tinyint(1) NOT NULL,
ADD COLUMN weapon_stattrak_count int(10) NOT NULL,
ADD COLUMN weapon_sticker_0 VARCHAR(128) DEFAULT '0;0;0;0;0;0;0' COMMENT 'id;schema;x;y;wear;scale;rotation',
ADD COLUMN weapon_sticker_1 VARCHAR(128) DEFAULT '0;0;0;0;0;0' COMMENT 'id;schema;x;y;wear;scale;rotation',
ADD COLUMN weapon_sticker_2 VARCHAR(128) DEFAULT '0;0;0;0;0;0' COMMENT 'id;schema;x;y;wear;scale;rotation',
ADD COLUMN weapon_sticker_3 VARCHAR(128) DEFAULT '0;0;0;0;0;0' COMMENT 'id;schema;x;y;wear;scale;rotation',
ADD COLUMN weapon_sticker_4 VARCHAR(128) DEFAULT '0;0;0;0;0;0' COMMENT 'id;schema;x;y;wear;scale;rotation',
ADD COLUMN weapon_keychain VARCHAR(128) DEFAULT '0;0;0;0;0' COMMENT 'id;x;y;z;seed';
```
</details>
### Use this plugin at your own risk! Using this may lead to GSLT ban or something else Valve come with. [Valve Server guidelines](https://blog.counter-strike.net/index.php/server_guidelines/)
## Website Preview
## Preview
![preview](https://github.com/Nereziel/cs2-WeaponPaints/blob/main/website/preview.png?raw=true)

View File

@@ -168,4 +168,6 @@ public partial class WeaponPaints
private static readonly PluginCapability<IMenuApi> MenuCapability = new("menu:nfcore");
private int _fadeSeed;
internal List<CCSPlayerController> Players = [];
}

View File

@@ -9,20 +9,20 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CounterStrikeSharp.API" Version="1.0.339" />
<PackageReference Include="Dapper" Version="2.1.35" />
<PackageReference Include="MySqlConnector" Version="2.4.0-beta.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="CounterStrikeSharp.API" Version="1.0.358" />
<PackageReference Include="Dapper" Version="2.1.66" />
<PackageReference Include="MySqlConnector" Version="2.4.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
</ItemGroup>
<ItemGroup>
<None Update="lang\**\*.*" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
<ItemGroup>
<None Update="gamedata\*.*" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
<ItemGroup>
<Reference Include="MenuManagerApi">
<HintPath>3rd_party\MenuManagerApi.dll</HintPath>

View File

@@ -1,6 +1,11 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005Cxdaff_005CDocuments_005CGitHub_005Ccs2_002DWeaponPaints_005C3rd_005Fparty_005CMenuManagerApi_002Edll/@EntryIndexedValue">True</s:Boolean>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ACBaseAnimGraph_002Eg_002Ecs_002Fl_003AC_0021_003FUsers_003Fxdaff_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003Fedce4cda20b83aa28fbed15b81eb0eda1753e497144879a4bd754947d37639_003FCBaseAnimGraph_002Eg_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ACBaseEntity_002Eg_002Ecs_002Fl_003AC_0021_003FUsers_003Fxdaff_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003Fdd25ac51dad807865e0d135626a4fd984d63a388bf0c3285f9d7d7db9c1071_003FCBaseEntity_002Eg_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ACBodyComponent_002Eg_002Ecs_002Fl_003AC_0021_003FUsers_003Fxdaff_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003Fdb7e149cad83cf211ee55349a3442256ec62acce5ba41474ad124572f767e271_003FCBodyComponent_002Eg_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ACCSPlayerController_002Ecs_002Fl_003AC_0021_003FUsers_003Fxdaff_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003Fab13f7aee75d35b3ec314a3fd92a24c4c0126cef65a8dda49bd83da5a2a77443_003FCCSPlayerController_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ACCSPlayerController_005FInventoryServices_002Eg_002Ecs_002Fl_003AC_0021_003FUsers_003Fxdaff_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003Fff255772feb17b2ef53224c45249eee339ad7148e2b42bb1afad71bd57d02b69_003FCCSPlayerController_005FInventoryServices_002Eg_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ACGameSceneNode_002Ecs_002Fl_003AC_0021_003FUsers_003Fxdaff_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F343a4f176a269193769d7fd81231808c83529cab0f6c98fd96eb77f558974_003FCGameSceneNode_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ACModelState_002Eg_002Ecs_002Fl_003AC_0021_003FUsers_003Fxdaff_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003Fb03ffa24c03867c84b5d095397bd1578b8ea563ab2c72b30242ffad815d49e_003FCModelState_002Eg_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AListeners_002Eg_002Ecs_002Fl_003AC_0021_003FUsers_003Fxdaff_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003Fdbb2ccedd8f0b227a69f9ef0b434aa5a70b83e93bf1eac4cd91a31b7985efd4_003FListeners_002Eg_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ANetworkedVector_002Ecs_002Fl_003AC_0021_003FUsers_003Fxdaff_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003Fd68dbf9c04bc6046e155f1866c3615a47e34017f330c9e351d68979b9281c_003FNetworkedVector_002Ecs/@EntryIndexedValue">ForceIncluded</s:String></wpf:ResourceDictionary>

View File

@@ -1,30 +0,0 @@
{
"wp_prefix": "{lightblue}[WeaponPaints] {default}",
"wp_info_website": "Navštiv {lime}{0}{default} kde si můžeš změnit skiny",
"wp_info_refresh": "Napiš {lime}!wp{default} pro synchronizaci vybraných skinů",
"wp_info_knife": "Napiš {lime}!knife{default} pro otevření menu nožů",
"wp_info_glove": "Napiš {lime}!gloves{default} pro otevření menu rukavic",
"wp_info_agent": "Napiš {lime}!agents{default} pro otevření menu agentů",
"wp_info_music": "Napiš {lime}!music{default} pro otevření menu MVP hudeb",
"wp_info_pin": "Napiš {lime}!pins{default} pro otevření menu odznaků",
"wp_command_cooldown": "{lightred}Skiny nelze nýni obnovit!",
"wp_command_refresh_done": "{lime}Obnovuji skiny",
"wp_knife_menu_select": "Vybral jsi si {lime}{0}{default} jako tvůj nůž",
"wp_knife_menu_kill": "",
"wp_knife_menu_title": "Menu nožů",
"wp_glove_menu_select": "Vybral jsi si {lime}{0}{default} jako tvoje rukavice",
"wp_glove_menu_title": "Menu rukavic",
"wp_agent_menu_select": "Vybral jsi si {lime}{0}{default} jako tvůj agent",
"wp_agent_menu_title": "Menu agentů",
"wp_music_menu_title": "Menu MVP hudeb",
"wp_music_menu_select": "Vybral jsi si {lime}{0}{default} jako tvojí MVP hudbu",
"wp_pins_menu_title": "Menu odznaků",
"wp_pins_menu_select": "Vybral jsi si {lime}{0}{default} jako tvůj odznak",
"wp_skin_menu_weapon_title": "Menu zbraní",
"wp_skin_menu_skin_title": "Vyběr skinů pro {lime}{0}{default}",
"wp_skin_menu_select": "Vybral jsi si {lime}{0}{default} jako tvůj skin",
"wp_stattrak_action": "Úspěšně jste změnil nastavení stattraku",
"None": "Žádné"
}