Compare commits

...

12 Commits

Author SHA1 Message Date
Nereziel
e9f7db5171 Merge pull request #51 from daffyyyy/website-fix-1
Fixed blank page
2023-11-19 21:14:15 +01:00
Dawid Bepierszcz
648b928b4e Update index.php 2023-11-19 21:10:55 +01:00
Nereziel
530a7d64c7 Update README.md 2023-11-19 20:45:12 +01:00
Nereziel
3453f4c505 Merge pull request #47 from daffyyyy/feature/global-share
EXPERIMENTAL (GlobalShare) - Website for all servers
2023-11-19 19:03:05 +01:00
Nereziel
25b466422b Update build.yml 2023-11-19 19:02:26 +01:00
daffyyyy
6baa59dd9b Update WeaponPaints.cs
New version
2023-11-19 12:30:47 +01:00
daffyyyy
10afe7ce1e Update WeaponPaints.cs 2023-11-19 12:24:57 +01:00
daffyyyy
5eeb0c5fec Initial 2023-11-19 02:07:29 +01:00
Nereziel
e53ee27b39 Merge pull request #44 from daffyyyy/fix-knives_finally
Finally fixed knife problem?
2023-11-18 19:26:37 +01:00
Dawid Bepierszcz
75112b02fe Update WeaponPaints.cs 2023-11-18 19:21:28 +01:00
Nereziel
8e92635231 sync paints on plugin reload 2023-11-18 15:20:26 +01:00
Nereziel
6923295cb6 Update build.yml 2023-11-18 15:14:40 +01:00
6 changed files with 776 additions and 616 deletions

View File

@@ -30,9 +30,10 @@ jobs:
run: dotnet build ${{ env.PROJECT_PATH }} -c WeaponPaints -o ${{ env.OUTPUT_PATH }}
publish:
if: github.event_name == 'push'
permissions: write-all
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3
- name: Setup .NET
@@ -72,4 +73,4 @@ jobs:
name: "Build ${{ env.BUILD_NUMBER }}"
tag: "build-${{ env.BUILD_NUMBER }}"
body: |
Place the plugin in game/csgo/addons/counterstrikesharp/plugins/WeaponPaints
Place the plugin in game/csgo/addons/counterstrikesharp/plugins/WeaponPaints

139
Config.cs
View File

