v1.1.0
This commit is contained in:
parent
6b8988ade4
commit
26cb787b57
125 changed files with 9157 additions and 1940 deletions
94
jRandomSkills - SRC Files/src/player/skills/LongZeus.cs
Normal file
94
jRandomSkills - SRC Files/src/player/skills/LongZeus.cs
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Entities.Constants;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using CS2TraceRay.Class;
|
||||
using CS2TraceRay.Struct;
|
||||
using jRandomSkills.src.player;
|
||||
using System.Numerics;
|
||||
using static jRandomSkills.jRandomSkills;
|
||||
using Vector = CounterStrikeSharp.API.Modules.Utils.Vector;
|
||||
|
||||
namespace jRandomSkills
|
||||
{
|
||||
public class LongZeus : ISkill
|
||||
{
|
||||
private const Skills skillName = Skills.LongZeus;
|
||||
private static float maxDistance = Config.GetValue<float>(skillName, "maxDistance");
|
||||
|
||||
public unsafe static void LoadSkill()
|
||||
{
|
||||
SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
|
||||
|
||||
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
|
||||
{
|
||||
Instance.AddTimer(0.1f, () =>
|
||||
{
|
||||
foreach (var player in Utilities.GetPlayers())
|
||||
{
|
||||
if (!Instance.IsPlayerValid(player)) continue;
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill != skillName) continue;
|
||||
EnableSkill(player);
|
||||
}
|
||||
});
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
|
||||
Instance.RegisterEventHandler<EventWeaponFire>((@event, info) =>
|
||||
{
|
||||
var player = @event.Userid;
|
||||
if (!Instance.IsPlayerValid(player)) return HookResult.Continue;
|
||||
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill != skillName) return HookResult.Continue;
|
||||
|
||||
var activeWeapon = player.Pawn.Value.WeaponServices.ActiveWeapon.Value;
|
||||
if (activeWeapon?.DesignerName != "weapon_taser") return HookResult.Continue;
|
||||
|
||||
var pawn = player.PlayerPawn.Value;
|
||||
Vector eyePos = new Vector(pawn.AbsOrigin.X, pawn.AbsOrigin.Y, pawn.AbsOrigin.Z + pawn.ViewOffset.Z);
|
||||
Vector endPos = eyePos + SkillUtils.GetForwardVector(pawn.EyeAngles) * maxDistance;
|
||||
|
||||
Ray ray = new Ray(Vector3.Zero);
|
||||
CTraceFilter filter = new CTraceFilter(pawn.Index, pawn.Index)
|
||||
{
|
||||
m_nObjectSetMask = 0xf,
|
||||
m_nCollisionGroup = (byte)CollisionGroup.COLLISION_GROUP_PLAYER_MOVEMENT,
|
||||
m_nInteractsWith = pawn.GetInteractsWith(),
|
||||
m_nInteractsExclude = 0,
|
||||
m_nBits = 11,
|
||||
m_bIterateEntities = true,
|
||||
m_bHitTriggers = false,
|
||||
m_nInteractsAs = 0x40000
|
||||
};
|
||||
|
||||
filter.m_nHierarchyIds[0] = pawn.GetHierarchyId();
|
||||
filter.m_nHierarchyIds[1] = 0;
|
||||
CGameTrace trace = TraceRay.TraceHull(eyePos, endPos, filter, ray);
|
||||
|
||||
if (!trace.HitPlayer(out CCSPlayerController? target) || target == null)
|
||||
return HookResult.Continue;
|
||||
|
||||
if (target.Handle == player.Handle) return HookResult.Continue;
|
||||
SkillUtils.TakeHealth(target.PlayerPawn.Value, 9999);
|
||||
return HookResult.Continue;
|
||||
});
|
||||
}
|
||||
|
||||
public static void EnableSkill(CCSPlayerController player)
|
||||
{
|
||||
SkillUtils.TryGiveWeapon(player, CsItem.Zeus);
|
||||
}
|
||||
|
||||
public class SkillConfig : Config.DefaultSkillInfo
|
||||
{
|
||||
public float MaxDistance { get; set; }
|
||||
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#6effc7", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false, float maxDistance = 4096f) : base(skill, active, color, onlyTeam, needsTeammates)
|
||||
{
|
||||
MaxDistance = maxDistance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue