mirror of
https://github.com/Nereziel/cs2-WeaponPaints.git
synced 2026-03-11 08:48:51 +00:00
Compare commits
3 Commits
build-408
...
bd8112ce50
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bd8112ce50 | ||
|
|
5b6216669b | ||
|
|
f3bb6abd81 |
93
Commands.cs
93
Commands.cs
@@ -147,8 +147,101 @@ public partial class WeaponPaints
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AddCommand("wp_refresh", "Admin refresh player skins", (player, info) =>
|
||||||
|
{
|
||||||
|
OnCommandSkinRefresh(player, info);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnCommandSkinRefresh(CCSPlayerController? player, CommandInfo command)
|
||||||
|
{
|
||||||
|
if (!Config.Additional.CommandWpEnabled || !Config.Additional.SkinEnabled || !_gBCommandsAllowed) return;
|
||||||
|
|
||||||
|
var args = command.GetArg(1);
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(args))
|
||||||
|
{
|
||||||
|
Console.WriteLine("[WeaponPaints] Usage: wp_refresh <steamid64|all>");
|
||||||
|
Console.WriteLine("[WeaponPaints] Examples:");
|
||||||
|
Console.WriteLine("[WeaponPaints] wp_refresh all - Refresh skins for all players");
|
||||||
|
Console.WriteLine("[WeaponPaints] wp_refresh 76561198012345678 - Refresh skins by SteamID64");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var targetPlayers = new List<CCSPlayerController>();
|
||||||
|
|
||||||
|
if (args.Equals("all", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
targetPlayers = Utilities.GetPlayers().Where(p =>
|
||||||
|
p != null && p.IsValid && !p.IsBot && p.UserId != null).ToList();
|
||||||
|
|
||||||
|
if (targetPlayers.Count == 0)
|
||||||
|
{
|
||||||
|
Console.WriteLine("[WeaponPaints] No players connected to refresh.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Console.WriteLine($"[WeaponPaints] Refreshing skins for {targetPlayers.Count} players...");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var foundPlayer = Utilities.GetPlayers().FirstOrDefault(p =>
|
||||||
|
p != null && p.IsValid && !p.IsBot && p.UserId != null &&
|
||||||
|
p.SteamID.ToString() == args);
|
||||||
|
|
||||||
|
if (foundPlayer == null)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"[WeaponPaints] Player with SteamID64 '{args}' not found.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
targetPlayers.Add(foundPlayer);
|
||||||
|
Console.WriteLine($"[WeaponPaints] Refreshing skins for {foundPlayer.PlayerName}...");
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var targetPlayer in targetPlayers)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
PlayerInfo? playerInfo = new PlayerInfo
|
||||||
|
{
|
||||||
|
UserId = targetPlayer.UserId,
|
||||||
|
Slot = targetPlayer.Slot,
|
||||||
|
Index = (int)targetPlayer.Index,
|
||||||
|
SteamId = targetPlayer.SteamID.ToString(),
|
||||||
|
Name = targetPlayer.PlayerName,
|
||||||
|
IpAddress = targetPlayer.IpAddress?.Split(":")[0]
|
||||||
|
};
|
||||||
|
|
||||||
|
if (WeaponSync != null)
|
||||||
|
{
|
||||||
|
_ = Task.Run(async () => await WeaponSync.GetPlayerData(playerInfo));
|
||||||
|
}
|
||||||
|
|
||||||
|
GivePlayerGloves(targetPlayer);
|
||||||
|
RefreshWeapons(targetPlayer);
|
||||||
|
GivePlayerAgent(targetPlayer);
|
||||||
|
GivePlayerMusicKit(targetPlayer);
|
||||||
|
AddTimer(0.15f, () => GivePlayerPin(targetPlayer));
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(Localizer["wp_command_refresh_done"]))
|
||||||
|
{
|
||||||
|
targetPlayer.Print(Localizer["wp_command_refresh_done"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
Console.WriteLine($"[WeaponPaints] Skins refreshed for {targetPlayer.PlayerName}");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"[WeaponPaints] Error refreshing skins for {targetPlayer.PlayerName}: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Console.WriteLine("[WeaponPaints] Refresh process completed.");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void OnCommandStattrak(CCSPlayerController? player, CommandInfo commandInfo)
|
private void OnCommandStattrak(CCSPlayerController? player, CommandInfo commandInfo)
|
||||||
{
|
{
|
||||||
if (player == null || !player.IsValid) return;
|
if (player == null || !player.IsValid) return;
|
||||||
|
|||||||
11
Events.cs
11
Events.cs
@@ -59,8 +59,6 @@ namespace WeaponPaints
|
|||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Players.Add(player);
|
|
||||||
|
|
||||||
return HookResult.Continue;
|
return HookResult.Continue;
|
||||||
}
|
}
|
||||||
@@ -116,7 +114,6 @@ namespace WeaponPaints
|
|||||||
|
|
||||||
_temporaryPlayerWeaponWear.TryRemove(player.Slot, out _);
|
_temporaryPlayerWeaponWear.TryRemove(player.Slot, out _);
|
||||||
CommandsCooldown.Remove(player.Slot);
|
CommandsCooldown.Remove(player.Slot);
|
||||||
Players.Remove(player);
|
|
||||||
|
|
||||||
return HookResult.Continue;
|
return HookResult.Continue;
|
||||||
}
|
}
|
||||||
@@ -242,7 +239,7 @@ namespace WeaponPaints
|
|||||||
|
|
||||||
if (steamid != null && steamid.IsValid())
|
if (steamid != null && steamid.IsValid())
|
||||||
{
|
{
|
||||||
player = Players.FirstOrDefault(p => p.IsValid && p.SteamID == steamid.SteamId64);
|
player = Utilities.GetPlayers().FirstOrDefault(p => p.IsValid && p.SteamID == steamid.SteamId64);
|
||||||
|
|
||||||
if (player == null)
|
if (player == null)
|
||||||
player = Utilities.GetPlayerFromSteamId(weapon.OriginalOwnerXuidLow);
|
player = Utilities.GetPlayerFromSteamId(weapon.OriginalOwnerXuidLow);
|
||||||
@@ -269,7 +266,11 @@ namespace WeaponPaints
|
|||||||
{
|
{
|
||||||
if (!Config.Additional.ShowSkinImage) return;
|
if (!Config.Additional.ShowSkinImage) return;
|
||||||
|
|
||||||
foreach (var player in Players)
|
foreach (var player in Utilities.GetPlayers().Where(p =>
|
||||||
|
p is { IsValid: true, PlayerPawn.IsValid: true, IsBot: false } and
|
||||||
|
{ Connected: PlayerConnectedState.PlayerConnected }
|
||||||
|
)
|
||||||
|
)
|
||||||
{
|
{
|
||||||
if (_playerWeaponImage.TryGetValue(player.Slot, out var value) && !string.IsNullOrEmpty(value))
|
if (_playerWeaponImage.TryGetValue(player.Slot, out var value) && !string.IsNullOrEmpty(value))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -168,6 +168,4 @@ public partial class WeaponPaints
|
|||||||
private static readonly PluginCapability<IMenuApi> MenuCapability = new("menu:nfcore");
|
private static readonly PluginCapability<IMenuApi> MenuCapability = new("menu:nfcore");
|
||||||
|
|
||||||
private int _fadeSeed;
|
private int _fadeSeed;
|
||||||
|
|
||||||
internal List<CCSPlayerController> Players = [];
|
|
||||||
}
|
}
|
||||||
@@ -332,27 +332,13 @@ namespace WeaponPaints
|
|||||||
if (!PlayerHasKnife(player) && hasKnife)
|
if (!PlayerHasKnife(player) && hasKnife)
|
||||||
{
|
{
|
||||||
var newKnife = new CBasePlayerWeapon(player.GiveNamedItem(CsItem.Knife));
|
var newKnife = new CBasePlayerWeapon(player.GiveNamedItem(CsItem.Knife));
|
||||||
|
newKnife.AddEntityIOEvent("Kill", newKnife, null, "", 0.01f);
|
||||||
var newWeapon = new CBasePlayerWeapon(player.GiveNamedItem(CsItem.USP));
|
var newWeapon = new CBasePlayerWeapon(player.GiveNamedItem(CsItem.USP));
|
||||||
player.GiveNamedItem(CsItem.Knife);
|
player.GiveNamedItem(CsItem.Knife);
|
||||||
player.ExecuteClientCommand("slot3");
|
player.ExecuteClientCommand("slot3");
|
||||||
|
newWeapon.AddEntityIOEvent("Kill", newWeapon, null, "", 0.01f);
|
||||||
Server.NextFrame(() =>
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (newKnife != null && newKnife.IsValid)
|
|
||||||
newKnife.AddEntityIOEvent("Kill", newKnife, null, "", 0.01f);
|
|
||||||
if (newWeapon != null && newWeapon.IsValid)
|
|
||||||
newWeapon.AddEntityIOEvent("Kill", newWeapon, null, "", 0.01f);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Logger.LogWarning("Error AddEntityIOEvent " + ex.Message);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
foreach (var entry in weaponsWithAmmo)
|
foreach (var entry in weaponsWithAmmo)
|
||||||
{
|
{
|
||||||
foreach (var ammo in entry.Value)
|
foreach (var ammo in entry.Value)
|
||||||
|
|||||||
@@ -9,20 +9,20 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="CounterStrikeSharp.API" Version="1.0.358" />
|
<PackageReference Include="CounterStrikeSharp.API" Version="1.0.339" />
|
||||||
<PackageReference Include="Dapper" Version="2.1.66" />
|
<PackageReference Include="Dapper" Version="2.1.35" />
|
||||||
<PackageReference Include="MySqlConnector" Version="2.4.0" />
|
<PackageReference Include="MySqlConnector" Version="2.4.0-beta.1" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Update="lang\**\*.*" CopyToOutputDirectory="PreserveNewest" />
|
<None Update="lang\**\*.*" CopyToOutputDirectory="PreserveNewest" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Update="gamedata\*.*" CopyToOutputDirectory="PreserveNewest" />
|
<None Update="gamedata\*.*" CopyToOutputDirectory="PreserveNewest" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="MenuManagerApi">
|
<Reference Include="MenuManagerApi">
|
||||||
<HintPath>3rd_party\MenuManagerApi.dll</HintPath>
|
<HintPath>3rd_party\MenuManagerApi.dll</HintPath>
|
||||||
|
|||||||
@@ -1,11 +1,6 @@
|
|||||||
<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">
|
<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: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_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_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_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>
|
<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>
|
||||||
Reference in New Issue
Block a user