mirror of
https://github.com/Nereziel/cs2-WeaponPaints.git
synced 2026-03-12 09:09:49 +00:00
Compare commits
2 Commits
94648c0eb4
...
build-406
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
129b34f5c0 | ||
|
|
fbf473b893 |
93
Commands.cs
93
Commands.cs
@@ -147,101 +147,8 @@ 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;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="CounterStrikeSharp.API" Version="1.0.342" />
|
<PackageReference Include="CounterStrikeSharp.API" Version="1.0.358" />
|
||||||
<PackageReference Include="Dapper" Version="2.1.66" />
|
<PackageReference Include="Dapper" Version="2.1.66" />
|
||||||
<PackageReference Include="MySqlConnector" Version="2.4.0" />
|
<PackageReference Include="MySqlConnector" Version="2.4.0" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
|
||||||
@@ -18,11 +18,11 @@
|
|||||||
<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>
|
||||||
|
|||||||
Reference in New Issue
Block a user