Compare commits
27 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
118931f44d | ||
|
|
843ae34e31 | ||
|
|
46a720ff83 | ||
|
|
63d059b607 | ||
|
|
005ef18338 | ||
|
|
c0c1fe2566 | ||
|
|
c4ad17a7ed | ||
|
|
99fde6ec52 | ||
|
|
ca2c3eb212 | ||
|
|
b5a4577af1 | ||
|
|
ba93e4a3aa | ||
|
|
7d435da9d1 | ||
|
|
50008cf74a | ||
|
|
4b9b169483 | ||
|
|
25d251deff | ||
|
|
d8f7798f9f | ||
|
|
fb023aff5b | ||
|
|
6c91e20a4d | ||
|
|
93dae346d0 | ||
|
|
8e0b1cc99a | ||
|
|
c99acbcdb3 | ||
|
|
8beaee94da | ||
|
|
62238b4446 | ||
|
|
03f194ac4e | ||
|
|
e775b05f9f | ||
|
|
b09b97bbd5 | ||
|
|
e441ccc601 |
7
.github/workflows/build.yml
vendored
@@ -34,13 +34,16 @@ jobs:
|
|||||||
${{ env.OUTPUT_PATH }}/CounterStrikeSharp.API.dll \
|
${{ env.OUTPUT_PATH }}/CounterStrikeSharp.API.dll \
|
||||||
${{ env.OUTPUT_PATH }}/McMaster.NETCore.Plugins.dll \
|
${{ env.OUTPUT_PATH }}/McMaster.NETCore.Plugins.dll \
|
||||||
${{ env.OUTPUT_PATH }}/Microsoft.DotNet.PlatformAbstractions.dll \
|
${{ env.OUTPUT_PATH }}/Microsoft.DotNet.PlatformAbstractions.dll \
|
||||||
${{ env.OUTPUT_PATH }}/Microsoft.Extensions.DependencyModel.dll
|
${{ env.OUTPUT_PATH }}/Microsoft.Extensions.DependencyModel.dll \
|
||||||
- name: Zip
|
- name: Zip
|
||||||
uses: thedoctor0/zip-release@0.7.5
|
uses: thedoctor0/zip-release@0.7.5
|
||||||
with:
|
with:
|
||||||
type: 'zip'
|
type: 'zip'
|
||||||
filename: '${{ env.PROJECT_NAME }}.zip'
|
filename: '${{ env.PROJECT_NAME }}.zip'
|
||||||
path: ${{ env.OUTPUT_PATH }}
|
path: ${{ env.OUTPUT_PATH }}
|
||||||
|
- name: Clean files Website
|
||||||
|
run: |
|
||||||
|
rm -rf website/img/
|
||||||
- name: Zip
|
- name: Zip
|
||||||
uses: thedoctor0/zip-release@0.7.5
|
uses: thedoctor0/zip-release@0.7.5
|
||||||
with:
|
with:
|
||||||
@@ -54,4 +57,4 @@ jobs:
|
|||||||
name: "Build ${{ env.BUILD_NUMBER }}"
|
name: "Build ${{ env.BUILD_NUMBER }}"
|
||||||
tag: "build-${{ env.BUILD_NUMBER }}"
|
tag: "build-${{ env.BUILD_NUMBER }}"
|
||||||
body: |
|
body: |
|
||||||
Place the plugin in game/csgo/addons/counterstrikesharp/plugins/WeaponPaints
|
Place the plugin in game/csgo/addons/counterstrikesharp/plugins/WeaponPaints
|
||||||
|
|||||||
20
Config.cs
@@ -21,9 +21,24 @@ namespace WeaponPaints
|
|||||||
public string KnifeMenuTitle { get; set; } = "Knife Menu.";
|
public string KnifeMenuTitle { get; set; } = "Knife Menu.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class Additional
|
||||||
|
{
|
||||||
|
[JsonPropertyName("SkinVisibilityFix")]
|
||||||
|
public bool SkinVisibilityFix { get; set; } = true;
|
||||||
|
|
||||||
|
[JsonPropertyName("KnifeEnabled")]
|
||||||
|
public bool KnifeEnabled { get; set; } = true;
|
||||||
|
|
||||||
|
[JsonPropertyName("SkinEnabled")]
|
||||||
|
public bool SkinEnabled { get; set; } = true;
|
||||||
|
|
||||||
|
[JsonPropertyName("CommandWpEnabled")]
|
||||||
|
public bool CommandWpEnabled { get; set; } = true;
|
||||||
|
}
|
||||||
|
|
||||||
public class WeaponPaintsConfig : BasePluginConfig
|
public class WeaponPaintsConfig : BasePluginConfig
|
||||||
{
|
{
|
||||||
public override int Version { get; set; } = 2;
|
public override int Version { get; set; } = 3;
|
||||||
|
|
||||||
[JsonPropertyName("DatabaseHost")]
|
[JsonPropertyName("DatabaseHost")]
|
||||||
public string DatabaseHost { get; set; } = "";
|
public string DatabaseHost { get; set; } = "";
|
||||||
@@ -51,6 +66,9 @@ namespace WeaponPaints
|
|||||||
|
|
||||||
[JsonPropertyName("Messages")]
|
[JsonPropertyName("Messages")]
|
||||||
public Messages Messages { get; set; } = new Messages();
|
public Messages Messages { get; set; } = new Messages();
|
||||||
|
|
||||||
|
[JsonPropertyName("Additional")]
|
||||||
|
public Additional Additional { get; set; } = new Additional();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
16
README.md
@@ -1,11 +1,13 @@
|
|||||||
# cs2-WeaponPaints
|
# cs2-WeaponPaints
|
||||||
|
|
||||||
[](https://ko-fi.com/E1E2G0P2O) or [Donate on Steam](https://steamcommunity.com/tradeoffer/new/?partner=41515647&token=gW2W-nXE)
|
|
||||||
|
|
||||||
### 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/)
|
|
||||||
|
|
||||||
### Description
|
### Description
|
||||||
Unfinished, unoptimized and not fully functional ugly demo weapon paints plugin for [CSSharp](https://docs.cssharp.dev/).
|
Unfinished, unoptimized and not fully functional ugly demo weapon paints plugin for [CSSharp](https://docs.cssharp.dev/).
|
||||||
|
There will be a lot of frequent changes which may break functionality or compatibility. You have been warned!
|
||||||
|
|
||||||
|
## Created [Discord server](https://discord.gg/mwEQppJ5AT) where you can discus about plugin.
|
||||||
|
|
||||||
|
### Consider to donate instead of buying from unknown sources.
|
||||||
|
[](https://ko-fi.com/E1E2G0P2O) or [Donate on Steam](https://steamcommunity.com/tradeoffer/new/?partner=41515647&token=gW2W-nXE)
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
- changes only paint, seed and wear on weapons and knives
|
- changes only paint, seed and wear on weapons and knives
|
||||||
@@ -22,12 +24,14 @@ Unfinished, unoptimized and not fully functional ugly demo weapon paints plugin
|
|||||||
- in `addons/counterstrikesharp/configs/core.json` set **FollowCS2ServerGuidelines** to **false**
|
- in `addons/counterstrikesharp/configs/core.json` set **FollowCS2ServerGuidelines** to **false**
|
||||||
|
|
||||||
### Web install:
|
### Web install:
|
||||||
- requires PHP (tested on php ver `8.2.3` and nginx webserver)
|
- requires PHP min v7.3 (tested on php ver `8.2.3` and nginx webserver)
|
||||||
- copy website to web server
|
- copy website to web server (img folder not needed)
|
||||||
- import `database.sql` to mysql
|
- import `database.sql` to mysql
|
||||||
- get steam api key [https://steamcommunity.com/dev/apikey](https://steamcommunity.com/dev/apikey)
|
- get steam api key [https://steamcommunity.com/dev/apikey](https://steamcommunity.com/dev/apikey)
|
||||||
- fill in database credentials and api key in `class/config.php`
|
- fill in database credentials and api key in `class/config.php`
|
||||||
- visit website and login via steam
|
- visit website and login via steam
|
||||||
|
|
||||||
|
### 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
|
### Preview
|
||||||

|

|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using CounterStrikeSharp.API;
|
using CounterStrikeSharp.API;
|
||||||
using CounterStrikeSharp.API.Core;
|
using CounterStrikeSharp.API.Core;
|
||||||
|
using CounterStrikeSharp.API.Core.Attributes;
|
||||||
using CounterStrikeSharp.API.Core.Attributes.Registration;
|
using CounterStrikeSharp.API.Core.Attributes.Registration;
|
||||||
using CounterStrikeSharp.API.Modules.Commands;
|
using CounterStrikeSharp.API.Modules.Commands;
|
||||||
using CounterStrikeSharp.API.Modules.Entities;
|
using CounterStrikeSharp.API.Modules.Entities;
|
||||||
@@ -13,6 +14,7 @@ using System.Reflection;
|
|||||||
|
|
||||||
|
|
||||||
namespace WeaponPaints;
|
namespace WeaponPaints;
|
||||||
|
[MinimumApiVersion(52)]
|
||||||
public class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig>
|
public class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig>
|
||||||
{
|
{
|
||||||
public override string ModuleName => "WeaponPaints";
|
public override string ModuleName => "WeaponPaints";
|
||||||
@@ -74,7 +76,8 @@ public class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig>
|
|||||||
RegisterListener<Listeners.OnMapStart>(OnMapStart);
|
RegisterListener<Listeners.OnMapStart>(OnMapStart);
|
||||||
RegisterEventHandler<EventPlayerSpawn>(OnPlayerSpawn);
|
RegisterEventHandler<EventPlayerSpawn>(OnPlayerSpawn);
|
||||||
//RegisterEventHandler<EventRoundPrestart>(OnRoundPreStart);
|
//RegisterEventHandler<EventRoundPrestart>(OnRoundPreStart);
|
||||||
SetupMenus();
|
if (Config.Additional.KnifeEnabled)
|
||||||
|
SetupMenus();
|
||||||
}
|
}
|
||||||
public void OnConfigParsed(WeaponPaintsConfig config)
|
public void OnConfigParsed(WeaponPaintsConfig config)
|
||||||
{
|
{
|
||||||
@@ -112,6 +115,7 @@ public class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig>
|
|||||||
}
|
}
|
||||||
private void OnMapStart(string mapName)
|
private void OnMapStart(string mapName)
|
||||||
{
|
{
|
||||||
|
if (!Config.Additional.KnifeEnabled) return;
|
||||||
// TODO
|
// TODO
|
||||||
// needed for now
|
// needed for now
|
||||||
base.AddTimer(2.0f, () => {
|
base.AddTimer(2.0f, () => {
|
||||||
@@ -124,46 +128,43 @@ public class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig>
|
|||||||
{
|
{
|
||||||
int playerIndex = playerSlot + 1;
|
int playerIndex = playerSlot + 1;
|
||||||
Task.Run(async () =>
|
Task.Run(async () =>
|
||||||
{
|
{
|
||||||
await GetKnifeFromDatabase(playerIndex);
|
if (Config.Additional.KnifeEnabled)
|
||||||
|
await GetKnifeFromDatabase(playerIndex);
|
||||||
await GetWeaponPaintsFromDatabase(playerIndex);
|
await GetWeaponPaintsFromDatabase(playerIndex);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
private void OnClientDisconnect(int playerSlot)
|
private void OnClientDisconnect(int playerSlot)
|
||||||
{
|
{
|
||||||
// TODO: Clean up after player
|
// TODO: Clean up after player
|
||||||
g_playersKnife.Remove(playerSlot+1);
|
if (Config.Additional.KnifeEnabled)
|
||||||
|
g_playersKnife.Remove(playerSlot+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private HookResult OnPlayerSpawn(EventPlayerSpawn @event, GameEventInfo info)
|
private HookResult OnPlayerSpawn(EventPlayerSpawn @event, GameEventInfo info)
|
||||||
{
|
{
|
||||||
var player = @event.Userid;
|
var player = @event.Userid;
|
||||||
if (!player.IsValid || !player.PlayerPawn.IsValid || !player.PawnIsAlive)
|
if (!player.IsValid || !player.PlayerPawn.IsValid)
|
||||||
{
|
{
|
||||||
return HookResult.Continue;
|
return HookResult.Continue;
|
||||||
}
|
}
|
||||||
if (player.IsBot)
|
|
||||||
{
|
|
||||||
player.GiveNamedItem("weapon_knife");
|
|
||||||
return HookResult.Continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!PlayerHasKnife(player))
|
if (Config.Additional.KnifeEnabled)
|
||||||
|
GiveKnifeToPlayer(player);
|
||||||
|
|
||||||
|
if (Config.Additional.SkinVisibilityFix)
|
||||||
{
|
{
|
||||||
if (g_playersKnife.TryGetValue((int)player.EntityIndex!.Value.Value, out var knife))
|
// Check the best slot and set it. Weird solution but works xD
|
||||||
{
|
AddTimer(0.1f, () => NativeAPI.IssueClientCommand((int)player.EntityIndex!.Value.Value - 1, "slot3"));
|
||||||
player.GiveNamedItem(knife);
|
AddTimer(0.25f, () => NativeAPI.IssueClientCommand((int)player.EntityIndex!.Value.Value - 1, "slot2"));
|
||||||
}
|
AddTimer(0.35f, () => NativeAPI.IssueClientCommand((int)player.EntityIndex!.Value.Value - 1, "slot1"));
|
||||||
else
|
|
||||||
{
|
|
||||||
player.GiveNamedItem("weapon_knife");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return HookResult.Continue;
|
return HookResult.Continue;
|
||||||
}
|
}
|
||||||
private void OnEntitySpawned(CEntityInstance entity)
|
private void OnEntitySpawned(CEntityInstance entity)
|
||||||
{
|
{
|
||||||
|
if (!Config.Additional.SkinEnabled) return;
|
||||||
var designerName = entity.DesignerName;
|
var designerName = entity.DesignerName;
|
||||||
if (!weaponList.Contains(designerName)) return;
|
if (!weaponList.Contains(designerName)) return;
|
||||||
bool isKnife = false;
|
bool isKnife = false;
|
||||||
@@ -207,9 +208,30 @@ public class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig>
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
public void GiveKnifeToPlayer(CCSPlayerController player)
|
||||||
|
{
|
||||||
|
if (!Config.Additional.KnifeEnabled) return;
|
||||||
|
if (player.IsBot)
|
||||||
|
{
|
||||||
|
player.GiveNamedItem((CsTeam)player.TeamNum == CsTeam.Terrorist ? "weapon_knife_t" : "weapon_knife");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!PlayerHasKnife(player))
|
||||||
|
{
|
||||||
|
if (g_playersKnife.TryGetValue((int)player.EntityIndex!.Value.Value, out var knife))
|
||||||
|
{
|
||||||
|
player.GiveNamedItem(knife);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player.GiveNamedItem((CsTeam)player.TeamNum == CsTeam.Terrorist ? "weapon_knife_t" : "weapon_knife");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
public void RemoveKnifeFromPlayer(CCSPlayerController player)
|
public void RemoveKnifeFromPlayer(CCSPlayerController player)
|
||||||
{
|
{
|
||||||
if (!player.PawnIsAlive) return;
|
if (!Config.Additional.KnifeEnabled) return;
|
||||||
if (!g_playersKnife.ContainsKey((int)player.EntityIndex!.Value.Value)) return;
|
if (!g_playersKnife.ContainsKey((int)player.EntityIndex!.Value.Value)) return;
|
||||||
var weapons = player.PlayerPawn.Value.WeaponServices!.MyWeapons;
|
var weapons = player.PlayerPawn.Value.WeaponServices!.MyWeapons;
|
||||||
foreach (var weapon in weapons)
|
foreach (var weapon in weapons)
|
||||||
@@ -220,15 +242,14 @@ public class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig>
|
|||||||
if (weapon.Value.DesignerName.Contains("knife"))
|
if (weapon.Value.DesignerName.Contains("knife"))
|
||||||
{
|
{
|
||||||
weapon.Value.Remove();
|
weapon.Value.Remove();
|
||||||
player.GiveNamedItem(g_playersKnife[(int)player.EntityIndex!.Value.Value]);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static bool PlayerHasKnife(CCSPlayerController player)
|
public bool PlayerHasKnife(CCSPlayerController player)
|
||||||
{
|
{
|
||||||
if (!player.PawnIsAlive) return false;
|
if (!Config.Additional.KnifeEnabled) return true;
|
||||||
var weapons = player.PlayerPawn.Value.WeaponServices!.MyWeapons;
|
var weapons = player.PlayerPawn.Value.WeaponServices!.MyWeapons;
|
||||||
foreach (var weapon in weapons)
|
foreach (var weapon in weapons)
|
||||||
{
|
{
|
||||||
@@ -244,6 +265,7 @@ public class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig>
|
|||||||
}
|
}
|
||||||
private void SetupMenus()
|
private void SetupMenus()
|
||||||
{
|
{
|
||||||
|
if (!Config.Additional.KnifeEnabled) return;
|
||||||
var giveItemMenu = new ChatMenu(ReplaceTags(Config.Messages.KnifeMenuTitle));
|
var giveItemMenu = new ChatMenu(ReplaceTags(Config.Messages.KnifeMenuTitle));
|
||||||
var handleGive = (CCSPlayerController player, ChatMenuOption option) =>
|
var handleGive = (CCSPlayerController player, ChatMenuOption option) =>
|
||||||
{
|
{
|
||||||
@@ -256,6 +278,7 @@ public class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig>
|
|||||||
player.PrintToChat(ReplaceTags(temp));
|
player.PrintToChat(ReplaceTags(temp));
|
||||||
}
|
}
|
||||||
RemoveKnifeFromPlayer(player);
|
RemoveKnifeFromPlayer(player);
|
||||||
|
GiveKnifeToPlayer(player);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
foreach (var knife in knifeTypes)
|
foreach (var knife in knifeTypes)
|
||||||
@@ -267,6 +290,7 @@ public class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig>
|
|||||||
[ConsoleCommand("css_wp", "refreshskins")]
|
[ConsoleCommand("css_wp", "refreshskins")]
|
||||||
public void OnCommandRefresh(CCSPlayerController? player, CommandInfo command)
|
public void OnCommandRefresh(CCSPlayerController? player, CommandInfo command)
|
||||||
{
|
{
|
||||||
|
if (!Config.Additional.CommandWpEnabled || !Config.Additional.SkinEnabled) return;
|
||||||
if (player == null) return;
|
if (player == null) return;
|
||||||
string temp = "";
|
string temp = "";
|
||||||
int playerIndex = (int)player.EntityIndex!.Value.Value;
|
int playerIndex = (int)player.EntityIndex!.Value.Value;
|
||||||
@@ -274,6 +298,8 @@ public class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig>
|
|||||||
{
|
{
|
||||||
commandCooldown[playerIndex] = DateTime.UtcNow;
|
commandCooldown[playerIndex] = DateTime.UtcNow;
|
||||||
Task.Run(async () => await GetWeaponPaintsFromDatabase(playerIndex));
|
Task.Run(async () => await GetWeaponPaintsFromDatabase(playerIndex));
|
||||||
|
if (Config.Additional.KnifeEnabled)
|
||||||
|
Task.Run(async () => await GetKnifeFromDatabase(playerIndex));
|
||||||
if (!string.IsNullOrEmpty(Config.Messages.SuccessRefreshCommand)) {
|
if (!string.IsNullOrEmpty(Config.Messages.SuccessRefreshCommand)) {
|
||||||
temp = $"{Config.Prefix} {Config.Messages.SuccessRefreshCommand}";
|
temp = $"{Config.Prefix} {Config.Messages.SuccessRefreshCommand}";
|
||||||
player.PrintToChat(ReplaceTags(temp));
|
player.PrintToChat(ReplaceTags(temp));
|
||||||
@@ -288,6 +314,7 @@ public class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig>
|
|||||||
[ConsoleCommand("css_ws", "weaponskins")]
|
[ConsoleCommand("css_ws", "weaponskins")]
|
||||||
public void OnCommandWS(CCSPlayerController? player, CommandInfo command)
|
public void OnCommandWS(CCSPlayerController? player, CommandInfo command)
|
||||||
{
|
{
|
||||||
|
if (!Config.Additional.SkinEnabled) return;
|
||||||
if (player == null) return;
|
if (player == null) return;
|
||||||
|
|
||||||
string temp = "";
|
string temp = "";
|
||||||
@@ -300,6 +327,7 @@ public class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig>
|
|||||||
temp = $"{Config.Prefix} {Config.Messages.SynchronizeMessageCommand}";
|
temp = $"{Config.Prefix} {Config.Messages.SynchronizeMessageCommand}";
|
||||||
player.PrintToChat(ReplaceTags(temp));
|
player.PrintToChat(ReplaceTags(temp));
|
||||||
}
|
}
|
||||||
|
if (!Config.Additional.KnifeEnabled) return;
|
||||||
if (!string.IsNullOrEmpty(Config.Messages.KnifeMessageCommand)) {
|
if (!string.IsNullOrEmpty(Config.Messages.KnifeMessageCommand)) {
|
||||||
temp = $"{Config.Prefix} {Config.Messages.KnifeMessageCommand}";
|
temp = $"{Config.Prefix} {Config.Messages.KnifeMessageCommand}";
|
||||||
player.PrintToChat(ReplaceTags(temp));
|
player.PrintToChat(ReplaceTags(temp));
|
||||||
@@ -312,6 +340,7 @@ public class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig>
|
|||||||
}
|
}
|
||||||
private async Task GetWeaponPaintsFromDatabase(int playerIndex)
|
private async Task GetWeaponPaintsFromDatabase(int playerIndex)
|
||||||
{
|
{
|
||||||
|
if (!Config.Additional.SkinEnabled) return;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
CCSPlayerController player = Utilities.GetPlayerFromIndex(playerIndex);
|
CCSPlayerController player = Utilities.GetPlayerFromIndex(playerIndex);
|
||||||
@@ -356,6 +385,7 @@ public class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig>
|
|||||||
}
|
}
|
||||||
private async Task GetKnifeFromDatabase(int playerIndex)
|
private async Task GetKnifeFromDatabase(int playerIndex)
|
||||||
{
|
{
|
||||||
|
if (!Config.Additional.KnifeEnabled) return;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
CCSPlayerController player = Utilities.GetPlayerFromIndex(playerIndex);
|
CCSPlayerController player = Utilities.GetPlayerFromIndex(playerIndex);
|
||||||
@@ -387,6 +417,7 @@ public class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig>
|
|||||||
}
|
}
|
||||||
private async Task SyncKnifeToDatabase(int playerIndex, string knife)
|
private async Task SyncKnifeToDatabase(int playerIndex, string knife)
|
||||||
{
|
{
|
||||||
|
if (!Config.Additional.KnifeEnabled) return;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
CCSPlayerController player = Utilities.GetPlayerFromIndex(playerIndex);
|
CCSPlayerController player = Utilities.GetPlayerFromIndex(playerIndex);
|
||||||
|
|||||||
96
website/class/utils.php
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
<?php
|
||||||
|
class UtilsClass
|
||||||
|
{
|
||||||
|
public static function skinsFromJson(): array
|
||||||
|
{
|
||||||
|
$skins = [];
|
||||||
|
$json = json_decode(file_get_contents(__DIR__ . "/../data/skins.json"), true);
|
||||||
|
|
||||||
|
foreach ($json as $skin) {
|
||||||
|
$skins[(int) $skin['weapon_defindex']][(int) $skin['paint']] = [
|
||||||
|
'weapon_name' => $skin['weapon_name'],
|
||||||
|
'paint_name' => $skin['paint_name'],
|
||||||
|
'image_url' => $skin['image'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $skins;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getWeaponsFromArray()
|
||||||
|
{
|
||||||
|
$weapons = [];
|
||||||
|
$temp = self::skinsFromJson();
|
||||||
|
|
||||||
|
foreach ($temp as $key => $value) {
|
||||||
|
if (key_exists($key, $weapons))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
$weapons[$key] = [
|
||||||
|
'weapon_name' => $value[0]['weapon_name'],
|
||||||
|
'paint_name' => $value[0]['paint_name'],
|
||||||
|
'image_url' => $value[0]['image_url'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $weapons;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getKnifeTypes()
|
||||||
|
{
|
||||||
|
$knifes = [];
|
||||||
|
$temp = self::getWeaponsFromArray();
|
||||||
|
|
||||||
|
foreach ($temp as $key => $weapon) {
|
||||||
|
if (
|
||||||
|
!in_array($key, [
|
||||||
|
500,
|
||||||
|
503,
|
||||||
|
505,
|
||||||
|
506,
|
||||||
|
507,
|
||||||
|
508,
|
||||||
|
509,
|
||||||
|
512,
|
||||||
|
514,
|
||||||
|
515,
|
||||||
|
516,
|
||||||
|
517,
|
||||||
|
518,
|
||||||
|
519,
|
||||||
|
520,
|
||||||
|
521,
|
||||||
|
522,
|
||||||
|
523,
|
||||||
|
525
|
||||||
|
])
|
||||||
|
)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
$knifes[$key] = [
|
||||||
|
'weapon_name' => $weapon['weapon_name'],
|
||||||
|
'paint_name' => rtrim(explode("|", $weapon['paint_name'])[0]),
|
||||||
|
'image_url' => $weapon['image_url'],
|
||||||
|
];
|
||||||
|
$knifes[0] = [
|
||||||
|
'weapon_name' => "weapon_knife",
|
||||||
|
'paint_name' => "Default knife",
|
||||||
|
'image_url' => "https://raw.githubusercontent.com/Nereziel/cs2-WeaponPaints/main/website/img/skins/weapon_knife.png",
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
ksort($knifes);
|
||||||
|
return $knifes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getSelectedSkins(array $temp)
|
||||||
|
{
|
||||||
|
$selected = [];
|
||||||
|
|
||||||
|
foreach ($temp as $weapon) {
|
||||||
|
$selected[$weapon['weapon_defindex']] = $weapon['weapon_paint_id'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $selected;
|
||||||
|
}
|
||||||
|
}
|
||||||
1
website/data/skins.json
Normal file
1715
website/database.sql
BIN
website/img/skins/weapon_ak47.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
website/img/skins/weapon_ak47_am_bamboo_jungle_light.png
Normal file
|
After Width: | Height: | Size: 77 KiB |
BIN
website/img/skins/weapon_ak47_aq_ak47_cartel_light.png
Normal file
|
After Width: | Height: | Size: 82 KiB |
BIN
website/img/skins/weapon_ak47_aq_oiled_light.png
Normal file
|
After Width: | Height: | Size: 82 KiB |
|
After Width: | Height: | Size: 83 KiB |
BIN
website/img/skins/weapon_ak47_cu_ak47_anarchy_light.png
Normal file
|
After Width: | Height: | Size: 86 KiB |
BIN
website/img/skins/weapon_ak47_cu_ak47_anubis_light.png
Normal file
|
After Width: | Height: | Size: 81 KiB |
BIN
website/img/skins/weapon_ak47_cu_ak47_asiimov_light.png
Normal file
|
After Width: | Height: | Size: 76 KiB |
BIN
website/img/skins/weapon_ak47_cu_ak47_aztec_light.png
Normal file
|
After Width: | Height: | Size: 74 KiB |
BIN
website/img/skins/weapon_ak47_cu_ak47_cobra_light.png
Normal file
|
After Width: | Height: | Size: 70 KiB |
BIN
website/img/skins/weapon_ak47_cu_ak47_cogthings_light.png
Normal file
|
After Width: | Height: | Size: 82 KiB |
BIN
website/img/skins/weapon_ak47_cu_ak47_courage_alt_light.png
Normal file
|
After Width: | Height: | Size: 78 KiB |
BIN
website/img/skins/weapon_ak47_cu_ak47_mastery_light.png
Normal file
|
After Width: | Height: | Size: 67 KiB |
BIN
website/img/skins/weapon_ak47_cu_ak47_nightwish_light.png
Normal file
|
After Width: | Height: | Size: 97 KiB |
BIN
website/img/skins/weapon_ak47_cu_ak47_point_disarray_light.png
Normal file
|
After Width: | Height: | Size: 87 KiB |
BIN
website/img/skins/weapon_ak47_cu_ak47_rubber_light.png
Normal file
|
After Width: | Height: | Size: 80 KiB |
BIN
website/img/skins/weapon_ak47_cu_ak47_winter_sport_light.png
Normal file
|
After Width: | Height: | Size: 92 KiB |
BIN
website/img/skins/weapon_ak47_cu_ak_head_shot_holo_light.png
Normal file
|
After Width: | Height: | Size: 88 KiB |
BIN
website/img/skins/weapon_ak47_cu_ak_island_floral_light.png
Normal file
|
After Width: | Height: | Size: 84 KiB |
BIN
website/img/skins/weapon_ak47_cu_ak_jaguar_light.png
Normal file
|
After Width: | Height: | Size: 88 KiB |
BIN
website/img/skins/weapon_ak47_cu_ak_neon_rider_light.png
Normal file
|
After Width: | Height: | Size: 94 KiB |
BIN
website/img/skins/weapon_ak47_cu_ak_xray_light.png
Normal file
|
After Width: | Height: | Size: 85 KiB |
|
After Width: | Height: | Size: 81 KiB |
BIN
website/img/skins/weapon_ak47_cu_green_leather_ak47_light.png
Normal file
|
After Width: | Height: | Size: 72 KiB |
BIN
website/img/skins/weapon_ak47_cu_panther_ak47_light.png
Normal file
|
After Width: | Height: | Size: 85 KiB |
BIN
website/img/skins/weapon_ak47_cu_pinstripe_ak47_light.png
Normal file
|
After Width: | Height: | Size: 75 KiB |
BIN
website/img/skins/weapon_ak47_cu_tribute_ak47_light.png
Normal file
|
After Width: | Height: | Size: 83 KiB |
BIN
website/img/skins/weapon_ak47_cu_well_traveled_ak47_light.png
Normal file
|
After Width: | Height: | Size: 81 KiB |
BIN
website/img/skins/weapon_ak47_gs_ak47_abstract_light.png
Normal file
|
After Width: | Height: | Size: 83 KiB |
BIN
website/img/skins/weapon_ak47_gs_ak47_bloodsport_light.png
Normal file
|
After Width: | Height: | Size: 85 KiB |
BIN
website/img/skins/weapon_ak47_gs_ak47_empress_light.png
Normal file
|
After Width: | Height: | Size: 88 KiB |
BIN
website/img/skins/weapon_ak47_gs_ak47_gold_arabesque_light.png
Normal file
|
After Width: | Height: | Size: 83 KiB |
BIN
website/img/skins/weapon_ak47_gs_ak47_nibbler_light.png
Normal file
|
After Width: | Height: | Size: 87 KiB |
BIN
website/img/skins/weapon_ak47_gs_ak47_professional_light.png
Normal file
|
After Width: | Height: | Size: 74 KiB |
BIN
website/img/skins/weapon_ak47_gs_ak47_strone_light.png
Normal file
|
After Width: | Height: | Size: 80 KiB |
BIN
website/img/skins/weapon_ak47_gs_ak47_supercharged_light.png
Normal file
|
After Width: | Height: | Size: 84 KiB |
BIN
website/img/skins/weapon_ak47_gs_ak_colony01_red_light.png
Normal file
|
After Width: | Height: | Size: 74 KiB |
BIN
website/img/skins/weapon_ak47_hy_ak47lam_blue_light.png
Normal file
|
After Width: | Height: | Size: 79 KiB |
BIN
website/img/skins/weapon_ak47_hy_ak47lam_bw_light.png
Normal file
|
After Width: | Height: | Size: 80 KiB |
BIN
website/img/skins/weapon_ak47_hy_ak47lam_green_light.png
Normal file
|
After Width: | Height: | Size: 79 KiB |
BIN
website/img/skins/weapon_ak47_hy_ak47lam_light.png
Normal file
|
After Width: | Height: | Size: 78 KiB |
BIN
website/img/skins/weapon_ak47_hy_mesh_safetyorange_light.png
Normal file
|
After Width: | Height: | Size: 81 KiB |
BIN
website/img/skins/weapon_ak47_hy_veneto_purple_light.png
Normal file
|
After Width: | Height: | Size: 70 KiB |
BIN
website/img/skins/weapon_ak47_sp_mesh_tan_light.png
Normal file
|
After Width: | Height: | Size: 71 KiB |
BIN
website/img/skins/weapon_ak47_sp_spray_jungle_light.png
Normal file
|
After Width: | Height: | Size: 70 KiB |
BIN
website/img/skins/weapon_ak47_sp_zebracam_light.png
Normal file
|
After Width: | Height: | Size: 70 KiB |
BIN
website/img/skins/weapon_aug.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
website/img/skins/weapon_aug_aa_fade_metallic_light.png
Normal file
|
After Width: | Height: | Size: 98 KiB |
BIN
website/img/skins/weapon_aug_am_aug_death_by_doggy_light.png
Normal file
|
After Width: | Height: | Size: 114 KiB |
BIN
website/img/skins/weapon_aug_am_aug_jumble_light.png
Normal file
|
After Width: | Height: | Size: 114 KiB |
BIN
website/img/skins/weapon_aug_am_bloom_blue_light.png
Normal file
|
After Width: | Height: | Size: 107 KiB |
BIN
website/img/skins/weapon_aug_am_circuitboard_orange_light.png
Normal file
|
After Width: | Height: | Size: 107 KiB |
BIN
website/img/skins/weapon_aug_am_intelligence_grey_light.png
Normal file
|
After Width: | Height: | Size: 105 KiB |
BIN
website/img/skins/weapon_aug_am_jade_light.png
Normal file
|
After Width: | Height: | Size: 102 KiB |
BIN
website/img/skins/weapon_aug_am_jorm_orange_light.png
Normal file
|
After Width: | Height: | Size: 112 KiB |
BIN
website/img/skins/weapon_aug_an_navy_bravo_light.png
Normal file
|
After Width: | Height: | Size: 97 KiB |
BIN
website/img/skins/weapon_aug_an_red_light.png
Normal file
|
After Width: | Height: | Size: 97 KiB |
BIN
website/img/skins/weapon_aug_cu_anime_aug_light.png
Normal file
|
After Width: | Height: | Size: 110 KiB |
BIN
website/img/skins/weapon_aug_cu_aug_chameleonaire_light.png
Normal file
|
After Width: | Height: | Size: 100 KiB |
BIN
website/img/skins/weapon_aug_cu_aug_momentum_light.png
Normal file
|
After Width: | Height: | Size: 106 KiB |
BIN
website/img/skins/weapon_aug_cu_aug_orange_triangle_light.png
Normal file
|
After Width: | Height: | Size: 103 KiB |
BIN
website/img/skins/weapon_aug_cu_aug_progressiv_light.png
Normal file
|
After Width: | Height: | Size: 95 KiB |
BIN
website/img/skins/weapon_aug_cu_aug_swallows_light.png
Normal file
|
After Width: | Height: | Size: 113 KiB |
BIN
website/img/skins/weapon_aug_cu_aug_whitefang_light.png
Normal file
|
After Width: | Height: | Size: 101 KiB |
BIN
website/img/skins/weapon_aug_gs_aug_aristocrat_light.png
Normal file
|
After Width: | Height: | Size: 110 KiB |
BIN
website/img/skins/weapon_aug_gs_aug_plague_light.png
Normal file
|
After Width: | Height: | Size: 109 KiB |
BIN
website/img/skins/weapon_aug_gs_aug_sand_storm_light.png
Normal file
|
After Width: | Height: | Size: 100 KiB |
BIN
website/img/skins/weapon_aug_gs_aug_stymphalian_birds_light.png
Normal file
|
After Width: | Height: | Size: 110 KiB |
BIN
website/img/skins/weapon_aug_gs_aug_syd_mead_light.png
Normal file
|
After Width: | Height: | Size: 105 KiB |
BIN
website/img/skins/weapon_aug_gs_aug_thunderstorm_light.png
Normal file
|
After Width: | Height: | Size: 107 KiB |
BIN
website/img/skins/weapon_aug_hy_aug_torn_orange_light.png
Normal file
|
After Width: | Height: | Size: 106 KiB |
BIN
website/img/skins/weapon_aug_hy_copperhead_light.png
Normal file
|
After Width: | Height: | Size: 108 KiB |
BIN
website/img/skins/weapon_aug_hy_dry_wood_light.png
Normal file
|
After Width: | Height: | Size: 107 KiB |
BIN
website/img/skins/weapon_aug_hy_dune_trap_light.png
Normal file
|
After Width: | Height: | Size: 114 KiB |
BIN
website/img/skins/weapon_aug_hy_feathers_aug_light.png
Normal file
|
After Width: | Height: | Size: 100 KiB |
BIN
website/img/skins/weapon_aug_hy_murano_blue_light.png
Normal file
|
After Width: | Height: | Size: 98 KiB |
BIN
website/img/skins/weapon_aug_hy_tiger_light.png
Normal file
|
After Width: | Height: | Size: 110 KiB |
BIN
website/img/skins/weapon_aug_so_pmc_light.png
Normal file
|
After Width: | Height: | Size: 100 KiB |
BIN
website/img/skins/weapon_aug_so_space_marine_light.png
Normal file
|
After Width: | Height: | Size: 103 KiB |
BIN
website/img/skins/weapon_aug_so_stormfront_light.png
Normal file
|
After Width: | Height: | Size: 104 KiB |
BIN
website/img/skins/weapon_aug_sp_labyrinth3_light.png
Normal file
|
After Width: | Height: | Size: 112 KiB |
BIN
website/img/skins/weapon_aug_sp_mesh_forest_fire_light.png
Normal file
|
After Width: | Height: | Size: 103 KiB |
BIN
website/img/skins/weapon_aug_sp_mesh_safetyblack_light.png
Normal file
|
After Width: | Height: | Size: 108 KiB |
BIN
website/img/skins/weapon_aug_sp_nukestripe_orange_aug_light.png
Normal file
|
After Width: | Height: | Size: 106 KiB |
BIN
website/img/skins/weapon_awp.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
website/img/skins/weapon_awp_aa_awp_fade_light.png
Normal file
|
After Width: | Height: | Size: 65 KiB |
BIN
website/img/skins/weapon_awp_am_awp_glory_light.png
Normal file
|
After Width: | Height: | Size: 65 KiB |
BIN
website/img/skins/weapon_awp_am_awp_pawpaw_light.png
Normal file
|
After Width: | Height: | Size: 73 KiB |
BIN
website/img/skins/weapon_awp_am_crumple_bravo_light.png
Normal file
|
After Width: | Height: | Size: 61 KiB |
BIN
website/img/skins/weapon_awp_am_lightning_awp_light.png
Normal file
|
After Width: | Height: | Size: 63 KiB |
BIN
website/img/skins/weapon_awp_am_tigers_blue_light.png
Normal file
|
After Width: | Height: | Size: 71 KiB |
BIN
website/img/skins/weapon_awp_aq_awp_twine_light.png
Normal file
|
After Width: | Height: | Size: 68 KiB |
BIN
website/img/skins/weapon_awp_cu_awp_asimov_light.png
Normal file
|
After Width: | Height: | Size: 68 KiB |