## GENERAL - Updated CSS to version 1.0.369. - Upgraded the project from .NET 8.0 to .NET 10.0. - Updated Turkish language translation by @ByDexterTR. - Added Russian language translation by @213sdfsdgf. - Fixed an issue with incorrect display of Arabic nicknames. - Used ForceFullUpdate to resolve the "FATAL ERROR: CopyExistingEntity" crash. - Disabled stale HandleCommandDrop hook to avoid crashes when a player joins a team (thanks to @vladimir214sd). - Added new signatures to gamedata. - Added the ability to configure the number of grenades for every skill that uses grenades as part of its ability (e.g., Miner, AntyFlash, MagneticDecoy, etc.). ## SKILL IMPROVEMENTS - Re-Zombie: -- Fixed weapon switching issues when a player is holding a Zeus and a knife. -- Weapons are now removed for bots in zombie mode. - Ghost: -- Blocked the ability to use the Zeus. - Thorns: -- Added a configurable maximum health limit (37 HP) for the damage that can be reflected. - Second Life / Phoenix / Re-Zombie: -- Fixed an issue where players would occasionally fail to respawn if they took too much damage too quickly. - Ghost / Chicken: -- Blocked the ability to use the SG556 (`weapon_sg556`). - Wallhack: -- Fixed a bug that caused temporary enemy highlighting right after death. - Cypher: -- Added camera position persistence. - God Mode: -- Fixed an issue with permanent immortality triggering after reaching exactly 0 HP. - Weapons Swap: -- The ammo count is now also transferred when weapons are swapped. - Muhammed: -- Renamed the skill to "DeathBomb". - Spectator: -- Fixed a bug where a player with the Chicken skill would still display as a ragdoll after death when spectated. - Friendly Fire: -- The skill now works even when the server's mp_friendlyfire setting is set to 0. - Baseball: -- Disabled teammate killing.
73 lines
No EOL
3.1 KiB
C#
73 lines
No EOL
3.1 KiB
C#
using CounterStrikeSharp.API;
|
|
using CounterStrikeSharp.API.Core;
|
|
using CounterStrikeSharp.API.Modules.Memory.DynamicFunctions;
|
|
using CounterStrikeSharp.API.Modules.Utils;
|
|
using src.utils;
|
|
|
|
namespace src.player.skills
|
|
{
|
|
public class FriendlyFire : ISkill
|
|
{
|
|
private const Skills skillName = Skills.FriendlyFire;
|
|
|
|
public static void LoadSkill()
|
|
{
|
|
SkillUtils.RegisterSkill(skillName, SkillsInfo.GetValue<string>(skillName, "color"));
|
|
}
|
|
|
|
public static void OnTakeDamage(DynamicHook h)
|
|
{
|
|
CEntityInstance param = h.GetParam<CEntityInstance>(0);
|
|
CTakeDamageInfo param2 = h.GetParam<CTakeDamageInfo>(1);
|
|
|
|
if (param == null || param.Entity == null || param2 == null || param2.Attacker == null || param2.Attacker.Value == null)
|
|
return;
|
|
|
|
if (param2.AmmoType == 255)
|
|
return;
|
|
|
|
CCSPlayerPawn attackerPawn = new(param2.Attacker.Value.Handle);
|
|
CCSPlayerPawn victimPawn = new(param.Handle);
|
|
|
|
if (attackerPawn == null || !attackerPawn.IsValid || victimPawn == null || !victimPawn.IsValid)
|
|
return;
|
|
|
|
if (attackerPawn.DesignerName != "player" || victimPawn.DesignerName != "player")
|
|
return;
|
|
|
|
if (attackerPawn == null || attackerPawn.Controller?.Value == null || victimPawn == null || victimPawn.Controller?.Value == null)
|
|
return;
|
|
|
|
var attackerController = attackerPawn.Controller.Value;
|
|
if (attackerController == null || !attackerController.IsValid) return;
|
|
|
|
var victimController = victimPawn.Controller.Value;
|
|
if (victimController == null || !victimController.IsValid) return;
|
|
|
|
var attacker = attackerController.As<CCSPlayerController>();
|
|
if (attacker == null || !attacker.IsValid) return;
|
|
|
|
var victim = victimController.As<CCSPlayerController>();
|
|
if (victim == null || !victim.IsValid) return;
|
|
|
|
var playerInfo = PlayerManager.GetPlayerByIndex(PlayerManager.GetPlayerEvent(attacker)!.Index);
|
|
if (playerInfo?.Skill != skillName || attacker!.Team != victim!.Team) return;
|
|
|
|
float damage = param2.Damage;
|
|
param2.Damage = 0;
|
|
|
|
Server.ExecuteCommand("mp_autokick 0");
|
|
|
|
SkillUtils.AddHealth(
|
|
victimPawn,
|
|
(int)(damage * SkillsInfo.GetValue<float>(skillName, "healthDamageMultiplier")),
|
|
victimPawn.MaxHealth
|
|
);
|
|
}
|
|
|
|
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#ff0000", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = true, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common, float healthDamageMultiplier = .3f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
|
|
{
|
|
public float HealthDamageMultiplier { get; set; } = healthDamageMultiplier;
|
|
}
|
|
}
|
|
} |