diff --git a/Events.cs b/Events.cs index 1f9d0382..a2ed22df 100644 --- a/Events.cs +++ b/Events.cs @@ -77,9 +77,6 @@ namespace WeaponPaints IpAddress = player.IpAddress?.Split(":")[0] }; - if (!GPlayerWeaponsInfo.TryGetValue(player.Slot, out var weaponInfos)) - return HookResult.Continue; - if (WeaponSync != null) _ = Task.Run(async () => await WeaponSync.SyncStatTrakToDatabase(playerInfo)); @@ -113,6 +110,35 @@ namespace WeaponPaints return HookResult.Continue; } + + [GameEventHandler(HookMode.Pre)] + public HookResult OnPlayerMvp(EventRoundMvp @event, GameEventInfo info) + { + var player = @event.Userid; + if (player == null || !player.IsValid || player.IsBot) + return HookResult.Continue; + + if (!(GPlayersMusic.TryGetValue(player.Slot, out var musicInfo) + && musicInfo.TryGetValue(player.Team, out var musicId) + && musicId != 0)) + return HookResult.Continue; + + @event.Musickitid = musicId; + @event.Nomusic = 0; + @event.Musickitmvps = 1; + @event.Value = 1; + + var newEvent = new EventRoundMvp(true) + { + Musickitid = musicId, + Nomusic = 0, + Musickitmvps = 1, + Value = 1 + }; + + newEvent.FireEvent(false); + return HookResult.Continue; + } private void OnMapStart(string mapName) { diff --git a/VERSION b/VERSION index 0d1ad2a0..83ff4ce3 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.9a \ No newline at end of file +2.9b \ No newline at end of file diff --git a/WeaponAction.cs b/WeaponAction.cs index 68b26aa3..1f9ffdd0 100644 --- a/WeaponAction.cs +++ b/WeaponAction.cs @@ -482,6 +482,8 @@ namespace WeaponPaints Utilities.SetStateChanged(player, "CCSPlayerController", "m_pInventoryServices"); player.MusicKitID = musicId; Utilities.SetStateChanged(player, "CCSPlayerController", "m_iMusicKitID"); + player.MusicKitMVPs = musicId; + Utilities.SetStateChanged(player, "CCSPlayerController", "m_iMusicKitMVPs"); } private static void GivePlayerPin(CCSPlayerController player) diff --git a/WeaponPaints.cs b/WeaponPaints.cs index 524f4d3c..025cb23e 100644 --- a/WeaponPaints.cs +++ b/WeaponPaints.cs @@ -16,7 +16,7 @@ public partial class WeaponPaints : BasePlugin, IPluginConfig "Nereziel & daffyy"; public override string ModuleDescription => "Skin, gloves, agents and knife selector, standalone and web-based"; public override string ModuleName => "WeaponPaints"; - public override string ModuleVersion => "2.9a"; + public override string ModuleVersion => "2.9b"; public override void Load(bool hotReload) { diff --git a/WeaponSynchronization.cs b/WeaponSynchronization.cs index 40960d69..e852b15d 100644 --- a/WeaponSynchronization.cs +++ b/WeaponSynchronization.cs @@ -325,13 +325,13 @@ internal class WeaponSynchronization if (weaponTeam == CsTeam.None) { // Assign music ID to both teams if weaponTeam is None - playerMusic[CsTeam.Terrorist] = row.music_id.Value; - playerMusic[CsTeam.CounterTerrorist] = row.music_id.Value; + playerMusic[CsTeam.Terrorist] = (ushort)row.music_id; + playerMusic[CsTeam.CounterTerrorist] = (ushort)row.music_id; } else { // Assign music ID to the specific team - playerMusic[weaponTeam] = row.music_id.Value; + playerMusic[weaponTeam] = (ushort)row.music_id; } } } diff --git a/website/class/config.php b/website/class/config.php index 34b0c046..fa7c508d 100644 --- a/website/class/config.php +++ b/website/class/config.php @@ -1,4 +1,6 @@