Fix for !wp and comments cleanup

This commit is contained in:
daffyyyy
2023-12-03 13:00:37 +01:00
parent a6b193cd13
commit 1e5c2a439f
7 changed files with 375 additions and 409 deletions

View File

@@ -5,38 +5,10 @@ using CounterStrikeSharp.API.Modules.Cvars;
using Newtonsoft.Json.Linq;
namespace WeaponPaints;
[MinimumApiVersion(90)]
public partial class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig>
{
public override string ModuleName => "WeaponPaints";
public override string ModuleDescription => "Skin and knife selector, standalone and web-based";
public override string ModuleAuthor => "Nereziel & daffyy";
public override string ModuleVersion => "1.3b";
public WeaponPaintsConfig Config { get; set; } = new();
internal static WeaponPaintsConfig _config = new WeaponPaintsConfig();
internal static WeaponSynchronization? weaponSync;
private CounterStrikeSharp.API.Modules.Timers.Timer? g_hTimerCheckSkinsData = null;
/*
private Dictionary<int, Dictionary<int, int>> gPlayerWeaponPaints = new();
private Dictionary<int, Dictionary<int, int>> gPlayerWeaponSeed = new();
private Dictionary<int, Dictionary<int, float>> gPlayerWeaponWear = new();
*/
private string DatabaseConnectionString = string.Empty;
internal Uri GlobalShareApi = new Uri("https://weaponpaints.fun/api.php");
internal int GlobalShareServerId = 0;
private DateTime[] commandCooldown = new DateTime[Server.MaxPlayers];
internal static Dictionary<int, Dictionary<int, WeaponInfo>> gPlayerWeaponsInfo = new Dictionary<int, Dictionary<int, WeaponInfo>>();
internal static Dictionary<int, int> g_knifePickupCount = new Dictionary<int, int>();
internal static Dictionary<int, string> g_playersKnife = new();
//internal static List<int> g_changedKnife = new();
internal bool g_bCommandsAllowed = true;
internal static List<JObject> skinsList = new List<JObject>();
internal static readonly Dictionary<string, string> weaponList = new()
{
{"weapon_deagle", "Desert Eagle"},
@@ -95,6 +67,87 @@ public partial class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig
{ "weapon_knife_skeleton", "Skeleton Knife" }
};
internal static WeaponPaintsConfig _config = new WeaponPaintsConfig();
internal static Dictionary<int, int> g_knifePickupCount = new Dictionary<int, int>();
internal static Dictionary<int, string> g_playersKnife = new();
internal static Dictionary<int, Dictionary<int, WeaponInfo>> gPlayerWeaponsInfo = new Dictionary<int, Dictionary<int, WeaponInfo>>();
internal static List<JObject> skinsList = new List<JObject>();
internal static WeaponSynchronization? weaponSync;
//internal static List<int> g_changedKnife = new();
internal bool g_bCommandsAllowed = true;
internal Uri GlobalShareApi = new Uri("https://weaponpaints.fun/api.php");
internal int GlobalShareServerId = 0;
private DateTime[] commandCooldown = new DateTime[Server.MaxPlayers];
private string DatabaseConnectionString = string.Empty;
private CounterStrikeSharp.API.Modules.Timers.Timer? g_hTimerCheckSkinsData = null;
public static Dictionary<int, string> weaponDefindex { get; } = new Dictionary<int, string>
{
{ 1, "weapon_deagle" },
{ 2, "weapon_elite" },
{ 3, "weapon_fiveseven" },
{ 4, "weapon_glock" },
{ 7, "weapon_ak47" },
{ 8, "weapon_aug" },
{ 9, "weapon_awp" },
{ 10, "weapon_famas" },
{ 11, "weapon_g3sg1" },
{ 13, "weapon_galilar" },
{ 14, "weapon_m249" },
{ 16, "weapon_m4a1" },
{ 17, "weapon_mac10" },
{ 19, "weapon_p90" },
{ 23, "weapon_mp5sd" },
{ 24, "weapon_ump45" },
{ 25, "weapon_xm1014" },
{ 26, "weapon_bizon" },
{ 27, "weapon_mag7" },
{ 28, "weapon_negev" },
{ 29, "weapon_sawedoff" },
{ 30, "weapon_tec9" },
{ 32, "weapon_hkp2000" },
{ 33, "weapon_mp7" },
{ 34, "weapon_mp9" },
{ 35, "weapon_nova" },
{ 36, "weapon_p250" },
{ 38, "weapon_scar20" },
{ 39, "weapon_sg556" },
{ 40, "weapon_ssg08" },
{ 60, "weapon_m4a1_silencer" },
{ 61, "weapon_usp_silencer" },
{ 63, "weapon_cz75a" },
{ 64, "weapon_revolver" },
{ 500, "weapon_bayonet" },
{ 503, "weapon_knife_css" },
{ 505, "weapon_knife_flip" },
{ 506, "weapon_knife_gut" },
{ 507, "weapon_knife_karambit" },
{ 508, "weapon_knife_m9_bayonet" },
{ 509, "weapon_knife_tactical" },
{ 512, "weapon_knife_falchion" },
{ 514, "weapon_knife_survival_bowie" },
{ 515, "weapon_knife_butterfly" },
{ 516, "weapon_knife_push" },
{ 517, "weapon_knife_cord" },
{ 518, "weapon_knife_canis" },
{ 519, "weapon_knife_ursus" },
{ 520, "weapon_knife_gypsy_jackknife" },
{ 521, "weapon_knife_outdoor" },
{ 522, "weapon_knife_stiletto" },
{ 523, "weapon_knife_widowmaker" },
{ 525, "weapon_knife_skeleton" }
};
public WeaponPaintsConfig Config { get; set; } = new();
public override string ModuleAuthor => "Nereziel & daffyy";
public override string ModuleDescription => "Skin and knife selector, standalone and web-based";
public override string ModuleName => "WeaponPaints";
public override string ModuleVersion => "1.3c";
public static WeaponPaintsConfig GetWeaponPaintsConfig()
{
return _config;
}
public override void Load(bool hotReload)
{
if (!Config.GlobalShare)
@@ -148,19 +201,6 @@ public partial class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig
Utility.ShowAd(ModuleVersion);
}
public static WeaponPaintsConfig GetWeaponPaintsConfig()
{
return _config;
}
// TODO: fix for map which change mp_t_default_melee
/*private HookResult OnRoundPreStart(EventRoundPrestart @event, GameEventInfo info)
{
NativeAPI.IssueServerCommand("mp_t_default_melee \"\"");
NativeAPI.IssueServerCommand("mp_ct_default_melee \"\"");
return HookResult.Continue;
}
*/
public override void Unload(bool hotReload)
{
base.Unload(hotReload);