@@ -3,92 +3,95 @@ using System.Text.Json.Serialization;
namespace WeaponPaints
{
public class Messages
{
[JsonPropertyName("WebsiteMessageCommand")]
public string WebsiteMessageCommand { get; set; } = "Visit {WEBSITE} where you can change skins.";
[JsonPropertyName("SynchronizeMessageCommand")]
public string SynchronizeMessageCommand { get; set; } = "Type !wp to synchronize chosen skins.";
[JsonPropertyName("KnifeMessageCommand")]
public string KnifeMessageCommand { get; set; } = "Type !knife to open knife menu.";
[JsonPropertyName("CooldownRefreshCommand")]
public string CooldownRefreshCommand { get; set; } = "You can't refresh weapon paints right now.";
[JsonPropertyName("SuccessRefreshCommand")]
public string SuccessRefreshCommand { get; set; } = "Refreshing weapon paints.";
[JsonPropertyName("ChosenKnifeMenu")]
public string ChosenKnifeMenu { get; set; } = "You have chosen {KNIFE} as your knife.";
[JsonPropertyName("ChosenKnifeMenuKill")]
public string ChosenKnifeMenuKill { get; set; } = "To correctly apply skin for knife, you need to type !kill.";
[JsonPropertyName("KnifeMenuTitle")]
public string KnifeMenuTitle { get; set; } = "Knife Menu.";
}
public class Messages
{
[JsonPropertyName("WebsiteMessageCommand")]
public string WebsiteMessageCommand { get; set; } = "Visit {WEBSITE} where you can change skins.";
[JsonPropertyName("SynchronizeMessageCommand")]
public string SynchronizeMessageCommand { get; set; } = "Type !wp to synchronize chosen skins.";
[JsonPropertyName("KnifeMessageCommand")]
public string KnifeMessageCommand { get; set; } = "Type !knife to open knife menu.";
[JsonPropertyName("CooldownRefreshCommand")]
public string CooldownRefreshCommand { get; set; } = "You can't refresh weapon paints right now.";
[JsonPropertyName("SuccessRefreshCommand")]
public string SuccessRefreshCommand { get; set; } = "Refreshing weapon paints.";
[JsonPropertyName("ChosenKnifeMenu")]
public string ChosenKnifeMenu { get; set; } = "You have chosen {KNIFE} as your knife.";
[JsonPropertyName("ChosenKnifeMenuKill")]
public string ChosenKnifeMenuKill { get; set; } = "To correctly apply skin for knife, you need to type !kill.";
[JsonPropertyName("KnifeMenuTitle")]
public string KnifeMenuTitle { get; set; } = "Knife Menu.";
}
public class Additional
{
[JsonPropertyName("SkinVisibilityFix")]
public bool SkinVisibilityFix { get; set; } = true;
public class Additional
{
[JsonPropertyName("SkinVisibilityFix")]
public bool SkinVisibilityFix { get; set; } = true;
[JsonPropertyName("KnifeEnabled")]
public bool KnifeEnabled { get; set; } = true;
[JsonPropertyName("KnifeEnabled")]
public bool KnifeEnabled { get; set; } = true;
[JsonPropertyName("SkinEnabled")]
public bool SkinEnabled { get; set; } = true;
[JsonPropertyName("SkinEnabled")]
public bool SkinEnabled { get; set; } = true;
[JsonPropertyName("CommandWpEnabled")]
public bool CommandWpEnabled { get; set; } = true;
[JsonPropertyName("CommandWpEnabled")]
public bool CommandWpEnabled { get; set; } = true;
[JsonPropertyName("CommandKillEnabled")]
public bool CommandKillEnabled { get; set; } = true;
[JsonPropertyName("CommandKnife")]
public string CommandKnife { get; set; } = "knife";
[JsonPropertyName("CommandKillEnabled")]
public bool CommandKillEnabled { get; set; } = true;
[JsonPropertyName("CommandSkin")]
public string CommandSkin { get; set; } = "ws";
[JsonPropertyName("CommandKnife")]
public string CommandKnife { get; set; } = "knife";
[JsonPropertyName("CommandRefresh")]
public string CommandRefresh { get; set; } = "wp";
[JsonPropertyName("CommandSkin")]
public string CommandSkin { get; set; } = "ws";
[JsonPropertyName("CommandKill")]
public string CommandKill { get; set; } = "kill";
[JsonPropertyName("CommandRefresh")]
public string CommandRefresh { get; set; } = "wp";
[JsonPropertyName("GiveRandomKnife")]
public bool GiveRandomKnife { get; set; } = false;
}
[JsonPropertyName("CommandKill")]
public string CommandKill { get; set; } = "kill";
public class WeaponPaintsConfig : BasePluginConfig
{
public override int Version { get; set; } = 4;
[JsonPropertyName("GiveRandomKnife")]
public bool GiveRandomKnife { get; set; } = false;
}
[JsonPropertyName("DatabaseHost")]
public string DatabaseHost { get; set; } = "";
public class WeaponPaintsConfig : BasePluginConfig
{
public override int Version { get; set; } = 4;
[JsonPropertyName("DatabasePort")]
public int DatabasePort { get; set; } = 3306;
[JsonPropertyName("DatabaseHost")]
public string DatabaseHost { get; set; } = "";
[JsonPropertyName("DatabaseUser")]
public string DatabaseUser { get; set; } = "";
[JsonPropertyName("DatabasePort")]
public int DatabasePort { get; set; } = 3306;
[JsonPropertyName("DatabasePassword")]
public string DatabasePassword { get; set; } = "";
[JsonPropertyName("DatabaseUser")]
public string DatabaseUser { get; set; } = "";
[JsonPropertyName("DatabaseName")]
public string DatabaseName { get; set; } = "";
[JsonPropertyName("DatabasePassword")]
public string DatabasePassword { get; set; } = "";
[JsonPropertyName("CmdRefreshCooldownSeconds")]
public int CmdRefreshCooldownSeconds { get; set; } = 60;
[JsonPropertyName("DatabaseName")]
public string DatabaseName { get; set; } = "";
[JsonPropertyName("Prefix")]
public string Prefix { get; set; } = "[WeaponPaints]";
[JsonPropertyName("GlobalShare")]
public bool GlobalShare { get; set; } = false;
[JsonPropertyName("Website")]
public string Website { get; set; } = "example.com/skins";
[JsonPropertyName("CmdRefreshCooldownSeconds")]
public int CmdRefreshCooldownSeconds { get; set; } = 60;
[JsonPropertyName("Messages")]
public Messages Messages { get; set; } = new Messages();
[JsonPropertyName("Prefix")]
public string Prefix { get; set; } = "[WeaponPaints]";
[JsonPropertyName("Website")]
public string Website { get; set; } = "example.com/skins";
[JsonPropertyName("Messages")]
public Messages Messages { get; set; } = new Messages();
[JsonPropertyName("Additional")]
public Additional Additional { get; set; } = new Additional();
}
[JsonPropertyName("Additional")]
public Additional Additional { get; set; } = new Additional();
}
}

