mirror of
https://github.com/Nereziel/cs2-WeaponPaints.git
synced 2026-02-17 18:39:07 +00:00
@@ -682,6 +682,8 @@ public partial class WeaponPaints
|
||||
playerMusic[team] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
GivePlayerMusicKit(player);
|
||||
|
||||
if (!string.IsNullOrEmpty(Localizer["wp_music_menu_select"]))
|
||||
{
|
||||
@@ -712,6 +714,8 @@ public partial class WeaponPaints
|
||||
{
|
||||
playerMusic[team] = 0;
|
||||
}
|
||||
|
||||
GivePlayerMusicKit(player);
|
||||
|
||||
if (!string.IsNullOrEmpty(Localizer["wp_music_menu_select"]))
|
||||
{
|
||||
|
||||
43
Events.cs
43
Events.cs
@@ -111,35 +111,6 @@ 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)
|
||||
{
|
||||
if (Config.Additional is { KnifeEnabled: false, SkinEnabled: false, GloveEnabled: false }) return;
|
||||
@@ -171,7 +142,6 @@ namespace WeaponPaints
|
||||
private HookResult OnRoundEnd(EventRoundEnd @event, GameEventInfo info)
|
||||
{
|
||||
_gBCommandsAllowed = false;
|
||||
|
||||
return HookResult.Continue;
|
||||
}
|
||||
|
||||
@@ -249,9 +219,8 @@ namespace WeaponPaints
|
||||
if (!Config.Additional.ShowSkinImage) return;
|
||||
|
||||
foreach (var player in Utilities.GetPlayers().Where(p =>
|
||||
p is { IsValid: true, PlayerPawn.IsValid: true } &&
|
||||
(LifeState_t)p.LifeState == LifeState_t.LIFE_ALIVE
|
||||
&& !p.IsBot && p is { Connected: PlayerConnectedState.PlayerConnected }
|
||||
p is { IsValid: true, PlayerPawn.IsValid: true, IsBot: false } and
|
||||
{ Connected: PlayerConnectedState.PlayerConnected }
|
||||
)
|
||||
)
|
||||
{
|
||||
@@ -284,10 +253,12 @@ namespace WeaponPaints
|
||||
if (player is null || !player.IsValid)
|
||||
return HookResult.Continue;
|
||||
|
||||
if (victim == null || victim == player)
|
||||
if (victim == null || !victim.IsValid || victim == player)
|
||||
return HookResult.Continue;
|
||||
|
||||
if (!GPlayerWeaponsInfo.TryGetValue(player.Slot, out _)) return HookResult.Continue;
|
||||
if (!GPlayerWeaponsInfo.TryGetValue(player.Slot, out var teamInfo) ||
|
||||
!teamInfo.TryGetValue(player.Team, out var teamWeapons) )
|
||||
return HookResult.Continue;
|
||||
|
||||
CBasePlayerWeapon? weapon = player.PlayerPawn.Value?.WeaponServices?.ActiveWeapon.Value;
|
||||
|
||||
@@ -295,7 +266,7 @@ namespace WeaponPaints
|
||||
|
||||
int weaponDefIndex = weapon.AttributeManager.Item.ItemDefinitionIndex;
|
||||
|
||||
if (!GPlayerWeaponsInfo[player.Slot][player.Team].TryGetValue(weaponDefIndex, out var weaponInfo) || weaponInfo.Paint == 0)
|
||||
if (!teamWeapons.TryGetValue(weaponDefIndex, out var weaponInfo) || weaponInfo.Paint == 0)
|
||||
return HookResult.Continue;
|
||||
|
||||
if (!weaponInfo.StatTrak) return HookResult.Continue;
|
||||
|
||||
@@ -473,17 +473,20 @@ namespace WeaponPaints
|
||||
|
||||
private static void GivePlayerMusicKit(CCSPlayerController player)
|
||||
{
|
||||
if (GPlayersMusic.TryGetValue(player.Slot, out var musicInfo) || musicInfo == null ||
|
||||
if (player.IsBot) return;
|
||||
if (!GPlayersMusic.TryGetValue(player.Slot, out var musicInfo) ||
|
||||
!musicInfo.TryGetValue(player.Team, out var musicId) || musicId == 0) return;
|
||||
|
||||
if (player.InventoryServices == null) return;
|
||||
|
||||
player.InventoryServices.MusicID = musicId;
|
||||
Utilities.SetStateChanged(player, "CCSPlayerController", "m_pInventoryServices");
|
||||
|
||||
player.MusicKitID = musicId;
|
||||
// player.MvpNoMusic = false;
|
||||
player.InventoryServices.MusicID = musicId;
|
||||
Utilities.SetStateChanged(player, "CCSPlayerController", "m_iMusicKitID");
|
||||
player.MusicKitMVPs = musicId;
|
||||
Utilities.SetStateChanged(player, "CCSPlayerController", "m_iMusicKitMVPs");
|
||||
// Utilities.SetStateChanged(player, "CCSPlayerController", "m_bMvpNoMusic");
|
||||
Utilities.SetStateChanged(player, "CCSPlayerController", "m_pInventoryServices");
|
||||
// player.MusicKitMVPs = musicId;
|
||||
// Utilities.SetStateChanged(player, "CCSPlayerController", "m_iMusicKitMVPs");
|
||||
}
|
||||
|
||||
private static void GivePlayerPin(CCSPlayerController player)
|
||||
|
||||
@@ -16,7 +16,7 @@ public partial class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig
|
||||
public override string ModuleAuthor => "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.9b";
|
||||
public override string ModuleVersion => "2.9c";
|
||||
|
||||
public override void Load(bool hotReload)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user