mirror of
https://github.com/Nereziel/cs2-WeaponPaints.git
synced 2026-02-17 18:39:07 +00:00
add fixes from 1.4c
This commit is contained in:
@@ -10,8 +10,7 @@ namespace WeaponPaints
|
||||
{
|
||||
if (!Config.AdditionalSetting.CommandWpEnabled || !Config.AdditionalSetting.SkinEnabled || !g_bCommandsAllowed) return;
|
||||
if (!Utility.IsPlayerValid(player)) return;
|
||||
if (player == null || player.Index <= 0) return;
|
||||
int playerIndex = (int)player!.Index;
|
||||
if (player == null || !player.IsValid || player.UserId == null || player.Index <= 0 || player.IsBot) return;
|
||||
|
||||
PlayerInfo playerInfo = new PlayerInfo
|
||||
{
|
||||
@@ -22,8 +21,6 @@ namespace WeaponPaints
|
||||
IpAddress = player?.IpAddress?.Split(":")[0]
|
||||
};
|
||||
|
||||
if (player == null || player.UserId == null) return;
|
||||
|
||||
if (!commandsCooldown.TryGetValue((int)player.UserId, out DateTime cooldownEndTime) ||
|
||||
DateTime.UtcNow >= (commandsCooldown.TryGetValue((int)player.UserId, out cooldownEndTime) ? cooldownEndTime : DateTime.UtcNow))
|
||||
{
|
||||
|
||||
@@ -16,8 +16,8 @@ namespace WeaponPaints
|
||||
UserId = player.UserId,
|
||||
Index = (int)player.Index,
|
||||
SteamId = player.SteamID,
|
||||
Name = player?.PlayerName,
|
||||
IpAddress = player?.IpAddress?.Split(":")[0]
|
||||
Name = player.PlayerName,
|
||||
IpAddress = player.IpAddress?.Split(":")[0]
|
||||
};
|
||||
|
||||
if (player == null || !player.IsValid || player.IsBot || player.IsHLTV || weaponSync == null) return;
|
||||
@@ -173,7 +173,7 @@ namespace WeaponPaints
|
||||
|
||||
weaponSync = new WeaponSynchronization(DatabaseConnectionString, Config, GlobalShareApi, GlobalShareServerId);
|
||||
});
|
||||
|
||||
/*
|
||||
g_hTimerCheckSkinsData = AddTimer(10.0f, () =>
|
||||
{
|
||||
List<CCSPlayerController> players = Utilities.GetPlayers();
|
||||
@@ -196,6 +196,7 @@ namespace WeaponPaints
|
||||
_ = weaponSync.GetKnifeFromDatabase(playerInfo);
|
||||
}
|
||||
}, CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE | CounterStrikeSharp.API.Modules.Timers.TimerFlags.REPEAT);
|
||||
*/
|
||||
}
|
||||
|
||||
private HookResult OnPlayerConnectFull(EventPlayerConnectFull @event, GameEventInfo info)
|
||||
@@ -273,7 +274,7 @@ namespace WeaponPaints
|
||||
{
|
||||
try
|
||||
{
|
||||
if (player == null || !player.IsValid || !player.PawnIsAlive || player.IsBot || player.IsHLTV) continue;
|
||||
if (player == null || !player.IsValid || !player.PawnIsAlive || player.IsBot || player.IsHLTV || player.Connected == PlayerConnectedState.PlayerDisconnecting) continue;
|
||||
|
||||
var viewModels = GetPlayerViewModels(player);
|
||||
|
||||
|
||||
@@ -141,7 +141,7 @@ public partial class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig
|
||||
internal int GlobalShareServerId = 0;
|
||||
internal static Dictionary<int, DateTime> commandsCooldown = new Dictionary<int, DateTime>();
|
||||
private string DatabaseConnectionString = string.Empty;
|
||||
private CounterStrikeSharp.API.Modules.Timers.Timer? g_hTimerCheckSkinsData = null;
|
||||
//private CounterStrikeSharp.API.Modules.Timers.Timer? g_hTimerCheckSkinsData = null;
|
||||
public WeaponPaintsConfig Config { get; set; } = new();
|
||||
public override string ModuleAuthor => "Nereziel & daffyy";
|
||||
public override string ModuleDescription => "Skin and knife selector, standalone and web-based";
|
||||
@@ -273,7 +273,7 @@ public partial class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig
|
||||
Task<string> responseBodyTask = response.Content.ReadAsStringAsync();
|
||||
responseBodyTask.Wait();
|
||||
string responseBody = responseBodyTask.Result;
|
||||
GlobalShareServerId = Int32.Parse(responseBody);
|
||||
GlobalShareServerId = int.Parse(responseBody);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user