Compare commits

..

7 Commits

Author SHA1 Message Date
Dawid Bepierszcz
6f86cddd13 Merge pull request #204 from daffyyyy/main
2.2c
2024-03-09 12:03:20 +01:00
Dawid Bepierszcz
24801e814b Merge branch 'Nereziel:main' into main 2024-03-09 12:02:55 +01:00
Dawid Bepierszcz
77def8a305 2.2c
- Minor changes
- Updated translations
- Updated css
2024-03-09 12:01:25 +01:00
Dawid Bepierszcz
651fae4d23 Merge pull request #191 from daffyyyy/main
2.2b
2024-03-05 12:28:48 +01:00
Dawid Bepierszcz
692c22f7d1 Merge branch 'Nereziel:main' into main 2024-03-05 12:27:46 +01:00
Dawid Bepierszcz
cf07106641 Merge branch 'main' of https://github.com/daffyyyy/cs2-WeaponPaints 2024-03-05 12:27:21 +01:00
Dawid Bepierszcz
44177f18fe 2.2b
- Small fixes 🍕
2024-03-05 12:27:19 +01:00
20 changed files with 65 additions and 42 deletions

View File

@@ -96,6 +96,12 @@ namespace WeaponPaints
player!.Print(Localizer["wp_info_glove"]);
}
if (Config.Additional.AgentEnabled)
if (!string.IsNullOrEmpty(Localizer["wp_info_agent"]))
{
player!.Print(Localizer["wp_info_agent"]);
}
if (Config.Additional.KnifeEnabled)
if (!string.IsNullOrEmpty(Localizer["wp_info_knife"]))
{
@@ -234,7 +240,6 @@ namespace WeaponPaints
return false;
});
string selectedSkin = opt.Text;
string selectedPaintID = selectedSkin.Substring(selectedSkin.LastIndexOf('(') + 1).Trim(')');

View File

@@ -10,6 +10,7 @@ namespace WeaponPaints
[JsonPropertyName("GloveEnabled")]
public bool GloveEnabled { get; set; } = true;
[JsonPropertyName("AgentEnabled")]
public bool AgentEnabled { get; set; } = true;
@@ -27,6 +28,7 @@ namespace WeaponPaints
[JsonPropertyName("CommandGlove")]
public string CommandGlove { get; set; } = "gloves";
[JsonPropertyName("CommandAgent")]
public string CommandAgent { get; set; } = "agents";

View File

@@ -1,7 +1,6 @@
using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Core.Attributes.Registration;
using CounterStrikeSharp.API.Modules.Memory.DynamicFunctions;
namespace WeaponPaints
{
@@ -242,6 +241,7 @@ namespace WeaponPaints
return HookResult.Continue;
}
/*
public HookResult OnGiveNamedItemPost(DynamicHook hook)
{
var itemServices = hook.GetParam<CCSPlayer_ItemServices>(0);
@@ -255,6 +255,7 @@ namespace WeaponPaints
return HookResult.Continue;
}
*/
public void OnEntitySpawned(CEntityInstance entity)
{
@@ -265,10 +266,10 @@ namespace WeaponPaints
Server.NextFrame(() =>
{
var weapon = new CBasePlayerWeapon(entity.Handle);
if (!weapon.IsValid) return;
if (weapon == null || !weapon.IsValid || weapon.OwnerEntity.Value == null) return;
var player = Utilities.GetPlayerFromSteamId(weapon.OriginalOwnerXuidLow);
if (player == null || !Utility.IsPlayerValid(player)) return;
CCSPlayerController? player = Utilities.GetPlayerFromIndex((int)weapon.OwnerEntity.Value.Index);
if (player == null || !player.IsValid || !Utility.IsPlayerValid(player)) return;
GivePlayerWeaponSkin(player, weapon);
});
@@ -291,7 +292,6 @@ namespace WeaponPaints
}
}
private void RegisterListeners()
{
RegisterListener<Listeners.OnMapStart>(OnMapStart);

View File

@@ -44,21 +44,27 @@ namespace WeaponPaints
string[] createTableQueries = new[]
{
@"CREATE TABLE IF NOT EXISTS `wp_player_skins` (
`steamid` varchar(64) NOT NULL,
`steamid` varchar(18) NOT NULL,
`weapon_defindex` int(6) NOT NULL,
`weapon_paint_id` int(6) NOT NULL,
`weapon_wear` float NOT NULL DEFAULT 0.000001,
`weapon_seed` int(16) NOT NULL DEFAULT 0
) ENGINE=InnoDB",
@"CREATE TABLE IF NOT EXISTS `wp_player_knife` (
`steamid` varchar(64) NOT NULL,
`steamid` varchar(18) NOT NULL,
`knife` varchar(64) NOT NULL,
UNIQUE (`steamid`)
) ENGINE = InnoDB",
@"CREATE TABLE IF NOT EXISTS `wp_player_gloves` (
`steamid` varchar(64) NOT NULL,
`steamid` varchar(18) NOT NULL,
`weapon_defindex` int(11) NOT NULL,
UNIQUE (`steamid`)
) ENGINE=InnoDB",
@"CREATE TABLE `wp_player_agents` (
`steamid` varchar(18) NOT NULL,
`agent_ct` varchar(64) DEFAULT NULL,
`agent_t` varchar(64) DEFAULT NULL,
UNIQUE KEY `steamid` (`steamid`)
) ENGINE=InnoDB"
};

