using CounterStrikeSharp.API; using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API.Modules.Utils; using jRandomSkills.src.player; using static jRandomSkills.jRandomSkills; namespace jRandomSkills { public class Silent : ISkill { private const Skills skillName = Skills.Silent; public static void LoadSkill() { SkillUtils.RegisterSkill(skillName, Config.GetValue(skillName, "color")); Instance.HookUserMessage(208, um => { var soundevent = um.ReadUInt("soundevent_hash"); var userIndex = um.ReadUInt("source_entity_index"); if (userIndex == 0) return HookResult.Continue; if (!Instance.footstepSoundEvents.Contains(soundevent) && !Instance.silentSoundEvents.Contains(soundevent)) return HookResult.Continue; var player = Utilities.GetPlayers().FirstOrDefault(p => p.Pawn?.Value != null && p.Pawn.Value.IsValid && p.Pawn.Value.Index == userIndex); if (!Instance.IsPlayerValid(player)) return HookResult.Continue; var playerInfo = Instance.SkillPlayer.FirstOrDefault(p => p.SteamID == player?.SteamID); if (playerInfo?.Skill != skillName) return HookResult.Continue; um.Recipients.Clear(); return HookResult.Handled; }, HookMode.Pre); } public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#333333", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false) : Config.DefaultSkillInfo(skill, active, color, onlyTeam, needsTeammates) { } } }