View File

@@ -11,7 +11,7 @@ There will be a lot of frequent changes which may break functionality or compati
### Features
- changes only paint, seed and wear on weapons and knives
- mysql based
- mysql based or global website at [weaponpaints.fun](https://weaponpaints.fun/), so you dont need mysql/website
- data sync on player connect
- Added command `!wp` to refresh skins (with cooldown in second can be configured)
- Added command `!ws` to show website
@@ -20,10 +20,12 @@ There will be a lot of frequent changes which may break functionality or compati
### CS2 server:
- compile and copy plugin to plugins. Info here [https://docs.cssharp.dev/guides/hello-world-plugin/](https://docs.cssharp.dev/guides/hello-world-plugin/)
- setup `addons/counterstrikesharp/configs/plugins/WeaponPaints/WeaponPaints.json` with database credentials
- setup `addons/counterstrikesharp/configs/plugins/WeaponPaints/WeaponPaints.json`
set `GlobalShare` to true for gloval, or include database credentials
- in `addons/counterstrikesharp/configs/core.json` set **FollowCS2ServerGuidelines** to **false**
### Web install:
- not needed if config `GlobalShare = true`
- requires PHP min v7.3 (tested on php ver `8.2.3` and nginx webserver)
- copy website to web server (img folder not needed)
- import `database.sql` to mysql
@@ -31,6 +33,9 @@ There will be a lot of frequent changes which may break functionality or compati
- fill in database credentials and api key in `class/config.php`
- visit website and login via steam
### Known issues
- Issue on Windows servers, no knives are given.
### 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/)
### Preview

File diff suppressed because it is too large Load Diff

View File

@@ -11,6 +11,7 @@
<PackageReference Include="CounterStrikeSharp.API" Version="*" />
<PackageReference Include="Dapper" Version="2.1.21" />
<PackageReference Include="MySqlConnector" Version="2.3.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
<ItemGroup>

View File

@@ -7,9 +7,7 @@ require_once 'class/utils.php';
$db = new DataBase();
if (isset($_SESSION['steamid'])) {
include('steamauth/userInfo.php');
$steamid = $steamprofile['steamid'];
$steamid = $_SESSION['steamid'];
$weapons = UtilsClass::getWeaponsFromArray();
$skins = UtilsClass::skinsFromJson();