View File

@@ -1 +1 @@
2.2a
2.2c

View File

@@ -183,7 +183,6 @@ namespace WeaponPaints
});
}
}
}, TimerFlags.STOP_ON_MAPCHANGE);
}
@@ -297,14 +296,16 @@ namespace WeaponPaints
}
}
public void GivePlayerAgent(CCSPlayerController player)
public static void GivePlayerAgent(CCSPlayerController player)
{
if (!g_playersAgent.ContainsKey(player.Slot)) return;
try
{
Server.NextFrame(() =>
{
string? model = player.TeamNum == 3 ? g_playersAgent[player.Slot].CT : g_playersAgent[player.Slot].T;
if (model == null) return;
if (string.IsNullOrEmpty(model)) return;
player.PlayerPawn.Value!.SetModel(
$"characters/models/{model}.vmdl"

View File

@@ -10,7 +10,7 @@ using System.Collections.Concurrent;
namespace WeaponPaints;
[MinimumApiVersion(178)]
[MinimumApiVersion(191)]
public partial class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig>
{
internal static WeaponPaints Instance { get; private set; } = new();
@@ -158,7 +158,7 @@ public partial class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig
public override string ModuleAuthor => "Nereziel & daffyy";
public override string ModuleDescription => "Skin, gloves, agents and knife selector, standalone and web-based";
public override string ModuleName => "WeaponPaints";
public override string ModuleVersion => "2.2a";
public override string ModuleVersion => "2.2c";
public static WeaponPaintsConfig GetWeaponPaintsConfig()
{

View File

@@ -9,8 +9,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CounterStrikeSharp.API" Version="1.0.179" />
<PackageReference Include="Dapper" Version="2.1.28" />
<PackageReference Include="CounterStrikeSharp.API" Version="1.0.193" />
<PackageReference Include="Dapper" Version="2.1.35" />
<PackageReference Include="MySqlConnector" Version="2.3.5" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>

View File

@@ -170,9 +170,9 @@ namespace WeaponPaints
{
await using var connection = await _database.GetConnectionAsync();
string query = @"
INSERT INTO `wp_player_agents` (`steamid`, `agent_ct`, `agent_t`)
VALUES(@steamid, @agent_ct, @agent_t)
ON DUPLICATE KEY UPDATE
INSERT INTO `wp_player_agents` (`steamid`, `agent_ct`, `agent_t`)
VALUES(@steamid, @agent_ct, @agent_t)
ON DUPLICATE KEY UPDATE
`agent_ct` = @agent_ct,
`agent_t` = @agent_t";

View File

@@ -1,23 +1,23 @@
{
"ChangeSubclass": {
"signatures": {
"library": "server",
"windows": "\\x48\\x89\\x5C\\x24\\x08\\x57\\x48\\x83\\xEC\\x20\\x48\\x8B\\xDA\\x48\\x8B\\xF9\\xE8\\x2A\\x2A\\x2A\\x2A\\x84\\xC0\\x74\\x2A\\x41\\xB0\\x01",
"linux": "\\x55\\x48\\x89\\xE5\\x41\\x57\\x41\\x56\\x41\\x55\\x49\\x89\\xF5\\x41\\x54\\x49\\x89\\xFC\\x53\\x48\\x81\\xEC\\xA8\\x00\\x00\\x00"
}
},
"CAttributeList_SetOrAddAttributeValueByName": {
"signatures": {
"library": "server",
"windows": "\\x40\\x53\\x41\\x56\\x41\\x57\\x48\\x81\\xEC\\x90\\x00\\x00\\x00\\x0F\\x29\\x74\\x24\\x70",
"linux": "\\x55\\x48\\x89\\xE5\\x41\\x57\\x41\\x56\\x49\\x89\\xFE\\x41\\x55\\x41\\x54\\x49\\x89\\xF4\\x53\\x48\\x83\\xEC\\x78"
}
},
"CBaseModelEntity_SetBodygroup": {
"signatures": {
"library": "server",
"windows": "\\x48\\x89\\x5C\\x24\\x08\\x48\\x89\\x74\\x24\\x10\\x57\\x48\\x83\\xEC\\x20\\x41\\x8B\\xF8\\x48\\x8B\\xF2\\x48\\x8B\\xD9\\xE8\\x2A\\x2A\\x2A\\x2A",
"linux": "\\x55\\x48\\x89\\xE5\\x41\\x56\\x49\\x89\\xF6\\x41\\x55\\x41\\x89\\xD5\\x41\\x54\\x49\\x89\\xFC\\x48\\x83\\xEC\\x08"
}
}
"ChangeSubclass": {
"signatures": {
"library": "server",
"windows": "\\x48\\x89\\x5C\\x24\\x08\\x57\\x48\\x83\\xEC\\x20\\x48\\x8B\\xDA\\x48\\x8B\\xF9\\xE8\\x2A\\x2A\\x2A\\x2A\\x84\\xC0\\x74\\x2A\\x41\\xB0\\x01",
"linux": "\\x55\\x48\\x89\\xE5\\x41\\x57\\x41\\x56\\x41\\x55\\x49\\x89\\xF5\\x41\\x54\\x49\\x89\\xFC\\x53\\x48\\x81\\xEC\\xA8\\x00\\x00\\x00"
}
},
"CAttributeList_SetOrAddAttributeValueByName": {
"signatures": {
"library": "server",
"windows": "\\x40\\x53\\x41\\x56\\x41\\x57\\x48\\x81\\xEC\\x90\\x00\\x00\\x00\\x0F\\x29\\x74\\x24\\x70",
"linux": "\\x55\\x48\\x89\\xE5\\x41\\x57\\x41\\x56\\x49\\x89\\xFE\\x41\\x55\\x41\\x54\\x49\\x89\\xF4\\x53\\x48\\x83\\xEC\\x78"
}
},
"CBaseModelEntity_SetBodygroup": {
"signatures": {
"library": "server",
"windows": "\\x48\\x89\\x5C\\x24\\x08\\x48\\x89\\x74\\x24\\x10\\x57\\x48\\x83\\xEC\\x20\\x41\\x8B\\xF8\\x48\\x8B\\xF2\\x48\\x8B\\xD9\\xE8\\x2A\\x2A\\x2A\\x2A",
"linux": "\\x55\\x48\\x89\\xE5\\x41\\x56\\x49\\x89\\xF6\\x41\\x55\\x41\\x89\\xD5\\x41\\x54\\x49\\x89\\xFC\\x48\\x83\\xEC\\x08"
}
}
}

View File

@@ -4,6 +4,7 @@
"wp_info_refresh": "Type {lime}!wp{default} to synchronize chosen skins",
"wp_info_knife": "Type {lime}!knife{default} to open knife menu",
"wp_info_glove": "Type {lime}!gloves{default} to open gloves menu",
"wp_info_agent": "Type {lime}!agents{default} to open agents menu",
"wp_command_cooldown": "{lightred}You can't refresh weapon paints right now",
"wp_command_refresh_done": "{lime}Refreshing weapon paints",
"wp_knife_menu_select": "You have chosen {lime}{0}{default} as your knife",

View File

@@ -4,6 +4,7 @@
"wp_info_refresh": "Ievadiet {lime}!wp{default}, lai sinhronizētu izvēlētās ādas",
"wp_info_knife": "Ievadiet {lime}!knife{default}, lai atvērtu nazis izvēlni",
"wp_info_glove": "Ievadiet {lime}!gloves{default}, lai atvērtu cimdi izvēlni",
"wp_info_agent": "Ierakstiet {lime}!agents{default}, lai atvērtu aģentu izvēlni",
"wp_command_cooldown": "{lightred}Šobrīd jūs nevarat atjaunot ieroču ādas",
"wp_command_refresh_done": "{lime}Atjauno ieroču ādas",
"wp_knife_menu_select": "Jūs esat izvēlējies {lime}{0}{default} kā savu nazi",

View File

@@ -4,6 +4,7 @@
"wp_info_refresh": "Wpisz {lime}!wp{default}, aby zsynchronizować wybrane skórki",
"wp_info_knife": "Wpisz {lime}!knife{default}, aby otworzyć menu noży",
"wp_info_glove": "Wpisz {lime}!gloves{default}, aby otworzyć menu rękawiczek",
"wp_info_agent": "Wpisz {lime}!agents{default}, aby otworzyć menu agentów",
"wp_command_cooldown": "{lightred}Nie możesz teraz odświeżyć skórek broni",
"wp_command_refresh_done": "{lime}Odświeżanie skórek broni",
"wp_knife_menu_select": "Wybrałeś {lime}{0}{default} jako swój nóż",

View File

@@ -4,6 +4,7 @@
"wp_info_refresh": "Digite {lime}!wp{default} para sincronizar as skins selecionadas",
"wp_info_knife": "Digite {lime}!knife{default} para abrir o menu de facas",
"wp_info_glove": "Digite {lime}!gloves{default} para abrir o menu de luvas",
"wp_info_agent": "Digite {lime}!agents{default} para abrir o menu de agentes",
"wp_command_cooldown": "{lightred}Você não pode atualizar as skins de arma agora",
"wp_command_refresh_done": "{lime}Atualizando as skins de arma",
"wp_knife_menu_select": "Você escolheu {lime}{0}{default} como sua faca",

View File

@@ -4,6 +4,7 @@
"wp_info_refresh": "Digite {lime}!wp{default} para sincronizar as skins selecionadas",
"wp_info_knife": "Digite {lime}!knife{default} para abrir o menu de facas",
"wp_info_glove": "Digite {lime}!gloves{default} para abrir o menu de luvas",
"wp_info_agent": "Digite {lime}!agents{default} para abrir o menu de agentes",
"wp_command_cooldown": "{lightred}Você não pode atualizar as skins de arma agora",
"wp_command_refresh_done": "{lime}Atualizando as skins de arma",
"wp_knife_menu_select": "Você escolheu {lime}{0}{default} como sua faca",

View File

@@ -4,6 +4,7 @@
"wp_info_refresh": "Введите {lime}!wp{default}, чтобы синхронизировать выбранные скины",
"wp_info_knife": "Введите {lime}!knife{default}, чтобы открыть меню ножей",
"wp_info_glove": "Введите {lime}!gloves{default}, чтобы открыть меню перчаток",
"wp_info_agent": "Введите {lime}!agents{default}, чтобы открыть меню агентов",
"wp_command_cooldown": "{lightred}Вы не можете обновить скины оружия сейчас",
"wp_command_refresh_done": "{lime}Обновление скинов оружия",
"wp_knife_menu_select": "Вы выбрали {lime}{0}{default} в качестве вашего ножа",

View File

@@ -4,6 +4,7 @@
"wp_info_refresh": "Senkronize edilen skinleri görmek için {lime}!wp{default} yazın",
"wp_info_knife": "Bıçak menüsünü açmak için {lime}!knife{default} yazın",
"wp_info_glove": "Eldiven menüsünü açmak için {lime}!gloves{default} yazın",
"wp_info_agent": "Ajanlar menüsünü açmak için {lime}!agents{default} yazın",
"wp_command_cooldown": "{lightred}Şu anda silah skinlerini yenileyemezsiniz",
"wp_command_refresh_done": "{lime}Silah skinleri yenileniyor",
"wp_knife_menu_select": "{lime}{0}{default} olarak bıçağınızı seçtiniz",

View File

@@ -4,6 +4,7 @@
"wp_info_refresh": "Введіть {lime}!wp{default}, щоб синхронізувати обрані шкури",
"wp_info_knife": "Введіть {lime}!knife{default}, щоб відкрити меню ножів",
"wp_info_glove": "Введіть {lime}!gloves{default}, щоб відкрити меню рукавичок",
"wp_info_agent": "Введіть {lime}!агенти{default}, щоб відкрити меню агентів",
"wp_command_cooldown": "{lightred}Наразі ви не можете оновлювати шкіри зброї",
"wp_command_refresh_done": "{lime}Оновлення шкірок зброї",
"wp_knife_menu_select": "Ви вибрали {lime}{0}{default} як ваш ніж",

View File

@@ -4,6 +4,7 @@
"wp_info_refresh": "输入 {lime}!wp{default} 同步已选择的皮肤",
"wp_info_knife": "输入 {lime}!knife{default} 打开刀具菜单",
"wp_info_glove": "输入 {lime}!gloves{default} 打开手套菜单",
"wp_info_agent": "键入 {lime}!agents{default} 打开代理菜单",
"wp_command_cooldown": "{lightred}您现在无法刷新武器皮肤",
"wp_command_refresh_done": "{lime}刷新武器皮肤",
"wp_knife_menu_select": "您已选择 {lime}{0}{default} 作为您的刀具",

View File

@@ -4,7 +4,7 @@
"image": "",
"model": "null",
"agent_name": "Agent | Default"
},
},
{
"team": 3,
"image": "",