mirror of
https://github.com/Nereziel/cs2-WeaponPaints.git
synced 2026-03-03 14:32:25 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
74a6dff114 | ||
|
|
e37f111f1b | ||
|
|
5e6286b667 | ||
|
|
ed4da98a50 |
18
Commands.cs
18
Commands.cs
@@ -13,29 +13,39 @@ namespace WeaponPaints
|
|||||||
string temp = "";
|
string temp = "";
|
||||||
if (player == null || player.Index <= 0) return;
|
if (player == null || player.Index <= 0) return;
|
||||||
int playerIndex = (int)player!.Index;
|
int playerIndex = (int)player!.Index;
|
||||||
|
|
||||||
|
PlayerInfo playerInfo = new PlayerInfo
|
||||||
|
{
|
||||||
|
UserId = player.UserId,
|
||||||
|
Index = (int)player.Index,
|
||||||
|
SteamId = player?.AuthorizedSteamID?.SteamId64.ToString(),
|
||||||
|
Name = player?.PlayerName,
|
||||||
|
IpAddress = player?.IpAddress?.Split(":")[0]
|
||||||
|
};
|
||||||
|
|
||||||
if (playerIndex != 0 && DateTime.UtcNow >= commandCooldown[playerIndex].AddSeconds(Config.CmdRefreshCooldownSeconds))
|
if (playerIndex != 0 && DateTime.UtcNow >= commandCooldown[playerIndex].AddSeconds(Config.CmdRefreshCooldownSeconds))
|
||||||
{
|
{
|
||||||
commandCooldown[playerIndex] = DateTime.UtcNow;
|
commandCooldown[playerIndex] = DateTime.UtcNow;
|
||||||
if (weaponSync != null)
|
if (weaponSync != null)
|
||||||
Task.Run(async () => await weaponSync.GetWeaponPaintsFromDatabase(playerIndex));
|
Task.Run(async () => await weaponSync.GetWeaponPaintsFromDatabase(playerInfo));
|
||||||
if (Config.Additional.KnifeEnabled)
|
if (Config.Additional.KnifeEnabled)
|
||||||
{
|
{
|
||||||
if (weaponSync != null)
|
if (weaponSync != null)
|
||||||
Task.Run(async () => await weaponSync.GetKnifeFromDatabase(playerIndex));
|
Task.Run(async () => await weaponSync.GetKnifeFromDatabase(playerInfo));
|
||||||
|
|
||||||
RefreshWeapons(player);
|
RefreshWeapons(player);
|
||||||
}
|
}
|
||||||
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(Utility.ReplaceTags(temp));
|
player!.PrintToChat(Utility.ReplaceTags(temp));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!string.IsNullOrEmpty(Config.Messages.CooldownRefreshCommand))
|
if (!string.IsNullOrEmpty(Config.Messages.CooldownRefreshCommand))
|
||||||
{
|
{
|
||||||
temp = $" {Config.Prefix} {Config.Messages.CooldownRefreshCommand}";
|
temp = $" {Config.Prefix} {Config.Messages.CooldownRefreshCommand}";
|
||||||
player.PrintToChat(Utility.ReplaceTags(temp));
|
player!.PrintToChat(Utility.ReplaceTags(temp));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
66
Events.cs
66
Events.cs
@@ -12,12 +12,25 @@ namespace WeaponPaints
|
|||||||
|
|
||||||
CCSPlayerController? player = Utilities.GetPlayerFromIndex(playerIndex);
|
CCSPlayerController? player = Utilities.GetPlayerFromIndex(playerIndex);
|
||||||
|
|
||||||
if (player == null || !player.IsValid || player.IsBot || player.IsHLTV) return;
|
PlayerInfo playerInfo = new PlayerInfo
|
||||||
|
{
|
||||||
|
UserId = player.UserId,
|
||||||
|
Index = (int)player.Index,
|
||||||
|
SteamId = player?.AuthorizedSteamID?.SteamId64.ToString(),
|
||||||
|
Name = player?.PlayerName,
|
||||||
|
IpAddress = player?.IpAddress?.Split(":")[0]
|
||||||
|
};
|
||||||
|
|
||||||
if (Config.Additional.SkinEnabled && weaponSync != null)
|
if (player == null || !player.IsValid || player.IsBot || player.IsHLTV || weaponSync == null) return;
|
||||||
_ = weaponSync.GetWeaponPaintsFromDatabase(playerIndex);
|
|
||||||
if (Config.Additional.KnifeEnabled && weaponSync != null)
|
Task.Run(async () =>
|
||||||
_ = weaponSync.GetKnifeFromDatabase(playerIndex);
|
{
|
||||||
|
if (Config.Additional.SkinEnabled)
|
||||||
|
await weaponSync.GetKnifeFromDatabase(playerInfo);
|
||||||
|
});
|
||||||
|
|
||||||
|
//if (Config.Additional.KnifeEnabled && weaponSync != null)
|
||||||
|
//_ = weaponSync.GetKnifeFromDatabase(playerIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnClientDisconnect(int playerSlot)
|
private void OnClientDisconnect(int playerSlot)
|
||||||
@@ -92,7 +105,6 @@ namespace WeaponPaints
|
|||||||
|
|
||||||
RemovePlayerKnife(player, true);
|
RemovePlayerKnife(player, true);
|
||||||
AddTimer(0.3f, () => GiveKnifeToPlayer(player));
|
AddTimer(0.3f, () => GiveKnifeToPlayer(player));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return HookResult.Continue;
|
return HookResult.Continue;
|
||||||
@@ -111,6 +123,8 @@ namespace WeaponPaints
|
|||||||
|
|
||||||
if (Config.GlobalShare)
|
if (Config.GlobalShare)
|
||||||
GlobalShareConnect();
|
GlobalShareConnect();
|
||||||
|
|
||||||
|
weaponSync = new WeaponSynchronization(DatabaseConnectionString, Config, GlobalShareApi, GlobalShareServerId);
|
||||||
});
|
});
|
||||||
|
|
||||||
g_hTimerCheckSkinsData = AddTimer(10.0f, () =>
|
g_hTimerCheckSkinsData = AddTimer(10.0f, () =>
|
||||||
@@ -122,27 +136,49 @@ namespace WeaponPaints
|
|||||||
if (player == null || !player.IsValid || player.IsBot || player.IsHLTV || player.AuthorizedSteamID == null) continue;
|
if (player == null || !player.IsValid || player.IsBot || player.IsHLTV || player.AuthorizedSteamID == null) continue;
|
||||||
if (gPlayerWeaponsInfo.ContainsKey((int)player.Index)) continue;
|
if (gPlayerWeaponsInfo.ContainsKey((int)player.Index)) continue;
|
||||||
|
|
||||||
|
PlayerInfo playerInfo = new PlayerInfo
|
||||||
|
{
|
||||||
|
UserId = player.UserId,
|
||||||
|
Index = (int)player.Index,
|
||||||
|
SteamId = player?.AuthorizedSteamID?.SteamId64.ToString(),
|
||||||
|
Name = player?.PlayerName,
|
||||||
|
IpAddress = player?.IpAddress?.Split(":")[0]
|
||||||
|
};
|
||||||
|
|
||||||
if (Config.Additional.SkinEnabled && weaponSync != null)
|
if (Config.Additional.SkinEnabled && weaponSync != null)
|
||||||
_ = weaponSync.GetWeaponPaintsFromDatabase((int)player.Index);
|
_ = weaponSync.GetWeaponPaintsFromDatabase(playerInfo);
|
||||||
if (Config.Additional.KnifeEnabled && weaponSync != null)
|
if (Config.Additional.KnifeEnabled && weaponSync != null)
|
||||||
_ = weaponSync.GetKnifeFromDatabase((int)player.Index);
|
_ = weaponSync.GetKnifeFromDatabase(playerInfo);
|
||||||
}
|
}
|
||||||
}, CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE | CounterStrikeSharp.API.Modules.Timers.TimerFlags.REPEAT);
|
}, CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE | CounterStrikeSharp.API.Modules.Timers.TimerFlags.REPEAT);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private HookResult OnPlayerConnectFull(EventPlayerConnectFull @event, GameEventInfo info)
|
private HookResult OnPlayerConnectFull(EventPlayerConnectFull @event, GameEventInfo info)
|
||||||
{
|
{
|
||||||
CCSPlayerController? player = @event.Userid;
|
CCSPlayerController? player = @event.Userid;
|
||||||
if (player == null || !player.IsValid || player.IsBot || player.IsHLTV) return HookResult.Continue;
|
|
||||||
|
|
||||||
if (!gPlayerWeaponsInfo.ContainsKey((int)player.Index))
|
if (player == null || !player.IsValid || player.IsBot || player.IsHLTV || weaponSync == null) return HookResult.Continue;
|
||||||
|
|
||||||
|
PlayerInfo playerInfo = new PlayerInfo
|
||||||
|
{
|
||||||
|
UserId = player.UserId,
|
||||||
|
Index = (int)player.Index,
|
||||||
|
SteamId = player?.AuthorizedSteamID?.SteamId64.ToString(),
|
||||||
|
Name = player?.PlayerName,
|
||||||
|
IpAddress = player?.IpAddress?.Split(":")[0]
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!gPlayerWeaponsInfo.ContainsKey((int)player!.Index))
|
||||||
{
|
{
|
||||||
Console.WriteLine($"[WeaponPaints] Retrying to retrieve player {player.PlayerName} skins");
|
Console.WriteLine($"[WeaponPaints] Retrying to retrieve player {player.PlayerName} skins");
|
||||||
if (Config.Additional.SkinEnabled && weaponSync != null)
|
Task.Run(async () =>
|
||||||
_ = weaponSync.GetWeaponPaintsFromDatabase((int)player.Index);
|
{
|
||||||
if (Config.Additional.KnifeEnabled && weaponSync != null)
|
if (Config.Additional.SkinEnabled)
|
||||||
_ = weaponSync.GetKnifeFromDatabase((int)player.Index);
|
await weaponSync.GetWeaponPaintsFromDatabase(playerInfo);
|
||||||
|
if (Config.Additional.KnifeEnabled)
|
||||||
|
await weaponSync.GetKnifeFromDatabase(playerInfo);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return HookResult.Continue;
|
return HookResult.Continue;
|
||||||
|
|||||||
11
PlayerInfo.cs
Normal file
11
PlayerInfo.cs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
namespace WeaponPaints
|
||||||
|
{
|
||||||
|
public class PlayerInfo
|
||||||
|
{
|
||||||
|
public int Index { get; set; }
|
||||||
|
public int? UserId { get; set; }
|
||||||
|
public string? SteamId { get; set; }
|
||||||
|
public string? Name { get; set; }
|
||||||
|
public string? IpAddress { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -38,7 +38,7 @@ namespace WeaponPaints
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string createTable1 = "CREATE TABLE IF NOT EXISTS `wp_player_skins` (`steamid` varchar(64) NOT NULL, `weapon_defindex` int(6) NOT NULL, `weapon_paint_id` int(6) NOT NULL, `weapon_wear` float NOT NULL DEFAULT 0.0001, `weapon_seed` int(16) NOT NULL DEFAULT 0) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci";
|
string createTable1 = "CREATE TABLE IF NOT EXISTS `wp_player_skins` (`steamid` varchar(64) 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 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci";
|
||||||
string createTable2 = "CREATE TABLE IF NOT EXISTS `wp_player_knife` (`steamid` varchar(64) NOT NULL, `knife` varchar(64) NOT NULL, UNIQUE (`steamid`)) ENGINE = InnoDB";
|
string createTable2 = "CREATE TABLE IF NOT EXISTS `wp_player_knife` (`steamid` varchar(64) NOT NULL, `knife` varchar(64) NOT NULL, UNIQUE (`steamid`)) ENGINE = InnoDB";
|
||||||
|
|
||||||
await connection.ExecuteAsync(createTable1, transaction: transaction);
|
await connection.ExecuteAsync(createTable1, transaction: transaction);
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ namespace WeaponPaints
|
|||||||
weapon.AttributeManager.Item.ItemIDHigh = weapon.AttributeManager.Item.ItemIDLow >> 32;
|
weapon.AttributeManager.Item.ItemIDHigh = weapon.AttributeManager.Item.ItemIDLow >> 32;
|
||||||
weapon.FallbackPaintKit = GetRandomPaint(weaponDefIndex);
|
weapon.FallbackPaintKit = GetRandomPaint(weaponDefIndex);
|
||||||
weapon.FallbackSeed = 0;
|
weapon.FallbackSeed = 0;
|
||||||
weapon.FallbackWear = 0.0f;
|
weapon.FallbackWear = 0.000001f;
|
||||||
if (!isKnife && weapon.CBodyComponent != null && weapon.CBodyComponent.SceneNode != null)
|
if (!isKnife && weapon.CBodyComponent != null && weapon.CBodyComponent.SceneNode != null)
|
||||||
{
|
{
|
||||||
var skeleton = GetSkeletonInstance(weapon.CBodyComponent.SceneNode);
|
var skeleton = GetSkeletonInstance(weapon.CBodyComponent.SceneNode);
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ using Newtonsoft.Json.Linq;
|
|||||||
|
|
||||||
namespace WeaponPaints;
|
namespace WeaponPaints;
|
||||||
|
|
||||||
[MinimumApiVersion(90)]
|
[MinimumApiVersion(101)]
|
||||||
public partial class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig>
|
public partial class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig>
|
||||||
{
|
{
|
||||||
internal static readonly Dictionary<string, string> weaponList = new()
|
internal static readonly Dictionary<string, string> weaponList = new()
|
||||||
@@ -156,22 +156,34 @@ public partial class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig
|
|||||||
Utility.TestDatabaseConnection();
|
Utility.TestDatabaseConnection();
|
||||||
}
|
}
|
||||||
|
|
||||||
weaponSync = new WeaponSynchronization(DatabaseConnectionString, Config, GlobalShareApi, GlobalShareServerId);
|
|
||||||
|
|
||||||
if (hotReload)
|
if (hotReload)
|
||||||
{
|
{
|
||||||
OnMapStart(string.Empty);
|
OnMapStart(string.Empty);
|
||||||
Task.Run(async () =>
|
|
||||||
{
|
|
||||||
for (int i = 1; i <= Server.MaxPlayers; i++)
|
|
||||||
{
|
|
||||||
if (Config.Additional.SkinEnabled && weaponSync != null)
|
|
||||||
await weaponSync.GetWeaponPaintsFromDatabase(i);
|
|
||||||
|
|
||||||
if (Config.Additional.KnifeEnabled && weaponSync != null)
|
List<CCSPlayerController> players = Utilities.GetPlayers();
|
||||||
await weaponSync.GetKnifeFromDatabase(i);
|
|
||||||
}
|
foreach (CCSPlayerController player in players)
|
||||||
});
|
{
|
||||||
|
if (player == null || !player.IsValid || player.IsBot || player.IsHLTV || player.AuthorizedSteamID == null) continue;
|
||||||
|
if (gPlayerWeaponsInfo.ContainsKey((int)player.Index)) continue;
|
||||||
|
|
||||||
|
PlayerInfo playerInfo = new PlayerInfo
|
||||||
|
{
|
||||||
|
UserId = player.UserId,
|
||||||
|
Index = (int)player.Index,
|
||||||
|
SteamId = player?.AuthorizedSteamID?.SteamId64.ToString(),
|
||||||
|
Name = player?.PlayerName,
|
||||||
|
IpAddress = player?.IpAddress?.Split(":")[0]
|
||||||
|
};
|
||||||
|
|
||||||
|
if (Config.Additional.SkinEnabled && weaponSync != null)
|
||||||
|
_ = weaponSync.GetWeaponPaintsFromDatabase(playerInfo);
|
||||||
|
if (Config.Additional.KnifeEnabled && weaponSync != null)
|
||||||
|
_ = weaponSync.GetKnifeFromDatabase(playerInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
RegisterListeners();
|
||||||
|
RegisterCommands();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.Additional.KnifeEnabled)
|
if (Config.Additional.KnifeEnabled)
|
||||||
@@ -237,6 +249,7 @@ public partial class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig
|
|||||||
throw new Exception("[WeaponPaints] Unable to retrieve serverid from GlobalShare!");
|
throw new Exception("[WeaponPaints] Unable to retrieve serverid from GlobalShare!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Console.WriteLine("[WeaponPaints] GlobalShare ONLINE");
|
Console.WriteLine("[WeaponPaints] GlobalShare ONLINE");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -21,24 +21,21 @@ namespace WeaponPaints
|
|||||||
_globalShareServerId = globalShareServerId;
|
_globalShareServerId = globalShareServerId;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal async Task GetKnifeFromDatabase(int playerIndex)
|
internal async Task GetKnifeFromDatabase(PlayerInfo player)
|
||||||
{
|
{
|
||||||
if (!_config.Additional.KnifeEnabled) return;
|
if (!_config.Additional.KnifeEnabled) return;
|
||||||
|
if (player.SteamId == null || player.Index == 0) return;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
CCSPlayerController player = Utilities.GetPlayerFromIndex(playerIndex);
|
|
||||||
if (!Utility.IsPlayerValid(player)) return;
|
|
||||||
if (player.AuthorizedSteamID == null) return;
|
|
||||||
string steamId = player.AuthorizedSteamID.SteamId64.ToString();
|
|
||||||
|
|
||||||
if (_config.GlobalShare)
|
if (_config.GlobalShare)
|
||||||
{
|
{
|
||||||
var values = new Dictionary<string, string>
|
var values = new Dictionary<string, string>
|
||||||
{
|
{
|
||||||
{ "server_id", _globalShareServerId.ToString() },
|
{ "server_id", _globalShareServerId.ToString() },
|
||||||
{ "steamid", steamId },
|
{ "steamid", player.SteamId },
|
||||||
{ "knife", "1" }
|
{ "knife", "1" }
|
||||||
};
|
};
|
||||||
|
|
||||||
UriBuilder builder = new UriBuilder(_globalShareApi);
|
UriBuilder builder = new UriBuilder(_globalShareApi);
|
||||||
builder.Query = string.Join("&", values.Select(p => $"{Uri.EscapeDataString(p.Key)}={Uri.EscapeDataString(p.Value)}"));
|
builder.Query = string.Join("&", values.Select(p => $"{Uri.EscapeDataString(p.Key)}={Uri.EscapeDataString(p.Value)}"));
|
||||||
|
|
||||||
@@ -53,7 +50,7 @@ namespace WeaponPaints
|
|||||||
string result = await response.Content.ReadAsStringAsync();
|
string result = await response.Content.ReadAsStringAsync();
|
||||||
if (!string.IsNullOrEmpty(result))
|
if (!string.IsNullOrEmpty(result))
|
||||||
{
|
{
|
||||||
WeaponPaints.g_playersKnife[playerIndex] = result;
|
WeaponPaints.g_playersKnife[player.Index] = result;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -72,10 +69,11 @@ namespace WeaponPaints
|
|||||||
{
|
{
|
||||||
await connection.OpenAsync();
|
await connection.OpenAsync();
|
||||||
string query = "SELECT `knife` FROM `wp_player_knife` WHERE `steamid` = @steamid";
|
string query = "SELECT `knife` FROM `wp_player_knife` WHERE `steamid` = @steamid";
|
||||||
string? PlayerKnife = await connection.QueryFirstOrDefaultAsync<string>(query, new { steamid = steamId });
|
string? PlayerKnife = await connection.QueryFirstOrDefaultAsync<string>(query, new { steamid = player.SteamId });
|
||||||
|
|
||||||
if (PlayerKnife != null)
|
if (PlayerKnife != null)
|
||||||
{
|
{
|
||||||
WeaponPaints.g_playersKnife[playerIndex] = PlayerKnife;
|
WeaponPaints.g_playersKnife[player.Index] = PlayerKnife;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -91,20 +89,14 @@ namespace WeaponPaints
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal async Task GetWeaponPaintsFromDatabase(int playerIndex)
|
internal async Task GetWeaponPaintsFromDatabase(PlayerInfo player)
|
||||||
{
|
{
|
||||||
if (!_config.Additional.SkinEnabled) return;
|
if (!_config.Additional.SkinEnabled) return;
|
||||||
|
if (player.SteamId == null || player.Index == 0) return;
|
||||||
|
|
||||||
CCSPlayerController player = Utilities.GetPlayerFromIndex(playerIndex);
|
if (!WeaponPaints.gPlayerWeaponsInfo.TryGetValue(player.Index, out _))
|
||||||
if (!Utility.IsPlayerValid(player)) return;
|
|
||||||
|
|
||||||
if (player.AuthorizedSteamID == null) return;
|
|
||||||
|
|
||||||
string steamId = player.AuthorizedSteamID.SteamId64.ToString();
|
|
||||||
|
|
||||||
if (!WeaponPaints.gPlayerWeaponsInfo.TryGetValue(playerIndex, out _))
|
|
||||||
{
|
{
|
||||||
WeaponPaints.gPlayerWeaponsInfo[playerIndex] = new Dictionary<int, WeaponInfo>();
|
WeaponPaints.gPlayerWeaponsInfo[player.Index] = new Dictionary<int, WeaponInfo>();
|
||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -113,7 +105,7 @@ namespace WeaponPaints
|
|||||||
var values = new Dictionary<string, string>
|
var values = new Dictionary<string, string>
|
||||||
{
|
{
|
||||||
{ "server_id", _globalShareServerId.ToString() },
|
{ "server_id", _globalShareServerId.ToString() },
|
||||||
{ "steamid", steamId },
|
{ "steamid", player.SteamId },
|
||||||
{ "skins", "1" }
|
{ "skins", "1" }
|
||||||
};
|
};
|
||||||
UriBuilder builder = new UriBuilder(_globalShareApi);
|
UriBuilder builder = new UriBuilder(_globalShareApi);
|
||||||
@@ -146,7 +138,7 @@ namespace WeaponPaints
|
|||||||
Seed = weaponSeed.Value,
|
Seed = weaponSeed.Value,
|
||||||
Wear = weaponWear.Value
|
Wear = weaponWear.Value
|
||||||
};
|
};
|
||||||
WeaponPaints.gPlayerWeaponsInfo[playerIndex][weaponDefIndex.Value] = weaponInfo;
|
WeaponPaints.gPlayerWeaponsInfo[player.Index][weaponDefIndex.Value] = weaponInfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -164,7 +156,7 @@ namespace WeaponPaints
|
|||||||
await connection.OpenAsync();
|
await connection.OpenAsync();
|
||||||
|
|
||||||
string query = "SELECT * FROM `wp_player_skins` WHERE `steamid` = @steamid";
|
string query = "SELECT * FROM `wp_player_skins` WHERE `steamid` = @steamid";
|
||||||
IEnumerable<dynamic> PlayerSkins = await connection.QueryAsync<dynamic>(query, new { steamid = steamId });
|
IEnumerable<dynamic> PlayerSkins = await connection.QueryAsync<dynamic>(query, new { steamid = player.SteamId });
|
||||||
|
|
||||||
if (PlayerSkins != null && PlayerSkins.AsList().Count > 0)
|
if (PlayerSkins != null && PlayerSkins.AsList().Count > 0)
|
||||||
{
|
{
|
||||||
@@ -181,7 +173,7 @@ namespace WeaponPaints
|
|||||||
Seed = weaponSeed,
|
Seed = weaponSeed,
|
||||||
Wear = weaponWear
|
Wear = weaponWear
|
||||||
};
|
};
|
||||||
WeaponPaints.gPlayerWeaponsInfo[playerIndex][weaponDefIndex] = weaponInfo;
|
WeaponPaints.gPlayerWeaponsInfo[player.Index][weaponDefIndex] = weaponInfo;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -1,73 +0,0 @@
|
|||||||
<?php
|
|
||||||
$weapons = array (
|
|
||||||
"weapon_deagle" => 1,
|
|
||||||
"weapon_elite" => 2,
|
|
||||||
"weapon_fiveseven" => 3,
|
|
||||||
"weapon_glock" => 4,
|
|
||||||
"weapon_ak47" => 7,
|
|
||||||
"weapon_aug" => 8,
|
|
||||||
"weapon_awp" => 9,
|
|
||||||
"weapon_famas" => 10,
|
|
||||||
"weapon_g3sg1" => 10,
|
|
||||||
"weapon_galilar" => 13,
|
|
||||||
"weapon_m249" => 14,
|
|
||||||
"weapon_m4a1" => 16,
|
|
||||||
"weapon_mac10" => 17,
|
|
||||||
"weapon_p90" => 19,
|
|
||||||
"weapon_mp5sd" => 23,
|
|
||||||
"weapon_ump45" => 24,
|
|
||||||
"weapon_xm1014" => 25,
|
|
||||||
"weapon_bizon" => 26,
|
|
||||||
"weapon_mag7" => 27,
|
|
||||||
"weapon_negev" => 28,
|
|
||||||
"weapon_sawedoff" => 29,
|
|
||||||
"weapon_tec9" => 30,
|
|
||||||
"weapon_hkp2000" => 32,
|
|
||||||
"weapon_mp7" => 33,
|
|
||||||
"weapon_mp9" => 34,
|
|
||||||
"weapon_nova" => 35,
|
|
||||||
"weapon_p250" => 36,
|
|
||||||
"weapon_scar20" => 38,
|
|
||||||
"weapon_sg556" => 39,
|
|
||||||
"weapon_ssg08" => 40,
|
|
||||||
"weapon_m4a1_silencer" => 60,
|
|
||||||
"weapon_usp_silencer" => 61,
|
|
||||||
"weapon_cz75a" => 63,
|
|
||||||
"weapon_revolver" => 64,
|
|
||||||
"weapon_bayonet" => 500,
|
|
||||||
"weapon_knife_css" => 503,
|
|
||||||
"weapon_knife_flip" => 505,
|
|
||||||
"weapon_knife_gut" => 506,
|
|
||||||
"weapon_knife_karambit" => 507,
|
|
||||||
"weapon_knife_m9_bayonet" => 508,
|
|
||||||
"weapon_knife_tactical" => 509,
|
|
||||||
"weapon_knife_falchion" => 512,
|
|
||||||
"weapon_knife_survival_bowie"=> 514,
|
|
||||||
"weapon_knife_butterfly" => 515,
|
|
||||||
"weapon_knife_push" => 516,
|
|
||||||
"weapon_knife_cord" => 517,
|
|
||||||
"weapon_knife_canis" => 518,
|
|
||||||
"weapon_knife_ursus" => 519,
|
|
||||||
"weapon_knife_gypsy_jackknife" => 520,
|
|
||||||
"weapon_knife_outdoor" => 521,
|
|
||||||
"weapon_knife_stiletto" => 522,
|
|
||||||
"weapon_knife_widowmaker" => 523,
|
|
||||||
"weapon_knife_skeleton" => 525);
|
|
||||||
$json = json_decode(file_get_contents('skins.json'));
|
|
||||||
echo "<pre>";
|
|
||||||
foreach($json as $skin)
|
|
||||||
{
|
|
||||||
if(!str_contains($skin->weapon->id, "weapon_")) continue;
|
|
||||||
$name = $skin->name;
|
|
||||||
$name = str_replace("'","\'",$name);
|
|
||||||
$weapon = $skin->weapon->id;
|
|
||||||
$image = $skin->image;
|
|
||||||
$paint = $skin->paint_index;
|
|
||||||
echo "('{$weapon}', {$weapons[$weapon]}, {$paint}, '{$image}', '{$name}')";
|
|
||||||
echo ",<br>";
|
|
||||||
|
|
||||||
}
|
|
||||||
//print_r($json);
|
|
||||||
echo "</pre>";
|
|
||||||
|
|
||||||
?>
|
|
||||||
Reference in New Issue
Block a user