This commit is contained in:
Juzlus 2025-08-29 02:41:39 +02:00
parent 6b8988ade4
commit 26cb787b57
125 changed files with 9157 additions and 1940 deletions

View file

@ -12,7 +12,8 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="CounterStrikeSharp.API" Version="1.0.336" /> <PackageReference Include="CounterStrikeSharp.API" Version="1.0.337" />
<PackageReference Include="CS2TraceRay" Version="1.0.5" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup> </ItemGroup>

View file

@ -2,9 +2,11 @@ using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Admin; using CounterStrikeSharp.API.Modules.Admin;
using CounterStrikeSharp.API.Modules.Commands; using CounterStrikeSharp.API.Modules.Commands;
using CounterStrikeSharp.API.Modules.Entities.Constants;
using CounterStrikeSharp.API.Modules.Memory;
using CounterStrikeSharp.API.Modules.Utils; using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.utils; using jRandomSkills.src.utils;
using System; using System.Runtime.InteropServices;
using static jRandomSkills.jRandomSkills; using static jRandomSkills.jRandomSkills;
namespace jRandomSkills namespace jRandomSkills
@ -20,33 +22,30 @@ namespace jRandomSkills
var commands = new Dictionary<IEnumerable<string>, (string description, CommandInfo.CommandCallback handler)> var commands = new Dictionary<IEnumerable<string>, (string description, CommandInfo.CommandCallback handler)>
{ {
{ SplitCommands(config.Set_Skill), ("Delete record", Command_SetSkill) }, { SplitCommands(config.SetSkillCommands), ("Delete record", Command_SetSkill) },
{ SplitCommands(config.SkillsList_Menu), ("Delete all records", Command_SkillsListMenu) }, { SplitCommands(config.SkillsListCommands), ("Delete all records", Command_SkillsListMenu) },
{ SplitCommands("t, useSkill"), ("Use/Type Skill", Command_UseTypeSkill) } { SplitCommands(config.UseSkillCommands), ("Use/Type skill", Command_UseTypeSkill) },
{ SplitCommands(config.ChangeMapCommands), ("Change map", Command_ChangeMap) },
{ SplitCommands(config.ConsoleCommands), ("Console command", Command_CustomCommand) },
{ SplitCommands(config.StartGameCommands), ("Start game", Command_StartGame) },
{ SplitCommands(config.SwapCommands), ("Swap team", Command_Swap) },
{ SplitCommands(config.ShuffleCommands), ("Shuffle team", Command_Shuffle) },
{ SplitCommands(config.PauseCommands), ("Pause game", Command_Pause) },
{ SplitCommands(config.HealCommands), ("Heal", Command_Heal) },
{ SplitCommands(config.SetScoreCommands), ("Set teams score", Command_SetScore) },
}; };
foreach (var commandPair in commands) foreach (var commandPair in commands)
{
foreach (var command in commandPair.Key) foreach (var command in commandPair.Key)
{
Instance.AddCommand($"css_{command}", commandPair.Value.description, commandPair.Value.handler); Instance.AddCommand($"css_{command}", commandPair.Value.description, commandPair.Value.handler);
} }
}
Instance.AddCommand($"css_map", "", Command_ChangeMap);
Instance.AddCommand($"css_console", "", Command_CustomCommand);
Instance.AddCommand($"css_start", "", Command_StartGame);
Instance.AddCommand($"css_swap", "", Command_Swap);
Instance.AddCommand($"css_shuffle", "", Command_Shuffle);
Instance.AddCommand($"css_pause", "", Command_Pause);
}
private static IEnumerable<string> SplitCommands(string commands) private static IEnumerable<string> SplitCommands(string commands)
{ {
return commands.Split(',').Select(c => c.Trim()); return commands.Split(',').Select(c => c.Trim());
} }
public static void AddCommands(IEnumerable<string> commands, string description, CommandInfo.CommandCallback commandAction) private static void AddCommands(IEnumerable<string> commands, string description, CommandInfo.CommandCallback commandAction)
{ {
foreach (var command in commands) foreach (var command in commands)
{ {
@ -55,7 +54,7 @@ namespace jRandomSkills
} }
[CommandHelper(minArgs: 0, whoCanExecute: CommandUsage.CLIENT_ONLY)] [CommandHelper(minArgs: 0, whoCanExecute: CommandUsage.CLIENT_ONLY)]
public static void Command_UseTypeSkill(CCSPlayerController? player, CommandInfo _) private static void Command_UseTypeSkill(CCSPlayerController? player, CommandInfo _)
{ {
if (player == null) return; if (player == null) return;
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID); var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
@ -65,15 +64,16 @@ namespace jRandomSkills
if (!player.IsValid || !player.PawnIsAlive) return; if (!player.IsValid || !player.PawnIsAlive) return;
string[] commands = _.ArgString.Trim().Split(" ", StringSplitOptions.RemoveEmptyEntries); string[] commands = _.ArgString.Trim().Split(" ", StringSplitOptions.RemoveEmptyEntries);
Debug.WriteToDebug($"Player {player.PlayerName} used the skill: {playerInfo.Skill}");
if (commands == null || commands.Length == 0) if (commands == null || commands.Length == 0)
Instance.SkillAction(playerInfo!.Skill.ToString(), "UseSkill", new object[] { player }); Instance.SkillAction(playerInfo!.Skill.ToString(), "UseSkill", new object[] { player });
else else
Instance.SkillAction(playerInfo!.Skill.ToString(), "TypeSkill", new object[] { player, commands }); Instance.SkillAction(playerInfo!.Skill.ToString(), "TypeSkill", new object[] { player, commands });
} }
[RequiresPermissions("@css/root")] [RequiresPermissions("@jRandmosSkills/admin")]
[CommandHelper(minArgs: 0, whoCanExecute: CommandUsage.CLIENT_ONLY)] [CommandHelper(minArgs: 0, whoCanExecute: CommandUsage.CLIENT_ONLY)]
public static void Command_SetSkill(CCSPlayerController? player, CommandInfo command) private static void Command_SetSkill(CCSPlayerController? player, CommandInfo command)
{ {
if (player == null) return; if (player == null) return;
@ -131,15 +131,15 @@ namespace jRandomSkills
} }
[CommandHelper(minArgs: 0, whoCanExecute: CommandUsage.CLIENT_ONLY)] [CommandHelper(minArgs: 0, whoCanExecute: CommandUsage.CLIENT_ONLY)]
public static void Command_SkillsListMenu(CCSPlayerController? player, CommandInfo command) private static void Command_SkillsListMenu(CCSPlayerController? player, CommandInfo command)
{ {
if (player == null) return; if (player == null) return;
Menu.DisplaySkillsList(player); Menu.DisplaySkillsList(player);
} }
[RequiresPermissions("@css/root")] [RequiresPermissions("@jRandmosSkills/admin")]
[CommandHelper(minArgs: 1, whoCanExecute: CommandUsage.CLIENT_AND_SERVER)] [CommandHelper(minArgs: 1, whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
public static void Command_ChangeMap(CCSPlayerController? player, CommandInfo command) private static void Command_ChangeMap(CCSPlayerController? player, CommandInfo command)
{ {
if (player == null) return; if (player == null) return;
string map = command.GetArg(1); string map = command.GetArg(1);
@ -160,9 +160,9 @@ namespace jRandomSkills
Server.ExecuteCommand($"changelevel {map}"); Server.ExecuteCommand($"changelevel {map}");
} }
[RequiresPermissions("@css/root")] [RequiresPermissions("@jRandmosSkills/admin")]
[CommandHelper(minArgs: 0, whoCanExecute: CommandUsage.CLIENT_AND_SERVER)] [CommandHelper(minArgs: 0, whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
public static void Command_StartGame(CCSPlayerController? player, CommandInfo command) private static void Command_StartGame(CCSPlayerController? player, CommandInfo command)
{ {
if (player == null) return; if (player == null) return;
int cheats = command.GetArg(1) == "sv" ? 1 : 0; int cheats = command.GetArg(1) == "sv" ? 1 : 0;
@ -180,18 +180,18 @@ namespace jRandomSkills
}); });
} }
[RequiresPermissions("@css/root")] [RequiresPermissions("@jRandmosSkills/root")]
[CommandHelper(minArgs: 1, whoCanExecute: CommandUsage.CLIENT_AND_SERVER)] [CommandHelper(minArgs: 1, whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
public static void Command_CustomCommand(CCSPlayerController? player, CommandInfo command) private static void Command_CustomCommand(CCSPlayerController? player, CommandInfo command)
{ {
if (player == null) return; if (player == null) return;
string param = command.GetArg(1); string param = command.GetArg(1);
Server.ExecuteCommand(param); Server.ExecuteCommand(param);
} }
[RequiresPermissions("@css/root")] [RequiresPermissions("@jRandmosSkills/admin")]
[CommandHelper(minArgs: 0, whoCanExecute: CommandUsage.CLIENT_AND_SERVER)] [CommandHelper(minArgs: 0, whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
public static void Command_Swap(CCSPlayerController? _player, CommandInfo command) private static void Command_Swap(CCSPlayerController? _player, CommandInfo command)
{ {
foreach (var player in Utilities.GetPlayers()) foreach (var player in Utilities.GetPlayers())
if (Instance.IsPlayerValid(player) && new CsTeam[] { CsTeam.CounterTerrorist, CsTeam.Terrorist }.Contains(player.Team)) if (Instance.IsPlayerValid(player) && new CsTeam[] { CsTeam.CounterTerrorist, CsTeam.Terrorist }.Contains(player.Team))
@ -199,9 +199,9 @@ namespace jRandomSkills
Server.ExecuteCommand($"mp_restartgame 1"); Server.ExecuteCommand($"mp_restartgame 1");
} }
[RequiresPermissions("@css/root")] [RequiresPermissions("@jRandmosSkills/admin")]
[CommandHelper(minArgs: 0, whoCanExecute: CommandUsage.CLIENT_AND_SERVER)] [CommandHelper(minArgs: 0, whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
public static void Command_Shuffle(CCSPlayerController? _player, CommandInfo command) private static void Command_Shuffle(CCSPlayerController? _player, CommandInfo command)
{ {
var players = Utilities.GetPlayers().FindAll(p => (Instance.IsPlayerValid(p) && new CsTeam[] { CsTeam.CounterTerrorist, CsTeam.Terrorist }.Contains(p.Team))); var players = Utilities.GetPlayers().FindAll(p => (Instance.IsPlayerValid(p) && new CsTeam[] { CsTeam.CounterTerrorist, CsTeam.Terrorist }.Contains(p.Team)));
double CTlimit = Instance.Random.Next(0, 2) == 0 ? Math.Floor(players.Count / 2.0) : Math.Ceiling(players.Count / 2.0); double CTlimit = Instance.Random.Next(0, 2) == 0 ? Math.Floor(players.Count / 2.0) : Math.Ceiling(players.Count / 2.0);
@ -214,13 +214,34 @@ namespace jRandomSkills
Server.ExecuteCommand($"mp_restartgame 1"); Server.ExecuteCommand($"mp_restartgame 1");
} }
[RequiresPermissions("@css/root")] [RequiresPermissions("@jRandmosSkills/admin")]
[CommandHelper(minArgs: 0, whoCanExecute: CommandUsage.CLIENT_AND_SERVER)] [CommandHelper(minArgs: 0, whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
public static void Command_Pause(CCSPlayerController? player, CommandInfo command) private static void Command_Pause(CCSPlayerController? player, CommandInfo command)
{ {
Server.PrintToChatAll($" {(gamePaused ? ChatColors.Green : ChatColors.Red)}{Localization.GetTranslation(gamePaused ? "unpause" : "pause")}"); Server.PrintToChatAll($" {(gamePaused ? ChatColors.Green : ChatColors.Red)}{Localization.GetTranslation(gamePaused ? "unpause" : "pause")}");
Server.ExecuteCommand( gamePaused ? "mp_unpause_match" : "mp_pause_match"); Server.ExecuteCommand( gamePaused ? "mp_unpause_match" : "mp_pause_match");
gamePaused = !gamePaused; gamePaused = !gamePaused;
} }
[RequiresPermissions("@jRandmosSkills/root")]
[CommandHelper(minArgs: 0, whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
private static void Command_Heal(CCSPlayerController? player, CommandInfo command)
{
SkillUtils.AddHealth(player.PlayerPawn.Value, 100);
player.PrintToChat($" {ChatColors.Green}{Localization.GetTranslation("healed")}");
}
[RequiresPermissions("@jRandmosSkills/root")]
[CommandHelper(minArgs: 2, whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
private static void Command_SetScore(CCSPlayerController? player, CommandInfo command)
{
if (!int.TryParse(command.GetArg(1), out int ctScore) || !int.TryParse(command.GetArg(2), out int tScore))
{
SkillUtils.PrintToChat(player, Localization.GetTranslation("correct_form_setscore"), true);
return;
}
SkillUtils.SetTeamScores((short)ctScore, (short)tScore, RoundEndReason.RoundDraw);
}
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

View file

@ -12,13 +12,14 @@ namespace jRandomSkills
{ {
public static jRandomSkills Instance { get; private set; } public static jRandomSkills Instance { get; private set; }
public List<dSkill_PlayerInfo> skillPlayer { get; } = new List<dSkill_PlayerInfo>(); public List<jSkill_PlayerInfo> skillPlayer { get; } = new List<jSkill_PlayerInfo>();
public Random Random { get; } = new Random(); public Random Random { get; } = new Random();
public CCSGameRules GameRules { get; set; }
public override string ModuleName => "[CS2] [ jRandomSkills ]"; public override string ModuleName => "[CS2] [ jRandomSkills ]";
public override string ModuleAuthor => "D3X, Juzlus"; public override string ModuleAuthor => "D3X, Juzlus";
public override string ModuleDescription => "Plugin adds random skills every round for CS2 by D3X. Modified by Juzlus."; public override string ModuleDescription => "Plugin adds random skills every round for CS2 by D3X. Modified by Juzlus.";
public override string ModuleVersion => "1.0.4"; public override string ModuleVersion => "1.1.0";
public override void Load(bool hotReload) public override void Load(bool hotReload)
{ {
@ -26,25 +27,23 @@ namespace jRandomSkills
Config.Initialize(); Config.Initialize();
Localization.Load(); Localization.Load();
// Debug.Load(); Debug.Load();
Event.Load(); Event.Load();
PlayerOnTick.Load(); PlayerOnTick.Load();
Command.Load(); Command.Load();
LoadAllSkills();
}
internal void LoadAllSkills()
None.LoadSkill(); {
// -> Mute.LoadSkill();;
// -> ToxicSmoke.LoadSkill();
// Shade.LoadSkill();
// FrozenDecoy.LoadSkill();
// Medic.LoadSkill();
return;
foreach (var skill in Enum.GetValues(typeof(Skills))) foreach (var skill in Enum.GetValues(typeof(Skills)))
SkillAction(skill.ToString(), "LoadSkill"); if (Config.GetValue<bool>(skill, "active"))
SkillAction(skill.ToString()!, "LoadSkill");
Debug.WriteToDebug($"jRandomSkills v{Instance.ModuleVersion} ({SkillData.Skills.Count - 1}/{Config.config.SkillsInfo.Length - 1} Skills) loaded!");
Debug.WriteToDebug($"GameModes: {(Config.GameModes)Config.config.Settings.GameMode}, Lang: {Config.config.Settings.LangCode}");
foreach (var skill in SkillData.Skills)
Debug.WriteToDebug($"Loaded: {skill.Skill}");
} }
internal void SkillAction(string skill, string methodName, object[] param = null) internal void SkillAction(string skill, string methodName, object[] param = null)
@ -83,11 +82,11 @@ namespace jRandomSkills
return player != null && player.IsValid && player.PlayerPawn?.Value != null && player.PlayerPawn.Value.LifeState == (byte)LifeState_t.LIFE_ALIVE; return player != null && player.IsValid && player.PlayerPawn?.Value != null && player.PlayerPawn.Value.LifeState == (byte)LifeState_t.LIFE_ALIVE;
} }
public uint[] footstepSoundEvents = { 2026488395, 2745524735, 2684452812, 2265091453, 1269567645, 520432428, 3266483468, 1346129716, 2061955732, 2240518199, 2829617974, 1194677450, 1803111098, 3749333696, 29217150, 1692050905, 2207486967, 2633527058, 3342414459, 988265811, 540697918, 1763490157, 3755338324, 3161194970, 3753692454, 3166948458, 3997353267, 3161194970, 3753692454, 3166948458, 3997353267, 809738584, 3368720745, 3295206520, 3184465677, 123085364, 3123711576, 737696412, 1403457606, 1770765328, 892882552, 3023174225, 4163677892, 3952104171, 4082928848, 1019414932, 1485322532, 1161855519, 1557420499, 1163426340, 809738584, 3368720745, 2708661994, 2479376962, 3295206520, 1404198078, 1194093029, 1253503839, 2189706910, 1218015996, 96240187, 1116700262, 84876002, 1598540856, 2231399653 }; public uint[] footstepSoundEvents = { 3109879199, 70939233, 1342713723, 2722081556, 1909915699, 3193435079, 2300993891, 3847761506, 4084367249, 1342713723, 3847761506, 2026488395, 2745524735, 2684452812, 2265091453, 1269567645, 520432428, 3266483468, 1346129716, 2061955732, 2240518199, 2829617974, 1194677450, 1803111098, 3749333696, 29217150, 1692050905, 2207486967, 2633527058, 3342414459, 988265811, 540697918, 1763490157, 3755338324, 3161194970, 3753692454, 3166948458, 3997353267, 3161194970, 3753692454, 3166948458, 3997353267, 809738584, 3368720745, 3295206520, 3184465677, 123085364, 3123711576, 737696412, 1403457606, 1770765328, 892882552, 3023174225, 4163677892, 3952104171, 4082928848, 1019414932, 1485322532, 1161855519, 1557420499, 1163426340, 809738584, 3368720745, 2708661994, 2479376962, 3295206520, 1404198078, 1194093029, 1253503839, 2189706910, 1218015996, 96240187, 1116700262, 84876002, 1598540856, 2231399653 };
public uint[] silentSoundEvents = { 117596568, 117596568, 740474905, 1661204257, 3009312615, 1506215040, 115843229, 3299941720, 1016523349, 2684452812, 2067683805, 2067683805, 1016523349, 4160462271, 1543118744, 585390608, 3802757032, 2302139631, 2546391140, 144629619, 4152012084, 4113422219, 1627020521, 2899365092, 819435812, 3218103073, 961838155, 1535891875, 1826799645, 3460445620, 1818046345, 3666896632, 3099536373, 1440734007, 1409986305, 1939055066, 782454593, 4074593561, 1540837791, 3257325156 }; public uint[] silentSoundEvents = { 2551626319, 765706800, 765706800, 2860219006, 2162652424, 2551626319, 2162652424, 117596568, 117596568, 740474905, 1661204257, 3009312615, 1506215040, 115843229, 3299941720, 1016523349, 2684452812, 2067683805, 2067683805, 1016523349, 4160462271, 1543118744, 585390608, 3802757032, 2302139631, 2546391140, 144629619, 4152012084, 4113422219, 1627020521, 2899365092, 819435812, 3218103073, 961838155, 1535891875, 1826799645, 3460445620, 1818046345, 3666896632, 3099536373, 1440734007, 1409986305, 1939055066, 782454593, 4074593561, 1540837791, 3257325156 };
} }
public class dSkill_PlayerInfo public class jSkill_PlayerInfo
{ {
public required ulong SteamID { get; set; } public required ulong SteamID { get; set; }
public required string PlayerName { get; set; } public required string PlayerName { get; set; }
@ -97,7 +96,7 @@ namespace jRandomSkills
public bool IsDrawing { get; set; } public bool IsDrawing { get; set; }
} }
public class dSkill_SkillInfo public class jSkill_SkillInfo
{ {
public Skills Skill { get; } public Skills Skill { get; }
public string Name { get; } public string Name { get; }
@ -106,7 +105,7 @@ namespace jRandomSkills
public bool Display { get; } public bool Display { get; }
public dSkill_SkillInfo(Skills skill, string color, bool display) public jSkill_SkillInfo(Skills skill, string color, bool display)
{ {
Skill = skill; Skill = skill;
Name = Localization.GetTranslation(skill.ToString().ToLower()); Name = Localization.GetTranslation(skill.ToString().ToLower());
@ -114,10 +113,15 @@ namespace jRandomSkills
Color = color; Color = color;
Display = display; Display = display;
} }
public static implicit operator Skills(jSkill_SkillInfo v)
{
throw new NotImplementedException();
}
} }
public static class SkillData public static class SkillData
{ {
public static List<dSkill_SkillInfo> Skills { get; } = new List<dSkill_SkillInfo>(); public static List<jSkill_SkillInfo> Skills { get; } = new List<jSkill_SkillInfo>();
} }
} }

View file

@ -1,127 +1,410 @@
{ {
"none_desc": "You have no skills", "none": "None",
"none_desc": "You have no skill",
"aimbot": "Aimbot",
"aimbot_desc": "Every bullet you hit counts as a headshot", "aimbot_desc": "Every bullet you hit counts as a headshot",
"antyflash_desc": "You are immune to flashes, and your flashes last 7 seconds",
"astronaut_desc": "You receive a random gravity value at the start of the round", "anomaly": "Anomaly",
"astronaut_desc2": "Your random gravity is: {0}x", "anomaly_desc": "You rewind a few seconds back in time",
"richboy_desc": "You receive a random amount of money at the start of the round",
"bunnyhop_desc": "You get auto \"BunnyHop\"", "antyflash": "Anti-Flash",
"silent_desc": "Your footsteps and jumps are silent to OTHER players", "antyflash_desc": "You are immune to flashbangs, and your flashbangs last 7 seconds",
"shade_desc": "You teleport behind the back of a hit enemy",
"dracula_desc": "Hitting an enemy restores a percentage of the damage dealt as health", "antyhead": "Iron Head",
"ghost_desc": "You are completely invisible", "antyhead_desc": "You take no damage from headshots",
"flash_desc": "Random player speed at the beginning of the round",
"flash_desc2": "Your speed multiplier is {0}x", "areareaper": "Zone Reaper",
"godmode_desc": "You are immortal for 2 seconds. Press [css_useSkill], cooldown 30s", "areareaper_desc": "You can choose a bomb site to deactivate",
"godmode_on": "Immortality enabled", "areareaper_incorrect_site": "No such bomb site found.",
"godmode_off": "Immortality disabled", "areareaper_no_site": "No bomb sites found.",
"areareaper_select_info": "Choose the bomb site you want to deactivate:",
"areareaper_site_disabled": "Bomb site {0} has been deactivated - no bombs can be planted there!",
"areareaper_used_info": "Your skill has already been used.",
"armored": "Armored",
"armored_desc": "You have a random damage taken multiplier", "armored_desc": "You have a random damage taken multiplier",
"armored_desc2": "Your damage taken multiplier is: {0}x", "armored_desc2": "Your damage taken multiplier is: {0}x",
"muhammed_desc": "You explode upon death, killing nearby players",
"dwarf_desc": "Random character size at the start of the round", "assassin": "Assassin",
"dwarf_desc2": "Your size multiplier is {0}x", "assassin_desc": "You deal increased damage to enemies from behind",
"medic_desc": "You receive a random number of medkits at the start of the round",
"randomweapon_desc": "You get a random weapon. Press [css_useSkill], cooldown 15s", "astronaut": "Astronaut",
"chicken_desc": "You get a chicken model + 10% faster movement - 50 HP", "astronaut_desc": "You receive a random gravity value at the start of the round",
"impostor_desc": "You start the round with an enemy player model", "astronaut_desc2": "Your random gravity is: {0}x",
"baseball": "Baseball Player",
"baseball_desc": "Your decoy bounces off walls and instantly kills an enemy on impact",
"behind": "Enemy Spin",
"behind_desc": "You have a random chance to turn an enemy 180 degrees when hitting them",
"behind_desc2": "Your chance to turn an enemy on hit is: {0}%",
"blademaster": "Blademaster",
"blademaster_desc": "While holding a knife, you have a high chance to deflect a shot",
"bunnyhop": "Bunny",
"bunnyhop_desc": "You get auto \"BunnyHop\"",
"c4camouflage": "C4 Camouflage",
"c4camouflage_desc": "You are invisible while holding the bomb",
"catapult": "Catapult",
"catapult_desc": "You have a random chance to launch an enemy upwards", "catapult_desc": "You have a random chance to launch an enemy upwards",
"catapult_desc2": "Your chance to launch an enemy on hit is: {0}%", "catapult_desc2": "Your chance to launch an enemy on hit is: {0}%",
"chicken": "Chicken",
"chicken_desc": "You get a chicken model + 10% faster movement - 50 HP",
"chillout": "Chillout",
"chillout_desc": "Planting the bomb takes significantly longer",
"cutter": "Cutter",
"cutter_desc": "Instant kill with a knife",
"darkness": "Darkness",
"darkness_desc": "Applies a darkness effect to a chosen enemy",
"darkness_enemy_info": "Let the lights go out.",
"darkness_player_info": "Darkness has overtaken player '{0}'.",
"darkness_select_info": "Choose the player you want to apply the darkness effect to:",
"deactivator": "Deactivator",
"deactivator_desc": "Choose a player whose skill you want to disable",
"deactivator_enemy_info": "Your skill has been disabled.",
"deactivator_player_info": "Player '{0}'s skill has been disabled.",
"deactivator_select_info": "Choose the player whose skill you want to disable:",
"deaf": "Deaf",
"deaf_desc": "Choose a player to mute all sounds for",
"deaf_enemy_info": "Your headphones have left the game.",
"deaf_player_info": "Sound has been disabled for player '{0}'.",
"deaf_select_info": "Choose the player for whom you want to mute all sounds:",
"disarmament": "Disarmament",
"disarmament_desc": "You have a random chance to make an enemy drop their weapon on hit",
"disarmament_desc2": "Your chance to disarm an enemy is: {0}%",
"distancer": "Rangefinder",
"distancer_desc": "You can see the distance to the nearest enemy",
"dracula": "Dracula",
"dracula_desc": "Hitting an enemy restores health equal to a percentage of the damage dealt",
"duplicator": "Duplicator",
"duplicator_desc": "Choose a player to copy their skill",
"duplicator_player_info": "Player '{0}'s skill has been copied.",
"duplicator_select_info": "Choose the player whose skill you want to copy:",
"dwarf": "Dwarf",
"dwarf_desc": "Random character size at the start of the round",
"dwarf_desc2": "Your size multiplier is: {0}x",
"enemyspawn": "Enemy Spawn",
"enemyspawn_desc": "Click [css_useSkill] to teleport to the enemy spawn",
"explosiveshot": "Explosive Shot",
"explosiveshot_desc": "Random chance to fire an explosive bullet while shooting",
"explosiveshot_desc2": "Your chance to fire an explosive bullet: {0}%",
"falconeye": "Falcon Eye",
"falconeye_desc": "Click [css_useSkill] to activate a bird's-eye view camera",
"fastreload": "Fastreload",
"fastreload_desc": "Click [css_useSkill] to reload the weapon you are currently holding",
"flash": "Flash",
"flash_desc": "Random player speed at the beginning of the round",
"flash_desc2": "Your speed multiplier is: {0}x",
"fortnite": "Fortnite",
"fortnite_desc": "Click [css_useSkill] to create a destructible barricade",
"fragilebomb": "Fragile Bomb",
"fragilebomb_desc": "Shooting the bomb damages it",
"fragilebomb_bomb_health": "Bomb health",
"friendlyfire": "Friendly Fire",
"friendlyfire_desc": "Shooting teammates heals them",
"frozendecoy": "Freezing Decoy",
"frozendecoy_desc": "Your decoy freezes all nearby players",
"ghost": "Ghost",
"ghost_desc": "You are completely invisible",
"glaz": "Glaz",
"glaz_desc": "You can see through smoke grenades",
"glitch": "Glitch",
"glitch_desc": "Disables the radar for a chosen enemy",
"glitch_enemy_info": "Your radar has been disabled.",
"glitch_player_info": "Player '{0}'s radar has been disabled.",
"glitch_select_info": "Choose the player whose radar you want to disable:",
"glue": "Glue",
"glue_desc": "Your grenades stick to walls",
"godmode": "God Mode",
"godmode_desc": "Click [css_useSkill] to become immortal for a short time",
"godmode_off": "Immortality disabled",
"godmode_on": "Immortality enabled",
"healingsmoke": "Healing Smoke",
"healingsmoke_desc": "Your smoke grenades heal",
"hermit": "Hermit",
"hermit_desc": "Killing restores ammo and a portion of health",
"holyhandgrenade": "Holy Hand Grenade",
"holyhandgrenade_desc": "Your HE grenades deal double damage and have double range",
"impostor": "Impostor",
"impostor_desc": "You start the round with an enemy player model",
"infiniteammo": "Infinite Ammo",
"infiniteammo_desc": "You receive infinite ammo for all your weapons", "infiniteammo_desc": "You receive infinite ammo for all your weapons",
"behind_desc": "You have a random chance to turn an enemy 180 degrees on hit",
"behind_desc2": "Your chance to turn an enemy on hit is: {0}%", "jackal": "Tracker",
"retreat_desc": "Return to spawn. Press [css_useSkill], cooldown 15s", "jackal_desc": "Choose a player who will leave a trail behind them",
"jackal_player_info": "Player '{0}' will start leaving a trail.",
"jackal_select_info": "Choose the player who will leave a trail:",
"jammer": "Jammer",
"jammer_desc": "Choose a player to disable their crosshair",
"jammer_enemy_info": "Your crosshair has been disabled.",
"jammer_player_info": "Player '{0}'s crosshair has been disabled.",
"jammer_select_info": "Choose the player whose crosshair you want to disable:",
"jumpban": "Legless",
"jumpban_desc": "Choose a player who cannot jump",
"jumpban_enemy_info": "Someone cut off your legs.",
"jumpban_player_info": "Player '{0}' can no longer jump.",
"jumpban_select_info": "Choose the player who cannot jump:",
"jumpingjack": "Jumping Jack",
"jumpingjack_desc": "Jumping restores health",
"killerflash": "Killer Flash",
"killerflash_desc": "Anyone fully blinded by your flashbang dies (including you)",
"lifeswap": "Life Swap",
"lifeswap_desc": "Choose a player to swap health with",
"lifeswap_enemy_info": "Someone borrowed your health.",
"lifeswap_player_info": "You swapped health with player '{0}'.",
"lifeswap_select_info": "Choose the player to swap health with:",
"longknife": "Long Knife",
"longknife_desc": "A primary knife attack deals damage regardless of distance",
"longzeus": "Long Zeus",
"longzeus_desc": "Zeus deals damage regardless of distance",
"medic": "Medic",
"medic_desc": "Click [css_useSkill] to use a healing charge that restores 50 health",
"moneyswap": "Taxman",
"moneyswap_desc": "Choose a player to swap money with",
"moneyswap_enemy_info": "The tax office got you.",
"moneyswap_player_info": "You swapped money with player '{0}'.",
"moneyswap_select_info": "Choose the player to swap money with:",
"muhammed": "Muhammed",
"muhammed_desc": "You explode upon death, killing nearby players",
"ninja": "Ninja",
"ninja_desc": "Standing still increases your invisibility by 33%, crouching by 33%, and holding a knife by 33%",
"nonades": "No-Nades",
"nonades_desc": "Grenades deal no damage to you",
"norecoil": "Focus",
"norecoil_desc": "No recoil while shooting",
"noclip": "NoClip",
"noclip_desc": "Click [css_useSkill] to enable noclip for a short time",
"oneshot": "One-Shot",
"oneshot_desc": "Hitting an enemy instantly kills them", "oneshot_desc": "Hitting an enemy instantly kills them",
"onlyhead": "Head Only",
"onlyhead_desc": "You only take damage to the head",
"paweljumper": "Pawel Jumper",
"paweljumper_desc": "You get an extra jump", "paweljumper_desc": "You get an extra jump",
"phoenix": "Phoenix",
"phoenix_desc": "You have a random chance to respawn after death", "phoenix_desc": "You have a random chance to respawn after death",
"phoenix_desc2": "Your chance to respawn after death: {0}%", "phoenix_desc2": "Your chance to respawn after death: {0}%",
"phoenix_respawn": "You have been resurrected from the ashes thanks to the power of: CHATCOLORS.REDPhoenix", "phoenix_respawn": "You have been resurrected from the ashes thanks to the power of: CHATCOLORS.REDPhoenix",
"psychicdefusing": "Psychic Defusing",
"psychicdefusing_desc": "When you are near the bomb, you start defusing it",
"psychicdefusing_hud_info": "{0} seconds remaining to defuse",
"pilot": "Pilot",
"pilot_desc": "Fly for a limited time. Hold [USE - E] to fly", "pilot_desc": "Fly for a limited time. Hold [USE - E] to fly",
"pilot_hud_info": "Recharging", "pilot_hud_info": "Recharging",
"radarhack_desc": "You can see enemies on the radar",
"planter": "Free Planter",
"planter_desc": "You can plant the bomb anywhere, with a detonation time of 60 seconds.",
"poison": "Poison",
"poison_desc": "Choose a player who will take damage every few seconds",
"poison_enemy_info": "You have been poisoned.",
"poison_player_info": "Player '{0}' has been poisoned.",
"poison_select_info": "Choose the player who will take damage every few seconds:",
"primaryban": "No Rifles",
"primaryban_desc": "Choose a player who cannot use rifles",
"primaryban_enemy_info": "You can no longer use rifles.",
"primaryban_player_info": "Player '{0}' can no longer use rifles.",
"primaryban_select_info": "Choose the player to ban from using rifles:",
"prosthesis": "Prosthesis",
"prosthesis_desc": "Arms and legs are bulletproof",
"push": "Pusher",
"push_desc": "You have a random chance to push an enemy back when hitting them",
"push_desc2": "Your chances of pushing back the enemy are: {0}%",
"pyro": "Pyro",
"pyro_desc": "Molotov restores health",
"quickshot": "Rapid Fire",
"quickshot_desc": "All bullets are fired very quickly",
"radarhack": "Radar Hack",
"radarhack_desc": "Enemies are visible on the radar",
"rambo": "Rambo",
"rambo_desc": "You receive a random amount of health at the start of the round", "rambo_desc": "You receive a random amount of health at the start of the round",
"enemyspawn_desc": "Teleport to enemy spawn. Press [css_useSkill], cooldown 15s",
"disarmament_desc": "You have a random chance to make an enemy drop their weapon on hit", "randomweapon": "Random Weapon",
"disarmament_desc2": "Your chance to disarm an enemy is: {0}%", "randomweapon_desc": "Click [css_useSkill] to receive a random weapon",
"planter_desc": "You can plant the bomb anywhere; bomb detonation time is 60s",
"rezombie": "Re-Zombie",
"rezombie_desc": "After death, you respawn as a zombie with increased health and no weapons",
"reactivearmor": "Reactive Armor",
"reactivearmor_desc": "Armor absorbs the first damage taken",
"regeneration": "Regeneration",
"regeneration_desc": "You restore health every few seconds",
"replicator": "Replicator",
"replicator_desc": "Click [css_useSkill] to create a replica that deals damage on hit",
"retreat": "Retreat",
"retreat_desc": "Click [css_useSkill] to return to spawn",
"returntosender": "Return to Sender",
"returntosender_desc": "The first hit on an enemy sends them back to their spawn",
"richboy": "Rich Boy",
"richboy_desc": "You receive a random amount of money at the start of the round",
"robinhood": "Robin Hood",
"robinhood_desc": "Dealing damage to an enemy steals their money",
"rubber": "Rubber Bullets",
"rubber_desc": "Your bullets significantly slow down players",
"saper": "Sapper",
"saper_desc": "You can plant and defuse bombs faster", "saper_desc": "You can plant and defuse bombs faster",
"timemanipulator_desc": "Slows down time for everyone for 6 seconds. Press [css_useSkill], cooldown 30s",
"quickshot_desc": "No cooldown when shooting", "secondlife": "Second Chance",
"teleporter_desc": "You swap places with the hit enemy", "secondlife_desc": "After death, you respawn with the same amount of health",
"wallhack_desc": "You can see enemies through walls",
"killerflash_desc": "Every enemy fully blinded by your flashbang dies (including you)", "shade": "Shade",
"weaponsswap_desc": "Swap weapons with a random enemy. Press [css_useSkill], cooldown 30s", "shade_desc": "You teleport behind the back of a hit enemy",
"weaponsswap_hud_info2": "You have no weapon to swap", "shade_nospace": "No space available",
"hud_info_no_enemy": "No enemy found",
"zeus_desc": "Zeus x27 instantly recharges", "shortbomb": "Short Fuse",
"frozendecoy_desc": "Your decoy grenade freezes all nearby players", "shortbomb_desc": "The bomb explodes much faster",
"antyhead_desc": "You receive no headshot damage",
"silent": "Silent",
"silent_desc": "Your footsteps and jumps are silent to OTHER players",
"sniperelite": "Sniper Elite",
"sniperelite_desc": "Click [css_useSkill] to swap your current weapon for an AWP",
"soldier": "Soldier",
"soldier_desc": "You have a random damage multiplier", "soldier_desc": "You have a random damage multiplier",
"soldier_desc2": "Your damage multiplier is: {0}x", "soldier_desc2": "Your damage multiplier is: {0}x",
"swapposition_desc": "Swap places with a random enemy. Press [css_useSkill], cooldown 30s",
"welcome_message": "Welcome {PLAYER} to {SERVER_NAME}!\nCurrent jRandomSkills version: {VERSION} ({SKILLS_COUNT} skills).\n\nOriginally created by:\n{AUTHOR1}\nModified and improved by:\n{AUTHOR2}", "soundmaker": "Soundmaker",
"hud_info": "Wait {0} seconds", "soundmaker_desc": "Click [css_useSkill] to trigger a sound for every enemy",
"no_player": "No player found.",
"duplicate_player": "More than one player found with the same name.", "spectator": "Spectator",
"drawing_skill": "Drawing a skill", "spectator_desc": "Click [css_useSkill] to spectate a random enemy",
"swapposition": "Position Swap",
"swapposition_desc": "Click [css_useSkill] to swap places with a random enemy",
"teleporter": "Teleporter",
"teleporter_desc": "You swap places with the hit enemy",
"thief": "Thief",
"thief_desc": "You can steal a skill from a chosen player",
"thief_enemy_info": "Your skill has been stolen.",
"thief_player_info": "Player '{0}'s skill has been stolen.",
"thief_select_info": "Choose the player whose skill you want to steal:",
"thirdeye": "Third Eye",
"thirdeye_desc": "Click [css_useSkill] to activate third-person view",
"toxicsmoke": "Toxic Smoke",
"toxicsmoke_desc": "Your smoke grenades deal damage",
"wallhack": "Wallhack",
"wallhack_desc": "You can see enemies through walls",
"watchmaker": "Watchmaker",
"watchmaker_desc": "Every grenade throw alters the round time",
"watchmaker_ct": "Round time shortened by {0} seconds.",
"watchmaker_tt": "Round time extended by {0} seconds.",
"weaponsswap": "Weapon Swap",
"weaponsswap_desc": "Click [css_useSkill] to swap weapons with a random enemy",
"weaponsswap_hud_info2": "You have no weapon to swap",
"zeus": "Zeus",
"zeus_desc": "Zeus x27 instantly recharges",
"your_skill": "Your current skill", "your_skill": "Your current skill",
"summary_start": "======SUMMARY=OF=THE=LAST=ROUND======",
"summary_end": "=======================================",
"enemy_skill": "Enemy's skill", "enemy_skill": "Enemy's skill",
"teammate_skills": "Your teammates' skills", "observer_skill": "Player's skill",
"observer_skill": "Player's power", "welcome_message": "Welcome {PLAYER} to {SERVER_NAME}!\nCurrent jRandomSkills version: {VERSION} ({SKILLS_COUNT} skills).\n\nOriginally created by:\n{AUTHOR1}\nModified and improved by:\n{AUTHOR2}\nOfficial Discord: https://discord.gg/72nzFguNtd",
"game_start": "Game started!", "drawing_skill": "Drawing a skill",
"invalid_map": "Invalid map name!", "disabled_weapon": "You cannot use this weapon",
"loading_map": "Loading a new map",
"skills_menu": "Skill List", "hud_info": "Wait another {0} seconds",
"hud_info_no_enemy": "No enemy found",
"active_hud_info": "Active for another {0} milliseconds",
"skills_menu": "skill List",
"no_player": "No matching player found.",
"duplicate_player": "More than one player found with the same name.",
"selectplayerskill_command": "Type /t",
"selectplayerskill_incorrect_enemy_index": "No player found with that index.",
"skill_not_found_setskill": "No such CHATCOLORS.REDskill found",
"player_not_found_setskill": "No such CHATCOLORS.REDplayer found",
"correct_form_setskill": "Correct usage: CHATCOLORS.RED!setskill <nickname> <skill>", "correct_form_setskill": "Correct usage: CHATCOLORS.RED!setskill <nickname> <skill>",
"skill_not_found_setskill": "Skill CHATCOLORS.REDnot found", "correct_form_setskill": "Correct usage: CHATCOLORS.RED!setscore <CT> <TT>",
"done_setskill": "skill set",
"error_setskill": "Failed to set CHATCOLORS.REDskill", "error_setskill": "Failed to set CHATCOLORS.REDskill",
"done_setskill": "Skill set",
"for_setskill": "for", "for_setskill": "for",
"none": "None", "invalid_map": "Map name entered incorrectly!",
"dwarf": "Dwarf", "loading_map": "Loading a new map",
"swapposition": "Swapper",
"killerflash": "Deadly Flash", "pause": "Match has been paused.",
"soldier": "Soldier", "unpause": "Match has been resumed.",
"armored": "Tank", "healed": "You have been healed.",
"aimbot": "Aimbot", "game_start": "Game started!",
"retreat": "Retreat",
"enemyspawn": "Enemy Spawn", "teammate_skills": "Your teammates' skills",
"zeus": "Zeus", "summary_start": "======SUMMARY=OF=THE=LAST=ROUND======",
"radarhack": "Radar Hack", "summary_end": "======================================="
"quickshot": "Quick-Shot",
"planter": "Planter",
"silent": "Silent",
"frozendecoy": "Freezing Decoy",
"timemanipulator": "Time Slow",
"godmode": "God Mode",
"randomweapon": "Random Weapon",
"weaponsswap": "Weapon Swap",
"wallhack": "Wallhack",
"flash": "Flash",
"paweljumper": "Paweł Jumper",
"bunnyhop": "Bunnyhop",
"impostor": "Spy",
"oneshot": "One-Shot",
"muhammed": "Muhammed",
"richboy": "Rich Boy",
"rambo": "Rambo",
"medic": "Medic",
"ghost": "Ghost",
"chicken": "Chicken",
"astronaut": "Astronaut",
"disarmament": "Disarmament",
"antyflash": "Anti-Flash",
"behind": "Enemy Rotation",
"infiniteammo": "Infinite Ammo",
"catapult": "Catapult",
"dracula": "Dracula",
"teleporter": "Teleporter",
"saper": "Sapper",
"phoenix": "Phoenix",
"pilot": "Pilot",
"shade": "Shade",
"antyhead": "Anty Head"
} }

View file

@ -3,215 +3,408 @@
"none_desc": "Nie posiadasz żadnej supermocy", "none_desc": "Nie posiadasz żadnej supermocy",
"aimbot": "Aimbot", "aimbot": "Aimbot",
"aimbot_desc": "Każdy twój trafiony pocisk jest liczony jako głowa", "aimbot_desc": "Każdy twój trafiony pocisk liczy się jako strzał w głowę",
"anomaly": "Anomalia",
"anomaly_desc": "Cofasz się o kilka sekund do tyłu",
"antyflash": "Anty Flash", "antyflash": "Anty Flash",
"antyflash_desc": "Posiadasz odporność na flashe i 7 sekund trwają twoje flash'e", "antyflash_desc": "Posiadasz odporność na flash'e, a twoje flash'e trwają 7 sekund",
"astronaut": "Astronauta", "antyhead": "Żelazna Głowa",
"astronaut_desc": "Otrzymujesz losową ilość grawitacji na start rundy", "antyhead_desc": "Nie otrzymujesz obrażeń w głowę",
"astronaut_desc2": "Twoja losowa grawitacja wynosi: {0}x",
"richboy": "Bogacz", "areareaper": "Niszczyciel Stref",
"richboy_desc": "Otrzymujesz losową ilość kasy na start rundy", "areareaper_desc": "Możesz wybrać strefę detonacji, którą chcesz dezaktywować",
"areareaper_incorrect_site": "Nie znaleziono takiej strefy detonacji.",
"bunnyhop": "Królik", "areareaper_no_site": "Nie znaleziono żadnej strefy detonacji.",
"bunnyhop_desc": "Otrzymujesz auto \"BunnyHopa\"", "areareaper_select_info": "Wybierz strefę detonacji, którą chcesz dezaktywować:",
"areareaper_site_disabled": "Strefa detonacji {0} została dezaktywowana - nie można na niej podłożyć bomby!",
"silent": "Cichociemny", "areareaper_used_info": "Twoja moc została już wykorzystana.",
"silent_desc": "Twoje kroki i skoki są niesłyszalne dla INNYCH graczy",
"shade": "Cień",
"shade_desc": "Teleportujesz się za plecy trafionego wroga",
"dracula": "Drakula",
"dracula_desc": "Po trafieniu ofiary otrzymujesz zwrot zdrowia w postaci danego procentu zadanych obrażeń",
"ghost": "Duszek",
"ghost_desc": "Jesteś całkowicie niewidzialny",
"flash": "Flash",
"flash_desc": "Losowa prędkośc postaci na początku rundy",
"flash_desc2": "Twój mnożnik prędkości to {0}x",
"godmode": "Nieśmiertelność",
"godmode_desc": "Jesteś nieśmiertelny przez 2 sekundy. Kliknij [css_useSkill], cooldown 30s",
"godmode_on": "Nieśmiertelność włączona",
"godmode_off": "Nieśmiertelność wyłączona",
"armored": "Gruby", "armored": "Gruby",
"armored_desc": "Masz losowy mnożnik otrzymywanych obrażeń", "armored_desc": "Masz losowy mnożnik otrzymywanych obrażeń",
"armored_desc2": "Twój mnożnik otrzymywanych obrażeń wynosi: {0}x", "armored_desc2": "Twój mnożnik otrzymywanych obrażeń wynosi: {0}x",
"muhammed": "Muhammed", "assassin": "Skrytobójca",
"muhammed_desc": "Po śmierci wybucha i zabija graczy w obrębie", "assassin_desc": "Zadajesz większe obrażenia przeciwnikowi od tyłu",
"dwarf": "MiniMajk", "astronaut": "Astronauta",
"dwarf_desc": "Losowa wielkość postaci na początku rundy", "astronaut_desc": "Na początku rundy otrzymujesz losową wartość grawitacji",
"dwarf_desc2": "Twój mnożnik wielkości to {0}x", "astronaut_desc2": "Twoja losowa grawitacja wynosi: {0}x",
"medic": "Medyk", "baseball": "Bejsbolista",
"medic_desc": "Otrzymujesz losową ilość apteczek na start rundy", "baseball_desc": "Twój wabik odbija się od ścian i natychmiastowo zabija wroga po trafieniu",
"randomweapon": "Losowa Broń", "behind": "Obrót Wroga",
"randomweapon_desc": "Dostajesz losową broń. Kliknij [css_useSkill], cooldown 15s", "behind_desc": "Masz losową szansę na obrócenie wroga o 180 stopni po trafieniu go",
"behind_desc2": "Twoje szanse na obrócenie wroga po trafieniu to: {0}%",
"chicken": "Kurczak", "blademaster": "Mistrz Ostrza",
"chicken_desc": "Otrzymujesz model kurczaka + jesteś o 10% szybszy - 50hp", "blademaster_desc": "Trzymając nóż, masz duże szanse na odparcie strzału",
"impostor": "Szpieg", "bunnyhop": "Królik",
"impostor_desc": "Otrzymujesz na start rundy model postaci wroga", "bunnyhop_desc": "Otrzymujesz auto \"BunnyHopa\"",
"c4camouflage": "C4 Kamuflaż",
"c4camouflage_desc": "Kiedy trzymasz bombę, jesteś niewidzialny",
"catapult": "Katapulta", "catapult": "Katapulta",
"catapult_desc": "Masz losową szanse na podrzucenie wroga", "catapult_desc": "Masz losową szanse na podrzucenie wroga",
"catapult_desc2": "Twoje szanse na podrzucenie wroga po trafieniu to: {0}%", "catapult_desc2": "Twoje szanse na podrzucenie wroga po trafieniu to: {0}%",
"infiniteammo": "Nieskończone Ammo", "chicken": "Kurczak",
"infiniteammo_desc": "Otrzymujesz nieskończoną ilość ammo do wszystkich swoich broni", "chicken_desc": "Otrzymujesz model kurczaka + jesteś o 10% szybszy - 50hp",
"behind": "Obrót Wroga", "chillout": "Wyluzowany",
"behind_desc": "Masz losową szanse na obrócenie wroga o 180 stopni po trafieniu", "chillout_desc": "Podłożenie bomby zajmuje znacznie więcej czasu",
"behind_desc2": "Twoje szanse na obrócenie wroga po trafieniu to: {0}%",
"retreat": "Odwrót", "cutter": "Scyzoryk",
"retreat_desc": "Powrót na spawna. Kliknij [css_useSkill], cooldown 15s", "cutter_desc": "Natychmiastowe zabójstwo nożem",
"oneshot": "Jednostrzałowiec", "darkness": "Mrok",
"oneshot_desc": "Po trafieniu od razu zabija przeciwnika", "darkness_desc": "Nadaje efekt ciemności wybranemu przeciwnikowi",
"darkness_enemy_info": "Niech zgasną światła.",
"darkness_player_info": "Ciemność opanowała gracza '{0}'.",
"darkness_select_info": "Wybierz gracza, któremu chcesz nadać efekt ciemności:",
"paweljumper": "Pawel Jumper", "deactivator": "Deaktywator",
"paweljumper_desc": "Otrzymujesz dodatkowy skok", "deactivator_desc": "Wybierasz gracza, którego supermoc chcesz wyłączyć",
"deactivator_enemy_info": "Twoja supermoc została wyłączona.",
"deactivator_player_info": "Moc gracza '{0}' została wyłączona.",
"deactivator_select_info": "Wybierz gracza, którego supermoc chcesz wyłączyć:",
"phoenix": "Phoenix", "deaf": "Głuchy",
"phoenix_desc": "Masz losową szans na odrodzenie się po śmierci", "deaf_desc": "Wybierasz gracza, dla którego chcesz wyłączyć wszystkie dźwięki",
"phoenix_desc2": "Twoje szanse na odrodzenie się po śmierci: {0}%", "deaf_enemy_info": "Słuchawki opuściły grę.",
"phoenix_respawn": "Zostałeś odrodzony z popiołów dzięki mocy: CHATCOLORS.REDPhoenix", "deaf_player_info": "Dźwięk został wyłączony dla gracza '{0}'.",
"deaf_select_info": "Wybierz gracza, dla którego chcesz wyłączyć wszystkie dźwięki:",
"pilot": "Pilot",
"pilot_desc": "Latanie przez określony czas. Przytrzymaj [USE - E], aby latać",
"pilot_hud_info": "W trakcie odnawiania",
"radarhack": "Radarowiec",
"radarhack_desc": "Widzisz wrogów na radarze",
"rambo": "Rambo",
"rambo_desc": "Otrzymujesz losową ilość zdrowia na start rundy",
"enemyspawn": "Resp Wroga",
"enemyspawn_desc": "Teleportacja na spawn wroga. Kliknij [css_useSkill], cooldown 15s",
"disarmament": "Rozbrojenie", "disarmament": "Rozbrojenie",
"disarmament_desc": "Masz losową szanse na wyrzucenie broni wroga po trafieniu", "disarmament_desc": "Masz losową szanse na wyrzucenie broni wroga po trafieniu",
"disarmament_desc2": "Twoje szanse na wyrzucenie broni wroga to: {0}%", "disarmament_desc2": "Twoje szanse na wyrzucenie broni wroga to: {0}%",
"planter": "Samowolka", "distancer": "Odległościomierz",
"planter_desc": "Możesz podłożyć bombę w dowolnym miejscu, czas detonacji bomby trwa 60s", "distancer_desc": "Możesz zobaczyć odległość do najbliższego przeciwnika",
"saper": "Saper", "dracula": "Drakula",
"saper_desc": "Możesz szybciej podłożyć bombę oraz ją zdefować", "dracula_desc": "Po trafieniu ofiary odzyskujesz zdrowie równe pewnemu procentowi zadanych obrażeń",
"timemanipulator": "Spowlnienie Czasu", "duplicator": "Duplikator",
"timemanipulator_desc": "Spowolnienie czasu dla wszystkich na 6 sekundy. Kliknij [css_useSkill], cooldown 30s", "duplicator_desc": "Wybierasz gracza, od którego chcesz skopiować supermoc",
"duplicator_player_info": "Moc gracza '{0}' została skopiowana.",
"duplicator_select_info": "Wybierz gracza, od którego chcesz skopiować supermoc:",
"quickshot": "Szybkostrzelność", "dwarf": "Mini Majk",
"quickshot_desc": "Brak cooldown przy strzelaniu", "dwarf_desc": "Losowa wielkość postaci na początku rundy",
"dwarf_desc2": "Twój mnożnik wielkości to {0}x",
"teleporter": "Teleporter", "enemyspawn": "Resp Wroga",
"teleporter_desc": "Zamieniasz się miejscami z trafionym wrogiem", "enemyspawn_desc": "Kliknij [css_useSkill], aby teleportować się na resp wroga",
"wallhack": "Wallhack", "explosiveshot": "Strzał Wybuchowy",
"wallhack_desc": "Widzisz wrogów przez ściany", "explosiveshot_desc": "Losowa szansa wystrzelenia pocisku wybuchowego podczas strzelania",
"explosiveshot_desc2": "Twoja szansa na wystrzelenie pocisku wybuchowego: {0}%",
"falconeye": "Oko Sokoła",
"falconeye_desc": "Kliknij [css_useSkill], aby aktywować kamerę z lotu ptaka",
"fastreload": "Szybkie Rączki",
"fastreload_desc": "Kliknij [css_useSkill], aby przeładować broń, którą obecnie trzymasz",
"flash": "Flash",
"flash_desc": "Losowa prędkośc postaci na początku rundy",
"flash_desc2": "Twój mnożnik prędkości to {0}x",
"fortnite": "Fortnite",
"fortnite_desc": "Kliknij [css_useSkill], aby stworzyć barykadę, którą można zniszczyć",
"fragilebomb": "Krucha Bomba",
"fragilebomb_desc": "Strzelanie do bomby powoduje jej uszkodzenie",
"fragilebomb_bomb_health": "Zdrowie bomby",
"friendlyfire": "Ogień Przyjacielski",
"friendlyfire_desc": "Strzelanie do członków drużyny leczy ich",
"frozendecoy": "Zamrażający Wabik",
"frozendecoy_desc": "Twój decoy zamraża wszystkich graczy w pobliżu",
"ghost": "Duszek",
"ghost_desc": "Jesteś całkowicie niewidzialny",
"glaz": "Glaz",
"glaz_desc": "Nie widzisz granatów dymnych",
"glitch": "Glitch",
"glitch_desc": "Wyłączasz radar wybranemu przeciwnikowi",
"glitch_enemy_info": "Twój radar został wyłączony.",
"glitch_player_info": "Radar gracza '{0}' został wyłączony.",
"glitch_select_info": "Wybierz gracza, dla którego chcesz wyłączyć radar:",
"glue": "Klej",
"glue_desc": "Twoje granaty przyklejają się do ścian",
"godmode": "Nieśmiertelność",
"godmode_desc": "Kliknij [css_useSkill], aby stać się nieśmiertelnym na krótką chwilę",
"godmode_off": "Nieśmiertelność wyłączona",
"godmode_on": "Nieśmiertelność włączona",
"healingsmoke": "Leczący Dym",
"healingsmoke_desc": "Twoje granaty dymne leczą",
"hermit": "Pustelnik",
"hermit_desc": "Zabijanie przywraca amunicję i część zdrowia",
"holyhandgrenade": "Święty Granat Ręczny",
"holyhandgrenade_desc": "Twoje granaty uderzeniowe zadają podwójne obrażenia i mają podwójny zasięg",
"impostor": "Szpieg",
"impostor_desc": "Na początku rundy otrzymujesz model postaci przeciwnika",
"infiniteammo": "Nieskończone Ammo",
"infiniteammo_desc": "Otrzymujesz nieskończoną ilość amunicji do wszystkich broni",
"jackal": "Stópkarz",
"jackal_desc": "Wybierasz gracza, który pozostawi za sobą ślad",
"jackal_player_info": "Gracz '{0}' zacznie zostawiać za sobą ślad.",
"jackal_select_info": "Wybierz gracza, który pozostawi za sobą ślad:",
"jammer": "Zakłócacz",
"jammer_desc": "Wybierasz gracza, dla którego chcesz wyłączyć celownik",
"jammer_enemy_info": "Twój celownik został wyłączony.",
"jammer_player_info": "Celownik gracza '{0}' została wyłączona.",
"jammer_select_info": "Wybierz gracza, dla którego chcesz wyłączyć celownik:",
"jumpban": "Beznogi",
"jumpban_desc": "Wybierasz gracza, który nie będzie mógł skakać",
"jumpban_enemy_info": "Ktoś odciął ci nogi.",
"jumpban_player_info": "Gracz '{0}' nie może teraz skakać.",
"jumpban_select_info": "Wybierz gracza, który nie będzie mógł skakać:",
"jumpingjack": "Pajacyk",
"jumpingjack_desc": "Skakanie przywraca zdrowie",
"killerflash": "Zabójczy Flash", "killerflash": "Zabójczy Flash",
"killerflash_desc": "Każdy całkowicie oślepiony twoim granatem umiera (również ty)", "killerflash_desc": "Każdy całkowicie oślepiony twoim granatem umiera (również ty)",
"weaponsswap": "Zamiana Broni", "lifeswap": "Zamiana Żyć",
"weaponsswap_desc": "Zamieniasz się bronią z losowym wrogiem. Kliknij [css_useSkill], cooldown 30s", "lifeswap_desc": "Wybierasz gracza, z którym chcesz wymienić się zdrowiem",
"weaponsswap_hud_info2": "Nie posiadasz broni na zamiane", "lifeswap_enemy_info": "Ktoś pożyczył sobie twoje zdrowie.",
"hud_info_no_enemy": "Nie znaleziono przeciwnika", "lifeswap_player_info": "Wymieniłeś się zdrowiem z graczem '{0}'.",
"lifeswap_select_info": "Wybierz gracza, z którym chcesz wymienić się zdrowiem:",
"zeus": "Zeus", "longknife": "Długi Nóż",
"zeus_desc": "Zeus x27 natychmiastowo się odnawia", "longknife_desc": "Podstawowy atak nożem zadaje obrażenia niezależnie od odległości",
"frozendecoy": "Zamrażający Decoy", "longzeus": "Długi Zeus",
"frozendecoy_desc": "Twój decoy zamraża wszystkich pobliskich graczy", "longzeus_desc": "Zeus zadaje obrażenia niezależnie od odległości",
"antyhead": "Żelazna Głowa", "medic": "Medyk",
"antyhead_desc": "Nie otrzymujesz obrażeń w głowę", "medic_desc": "Kliknij [css_useSkill], aby użyć ładunku leczniczego, który przywraca 50 punktów zdrowia",
"moneyswap": "Skarbówka",
"moneyswap_desc": "Wybierasz gracza, z którym chcesz zamienić się pieniędzmi",
"moneyswap_enemy_info": "Urząd skarbowy cię dopadł.",
"moneyswap_player_info": "Wymieniłeś swoje pieniądze z graczem '{0}'.",
"moneyswap_select_info": "Wybierz gracza, z którym chcesz zamienić się pieniędzmi:",
"muhammed": "Muhammed",
"muhammed_desc": "Po śmierci eksplodujesz i zabijasz graczy znajdujących się w zasięgu",
"ninja": "Ninja",
"ninja_desc": "Stojąc nieruchomo zwiększasz swoją niewidzialność o 33%, kucając o 33%, a trzymając nóż o 33%",
"nonades": "Pancernik",
"nonades_desc": "Granaty nie zadają Ci obrażeń",
"norecoil": "Skupienie",
"norecoil_desc": "Brak odrzutu podczas strzelania",
"noclip": "NoClip",
"noclip_desc": "Kliknij [css_useSkill], aby włączyć noclip na krótki czas",
"oneshot": "Jednostrzałowiec",
"oneshot_desc": "Po trafieniu natychmiast zabijasz przeciwnika",
"onlyhead": "Tylko Głowa",
"onlyhead_desc": "Otrzymujesz obrażenia tylko w głowę",
"paweljumper": "Pawel Jumper",
"paweljumper_desc": "Otrzymujesz dodatkowy skok",
"phoenix": "Feniks",
"phoenix_desc": "Masz losową szans na odrodzenie się po śmierci",
"phoenix_desc2": "Twoje szanse na odrodzenie się po śmierci: {0}%",
"phoenix_respawn": "Zostałeś odrodzony z popiołów dzięki mocy: CHATCOLORS.REDPhoenix",
"psychicdefusing": "Zdalne Rozbrajanie",
"psychicdefusing_desc": "Kiedy jesteś blisko bomby, zaczynasz ją rozbrajać",
"psychicdefusing_hud_info": "Pozostało {0} sekund do rozbrojenia",
"pilot": "Pilot",
"pilot_desc": "Latanie przez określony czas. Przytrzymaj [USE - E], aby latać",
"pilot_hud_info": "W trakcie odnawiania",
"planter": "Samowolka",
"planter_desc": "Bombę można podłożyć w dowolnym miejscu, a czas detonacji wynosi 60 sekund.",
"poison": "Trutka",
"poison_desc": "Wybierasz gracza, który co kilka sekund będzie otrzymywał obrażenia",
"poison_enemy_info": "Zostałeś otruty.",
"poison_player_info": "Gracz '{0}' został otruty.",
"poison_select_info": "Wybierz gracza, który co kilka sekund będzie otrzymywał obrażenia:",
"primaryban": "Brak Karabinów",
"primaryban_desc": "Wybierasz gracza, który nie może używać karabinów",
"primaryban_enemy_info": "Nie możesz już używać karabinów.",
"primaryban_player_info": "Gracz '{0}' nie może już używać karabinów.",
"primaryban_select_info": "Wybierz gracza, któremu chcesz zabronić używania karabinów:",
"prosthesis": "Proteza",
"prosthesis_desc": "Ramiona i nogi są kuloodporne",
"push": "Odpychacz",
"push_desc": "Masz losową szansę na odepchnięcie wroga po trafieniu go",
"push_desc2": "Twoje szanse na odepchnięcie wroga to: {0}%",
"pyro": "Pyro",
"pyro_desc": "Molotow przywraca zdrowie",
"quickshot": "Szybkostrzelność",
"quickshot_desc": "Wszystkie pociski są wystrzeliwane bardzo szybko",
"radarhack": "Radarowiec",
"radarhack_desc": "Na radarze widać wrogów",
"rambo": "Rambo",
"rambo_desc": "Na początku rundy otrzymujesz losową ilość zdrowia",
"randomweapon": "Losowa Broń",
"randomweapon_desc": "Kliknij [css_useSkill], aby otrzymać losową broń",
"rezombie": "Re-Zombie",
"rezombie_desc": "Po śmierci odradzasz się jako zombie z większym zdrowiem i bez broni",
"reactivearmor": "Pancerz Reaktywny",
"reactivearmor_desc": "Pancerz pochłania pierwsze otrzymane obrażenia",
"regeneration": "Regeneracja",
"regeneration_desc": "Co kilka sekund odnawiasz zdrowie",
"replicator": "Replikator",
"replicator_desc": "Kliknij [css_useSkill], aby stworzyć swoją replikę, która zadaje obrażenia po trafieniu",
"retreat": "Odwrót",
"retreat_desc": "Kliknij [css_useSkill], aby powrócić na resp",
"returntosender": "Zwrot do Nadawcy",
"returntosender_desc": "Pierwsze trafienie wroga powoduje, że wraca on na swój resp",
"richboy": "Bogacz",
"richboy_desc": "Na początku rundy otrzymujesz losową kwotę gotówki",
"robinhood": "Robin Hood",
"robinhood_desc": "Zadanie obrażeń przeciwnikowi powoduje kradzież jego pieniędzy",
"rubber": "Gumowe Kule",
"rubber_desc": "Twoje pociski znacznie spowalniają graczy",
"saper": "Saper",
"saper_desc": "Możesz szybciej podłożyć bombę i ją rozbroić",
"secondlife": "Druga Szansa",
"secondlife_desc": "Po śmierci odradzasz się z taką samą ilością zdrowia",
"shade": "Cień",
"shade_desc": "Teleportujesz się za plecy trafionego wroga",
"shade_nospace": "Brak miejsca",
"shortbomb": "Krótka Bomba",
"shortbomb_desc": "Bomba wybucha znacznie szybciej",
"silent": "Cichociemny",
"silent_desc": "Twoje kroki i skoki są niesłyszalne dla INNYCH graczy",
"sniperelite": "SzeliS",
"sniperelite_desc": "Kliknij [css_useSkill], aby zamienić aktualną broń na AWP",
"soldier": "Żołnierz", "soldier": "Żołnierz",
"soldier_desc": "Masz losowy mnożnik obrażeń", "soldier_desc": "Masz losowy mnożnik obrażeń",
"soldier_desc2": "Twój mnożnik obrażeń wynosi: {0}x", "soldier_desc2": "Twój mnożnik obrażeń wynosi: {0}x",
"soundmaker": "Dźwiękowiec",
"soundmaker_desc": "Kliknij [css_useSkill], aby wywołać dzwięk u każdego przeciwnika",
"spectator": "Obserwator",
"spectator_desc": "Kliknij [css_useSkill], aby obserwować losowego przeciwnika",
"swapposition": "Zamiana Miejsc", "swapposition": "Zamiana Miejsc",
"swapposition_desc": "Zamiana miejscami z losowym wrogiem. Kliknij [css_useSkill], cooldown 30s", "swapposition_desc": "Kliknij [css_useSkill], aby zamienić się miejscami z losowym przeciwnikiem",
"holyhandgrenade": "Święty granat ręczny", "teleporter": "Teleporter",
"holyhandgrenade_desc": "Twoje granaty uderzeniowe mają podwójne obrażenia i zasięg", "teleporter_desc": "Zamieniasz się miejscami z trafionym przeciwnikiem",
"areareaper": "Niszczyciel stref",
"areareaper_desc": "Możesz wybrać strefę detonacji do dezaktywowania",
"areareaper_incorrect_site": "Nie znaleziono takiej strefy detonacji.",
"areareaper_no_site": "Nie znaleziono żadnej strefy detonacji.",
"areareaper_used_info": "Twoja moc została już wykorzystana.",
"areareaper_site_disabled": "Strefa detonacji {0} została dezaktywowana - nie można na nią podłożyć bomby!",
"areareaper_select_info": "Wybierz strefę detonacji, którą chcesz dezaktywować:",
"deactivator": "Deaktywator",
"deactivator_desc": "",
"deactivator_enemy_info": "Twoja supermoc została wyłączona.",
"deactivator_player_info": "Moc gracza '{0}' została wyłączona.",
"deactivator_select_info": "Wybierz gracza któremu chcesz wyłączyć supermoc:",
"glitch": "Glitch",
"jammer_enemy_info": "Twój radar został wyłączony.",
"glitch_desc": "Wyłącza radar wybranemu przeciwnikowi",
"glitch_player_info": "Radar gracza '{0}' został wyłączony.",
"glitch_select_info": "Wybierz gracza któremu chcesz wyłączyć radar:",
"jammer": "Zakłócacz",
"jammer_desc": "",
"jammer_enemy_info": "Twój celownik został wyłączony.",
"jammer_player_info": "Celownik gracza '{0}' została wyłączona.",
"jammer_select_info": "Wybierz gracza któremu chcesz wyłączyć celownik:",
"duplicator": "Duplikator",
"duplicator_desc": "",
"duplicator_player_info": "Moc gracza '{0}' została skopiowana.",
"duplicator_select_info": "Wybierz gracza od którego chcesz skopiować supermoc:",
"thief": "Złodziej", "thief": "Złodziej",
"thief_desc": "", "thief_desc": "Możesz ukraść supermoc wybranemu graczowi",
"thief_enemy_info": "Twoja supermoc została ukradziona.", "thief_enemy_info": "Twoja supermoc została skradziona.",
"thief_player_info": "Moc gracza '{0}' została ukradziona.", "thief_player_info": "Moc gracza '{0}' została skradziona.",
"thief_select_info": "Wybierz gracza któremu chcesz ukraść supermoc:", "thief_select_info": "Wybierz gracza, którego supermoc chcesz ukraść:",
"selectplayerskill_incorrect_enemy_index": "Nie znaleziono gracza o takim index'ie.", "thirdeye": "Trzecie Oko",
"selectplayerskill_not_found": "Nie znaleziono graczy!", "thirdeye_desc": "Kliknij [css_useSkill], aby aktywować trzecią osobę",
"selectplayerskill_command": "Wpisz /t",
"pause": "Mecz został zapauzowany.", "toxicsmoke": "Toksyczny Dym",
"unpause": "Mecz został wznowiony.", "toxicsmoke_desc": "Twoje granaty dymny zadają obrażenia",
"welcome_message": "Witaj {PLAYER} na serwerze {SERVER_NAME}!\nAktualna wersja jRandomSkills: {VERSION} ({SKILLS_COUNT} supermocy).\n\nPierwotnie plugin stworzona przez:\n{AUTHOR1}\nZmodyfikowany i ulepszony przez:\n{AUTHOR2}",
"hud_info": "Poczekaj jeszcze {0} sekund", "wallhack": "Wallhack",
"wallhack_desc": "Widzisz wrogów przez ściany",
"watchmaker": "Zegarmistrz",
"watchmaker_desc": "Każdy rzut granatem zmienia czas rundy",
"watchmaker_ct": "Czas rundy został skrócony o {0} sekund.",
"watchmaker_tt": "Czas rundy został wydłużony o {0} sekund",
"weaponsswap": "Zamiana Broni",
"weaponsswap_desc": "Kliknij [css_useSkill], aby zamienić się bronią z losowym przeciwnikiem",
"weaponsswap_hud_info2": "Nie posiadasz broni na zamiane",
"zeus": "Zeus",
"zeus_desc": "Zeus x27 natychmiastowo się odnawia",
"your_skill": "Twoja aktualna moc",
"enemy_skill": "Supermoc przeciwnika",
"observer_skill": "Moc gracza",
"welcome_message": "Witaj {PLAYER} na serwerze {SERVER_NAME}!\nAktualna wersja jRandomSkills: {VERSION} ({SKILLS_COUNT} supermocy).\n\nPierwotnie plugin stworzona przez:\n{AUTHOR1}\nZmodyfikowany i ulepszony przez:\n{AUTHOR2}\nOficjalny discord: https://discord.gg/72nzFguNtd",
"drawing_skill": "Losowanie mocy",
"disabled_weapon": "Nie możesz używać tej broni", "disabled_weapon": "Nie możesz używać tej broni",
"hud_info": "Poczekaj jeszcze {0} sekund",
"hud_info_no_enemy": "Nie znaleziono przeciwnika",
"active_hud_info": "Działa jeszcze przez {0} milisekund",
"skills_menu": "Lista Super Mocy",
"no_player": "Nie znaleziono pasującego gracza.", "no_player": "Nie znaleziono pasującego gracza.",
"duplicate_player": "Znaleziono więcej niż jednego gracza o tej samej nazwie.", "duplicate_player": "Znaleziono więcej niż jednego gracza o tej samej nazwie.",
"drawing_skill": "Losowanie mocy", "selectplayerskill_command": "Wpisz /t",
"your_skill": "Twoja aktualna moc", "selectplayerskill_incorrect_enemy_index": "Nie znaleziono gracza o takim index'ie.",
"summary_start": "======PODSUMOWANIE=Z=OSTATNIEJ=RUNDY======",
"summary_end": "============================================",
"enemy_skill": "Supermoc przeciwnika",
"teammate_skills": "Supermoce twoich sojuszników",
"observer_skill": "Moc gracza",
"game_start": "Gra rozpoczęta!",
"invalid_map": "Niepoprawnie podano nazwę mapy!",
"loading_map": "Ładowanie nowej mapy",
"skills_menu": "Lista Super Mocy",
"correct_form_setskill": "Poprawne użycie: CHATCOLORS.RED!setskill <nick> <supermoc>",
"player_not_found_setskill": "Nie znaleziono takiego CHATCOLORS.REDgracza",
"skill_not_found_setskill": "Nie znaleziono takiej CHATCOLORS.REDsupermocy", "skill_not_found_setskill": "Nie znaleziono takiej CHATCOLORS.REDsupermocy",
"error_setskill": "Nie udało się ustawić CHATCOLORS.REDsupermocy", "player_not_found_setskill": "Nie znaleziono takiego CHATCOLORS.REDgracza",
"correct_form_setskill": "Poprawne użycie: CHATCOLORS.RED!setskill <nick> <supermoc>",
"correct_form_setscore": "Poprawne użycie: CHATCOLORS.RED!setscore <CT> <TT>",
"done_setskill": "Ustawiono Supermoc", "done_setskill": "Ustawiono Supermoc",
"for_setskill": "dla" "error_setskill": "Nie udało się ustawić CHATCOLORS.REDsupermocy",
"for_setskill": "dla",
"invalid_map": "Nazwa mapy została wprowadzona nieprawidłowo!",
"loading_map": "Ładowanie nowej mapy",
"pause": "Mecz został wstrzymany.",
"unpause": "Mecz został wznowiony.",
"healed": "Zostałeś uleczony.",
"game_start": "Gra rozpoczęta!",
"teammate_skills": "Supermoce twoich sojuszników",
"summary_start": "======PODSUMOWANIE=Z=OSTATNIEJ=RUNDY======",
"summary_end": "============================================"
} }

View file

@ -0,0 +1,410 @@
{
"none": "Nenhum",
"none_desc": "Você não tem nenhuma habilidade",
"aimbot": "Aimbot",
"aimbot_desc": "Cada bala que você acertar conta como um tiro na cabeça",
"anomaly": "Anomalia",
"anomaly_desc": "Você retrocede alguns segundos no tempo",
"antyflash": "Anti-Flash",
"antyflash_desc": "Você é imune a granadas de flash, e suas granadas de flash duram 7 segundos",
"antyhead": "Cabeça de Ferro",
"antyhead_desc": "Você não recebe dano de tiros na cabeça",
"areareaper": "Ceifador de Zonas",
"areareaper_desc": "Você pode escolher um local de bomba para desativar",
"areareaper_incorrect_site": "Nenhum local de bomba encontrado.",
"areareaper_no_site": "Nenhum local de bomba encontrado.",
"areareaper_select_info": "Escolha o local de bomba que deseja desativar:",
"areareaper_site_disabled": "Local de bomba {0} foi desativado - nenhuma bomba pode ser plantada lá!",
"areareaper_used_info": "Seu poder já foi usado.",
"armored": "Blindado",
"armored_desc": "Você tem um multiplicador de dano recebido aleatório",
"armored_desc2": "Seu multiplicador de dano recebido é: {0}x",
"assassin": "Assassino",
"assassin_desc": "Você causa mais dano aos inimigos por trás",
"astronaut": "Astronauta",
"astronaut_desc": "Você recebe um valor de gravidade aleatório no início da rodada",
"astronaut_desc2": "Sua gravidade aleatória é: {0}x",
"baseball": "Jogador de Beisebol",
"baseball_desc": "Seu chamariz ricocheteia nas paredes e mata instantaneamente um inimigo ao acertar",
"behind": "Giro do Inimigo",
"behind_desc": "Você tem uma chance aleatória de girar um inimigo 180 graus ao acertá-lo",
"behind_desc2": "Sua chance de girar um inimigo ao acertar é: {0}%",
"blademaster": "Mestre das Lâminas",
"blademaster_desc": "Enquanto segura uma faca, você tem uma alta chance de desviar de um tiro",
"bunnyhop": "Coelho",
"bunnyhop_desc": "Você ganha \"BunnyHop\" automático",
"c4camouflage": "Camuflagem C4",
"c4camouflage_desc": "Você fica invisível enquanto segura a bomba",
"catapult": "Catapulta",
"catapult_desc": "Você tem uma chance aleatória de lançar um inimigo para cima",
"catapult_desc2": "Sua chance de lançar um inimigo ao acertar é: {0}%",
"chicken": "Galinha",
"chicken_desc": "Você ganha um modelo de galinha + 10% de movimento mais rápido - 50 HP",
"chillout": "Descontraído",
"chillout_desc": "Plantar a bomba leva significativamente mais tempo",
"cutter": "Cortador",
"cutter_desc": "Mata instantaneamente com uma faca",
"darkness": "Escuridão",
"darkness_desc": "Aplica um efeito de escuridão a um inimigo escolhido",
"darkness_enemy_info": "Que as luzes se apaguem.",
"darkness_player_info": "A escuridão tomou conta do jogador '{0}'.",
"darkness_select_info": "Escolha o jogador ao qual deseja aplicar o efeito de escuridão:",
"deactivator": "Desativador",
"deactivator_desc": "Escolha um jogador cuja habilidade você deseja desativar",
"deactivator_enemy_info": "Sua habilidade foi desativada.",
"deactivator_player_info": "A habilidade do jogador '{0}' foi desativada.",
"deactivator_select_info": "Escolha o jogador cuja habilidade você deseja desativar:",
"deaf": "Surdo",
"deaf_desc": "Escolha um jogador para silenciar todos os sons",
"deaf_enemy_info": "Seus fones de ouvido saíram do jogo.",
"deaf_player_info": "O som foi desativado para o jogador '{0}'.",
"deaf_select_info": "Escolha o jogador para quem deseja silenciar todos os sons:",
"disarmament": "Desarmamento",
"disarmament_desc": "Você tem uma chance aleatória de fazer um inimigo largar sua arma ao acertá-lo",
"disarmament_desc2": "Sua chance de desarmar um inimigo é: {0}%",
"distancer": "Medidor de Distância",
"distancer_desc": "Você pode ver a distância até o inimigo mais próximo",
"dracula": "Drácula",
"dracula_desc": "Acertar um inimigo restaura saúde igual a uma porcentagem do dano causado",
"duplicator": "Duplicador",
"duplicator_desc": "Escolha um jogador para copiar sua habilidade",
"duplicator_player_info": "A habilidade do jogador '{0}' foi copiada.",
"duplicator_select_info": "Escolha o jogador cuja habilidade você deseja copiar:",
"dwarf": "Anão",
"dwarf_desc": "Tamanho de personagem aleatório no início da rodada",
"dwarf_desc2": "Seu multiplicador de tamanho é: {0}x",
"enemyspawn": "Spawn Inimigo",
"enemyspawn_desc": "Clique em [css_useSkill] para se teletransportar para o spawn inimigo",
"explosiveshot": "Tiro Explosivo",
"explosiveshot_desc": "Chance aleatória de disparar uma bala explosiva enquanto atira",
"explosiveshot_desc2": "Sua chance de disparar uma bala explosiva: {0}%",
"falconeye": "Olho de Falcão",
"falconeye_desc": "Clique em [css_useSkill] para ativar uma câmera com visão aérea",
"fastreload": "Recarga Rápida",
"fastreload_desc": "Clique em [css_useSkill] para recarregar a arma que você está segurando",
"flash": "Flash",
"flash_desc": "Velocidade de jogador aleatória no início da rodada",
"flash_desc2": "Seu multiplicador de velocidade é: {0}x",
"fortnite": "Fortnite",
"fortnite_desc": "Clique em [css_useSkill] para criar uma barricada destrutível",
"fragilebomb": "Bomba Frágil",
"fragilebomb_desc": "Atirar na bomba a danifica",
"fragilebomb_bomb_health": "Vida da bomba",
"friendlyfire": "Fogo Amigo",
"friendlyfire_desc": "Atirar em companheiros de equipe os cura",
"frozendecoy": "Chamariz Congelante",
"frozendecoy_desc": "Seu chamariz congela todos os jogadores próximos",
"ghost": "Fantasma",
"ghost_desc": "Você é completamente invisível",
"glaz": "Glaz",
"glaz_desc": "Você não pode ver granadas de fumaça",
"glitch": "Glitch",
"glitch_desc": "Desativa o radar de um inimigo escolhido",
"glitch_enemy_info": "Seu radar foi desativado.",
"glitch_player_info": "O radar do jogador '{0}' foi desativado.",
"glitch_select_info": "Escolha o jogador cujo radar você deseja desativar:",
"glue": "Cola",
"glue_desc": "Suas granadas grudam nas paredes",
"godmode": "Modo Deus",
"godmode_desc": "Clique em [css_useSkill] para se tornar imortal por um curto período",
"godmode_off": "Imortalidade desativada",
"godmode_on": "Imortalidade ativada",
"healingsmoke": "Fumaça Curativa",
"healingsmoke_desc": "Suas granadas de fumaça curam",
"hermit": "Eremita",
"hermit_desc": "Matar restaura munição e uma porção de saúde",
"holyhandgrenade": "Granada Sagrada",
"holyhandgrenade_desc": "Suas granadas explosivas causam dano dobrado e têm alcance dobrado",
"impostor": "Impostor",
"impostor_desc": "Você começa a rodada com um modelo de jogador inimigo",
"infiniteammo": "Munição Infinita",
"infiniteammo_desc": "Você recebe munição infinita para todas as suas armas",
"jackal": "Rastreador",
"jackal_desc": "Escolha um jogador que deixará um rastro atrás dele",
"jackal_player_info": "O jogador '{0}' começará a deixar um rastro.",
"jackal_select_info": "Escolha o jogador que deixará um rastro:",
"jammer": "Jammer",
"jammer_desc": "Escolha um jogador para desativar sua mira",
"jammer_enemy_info": "Sua mira foi desativada.",
"jammer_player_info": "A mira do jogador '{0}' foi desativada.",
"jammer_select_info": "Escolha o jogador cuja mira você deseja desativar:",
"jumpban": "Sem Pernas",
"jumpban_desc": "Escolha um jogador que não poderá pular",
"jumpban_enemy_info": "Alguém cortou suas pernas.",
"jumpban_player_info": "O jogador '{0}' não pode mais pular.",
"jumpban_select_info": "Escolha o jogador que não poderá pular:",
"jumpingjack": "Pula-Pula",
"jumpingjack_desc": "Pular restaura saúde",
"killerflash": "Flash Mortal",
"killerflash_desc": "Qualquer um completamente cego pela sua granada de flash morre (incluindo você)",
"lifeswap": "Troca de Vida",
"lifeswap_desc": "Escolha um jogador para trocar saúde com ele",
"lifeswap_enemy_info": "Alguém pegou sua saúde emprestada.",
"lifeswap_player_info": "Você trocou saúde com o jogador '{0}'.",
"lifeswap_select_info": "Escolha o jogador com quem deseja trocar saúde:",
"longknife": "Faca Longa",
"longknife_desc": "Um ataque com faca primária causa dano independentemente da distância",
"longzeus": "Zeus Longo",
"longzeus_desc": "Zeus causa dano independentemente da distância",
"medic": "Médico",
"medic_desc": "Clique em [css_useSkill] para usar uma carga de cura que restaura 50 de saúde",
"moneyswap": "Cobrador de Impostos",
"moneyswap_desc": "Escolha um jogador para trocar dinheiro com ele",
"moneyswap_enemy_info": "A receita federal te pegou.",
"moneyswap_player_info": "Você trocou dinheiro com o jogador '{0}'.",
"moneyswap_select_info": "Escolha o jogador com quem deseja trocar dinheiro:",
"muhammed": "Muhammed",
"muhammed_desc": "Você explode ao morrer, matando jogadores próximos",
"ninja": "Ninja",
"ninja_desc": "Ficar parado aumenta sua invisibilidade em 33%, agachar em 33%, e segurar uma faca em 33%",
"nonades": "Sem Granadas",
"nonades_desc": "Granadas não causam dano a você",
"norecoil": "Foco",
"norecoil_desc": "Sem recuo ao atirar",
"noclip": "NoClip",
"noclip_desc": "Clique em [css_useSkill] para ativar noclip por um curto período",
"oneshot": "Tiro Único",
"oneshot_desc": "Acertar um inimigo o mata instantaneamente",
"onlyhead": "Apenas Cabeça",
"onlyhead_desc": "Você só recebe dano na cabeça",
"paweljumper": "Pawel Jumper",
"paweljumper_desc": "Você ganha um pulo extra",
"phoenix": "Fênix",
"phoenix_desc": "Você tem uma chance aleatória de renascer após a morte",
"phoenix_desc2": "Sua chance de renascer após a morte: {0}%",
"phoenix_respawn": "Você foi ressuscitado das cinzas graças ao poder de: CHATCOLORS.REDPhoenix",
"psychicdefusing": "Desarme Psíquico",
"psychicdefusing_desc": "Quando você está perto da bomba, começa a desarmá-la",
"psychicdefusing_hud_info": "{0} segundos restantes para desarmar",
"pilot": "Piloto",
"pilot_desc": "Voe por um tempo limitado. Segure [USE - E] para voar",
"pilot_hud_info": "Recarregando",
"planter": "Plantador Livre",
"planter_desc": "Você pode plantar a bomba em qualquer lugar, com um tempo de detonação de 60 segundos.",
"poison": "Veneno",
"poison_desc": "Escolha um jogador que receberá dano a cada poucos segundos",
"poison_enemy_info": "Você foi envenenado.",
"poison_player_info": "O jogador '{0}' foi envenenado.",
"poison_select_info": "Escolha o jogador que receberá dano a cada poucos segundos:",
"primaryban": "Sem Rifles",
"primaryban_desc": "Escolha um jogador que não poderá usar rifles",
"primaryban_enemy_info": "Você não pode mais usar rifles.",
"primaryban_player_info": "O jogador '{0}' não pode mais usar rifles.",
"primaryban_select_info": "Escolha o jogador para proibir de usar rifles:",
"prosthesis": "Prótese",
"prosthesis_desc": "Braços e pernas são à prova de balas",
"push": "Empurrador",
"push_desc": "Você tem uma chance aleatória de empurrar um inimigo para trás ao acertá-lo",
"push_desc2": "Suas chances de repelir o inimigo são: {0}%",
"pyro": "Piro",
"pyro_desc": "Molotov restaura saúde",
"quickshot": "Tiro Rápido",
"quickshot_desc": "Todas as balas são disparadas muito rapidamente",
"radarhack": "Hack de Radar",
"radarhack_desc": "Inimigos são visíveis no radar",
"rambo": "Rambo",
"rambo_desc": "Você recebe uma quantidade aleatória de saúde no início da rodada",
"randomweapon": "Arma Aleatória",
"randomweapon_desc": "Clique em [css_useSkill] para receber uma arma aleatória",
"rezombie": "Re-Zumbi",
"rezombie_desc": "Após a morte, você renasce como um zumbi com mais saúde e sem armas",
"reactivearmor": "Armadura Reativa",
"reactivearmor_desc": "A armadura absorve o primeiro dano recebido",
"regeneration": "Regeneração",
"regeneration_desc": "Você restaura saúde a cada poucos segundos",
"replicator": "Replicador",
"replicator_desc": "Clique em [css_useSkill] para criar uma réplica que causa dano ao acertar",
"retreat": "Recuo",
"retreat_desc": "Clique em [css_useSkill] para retornar ao spawn",
"returntosender": "Devolução ao Remetente",
"returntosender_desc": "O primeiro acerto em um inimigo o envia de volta ao seu spawn",
"richboy": "Garoto Rico",
"richboy_desc": "Você recebe uma quantidade aleatória de dinheiro no início da rodada",
"robinhood": "Robin Hood",
"robinhood_desc": "Causar dano a um inimigo rouba seu dinheiro",
"rubber": "Balas de Borracha",
"rubber_desc": "Suas balas retardam significativamente os jogadores",
"saper": "Sapeador",
"saper_desc": "Você pode plantar e desarmar bombas mais rápido",
"secondlife": "Segunda Chance",
"secondlife_desc": "Após a morte, você renasce com a mesma quantidade de saúde",
"shade": "Sombra",
"shade_desc": "Você se teletransporta para trás de um inimigo acertado",
"shade_nospace": "Sem espaço disponível",
"shortbomb": "Fusível Curto",
"shortbomb_desc": "A bomba explode muito mais rápido",
"silent": "Silencioso",
"silent_desc": "Seus passos e pulos são silenciosos para OUTROS jogadores",
"sniperelite": "Atirador de Elite",
"sniperelite_desc": "Clique em [css_useSkill] para trocar sua arma atual por uma AWP",
"soldier": "Soldado",
"soldier_desc": "Você tem um multiplicador de dano aleatório",
"soldier_desc2": "Seu multiplicador de dano é: {0}x",
"soundmaker": "Criador de Som",
"soundmaker_desc": "Clique em [css_useSkill] para acionar um som para cada inimigo",
"spectator": "Espectador",
"spectator_desc": "Clique em [css_useSkill] para observar um inimigo aleatório",
"swapposition": "Troca de Posição",
"swapposition_desc": "Clique em [css_useSkill] para trocar de lugar com um inimigo aleatório",
"teleporter": "Teletransportador",
"teleporter_desc": "Você troca de lugar com o inimigo acertado",
"thief": "Ladrão",
"thief_desc": "Você pode roubar uma habilidade de um jogador escolhido",
"thief_enemy_info": "Sua habilidade foi roubada.",
"thief_player_info": "A habilidade do jogador '{0}' foi roubada.",
"thief_select_info": "Escolha o jogador cuja habilidade você deseja roubar:",
"thirdeye": "Terceiro Olho",
"thirdeye_desc": "Clique em [css_useSkill] para ativar a visão em terceira pessoa",
"toxicsmoke": "Fumaça Tóxica",
"toxicsmoke_desc": "Suas granadas de fumaça causam dano",
"wallhack": "Wallhack",
"wallhack_desc": "Você pode ver inimigos através das paredes",
"watchmaker": "Relojoeiro",
"watchmaker_desc": "Cada arremesso de granada altera o tempo da rodada",
"watchmaker_ct": "Tempo da rodada reduzido em {0} segundos.",
"watchmaker_tt": "Tempo da rodada estendido em {0} segundos.",
"weaponsswap": "Troca de Armas",
"weaponsswap_desc": "Clique em [css_useSkill] para trocar armas com um inimigo aleatório",
"weaponsswap_hud_info2": "Você não tem arma para trocar",
"zeus": "Zeus",
"zeus_desc": "Zeus x27 recarrega instantaneamente",
"your_skill": "Seu poder atual",
"enemy_skill": "Habilidade do inimigo",
"observer_skill": "Poder do jogador",
"welcome_message": "Bem-vindo {PLAYER} ao {SERVER_NAME}!\nVersão atual do jRandomSkills: {VERSION} ({SKILLS_COUNT} habilidades).\n\nCriado originalmente por:\n{AUTHOR1}\nModificado e aprimorado por:\n{AUTHOR2}",
"drawing_skill": "Sorteando uma habilidade",
"disabled_weapon": "Você não pode usar esta arma",
"hud_info": "Espere mais {0} segundos",
"hud_info_no_enemy": "Nenhum inimigo encontrado",
"active_hud_info": "Ativo por mais {0} milissegundos",
"skills_menu": "Lista de Habilidades",
"no_player": "Nenhum jogador correspondente encontrado.",
"duplicate_player": "Mais de um jogador encontrado com o mesmo nome.",
"selectplayerskill_command": "Digite /t",
"selectplayerskill_incorrect_enemy_index": "Nenhum jogador encontrado com esse índice.",
"skill_not_found_setskill": "Nenhuma habilidade CHATCOLORS.RED encontrada",
"player_not_found_setskill": "Nenhum jogador CHATCOLORS.RED encontrado",
"correct_form_setskill": "Uso correto: CHATCOLORS.RED!setskill <apelido> <habilidade>",
"correct_form_setscore": "Uso correto: CHATCOLORS.RED!setscore <CT> <TT>",
"done_setskill": "Habilidade definida",
"error_setskill": "Falha ao definir a habilidade CHATCOLORS.RED",
"for_setskill": "para",
"invalid_map": "Nome do mapa inserido incorretamente!",
"loading_map": "Carregando um novo mapa",
"pause": "Partida pausada.",
"unpause": "Partida retomada.",
"healed": "Você foi curado.",
"game_start": "Jogo iniciado!",
"teammate_skills": "Habilidades dos seus companheiros de equipe",
"summary_start": "=======RESUMO=DA=ÚLTIMA=RODADA=======",
"summary_end": "======================================="
}

View file

@ -0,0 +1,410 @@
{
"none": "无",
"none_desc": "你没有任何技能",
"aimbot": "自动瞄准",
"aimbot_desc": "你击中的每颗子弹都算作爆头",
"anomaly": "异常",
"anomaly_desc": "你会倒退几秒钟的时间",
"antyflash": "防闪",
"antyflash_desc": "你对闪光弹免疫,你的闪光弹持续7秒",
"antyhead": "铁头",
"antyhead_desc": "你不会受到爆头伤害",
"areareaper": "区域收割者",
"areareaper_desc": "你可以选择一个炸弹点进行禁用",
"areareaper_incorrect_site": "未找到此炸弹点。",
"areareaper_no_site": "未找到任何炸弹点。",
"areareaper_select_info": "选择你想禁用的炸弹点:",
"areareaper_site_disabled": "炸弹点 {0} 已被禁用 - 无法在此放置炸弹!",
"areareaper_used_info": "你的能力已被使用。",
"armored": "装甲",
"armored_desc": "你有随机受到伤害的倍率",
"armored_desc2": "你的受到伤害倍率是:{0}x",
"assassin": "刺客",
"assassin_desc": "从背后攻击敌人时造成更高的伤害",
"astronaut": "宇航员",
"astronaut_desc": "回合开始时你会获得随机重力值",
"astronaut_desc2": "你的随机重力是:{0}x",
"baseball": "棒球手",
"baseball_desc": "你的诱饵弹会在墙壁上反弹并在击中敌人时立即杀死",
"behind": "敌人旋转",
"behind_desc": "你有随机几率在击中敌人时使其旋转180度",
"behind_desc2": "你击中敌人使其旋转的几率是:{0}%",
"blademaster": "刀锋大师",
"blademaster_desc": "持刀时,你有很高几率格挡子弹",
"bunnyhop": "兔子",
"bunnyhop_desc": "你获得自动“兔子跳”",
"c4camouflage": "C4伪装",
"c4camouflage_desc": "你持有炸弹时隐形",
"catapult": "弹射",
"catapult_desc": "你有随机几率将敌人向上弹射",
"catapult_desc2": "你击中敌人将其弹射的几率是:{0}%",
"chicken": "鸡",
"chicken_desc": "你获得鸡模型 + 移动速度提高10% - 50生命值",
"chillout": "悠闲",
"chillout_desc": "放置炸弹需要显著更长的时间",
"cutter": "切割者",
"cutter_desc": "用刀可立即杀死敌人",
"darkness": "黑暗",
"darkness_desc": "对选定的敌人施加黑暗效果",
"darkness_enemy_info": "让灯光熄灭。",
"darkness_player_info": "黑暗笼罩了玩家 '{0}'。",
"darkness_select_info": "选择你想施加黑暗效果的玩家:",
"deactivator": "禁用者",
"deactivator_desc": "选择一个玩家以禁用其技能",
"deactivator_enemy_info": "你的技能已被禁用。",
"deactivator_player_info": "玩家 '{0}' 的技能已被禁用。",
"deactivator_select_info": "选择你想禁用其技能的玩家:",
"deaf": "聾病",
"deaf_desc": "选择一个玩家以静音其所有声音",
"deaf_enemy_info": "你的耳机已退出游戏。",
"deaf_player_info": "玩家 '{0}' 的声音已被禁用。",
"deaf_select_info": "选择你想静音其所有声音的玩家:",
"disarmament": "解除武装",
"disarmament_desc": "你有随机几率在击中敌人时使其丢下武器",
"disarmament_desc2": "你使敌人解除武装的几率是:{0}%",
"distancer": "测距仪",
"distancer_desc": "你可以看到与最近敌人的距离",
"dracula": "德古拉",
"dracula_desc": "击中敌人会根据造成的伤害百分比恢复你的生命值",
"duplicator": "复制者",
"duplicator_desc": "选择一个玩家以复制其技能",
"duplicator_player_info": "玩家 '{0}' 的技能已被复制。",
"duplicator_select_info": "选择你想复制其技能的玩家:",
"dwarf": "矮人",
"dwarf_desc": "回合开始时获得随机角色大小",
"dwarf_desc2": "你的体型倍率是:{0}x",
"enemyspawn": "敌人出生点",
"enemyspawn_desc": "点击 [css_useSkill] 传送到敌人出生点",
"explosiveshot": "爆炸射击",
"explosiveshot_desc": "射击时有随机几率发射爆炸子弹",
"explosiveshot_desc2": "你发射爆炸子弹的几率是:{0}%",
"falconeye": "鹰眼",
"falconeye_desc": "点击 [css_useSkill] 激活鸟瞰视角摄像头",
"fastreload": "快速装弹",
"fastreload_desc": "点击 [css_useSkill] 重新装填你当前持有的武器",
"flash": "闪电",
"flash_desc": "回合开始时获得随机玩家速度",
"flash_desc2": "你的速度倍率是:{0}x",
"fortnite": "堡垒之夜",
"fortnite_desc": "点击[css_useSkill]创建可破坏路障",
"fragilebomb": "脆弱炸弹",
"fragilebomb_desc": "射击炸弹会对其造成伤害",
"fragilebomb_bomb_health": "炸弹生命值",
"friendlyfire": "友军火力",
"friendlyfire_desc": "射击队友会治愈他们",
"frozendecoy": "冰冻诱饵",
"frozendecoy_desc": "你的诱饵弹会冻结附近的所有玩家",
"ghost": "幽灵",
"ghost_desc": "你完全隐形",
"glaz": "格拉兹",
"glaz_desc": "你无法看到烟雾弹",
"glitch": "故障",
"glitch_desc": "禁用选定敌人的雷达",
"glitch_enemy_info": "你的雷达已被禁用。",
"glitch_player_info": "玩家 '{0}' 的雷达已被禁用。",
"glitch_select_info": "选择你想禁用其雷达的玩家:",
"glue": "粘胶",
"glue_desc": "你的手榴弹会粘在墙上",
"godmode": "神模式",
"godmode_desc": "点击 [css_useSkill] 在短时间内变得无敌",
"godmode_off": "无敌状态已禁用",
"godmode_on": "无敌状态已启用",
"healingsmoke": "治疗烟雾",
"healingsmoke_desc": "你的烟雾弹会治疗",
"hermit": "隐士",
"hermit_desc": "击杀敌人会恢复弹药和部分生命值",
"holyhandgrenade": "神圣手榴弹",
"holyhandgrenade_desc": "你的高爆手榴弹造成双倍伤害并拥有双倍范围",
"impostor": "冒名顶替者",
"impostor_desc": "回合开始时你获得敌方玩家模型",
"infiniteammo": "无限弹药",
"infiniteammo_desc": "你为所有武器获得无限弹药",
"jackal": "追踪者",
"jackal_desc": "选择一个玩家,其身后会留下痕迹",
"jackal_player_info": "玩家 '{0}' 将开始留下痕迹。",
"jackal_select_info": "选择将留下痕迹的玩家:",
"jammer": "干扰器",
"jammer_desc": "选择一个玩家以禁用其准星",
"jammer_enemy_info": "你的准星已被禁用。",
"jammer_player_info": "玩家 '{0}' 的准星已被禁用。",
"jammer_select_info": "选择你想禁用其准星的玩家:",
"jumpban": "无腿",
"jumpban_desc": "选择一个玩家使其无法跳跃",
"jumpban_enemy_info": "有人切断了你的腿。",
"jumpban_player_info": "玩家 '{0}' 现在无法跳跃。",
"jumpban_select_info": "选择无法跳跃的玩家:",
"jumpingjack": "跳跃杰克",
"jumpingjack_desc": "跳跃会恢复生命值",
"killerflash": "致命闪光",
"killerflash_desc": "任何被你的闪光弹完全致盲的人都会死亡(包括你自己)",
"lifeswap": "生命交换",
"lifeswap_desc": "选择一个玩家以交换生命值",
"lifeswap_enemy_info": "有人借走了你的生命值。",
"lifeswap_player_info": "你与玩家 '{0}' 交换了生命值。",
"lifeswap_select_info": "选择你想与之交换生命值的玩家:",
"longknife": "长刀",
"longknife_desc": "近战刀具攻击无论距离远近均可造成伤害",
"longzeus": "长宙斯",
"longzeus_desc": "宙斯电击枪无论距离多远都能造成伤害",
"medic": "医务兵",
"medic_desc": "点击 [css_useSkill] 使用治疗装置恢复50点生命值",
"moneyswap": "税务员",
"moneyswap_desc": "选择一个玩家以交换金钱",
"moneyswap_enemy_info": "税务局找上你了。",
"moneyswap_player_info": "你与玩家 '{0}' 交换了金钱。",
"moneyswap_select_info": "选择你想与之交换金钱的玩家:",
"muhammed": "穆罕默德",
"muhammed_desc": "你死亡时会爆炸,杀死附近的玩家",
"ninja": "忍者",
"ninja_desc": "站立不动增加33%隐形,蹲下增加33%,持刀增加33%",
"nonades": "无手榴弹",
"nonades_desc": "手榴弹对你不造成伤害",
"norecoil": "专注",
"norecoil_desc": "射击时无后坐力",
"noclip": "无碰撞",
"noclip_desc": "点击 [css_useSkill] 在短时间内启用无碰撞模式",
"oneshot": "一击必杀",
"oneshot_desc": "击中敌人立即杀死他们",
"onlyhead": "仅头部",
"onlyhead_desc": "你只会在头部受到伤害",
"paweljumper": "帕维尔跳跃者",
"paweljumper_desc": "你获得额外的跳跃",
"phoenix": "凤凰",
"phoenix_desc": "你有随机几率在死亡后复活",
"phoenix_desc2": "你死亡后复活的几率是:{0}%",
"phoenix_respawn": "你因 CHATCOLORS.RED凤凰 的力量从灰烬中重生",
"psychicdefusing": "心灵拆弹",
"psychicdefusing_desc": "当你靠近炸弹时,你开始拆除它",
"psychicdefusing_hud_info": "拆除还剩 {0} 秒",
"pilot": "飞行员",
"pilot_desc": "在有限时间内飞行。按住 [USE - E] 飞行",
"pilot_hud_info": "正在充能",
"planter": "自由种植者",
"planter_desc": "你可以在任何地方放置炸弹,引爆时间为60秒。",
"poison": "毒药",
"poison_desc": "选择一个玩家,每隔几秒受到伤害",
"poison_enemy_info": "你被毒害了。",
"poison_player_info": "玩家 '{0}' 已被毒害。",
"poison_select_info": "选择每隔几秒将受到伤害的玩家:",
"primaryban": "无步枪",
"primaryban_desc": "选择一个玩家使其无法使用步枪",
"primaryban_enemy_info": "你无法再使用步枪。",
"primaryban_player_info": "玩家 '{0}' 无法再使用步枪。",
"primaryban_select_info": "选择禁止使用步枪的玩家:",
"prosthesis": "假肢",
"prosthesis_desc": "手臂和腿部防弹",
"push": "推力者",
"push_desc": "你有随机几率在击中敌人时将其推回",
"push_desc2": "你击退敌人的几率为:{0}%",
"pyro": "火焰兵",
"pyro_desc": "燃烧瓶会恢复生命值",
"quickshot": "快速射击",
"quickshot_desc": "所有子弹射击速度极快",
"radarhack": "雷达外挂",
"radarhack_desc": "雷达上可以看到敌人",
"rambo": "兰博",
"rambo_desc": "回合开始时你获得随机数量的生命值",
"randomweapon": "随机武器",
"randomweapon_desc": "点击 [css_useSkill] 获得随机武器",
"rezombie": "重生僵尸",
"rezombie_desc": "死亡后你将作为僵尸复活,拥有更多生命值但无武器",
"reactivearmor": "反应装甲",
"reactivearmor_desc": "装甲吸收首次受到的伤害",
"regeneration": "再生",
"regeneration_desc": "每隔几秒恢复生命值",
"replicator": "复制者",
"replicator_desc": "点击 [css_useSkill] 创建一个造成伤害的复制体",
"retreat": "撤退",
"retreat_desc": "点击 [css_useSkill] 返回出生点",
"returntosender": "退货",
"returntosender_desc": "首次击中敌人会将其送回出生点",
"richboy": "富少",
"richboy_desc": "回合开始时你获得随机数量的钱",
"robinhood": "罗宾汉",
"robinhood_desc": "对敌人造成伤害会偷取他们的钱",
"rubber": "橡胶子弹",
"rubber_desc": "你的子弹会显著减慢玩家速度",
"saper": "工兵",
"saper_desc": "你可以更快地放置和拆除炸弹",
"secondlife": "第二次机会",
"secondlife_desc": "死亡后你会以相同生命值复活",
"shade": "阴影",
"shade_desc": "你会传送到被击中敌人的背后",
"shade_nospace": "无可用空间",
"shortbomb": "短引信",
"shortbomb_desc": "炸弹爆炸速度快得多",
"silent": "无声",
"silent_desc": "你的脚步和跳跃对其他玩家无声",
"sniperelite": "狙击精英",
"sniperelite_desc": "点击 [css_useSkill] 将当前武器替换为AWP",
"soldier": "士兵",
"soldier_desc": "你有随机伤害倍率",
"soldier_desc2": "你的伤害倍率是:{0}x",
"soundmaker": "声音制造者",
"soundmaker_desc": "点击 [css_useSkill] 为每个敌人触发一个声音",
"spectator": "观察者",
"spectator_desc": "点击 [css_useSkill] 观察一个随机敌人",
"swapposition": "位置交换",
"swapposition_desc": "点击 [css_useSkill] 与随机敌人交换位置",
"teleporter": "传送者",
"teleporter_desc": "你与被击中的敌人交换位置",
"thief": "小偷",
"thief_desc": "你可以从选定玩家那里偷取技能",
"thief_enemy_info": "你的技能被偷走了。",
"thief_player_info": "玩家 '{0}' 的技能被偷走了。",
"thief_select_info": "选择你想偷取其技能的玩家:",
"thirdeye": "第三只眼",
"thirdeye_desc": "点击 [css_useSkill] 激活第三人称视角",
"toxicsmoke": "毒烟",
"toxicsmoke_desc": "你的烟雾弹会造成伤害",
"wallhack": "透视",
"wallhack_desc": "你可以通过墙壁看到敌人",
"watchmaker": "钟表匠",
"watchmaker_desc": "每次投掷手榴弹都会改变回合时间",
"watchmaker_ct": "回合时间缩短了 {0} 秒。",
"watchmaker_tt": "回合时间延长了 {0} 秒。",
"weaponsswap": "武器交换",
"weaponsswap_desc": "点击 [css_useSkill] 与随机敌人交换武器",
"weaponsswap_hud_info2": "你没有可交换的武器",
"zeus": "宙斯",
"zeus_desc": "宙斯x27立即充能",
"your_skill": "你当前的技能",
"enemy_skill": "敌人的技能",
"observer_skill": "玩家的技能",
"welcome_message": "欢迎 {PLAYER} 来到 {SERVER_NAME}!\n当前 jRandomSkills 版本:{VERSION}({SKILLS_COUNT} 个技能)。\n\n最初由以下人员创建:\n{AUTHOR1}\n由以下人员修改和改进:\n{AUTHOR2}",
"drawing_skill": "抽取技能",
"disabled_weapon": "你无法使用这把武器",
"hud_info": "再等 {0} 秒",
"hud_info_no_enemy": "未找到敌人",
"active_hud_info": "还剩 {0} 毫秒有效",
"skills_menu": "技能列表",
"no_player": "未找到匹配的玩家。",
"duplicate_player": "找到多个同名玩家。",
"selectplayerskill_command": "输入 /t",
"selectplayerskill_incorrect_enemy_index": "未找到该索引的玩家。",
"skill_not_found_setskill": "未找到 CHATCOLORS.RED 技能",
"player_not_found_setskill": "未找到 CHATCOLORS.RED 玩家",
"correct_form_setskill": "正确用法:CHATCOLORS.RED!setskill <昵称> <技能>",
"correct_form_setscore": "正确用法:CHATCOLORS.RED!setscore <CT> <TT>",
"done_setskill": "技能已设置",
"error_setskill": "无法设置 CHATCOLORS.RED 技能",
"for_setskill": "为",
"invalid_map": "地图名称输入错误!",
"loading_map": "正在加载新地图",
"pause": "比赛已暂停。",
"unpause": "比赛已恢复。",
"healed": "你已被治疗。",
"game_start": "游戏开始!",
"teammate_skills": "你队友的技能",
"summary_start": "=============上一回合总结==============",
"summary_end": "======================================="
}

View file

@ -1,11 +1,8 @@
using CounterStrikeSharp.API; using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Entities;
using CounterStrikeSharp.API.Modules.Memory; using CounterStrikeSharp.API.Modules.Memory;
using CounterStrikeSharp.API.Modules.Memory.DynamicFunctions; using CounterStrikeSharp.API.Modules.Memory.DynamicFunctions;
using CounterStrikeSharp.API.Modules.Utils; using CounterStrikeSharp.API.Modules.Utils;
using System.Numerics;
using System.Runtime.InteropServices;
using static jRandomSkills.jRandomSkills; using static jRandomSkills.jRandomSkills;
namespace jRandomSkills namespace jRandomSkills
@ -17,7 +14,6 @@ namespace jRandomSkills
public static void Load() public static void Load()
{ {
Debug.sessionId = $"{DateTime.Now:yyyy-MM-dd_HH-mm-ss}"; Debug.sessionId = $"{DateTime.Now:yyyy-MM-dd_HH-mm-ss}";
Debug.WriteToDebug($"jRandomSkills v{Instance.ModuleVersion} loaded!");
Instance.RegisterEventHandler<EventPlayerConnectFull>((@event, info) => Instance.RegisterEventHandler<EventPlayerConnectFull>((@event, info) =>
{ {
var player = @event.Userid; var player = @event.Userid;
@ -123,6 +119,9 @@ namespace jRandomSkills
public static void WriteToDebug(string message) public static void WriteToDebug(string message)
{ {
if (Config.config.Settings.DebugMode != true)
return;
string filename = $"Debug_{sessionId}.txt"; string filename = $"Debug_{sessionId}.txt";
string pluginFolder = Path.Combine(Server.GameDirectory, "csgo", "addons", "counterstrikesharp", "plugins", "jRandomSkills"); string pluginFolder = Path.Combine(Server.GameDirectory, "csgo", "addons", "counterstrikesharp", "plugins", "jRandomSkills");
string debugFolder = Path.Combine(pluginFolder, "Debug"); string debugFolder = Path.Combine(pluginFolder, "Debug");

View file

@ -14,69 +14,106 @@ public interface ISkill
public enum Skills public enum Skills
{ {
None, None,
Dwarf,
SwapPosition,
FrozenDecoy,
Soldier,
Armored,
Aimbot, Aimbot,
Retreat, Anomaly,
EnemySpawn,
Zeus,
RadarHack,
QuickShot,
Planter,
Silent,
KillerFlash,
TimeManipulator,
GodMode,
RandomWeapon,
WeaponsSwap,
Wallhack,
Mute,
HolyHandGrenade,
Replicator,
ToxicSmoke,
Deactivator,
Thief,
Duplicator,
AreaReaper,
Hermit,
RobinHood,
Jammer,
Glitch,
ReturnToSender,
ReactiveArmor,
OnlyHead,
Prosthesis,
SoundMaker,
Ninja,
C4Camouflage,
SecondLife,
NoRecoil,
Flash,
PawelJumper,
BunnyHop,
Impostor,
OneShot,
Muhammed,
RichBoy,
Rambo,
Medic,
Ghost,
Chicken,
Astronaut,
Disarmament,
AntyFlash, AntyFlash,
Behind,
InfiniteAmmo,
Catapult,
Dracula,
Teleporter,
Saper,
Phoenix,
Pilot,
Shade,
AntyHead, AntyHead,
AreaReaper,
Armored,
Assassin,
Astronaut,
Baseball,
Behind,
BladeMaster,
BunnyHop,
C4Camouflage,
Catapult,
Chicken,
ChillOut,
Cutter,
Darkness,
Deactivator,
Deaf,
Disarmament,
Distancer,
Dracula,
Duplicator,
Dwarf,
EnemySpawn,
ExplosiveShot,
FalconEye,
FastReload,
Flash,
Fortnite,
FragileBomb,
FriendlyFire,
FrozenDecoy,
Ghost,
Glaz,
Glitch,
Glue,
GodMode,
HealingSmoke,
Hermit,
HolyHandGrenade,
Impostor,
InfiniteAmmo,
Jackal,
Jammer,
JumpBan,
JumpingJack,
KillerFlash,
LifeSwap,
LongKnife,
LongZeus,
Medic,
MoneySwap,
Muhammed,
Ninja,
NoNades,
NoRecoil,
Noclip,
OneShot,
OnlyHead,
PawelJumper,
Phoenix,
PsychicDefusing,
Pilot,
Planter,
Poison,
PrimaryBan,
Prosthesis,
Push,
Pyro,
QuickShot,
RadarHack,
Rambo,
RandomWeapon,
ReZombie,
ReactiveArmor,
Regeneration,
Replicator,
Retreat,
ReturnToSender,
RichBoy,
RobinHood,
Rubber,
Saper,
SecondLife,
Shade,
ShortBomb,
Silent,
SniperElite,
Soldier,
SoundMaker,
Spectator,
SwapPosition,
Teleporter,
Thief,
ThirdEye,
ToxicSmoke,
Wallhack,
Watchmaker,
WeaponsSwap,
Zeus,
} }

View file

@ -11,6 +11,11 @@ namespace jRandomSkills
{ {
public static class Event public static class Event
{ {
private static jSkill_SkillInfo ctSkill = new jSkill_SkillInfo(Skills.None, Config.GetValue<string>(Skills.None, "color"), false);
private static jSkill_SkillInfo tSkill = new jSkill_SkillInfo(Skills.None, Config.GetValue<string>(Skills.None, "color"), false);
private static jSkill_SkillInfo allSkill = new jSkill_SkillInfo(Skills.None, Config.GetValue<string>(Skills.None, "color"), false);
private static List<jSkill_SkillInfo> debugSkills = new List<jSkill_SkillInfo>(SkillData.Skills);
public static void Load() public static void Load()
{ {
Instance.RegisterEventHandler<EventPlayerConnectFull>((@event, info) => Instance.RegisterEventHandler<EventPlayerConnectFull>((@event, info) =>
@ -19,11 +24,11 @@ namespace jRandomSkills
if (player == null || !player.IsValid) return HookResult.Continue; if (player == null || !player.IsValid) return HookResult.Continue;
Instance.skillPlayer.Add(new dSkill_PlayerInfo Instance.skillPlayer.Add(new jSkill_PlayerInfo
{ {
SteamID = player.SteamID, SteamID = player.SteamID,
PlayerName = player.PlayerName, PlayerName = player.PlayerName,
Skill = src.player.Skills.None, Skill = Skills.None,
SpecialSkill = Skills.None, SpecialSkill = Skills.None,
IsDrawing = false, IsDrawing = false,
SkillChance = 1, SkillChance = 1,
@ -112,6 +117,29 @@ namespace jRandomSkills
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) => Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
{ {
Config.DefaultSkillInfo[] terroristSkills = Config.config.SkillsInfo.Where(s => s.OnlyTeam == (int)CsTeam.Terrorist).ToArray();
Config.DefaultSkillInfo[] counterterroristSkills = Config.config.SkillsInfo.Where(s => s.OnlyTeam == (int)CsTeam.CounterTerrorist).ToArray();
Config.DefaultSkillInfo[] allTeamsSkills = Config.config.SkillsInfo.Where(s => s.OnlyTeam == 0).ToArray();
if (Config.config.Settings.GameMode == (int)Config.GameModes.TeamSkills)
{
List<jSkill_SkillInfo> tSkills = new List<jSkill_SkillInfo>(SkillData.Skills);
tSkills.RemoveAll(s => s.Skill == tSkill.Skill || s.Skill == Skills.None || counterterroristSkills.Any(s2 => s2.Name == s.Skill.ToString()));
tSkill = tSkills.Count == 0 ? new jSkill_SkillInfo(Skills.None, Config.GetValue<string>(Skills.None, "color"), false) : tSkills[Instance.Random.Next(tSkills.Count)];
List<jSkill_SkillInfo> ctSkills = new List<jSkill_SkillInfo>(SkillData.Skills);
ctSkills.RemoveAll(s => s.Skill == ctSkill.Skill || s.Skill == Skills.None || terroristSkills.Any(s2 => s2.Name == s.Skill.ToString()));
ctSkill = ctSkills.Count == 0 ? new jSkill_SkillInfo(Skills.None, Config.GetValue<string>(Skills.None, "color"), false) : ctSkills[Instance.Random.Next(ctSkills.Count)];
}
else if (Config.config.Settings.GameMode == (int)Config.GameModes.SameSkills)
{
List<jSkill_SkillInfo> allSkills = new List<jSkill_SkillInfo>(SkillData.Skills);
allSkills.RemoveAll(s => s.Skill == allSkill.Skill || s.Skill == Skills.None || !allTeamsSkills.Any(s2 => s2.Name == s.Skill.ToString()));
allSkill = allSkills.Count == 0 ? new jSkill_SkillInfo(Skills.None, Config.GetValue<string>(Skills.None, "color"), false) : allSkills[Instance.Random.Next(allSkills.Count)];
}
else if (Config.config.Settings.GameMode == (int)Config.GameModes.Debug && debugSkills.Count == 0)
debugSkills = new List<jSkill_SkillInfo>(SkillData.Skills);
foreach (var player in Utilities.GetPlayers()) foreach (var player in Utilities.GetPlayers())
{ {
var playerTeam = player.Team; var playerTeam = player.Team;
@ -123,24 +151,39 @@ namespace jRandomSkills
if (skillPlayer != null) if (skillPlayer != null)
{ {
skillPlayer.IsDrawing = false; skillPlayer.IsDrawing = false;
jSkill_SkillInfo randomSkill = new jSkill_SkillInfo(Skills.None, Config.GetValue<string>(Skills.None, "color"), false);
List<dSkill_SkillInfo> skillList = new List<dSkill_SkillInfo>(SkillData.Skills); if (Config.config.Settings.GameMode == (int)Config.GameModes.Normal)
{
List<jSkill_SkillInfo> skillList = new List<jSkill_SkillInfo>(SkillData.Skills);
skillList.RemoveAll(s => s?.Skill == skillPlayer?.Skill || s?.Skill == skillPlayer?.SpecialSkill || s?.Skill == Skills.None); skillList.RemoveAll(s => s?.Skill == skillPlayer?.Skill || s?.Skill == skillPlayer?.SpecialSkill || s?.Skill == Skills.None);
if (Utilities.GetPlayers().FindAll(p => p.Team == player.Team && p.IsValid && !p.IsBot).Count != 1) if (Utilities.GetPlayers().FindAll(p => p.Team == player.Team && p.IsValid && !p.IsBot).Count == 1)
{ {
Config.SkillInfo[] skillsOnly1v1 = Config.config.SkillsInfo.Where(s => s.Only1v1).ToArray(); Config.DefaultSkillInfo[] skillsNeedsTeammates = Config.config.SkillsInfo.Where(s => s.NeedsTeammates).ToArray();
skillList.RemoveAll(s => skillsOnly1v1.Any(s2 => s2.Name == s.Skill.ToString())); skillList.RemoveAll(s => skillsNeedsTeammates.Any(s2 => s2.Name == s.Skill.ToString()));
} }
Config.SkillInfo[] terroristSkills = Config.config.SkillsInfo.Where(s => s.Team == 2).ToArray();
Config.SkillInfo[] counterterroristSkills = Config.config.SkillsInfo.Where(s => s.Team == 3).ToArray();
if (player.Team == CsTeam.Terrorist) if (player.Team == CsTeam.Terrorist)
skillList.RemoveAll(s => counterterroristSkills.Any(s2 => s2.Name == s.Skill.ToString())); skillList.RemoveAll(s => counterterroristSkills.Any(s2 => s2.Name == s.Skill.ToString()));
else else
skillList.RemoveAll(s => terroristSkills.Any(s2 => s2.Name == s.Skill.ToString())); skillList.RemoveAll(s => terroristSkills.Any(s2 => s2.Name == s.Skill.ToString()));
var randomSkill = skillList.Count == 0 ? new dSkill_SkillInfo(Skills.None, "#ffffff", false) : skillList[Instance.Random.Next(skillList.Count)]; randomSkill = skillList.Count == 0 ? new jSkill_SkillInfo(Skills.None, Config.GetValue<string>(Skills.None, "color"), false) : skillList[Instance.Random.Next(skillList.Count)];
}
else if (Config.config.Settings.GameMode == (int)Config.GameModes.TeamSkills)
randomSkill = player.Team == CsTeam.Terrorist ? tSkill : ctSkill;
else if (Config.config.Settings.GameMode == (int)Config.GameModes.SameSkills)
randomSkill = allSkill;
else if (Config.config.Settings.GameMode == (int)Config.GameModes.Debug)
{
if (debugSkills.Count == 0)
debugSkills = new List<jSkill_SkillInfo>(SkillData.Skills);
randomSkill = debugSkills[0];
debugSkills.RemoveAt(0);
player.PrintToChat($"{SkillData.Skills.Count - debugSkills.Count}/{SkillData.Skills.Count}");
}
skillPlayer.Skill = randomSkill.Skill; skillPlayer.Skill = randomSkill.Skill;
skillPlayer.SpecialSkill = Skills.None; skillPlayer.SpecialSkill = Skills.None;
Debug.WriteToDebug($"Player {skillPlayer.PlayerName} has got the skill \"{randomSkill.Name}\"."); Debug.WriteToDebug($"Player {skillPlayer.PlayerName} has got the skill \"{randomSkill.Name}\".");

View file

@ -14,14 +14,34 @@ namespace jRandomSkills
{ {
Instance.RegisterListener<OnTick>(() => Instance.RegisterListener<OnTick>(() =>
{ {
UpdateGameRules();
foreach (var player in Utilities.GetPlayers()) foreach (var player in Utilities.GetPlayers())
{
if (player != null && player.IsValid) if (player != null && player.IsValid)
{
UpdatePlayerHud(player); UpdatePlayerHud(player);
}
}
}); });
Instance.RegisterListener<OnMapStart>(OnMapStart);
}
private static void OnMapStart(string mapName)
{
Instance.GameRules = null;
}
private static void InitializeGameRules()
{
if (Instance.GameRules != null) return;
var gameRulesProxy = Utilities.FindAllEntitiesByDesignerName<CCSGameRulesProxy>("cs_gamerules").FirstOrDefault();
if (gameRulesProxy != null)
Instance.GameRules = gameRulesProxy?.GameRules;
}
private static void UpdateGameRules()
{
if (Instance.GameRules == null)
InitializeGameRules();
else
Instance.GameRules.GameRestart = Instance.GameRules.RestartRoundTime < Server.CurrentTime;
} }
private static void UpdatePlayerHud(CCSPlayerController player) private static void UpdatePlayerHud(CCSPlayerController player)

View file

@ -1,7 +1,7 @@
using CounterStrikeSharp.API; using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Memory; using CounterStrikeSharp.API.Modules.Memory;
using CounterStrikeSharp.API.Modules.Memory.DynamicFunctions; using CounterStrikeSharp.API.Modules.Memory.DynamicFunctions;
using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player; using jRandomSkills.src.player;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using static jRandomSkills.jRandomSkills; using static jRandomSkills.jRandomSkills;
@ -10,15 +10,12 @@ namespace jRandomSkills
{ {
public class Aimbot : ISkill public class Aimbot : ISkill
{ {
private static Skills skillName = Skills.Aimbot; private const Skills skillName = Skills.Aimbot;
private static Dictionary<nint, int> hitGroups = new Dictionary<nint, int>(); private static Dictionary<nint, int> hitGroups = new Dictionary<nint, int>();
public static void LoadSkill() public static void LoadSkill()
{ {
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true) SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
return;
SkillUtils.RegisterSkill(skillName, "#ff0000");
VirtualFunctions.CBaseEntity_TakeDamageOldFunc.Hook(OnTakeDamage, HookMode.Pre); VirtualFunctions.CBaseEntity_TakeDamageOldFunc.Hook(OnTakeDamage, HookMode.Pre);
} }
@ -66,5 +63,12 @@ namespace jRandomSkills
return HookResult.Continue; return HookResult.Continue;
} }
public class SkillConfig : Config.DefaultSkillInfo
{
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#ff0000", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false) : base(skill, active, color, onlyTeam, needsTeammates)
{
}
}
} }
} }

View file

@ -0,0 +1,163 @@
using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player;
using jRandomSkills.src.utils;
using static CounterStrikeSharp.API.Core.Listeners;
using static jRandomSkills.jRandomSkills;
namespace jRandomSkills
{
public class Anomaly : ISkill
{
private const Skills skillName = Skills.Anomaly;
private static int maxSize = Config.GetValue<int>(skillName, "secondsInBack");
private static float tickRate = 64;
private static float timerCooldown = Config.GetValue<float>(skillName, "cooldown");
private static readonly Dictionary<ulong, PlayerSkillInfo> SkillPlayerInfo = new Dictionary<ulong, PlayerSkillInfo>();
public 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())
{
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
if (playerInfo?.Skill == skillName)
EnableSkill(player);
}
});
return HookResult.Continue;
});
Instance.RegisterEventHandler<EventRoundEnd>((@event, info) =>
{
SkillPlayerInfo.Clear();
return HookResult.Continue;
});
Instance.RegisterEventHandler<EventPlayerDeath>((@event, info) =>
{
var player = @event.Userid;
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
if (playerInfo?.Skill == skillName)
if (SkillPlayerInfo.ContainsKey(player.SteamID))
SkillPlayerInfo.Remove(player.SteamID);
return HookResult.Continue;
});
Instance.RegisterListener<OnTick>(() =>
{
foreach (var player in Utilities.GetPlayers())
{
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
if (playerInfo?.Skill == skillName)
if (SkillPlayerInfo.TryGetValue(player.SteamID, out var skillInfo))
{
UpdateHUD(player, skillInfo);
if (Server.TickCount % tickRate != 0) return;
var pawn = player.PlayerPawn.Value;
if (pawn != null && pawn.IsValid)
{
skillInfo.LastPositions.Add(new Vector(pawn.AbsOrigin.X, pawn.AbsOrigin.Y, pawn.AbsOrigin.Z));
skillInfo.LastRotations.Add(new QAngle(pawn.EyeAngles.X, pawn.EyeAngles.Y, pawn.EyeAngles.Z));
if (skillInfo.LastRotations.Count > maxSize)
{
skillInfo.LastPositions.RemoveAt(0);
skillInfo.LastRotations.RemoveAt(0);
}
}
}
}
});
}
public static void EnableSkill(CCSPlayerController player)
{
SkillPlayerInfo[player.SteamID] = new PlayerSkillInfo
{
SteamID = player.SteamID,
CanUse = true,
Cooldown = DateTime.MinValue,
LastPositions = new List<Vector>(),
LastRotations = new List<QAngle>(),
};
}
public static void DisableSkill(CCSPlayerController player)
{
if (SkillPlayerInfo.ContainsKey(player.SteamID))
SkillPlayerInfo.Remove(player.SteamID);
}
private static void UpdateHUD(CCSPlayerController player, PlayerSkillInfo skillInfo)
{
float cooldown = 0;
if (skillInfo != null)
{
float time = (int)(skillInfo.Cooldown.AddSeconds(timerCooldown) - DateTime.Now).TotalSeconds;
cooldown = Math.Max(time, 0);
if (cooldown == 0 && skillInfo?.CanUse == false)
skillInfo.CanUse = true;
}
var skillData = SkillData.Skills.FirstOrDefault(s => s.Skill == skillName);
if (skillData == null) return;
string infoLine = $"<font class='fontSize-l' class='fontWeight-Bold' color='#FFFFFF'>{Localization.GetTranslation("your_skill")}:</font> <br>";
string skillLine = $"<font class='fontSize-l' class='fontWeight-Bold' color='{skillData.Color}'>{skillData.Name}</font> <br>";
string remainingLine = cooldown != 0 ? $"<font class='fontSize-m' color='#FFFFFF'>{Localization.GetTranslation("hud_info", $"<font color='#FF0000'>{cooldown}</font>")}</font> <br>" : "";
var hudContent = infoLine + skillLine + remainingLine;
player.PrintToCenterHtml(hudContent);
}
public static void UseSkill(CCSPlayerController player)
{
var playerPawn = player.PlayerPawn.Value;
if (playerPawn?.CBodyComponent == null) return;
if (SkillPlayerInfo.TryGetValue(player.SteamID, out var skillInfo))
{
if (!player.IsValid || !player.PawnIsAlive) return;
if (skillInfo.CanUse)
{
skillInfo.CanUse = false;
skillInfo.Cooldown = DateTime.Now;
Vector lastPosition = skillInfo.LastPositions.FirstOrDefault();
QAngle lastRotation = skillInfo.LastRotations.FirstOrDefault();
if (lastPosition != null && lastRotation != null)
playerPawn.Teleport(lastPosition, lastRotation, null);
}
}
}
public class PlayerSkillInfo
{
public ulong SteamID { get; set; }
public bool CanUse { get; set; }
public DateTime Cooldown { get; set; }
public List<Vector> LastPositions { get; set; }
public List<QAngle> LastRotations { get; set; }
}
public class SkillConfig : Config.DefaultSkillInfo
{
public int SecondsInBack { get; set; }
public float Cooldown { get; set; }
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#a86eff", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false, int secondsInBack = 5, float cooldown = 15) : base(skill, active, color, onlyTeam, needsTeammates)
{
SecondsInBack = secondsInBack;
Cooldown = cooldown;
}
}
}
}

View file

@ -1,4 +1,7 @@
using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Entities.Constants;
using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player; using jRandomSkills.src.player;
using static jRandomSkills.jRandomSkills; using static jRandomSkills.jRandomSkills;
@ -6,14 +9,27 @@ namespace jRandomSkills
{ {
public class AntyFlash : ISkill public class AntyFlash : ISkill
{ {
private static Skills skillName = Skills.AntyFlash; private const Skills skillName = Skills.AntyFlash;
public static void LoadSkill() public static void LoadSkill()
{ {
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true) SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
return;
SkillUtils.RegisterSkill(skillName, "#D6E6FF"); 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<EventPlayerBlind>((@event, info) => Instance.RegisterEventHandler<EventPlayerBlind>((@event, info) =>
{ {
@ -35,5 +51,17 @@ namespace jRandomSkills
return HookResult.Continue; return HookResult.Continue;
}); });
} }
public static void EnableSkill(CCSPlayerController player)
{
SkillUtils.TryGiveWeapon(player, CsItem.FlashbangGrenade);
}
public class SkillConfig : Config.DefaultSkillInfo
{
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#D6E6FF", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false) : base(skill, active, color, onlyTeam, needsTeammates)
{
}
}
} }
} }

View file

@ -1,4 +1,5 @@
using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player; using jRandomSkills.src.player;
using static jRandomSkills.jRandomSkills; using static jRandomSkills.jRandomSkills;
@ -6,14 +7,11 @@ namespace jRandomSkills
{ {
public class AntyHead : ISkill public class AntyHead : ISkill
{ {
private static Skills skillName = Skills.AntyHead; private const Skills skillName = Skills.AntyHead;
public static void LoadSkill() public static void LoadSkill()
{ {
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true) SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
return;
SkillUtils.RegisterSkill(skillName, "#8B4513");
Instance.RegisterEventHandler<EventPlayerHurt>((@event, info) => Instance.RegisterEventHandler<EventPlayerHurt>((@event, info) =>
{ {
@ -45,5 +43,12 @@ namespace jRandomSkills
playerPawn.Health = (int)newHealth; playerPawn.Health = (int)newHealth;
} }
public class SkillConfig : Config.DefaultSkillInfo
{
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#8B4513", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false) : base(skill, active, color, onlyTeam, needsTeammates)
{
}
}
} }
} }

View file

@ -9,11 +9,11 @@ namespace jRandomSkills
{ {
public class AreaReaper : ISkill public class AreaReaper : ISkill
{ {
private static Skills skillName = Skills.AreaReaper; private const Skills skillName = Skills.AreaReaper;
public static void LoadSkill() public static void LoadSkill()
{ {
SkillUtils.RegisterSkill(skillName, "#edf5b5", false); SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) => Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
{ {
@ -94,5 +94,12 @@ namespace jRandomSkills
foreach (var bombTarget in bombTargets) foreach (var bombTarget in bombTargets)
bombTarget.AcceptInput("Enable"); bombTarget.AcceptInput("Enable");
} }
public class SkillConfig : Config.DefaultSkillInfo
{
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#edf5b5", CsTeam onlyTeam = CsTeam.CounterTerrorist, bool needsTeammates = false) : base(skill, active, color, onlyTeam, needsTeammates)
{
}
}
} }
} }

View file

@ -11,14 +11,11 @@ namespace jRandomSkills
{ {
public class Armored : ISkill public class Armored : ISkill
{ {
private static Skills skillName = Skills.Armored; private const Skills skillName = Skills.Armored;
public static void LoadSkill() public static void LoadSkill()
{ {
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true) SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"), false);
return;
SkillUtils.RegisterSkill(skillName, "#d1430a", false);
VirtualFunctions.CBaseEntity_TakeDamageOldFunc.Hook(OnTakeDamage, HookMode.Pre); VirtualFunctions.CBaseEntity_TakeDamageOldFunc.Hook(OnTakeDamage, HookMode.Pre);
@ -44,10 +41,7 @@ namespace jRandomSkills
{ {
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID); var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
var skillConfig = Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString()); float newScale = (float)Instance.Random.NextDouble() * (Config.GetValue<float>(skillName, "ChanceTo") - Config.GetValue<float>(skillName, "ChanceFrom")) + Config.GetValue<float>(skillName, "ChanceFrom");
if (skillConfig == null) return;
float newScale = (float)Instance.Random.NextDouble() * (skillConfig.ChanceTo - skillConfig.ChanceFrom) + skillConfig.ChanceFrom;
playerInfo.SkillChance = newScale; playerInfo.SkillChance = newScale;
newScale = (float)Math.Round(newScale, 2); newScale = (float)Math.Round(newScale, 2);
SkillUtils.PrintToChat(player, $"{ChatColors.DarkRed}{Localization.GetTranslation("armored")}{ChatColors.Lime}: " + Localization.GetTranslation("armored_desc2", newScale), false); SkillUtils.PrintToChat(player, $"{ChatColors.DarkRed}{Localization.GetTranslation("armored")}{ChatColors.Lime}: " + Localization.GetTranslation("armored_desc2", newScale), false);
@ -73,15 +67,24 @@ namespace jRandomSkills
CCSPlayerController attacker = attackerPawn.Controller.Value.As<CCSPlayerController>(); CCSPlayerController attacker = attackerPawn.Controller.Value.As<CCSPlayerController>();
CCSPlayerController victim = victimPawn.Controller.Value.As<CCSPlayerController>(); CCSPlayerController victim = victimPawn.Controller.Value.As<CCSPlayerController>();
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == attacker.SteamID); var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == victim.SteamID);
if (playerInfo == null) return HookResult.Continue; if (playerInfo == null) return HookResult.Continue;
if (playerInfo.Skill == skillName && attacker.PawnIsAlive) if (playerInfo.Skill == skillName && victim.PawnIsAlive)
{
param2.Damage *= (float)playerInfo.SkillChance; param2.Damage *= (float)playerInfo.SkillChance;
}
return HookResult.Continue; return HookResult.Continue;
} }
public class SkillConfig : Config.DefaultSkillInfo
{
public float ChanceFrom { get; set; }
public float ChanceTo { get; set; }
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#d1430a", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false, float chanceFrom = .65f, float chanceTo = .85f) : base(skill, active, color, onlyTeam, needsTeammates)
{
ChanceFrom = chanceFrom;
ChanceTo = chanceTo;
}
}
} }
} }

View file

@ -0,0 +1,78 @@
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player;
using static jRandomSkills.jRandomSkills;
namespace jRandomSkills
{
public class Assassin : ISkill
{
private const Skills skillName = Skills.Assassin;
private static float damageMultiplier = Config.GetValue<float>(skillName, "damageMultiplier");
private static float toleranceDeg = Config.GetValue<float>(skillName, "toleranceDeg");
private static string[] nades = { "inferno", "flashbang", "smokegrenade", "decoy", "hegrenade" };
public static void LoadSkill()
{
SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
Instance.RegisterEventHandler<EventPlayerHurt>((@event, info) =>
{
var damage = @event.DmgHealth;
var victim = @event.Userid;
var attacker = @event.Attacker;
var weapon = @event.Weapon;
HitGroup_t hitgroup = (HitGroup_t)@event.Hitgroup;
if (!Instance.IsPlayerValid(attacker) || !Instance.IsPlayerValid(victim) || attacker == victim) return HookResult.Continue;
if (nades.Contains(weapon)) return HookResult.Continue;
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == attacker.SteamID);
if (playerInfo?.Skill != skillName) return HookResult.Continue;
if (IsBehind(attacker, victim))
SkillUtils.TakeHealth(victim.PlayerPawn.Value, (int)(damage * (damageMultiplier - 1f)));
return HookResult.Continue;
});
}
private static bool IsBehind(CCSPlayerController attacker, CCSPlayerController victim)
{
var attackerPawn = attacker.PlayerPawn.Value;
var victimPawn = victim.PlayerPawn.Value;
if (attackerPawn == null || !attackerPawn.IsValid || victimPawn == null || !victimPawn.IsValid) return false;
var angles = GetAngleRange(victimPawn.AbsRotation.Y);
return IsBeetween(angles.Item1, angles.Item2, attackerPawn.AbsRotation.Y);
}
private static (float, float) GetAngleRange(float angle)
{
float min = angle - toleranceDeg;
float max = angle + toleranceDeg;
if (min < -180) min += 360f;
if (max > 180f) max -= 360f;
return (min, max);
}
private static bool IsBeetween(float a, float b, float target)
{
if (a <= b)
return (target >= a && target <= b);
return (target >= a || target <= b);
}
public class SkillConfig : Config.DefaultSkillInfo
{
public float DamageMultiplier { get; set; }
public float ToleranceDeg { get; set; }
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#d9d9d9", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false, float damageMultiplier = 2f, float toleranceDeg = 45f) : base(skill, active, color, onlyTeam, needsTeammates)
{
DamageMultiplier = damageMultiplier;
ToleranceDeg = toleranceDeg;
}
}
}
}

View file

@ -9,14 +9,11 @@ namespace jRandomSkills
{ {
public class Astronaut : ISkill public class Astronaut : ISkill
{ {
private static Skills skillName = Skills.Astronaut; private const Skills skillName = Skills.Astronaut;
public static void LoadSkill() public static void LoadSkill()
{ {
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true) SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"), false);
return;
SkillUtils.RegisterSkill(skillName, "#7E10AD", false);
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) => Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
{ {
@ -35,6 +32,13 @@ namespace jRandomSkills
}); });
return HookResult.Continue; return HookResult.Continue;
}); });
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
{
foreach (var player in Utilities.GetPlayers())
DisableSkill(player);
return HookResult.Continue;
});
} }
public static void EnableSkill(CCSPlayerController player) public static void EnableSkill(CCSPlayerController player)
@ -44,17 +48,25 @@ namespace jRandomSkills
public static void DisableSkill(CCSPlayerController player) public static void DisableSkill(CCSPlayerController player)
{ {
player.Pawn.Value.GravityScale = 1; player.Pawn.Value.ActualGravityScale = 1;
} }
private static void ApplyGravityModifier(CCSPlayerController player) private static void ApplyGravityModifier(CCSPlayerController player)
{ {
var skillConfig = Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString()); float gravityModifier = (float)Math.Round(Instance.Random.NextDouble() * (Config.GetValue<float>(skillName, "ChanceTo") - Config.GetValue<float>(skillName, "chanceFrom")) + Config.GetValue<float>(skillName, "chanceFrom"), 1);
if (skillConfig == null) return;
float gravityModifier = (float)Math.Round(Instance.Random.NextDouble() * (skillConfig.ChanceTo - skillConfig.ChanceFrom) + skillConfig.ChanceFrom, 1);
SkillUtils.PrintToChat(player, $"{ChatColors.DarkRed}{Localization.GetTranslation("astronaut")}{ChatColors.Lime}: " + Localization.GetTranslation("astronaut_desc2", gravityModifier), false); SkillUtils.PrintToChat(player, $"{ChatColors.DarkRed}{Localization.GetTranslation("astronaut")}{ChatColors.Lime}: " + Localization.GetTranslation("astronaut_desc2", gravityModifier), false);
player.Pawn.Value.GravityScale = gravityModifier; player.Pawn.Value.ActualGravityScale = gravityModifier;
}
public class SkillConfig : Config.DefaultSkillInfo
{
public float ChanceFrom { get; set; }
public float ChanceTo { get; set; }
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#7E10AD", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false, float chanceFrom = .1f, float chanceTo = .7f) : base(skill, active, color, onlyTeam, needsTeammates)
{
ChanceFrom = chanceFrom;
ChanceTo = chanceTo;
}
} }
} }
} }

View file

@ -0,0 +1,130 @@
using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Entities.Constants;
using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player;
using static jRandomSkills.jRandomSkills;
namespace jRandomSkills
{
public class Baseball : ISkill
{
private const Skills skillName = Skills.Baseball;
private static float speedMultipier = Config.GetValue<float>(skillName, "speedMultipier");
private static float maxSpeed = Config.GetValue<float>(skillName, "maxSpeed");
private static int damageDeal = Config.GetValue<int>(skillName, "damageDeal");
private static HashSet<CDecoyProjectile> decoys = new HashSet<CDecoyProjectile>();
public 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<EventPlayerHurt>((@event, info) =>
{
var victim = @event.Userid;
var attacker = @event.Attacker;
var weapon = @event.Weapon;
if (weapon != "decoy") return HookResult.Continue;
if (!Instance.IsPlayerValid(victim) || !Instance.IsPlayerValid(attacker)) return HookResult.Continue;
var attackerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == attacker.SteamID);
if (attackerInfo?.Skill != skillName) return HookResult.Continue;
SkillUtils.TakeHealth(victim.PlayerPawn.Value, damageDeal);
return HookResult.Continue;
});
Instance.RegisterListener<Listeners.OnEntitySpawned>(@event =>
{
var name = @event.DesignerName;
if (name != "decoy_projectile")
return;
var decoy = @event.As<CDecoyProjectile>();
var pawn = decoy.OwnerEntity.Value.As<CCSPlayerPawn>();
var player = pawn.Controller.Value.As<CCSPlayerController>();
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
if (playerInfo?.Skill != skillName) return;
decoys.Add(decoy);
});
Instance.RegisterEventHandler<EventDecoyStarted>((@event, info) =>
{
var player = @event.Userid;
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
if (playerInfo?.Skill != skillName) return HookResult.Continue;
var decoy = decoys.FirstOrDefault(d => d.Index == @event.Entityid);
if (decoy != null && decoy.IsValid)
decoy.Remove();
return HookResult.Continue;
});
Instance.RegisterListener<Listeners.OnTick>(OnTick);
}
private static void OnTick()
{
foreach (var decoy in decoys)
{
if (decoy == null || !decoy.IsValid)
{
decoys.Remove(decoy);
continue;
}
decoy.Bounces = 0;
if (Server.TickCount % 8 != 0) continue;
var vel = decoy.AbsVelocity;
float speed = vel.Length();
float targetSpeed = Math.Min(speed * speedMultipier, maxSpeed);
if (speed > .01f)
{
var dir = vel / speed;
var newVelocity = dir * targetSpeed;
decoy.AbsVelocity.X = newVelocity.X;
decoy.AbsVelocity.Y = newVelocity.Y;
decoy.AbsVelocity.Z = newVelocity.Z;
}
}
}
public static void EnableSkill(CCSPlayerController player)
{
SkillUtils.TryGiveWeapon(player, CsItem.DecoyGrenade);
}
public class SkillConfig : Config.DefaultSkillInfo
{
public float SpeedMultipier { get; set; }
public float MaxSpeed { get; set; }
public float DamageDeal { get; set; }
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#2effc7", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false, float speedMultipier = 2f, float maxSpeed = 900f, int damageDeal = 9999) : base(skill, active, color, onlyTeam, needsTeammates)
{
SpeedMultipier = speedMultipier;
MaxSpeed = maxSpeed;
DamageDeal = damageDeal;
}
}
}
}

View file

@ -9,14 +9,11 @@ namespace jRandomSkills
{ {
public class Behind : ISkill public class Behind : ISkill
{ {
private static Skills skillName = Skills.Behind; private const Skills skillName = Skills.Behind;
public static void LoadSkill() public static void LoadSkill()
{ {
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true) SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"), false);
return;
SkillUtils.RegisterSkill(skillName, "#00FF00", false);
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) => Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
{ {
@ -57,11 +54,8 @@ namespace jRandomSkills
public static void EnableSkill(CCSPlayerController player) public static void EnableSkill(CCSPlayerController player)
{ {
var skillConfig = Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString());
if (skillConfig == null) return;
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID); var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
float newChance = (float)Instance.Random.NextDouble() * (skillConfig.ChanceTo - skillConfig.ChanceFrom) + skillConfig.ChanceFrom; float newChance = (float)Instance.Random.NextDouble() * (Config.GetValue<float>(skillName, "ChanceTo") - Config.GetValue<float>(skillName, "ChanceFrom")) + Config.GetValue<float>(skillName, "ChanceFrom");
playerInfo.SkillChance = newChance; playerInfo.SkillChance = newChance;
newChance = (float)Math.Round(newChance, 2) * 100; newChance = (float)Math.Round(newChance, 2) * 100;
newChance = (float)Math.Round(newChance); newChance = (float)Math.Round(newChance);
@ -84,5 +78,16 @@ namespace jRandomSkills
player.PlayerPawn.Value.Teleport(currentPosition, newAngles, new Vector(0, 0, 0)); player.PlayerPawn.Value.Teleport(currentPosition, newAngles, new Vector(0, 0, 0));
} }
public class SkillConfig : Config.DefaultSkillInfo
{
public float ChanceFrom { get; set; }
public float ChanceTo { get; set; }
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#00FF00", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false, float chanceFrom = .2f, float chanceTo = .4f) : base(skill, active, color, onlyTeam, needsTeammates)
{
ChanceFrom = chanceFrom;
ChanceTo = chanceTo;
}
}
} }
} }

View file

@ -0,0 +1,75 @@
using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player;
using static jRandomSkills.jRandomSkills;
namespace jRandomSkills
{
public class BladeMaster : ISkill
{
private const Skills skillName = Skills.BladeMaster;
private static string[] noReflectionWeapon = { "inferno", "flashbang", "smokegrenade", "decoy", "hegrenade", "knife" };
private static float torseReflectionChance = Config.GetValue<float>(skillName, "torseReflectionChance") * 100;
private static float legReflectionChance = Config.GetValue<float>(skillName, "legReflectionChance") * 100;
public static void LoadSkill()
{
SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
Instance.RegisterEventHandler<EventPlayerHurt>((@event, info) =>
{
var victim = @event.Userid;
int damage = @event.DmgHealth;
HitGroup_t hitGroup = (HitGroup_t)@event.Hitgroup;
string weapon = @event.Weapon;
if (noReflectionWeapon.Contains(weapon) || !Instance.IsPlayerValid(victim)) return HookResult.Continue;
var victimInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == victim.SteamID);
if (victimInfo == null || victimInfo.Skill != skillName) return HookResult.Continue;
int chance = Instance.Random.Next(0, 101);
if (hitGroup == HitGroup_t.HITGROUP_LEFTLEG || hitGroup == HitGroup_t.HITGROUP_RIGHTLEG)
{
if (chance > legReflectionChance)
return HookResult.Continue;
}
else
if (chance > torseReflectionChance)
return HookResult.Continue;
var pawn = victim.PlayerPawn.Value;
if (pawn == null || !pawn.IsValid) return HookResult.Continue;
var activeWeapon = pawn.WeaponServices.ActiveWeapon.Value;
if (activeWeapon == null || !activeWeapon.IsValid || activeWeapon.DesignerName != "weapon_knife") return HookResult.Continue;
RestoreHealth(victim, damage);
return HookResult.Stop;
});
}
private static void RestoreHealth(CCSPlayerController victim, float damage)
{
var playerPawn = victim.PlayerPawn.Value;
var newHealth = playerPawn.Health + damage;
if (newHealth > 100)
newHealth = 100;
playerPawn.Health = (int)newHealth;
Utilities.SetStateChanged(playerPawn, "CBaseEntity", "m_iHealth");
}
public class SkillConfig : Config.DefaultSkillInfo
{
public float TorseReflectionChance { get; set; }
public float LegReflectionChance { get; set; }
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#cc7504", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false, float torseReflectionChance = .95f, float legReflectionChance = .80f) : base(skill, active, color, onlyTeam, needsTeammates)
{
TorseReflectionChance = torseReflectionChance;
LegReflectionChance = legReflectionChance;
}
}
}
}

View file

@ -9,16 +9,14 @@ namespace jRandomSkills
{ {
public class BunnyHop : ISkill public class BunnyHop : ISkill
{ {
private static Skills skillName = Skills.BunnyHop; private const Skills skillName = Skills.BunnyHop;
private const float MaxSpeed = 500f; private static float maxSpeed = Config.GetValue<float>(skillName, "maxSpeed");
private const float BunnyHopVelocity = 300f; private static float bunnyHopVelocity = Config.GetValue<float>(skillName, "jumpVelocity");
private static float jumpBoost = Config.GetValue<float>(skillName, "jumpBoost");
public static void LoadSkill() public static void LoadSkill()
{ {
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true) SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
return;
SkillUtils.RegisterSkill(skillName, "#EB4034");
Instance.RegisterListener<OnTick>(OnTick); Instance.RegisterListener<OnTick>(OnTick);
} }
@ -27,40 +25,52 @@ namespace jRandomSkills
foreach (var player in Utilities.GetPlayers()) foreach (var player in Utilities.GetPlayers())
{ {
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID); var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
if (playerInfo?.Skill == skillName) if (playerInfo?.Skill == skillName)
{
GiveBunnyHop(player); GiveBunnyHop(player);
} }
} }
}
private static void GiveBunnyHop(CCSPlayerController player) private static void GiveBunnyHop(CCSPlayerController player)
{ {
var playerPawn = player.PlayerPawn.Value; var playerPawn = player.PlayerPawn.Value;
if (playerPawn != null) if (playerPawn == null || !playerPawn.IsValid) return;
{
if (Math.Round(playerPawn.AbsVelocity.Length2D()) > MaxSpeed && MaxSpeed != 0)
ChangeVelocity(playerPawn, MaxSpeed);
var flags = (PlayerFlags)playerPawn.Flags; var flags = (PlayerFlags)playerPawn.Flags;
var buttons = player.Buttons; var buttons = player.Buttons;
if (buttons.HasFlag(PlayerButtons.Jump) && flags.HasFlag(PlayerFlags.FL_ONGROUND) && !playerPawn.MoveType.HasFlag(MoveType_t.MOVETYPE_LADDER)) if (buttons.HasFlag(PlayerButtons.Jump) && flags.HasFlag(PlayerFlags.FL_ONGROUND) && !playerPawn.MoveType.HasFlag(MoveType_t.MOVETYPE_LADDER))
playerPawn.AbsVelocity.Z = BunnyHopVelocity;
}
}
private static void ChangeVelocity(CCSPlayerPawn? pawn, float vel)
{ {
if (pawn == null) return; playerPawn.AbsVelocity.Z = bunnyHopVelocity;
var currentVelocity = new Vector(pawn.AbsVelocity.X, pawn.AbsVelocity.Y, pawn.AbsVelocity.Z); var vX = playerPawn.AbsVelocity.X;
var currentSpeed3D = Math.Sqrt(currentVelocity.X * currentVelocity.X + currentVelocity.Y * currentVelocity.Y + currentVelocity.Z * currentVelocity.Z); var vY = playerPawn.AbsVelocity.Y;
var speed2D = Math.Sqrt(vX * vX + vY * vY);
var scale = 1d;
pawn.AbsVelocity.X = (float)(currentVelocity.X / currentSpeed3D) * vel; if (speed2D < maxSpeed)
pawn.AbsVelocity.Y = (float)(currentVelocity.Y / currentSpeed3D) * vel; {
pawn.AbsVelocity.Z = (float)(currentVelocity.Z / currentSpeed3D) * vel; var newSpeed = Math.Min(speed2D * jumpBoost, maxSpeed);
scale = newSpeed / (speed2D == 0 ? 1 : speed2D);
}
else if (speed2D > maxSpeed)
scale = maxSpeed / speed2D;
playerPawn.AbsVelocity.X = (float)(vX * scale);
playerPawn.AbsVelocity.Y = (float)(vY * scale);
}
}
public class SkillConfig : Config.DefaultSkillInfo
{
public float MaxSpeed { get; set; }
public float JumpVelocity { get; set; }
public float JumpBoost { get; set; }
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#d1430a", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false, float maxSpeed = 500f, float jumpVelocity = 300f, float jumpBoost = 2f) : base(skill, active, color, onlyTeam, needsTeammates)
{
MaxSpeed = maxSpeed;
JumpVelocity = jumpVelocity;
JumpBoost = jumpBoost;
}
} }
} }
} }

View file

@ -1,6 +1,7 @@
using System.Drawing; using System.Drawing;
using CounterStrikeSharp.API; using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player; using jRandomSkills.src.player;
using static jRandomSkills.jRandomSkills; using static jRandomSkills.jRandomSkills;
@ -8,14 +9,11 @@ namespace jRandomSkills
{ {
public class C4Camouflage : ISkill public class C4Camouflage : ISkill
{ {
private static Skills skillName = Skills.C4Camouflage; private const Skills skillName = Skills.C4Camouflage;
public static void LoadSkill() public static void LoadSkill()
{ {
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true) SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
return;
SkillUtils.RegisterSkill(skillName, "#00911f");
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) => Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
{ {
@ -23,6 +21,7 @@ namespace jRandomSkills
{ {
foreach (var player in Utilities.GetPlayers()) foreach (var player in Utilities.GetPlayers())
{ {
DisableSkill(player);
if (!Instance.IsPlayerValid(player)) continue; if (!Instance.IsPlayerValid(player)) continue;
var playerPawn = player.PlayerPawn?.Value; var playerPawn = player.PlayerPawn?.Value;
@ -35,10 +34,15 @@ namespace jRandomSkills
return HookResult.Continue; return HookResult.Continue;
}); });
Instance.RegisterEventHandler<EventRoundEnd>((@event, info) => Instance.RegisterEventHandler<EventPlayerDeath>((@event, info) =>
{ {
foreach (var player in Utilities.GetPlayers()) var player = @event.Userid;
if (!player.IsValid || player.PlayerPawn.Value == null) return HookResult.Continue;
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
if (playerInfo?.Skill == skillName)
DisableSkill(player); DisableSkill(player);
return HookResult.Continue; return HookResult.Continue;
}); });
@ -117,5 +121,12 @@ namespace jRandomSkills
} }
} }
} }
public class SkillConfig : Config.DefaultSkillInfo
{
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#00911f", CsTeam onlyTeam = CsTeam.Terrorist, bool needsTeammates = false) : base(skill, active, color, onlyTeam, needsTeammates)
{
}
}
} }
} }

View file

@ -9,14 +9,11 @@ namespace jRandomSkills
{ {
public class Catapult : ISkill public class Catapult : ISkill
{ {
private static Skills skillName = Skills.Catapult; private const Skills skillName = Skills.Catapult;
public static void LoadSkill() public static void LoadSkill()
{ {
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true) SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"), false);
return;
SkillUtils.RegisterSkill(skillName, "#FF4500", false);
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) => Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
{ {
@ -40,10 +37,7 @@ namespace jRandomSkills
var attacker = @event.Attacker; var attacker = @event.Attacker;
var victim = @event.Userid; var victim = @event.Userid;
if (attacker == null || !attacker.IsValid || victim == null || !victim.IsValid) return HookResult.Continue; if (!Instance.IsPlayerValid(attacker) || !Instance.IsPlayerValid(victim) || attacker == victim) return HookResult.Continue;
if (attacker == victim) return HookResult.Continue;
var attackerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == attacker.SteamID); var attackerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == attacker.SteamID);
if (attackerInfo?.Skill == skillName && victim.PawnIsAlive) if (attackerInfo?.Skill == skillName && victim.PawnIsAlive)
@ -64,15 +58,23 @@ namespace jRandomSkills
public static void EnableSkill(CCSPlayerController player) public static void EnableSkill(CCSPlayerController player)
{ {
var skillConfig = Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString());
if (skillConfig == null) return;
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID); var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
float newChance = (float)Instance.Random.NextDouble() * (skillConfig.ChanceTo - skillConfig.ChanceFrom) + skillConfig.ChanceFrom; float newChance = (float)Instance.Random.NextDouble() * (Config.GetValue<float>(skillName, "chanceTo") - Config.GetValue<float>(skillName, "chanceFrom")) + Config.GetValue<float>(skillName, "chanceFrom");
playerInfo.SkillChance = newChance; playerInfo.SkillChance = newChance;
newChance = (float)Math.Round(newChance, 2) * 100; newChance = (float)Math.Round(newChance, 2) * 100;
newChance = (float)Math.Round(newChance); newChance = (float)Math.Round(newChance);
SkillUtils.PrintToChat(player, $"{ChatColors.DarkRed}{Localization.GetTranslation("catapult")}{ChatColors.Lime}: " + Localization.GetTranslation("catapult_desc2", newChance), false); SkillUtils.PrintToChat(player, $"{ChatColors.DarkRed}{Localization.GetTranslation("catapult")}{ChatColors.Lime}: " + Localization.GetTranslation("catapult_desc2", newChance), false);
} }
public class SkillConfig : Config.DefaultSkillInfo
{
public float ChanceFrom { get; set; }
public float ChanceTo { get; set; }
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#FF4500", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false, float chanceFrom = .2f, float chanceTo = .4f) : base(skill, active, color, onlyTeam, needsTeammates)
{
ChanceFrom = chanceFrom;
ChanceTo = chanceTo;
}
}
} }
} }

View file

@ -11,7 +11,7 @@ namespace jRandomSkills
{ {
public class Chicken : ISkill public class Chicken : ISkill
{ {
private static Skills skillName = Skills.Chicken; private const Skills skillName = Skills.Chicken;
private static string[] disabledWeapons = private static string[] disabledWeapons =
{ {
"weapon_ak47", "weapon_ak47",
@ -44,10 +44,7 @@ namespace jRandomSkills
public static void LoadSkill() public static void LoadSkill()
{ {
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true) SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
return;
SkillUtils.RegisterSkill(skillName, "#FF8B42");
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) => Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
{ {
@ -82,7 +79,13 @@ namespace jRandomSkills
Instance.RegisterEventHandler<EventPlayerDeath>((@event, info) => Instance.RegisterEventHandler<EventPlayerDeath>((@event, info) =>
{ {
DisableSkill(@event.Userid); var player = @event.Userid;
if (!player.IsValid || player.PlayerPawn.Value == null) return HookResult.Continue;
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
if (playerInfo?.Skill == skillName)
DisableSkill(player);
return HookResult.Continue; return HookResult.Continue;
}); });
@ -95,6 +98,13 @@ namespace jRandomSkills
return HookResult.Continue; return HookResult.Continue;
}); });
Instance.RegisterEventHandler<EventRoundStart>((@event, info) =>
{
foreach (var player in Utilities.GetPlayers())
SetWeaponAttack(player, false);
return HookResult.Continue;
});
Instance.RegisterListener<OnTick>(OnTick); Instance.RegisterListener<OnTick>(OnTick);
} }
@ -104,7 +114,6 @@ namespace jRandomSkills
if (playerPawn != null) if (playerPawn != null)
{ {
playerPawn.VelocityModifier = 1.1f; playerPawn.VelocityModifier = 1.1f;
Utilities.SetStateChanged(player, "CCSPlayerPawn", "m_flVelocityModifier");
playerPawn.Health = 50; playerPawn.Health = 50;
Utilities.SetStateChanged(playerPawn, "CBaseEntity", "m_iHealth"); Utilities.SetStateChanged(playerPawn, "CBaseEntity", "m_iHealth");
@ -127,7 +136,6 @@ namespace jRandomSkills
if (playerPawn != null) if (playerPawn != null)
{ {
playerPawn.VelocityModifier = 1f; playerPawn.VelocityModifier = 1f;
Utilities.SetStateChanged(player, "CCSPlayerPawn", "m_flVelocityModifier");
playerPawn.Health += 50; playerPawn.Health += 50;
Utilities.SetStateChanged(playerPawn, "CBaseEntity", "m_iHealth"); Utilities.SetStateChanged(playerPawn, "CBaseEntity", "m_iHealth");
@ -219,5 +227,12 @@ namespace jRandomSkills
var hudContent = infoLine + skillLine + remainingLine; var hudContent = infoLine + skillLine + remainingLine;
player.PrintToCenterHtml(hudContent); player.PrintToCenterHtml(hudContent);
} }
public class SkillConfig : Config.DefaultSkillInfo
{
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#FF8B42", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false) : base(skill, active, color, onlyTeam, needsTeammates)
{
}
}
} }
} }

View file

@ -0,0 +1,50 @@
using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player;
using static jRandomSkills.jRandomSkills;
namespace jRandomSkills
{
public class ChillOut : ISkill
{
private const Skills skillName = Skills.ChillOut;
private static float bombArmedTime = Config.GetValue<float>(skillName, "bombArmedTime");
public static void LoadSkill()
{
SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
Instance.RegisterEventHandler<EventBombBeginplant>((@event, info) =>
{
var player = @event.Userid;
if (!Instance.IsPlayerValid(player)) return HookResult.Continue;
var anyChillOut = Instance.skillPlayer.FirstOrDefault(p => p.Skill == skillName);
if (anyChillOut != null)
{
var bombEntities = Utilities.FindAllEntitiesByDesignerName<CC4>("weapon_c4").ToList();
if (bombEntities.Any())
{
var bomb = bombEntities.FirstOrDefault();
if (bomb != null)
bomb.ArmedTime = Server.CurrentTime + bombArmedTime;
}
}
return HookResult.Continue;
});
}
public class SkillConfig : Config.DefaultSkillInfo
{
public float BombArmedTime { get; set; }
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#343deb", CsTeam onlyTeam = CsTeam.CounterTerrorist, bool needsTeammates = false, float bombArmedTime = 10f) : base(skill, active, color, onlyTeam, needsTeammates)
{
BombArmedTime = bombArmedTime;
}
}
}
}

View file

@ -0,0 +1,41 @@
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player;
using static jRandomSkills.jRandomSkills;
namespace jRandomSkills
{
public class Cutter : ISkill
{
private const Skills skillName = Skills.Cutter;
public static void LoadSkill()
{
SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
Instance.RegisterEventHandler<EventPlayerHurt>((@event, info) =>
{
var damage = @event.DmgHealth;
var attacker = @event.Attacker;
var victim = @event.Userid;
var weapon = @event.Weapon;
if (!Instance.IsPlayerValid(attacker) || !Instance.IsPlayerValid(victim) || attacker == victim) return HookResult.Continue;
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == attacker.SteamID);
if (playerInfo?.Skill != skillName) return HookResult.Continue;
if (weapon == "knife")
SkillUtils.TakeHealth(victim.PlayerPawn.Value, 9999);
return HookResult.Continue;
});
}
public class SkillConfig : Config.DefaultSkillInfo
{
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#88a31a", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false) : base(skill, active, color, onlyTeam, needsTeammates)
{
}
}
}
}

View file

@ -0,0 +1,136 @@
using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player;
using jRandomSkills.src.utils;
using static jRandomSkills.jRandomSkills;
namespace jRandomSkills
{
public class Darkness : ISkill
{
private const Skills skillName = Skills.Darkness;
private static float brightness = Config.GetValue<float>(skillName, "brightness");
private static Dictionary<CCSPlayerController, CPostProcessingVolume> deafultPostProcessing = new Dictionary<CCSPlayerController, CPostProcessingVolume>();
private static List<CPostProcessingVolume> newPostProcessing = new List<CPostProcessingVolume>();
public static void LoadSkill()
{
SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"), false);
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<EventRoundEnd>((@event, info) =>
{
foreach (var player in deafultPostProcessing.Keys)
DisableSkill(player);
foreach (var postProcessing in newPostProcessing)
postProcessing.Remove();
newPostProcessing.Clear();
return HookResult.Continue;
});
Instance.RegisterEventHandler<EventPlayerDeath>((@event, info) =>
{
SetUpPostProcessing(@event.Userid, true);
return HookResult.Continue;
});
}
public static void TypeSkill(CCSPlayerController player, string[] commands)
{
if (player == null || !player.IsValid || !player.PawnIsAlive) return;
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
if (playerInfo?.Skill != skillName) return;
if (playerInfo.SkillChance == 1)
{
player.PrintToChat($" {ChatColors.Red}{Localization.GetTranslation("areareaper_used_info")}");
return;
}
string enemyId = commands[0];
var enemy = Utilities.GetPlayers().FirstOrDefault(p => p.Team != player.Team && p.Index.ToString() == enemyId);
if (enemy == null)
{
player.PrintToChat($" {ChatColors.Red}" + Localization.GetTranslation("selectplayerskill_incorrect_enemy_index"));
return;
}
SetUpPostProcessing(enemy);
playerInfo.SkillChance = 1;
player.PrintToChat($" {ChatColors.Green}" + Localization.GetTranslation("darkness_player_info", enemy.PlayerName));
enemy.PrintToChat($" {ChatColors.Red}" + Localization.GetTranslation("darkness_enemy_info"));
}
public static void EnableSkill(CCSPlayerController player)
{
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
playerInfo.SkillChance = 0;
SkillUtils.PrintToChat(player, Localization.GetTranslation("darkness") + ":", false);
player.PrintToChat($" {ChatColors.Green}{Localization.GetTranslation("darkness_select_info")}");
var enemies = Utilities.GetPlayers().Where(p => p.Team != player.Team && p.IsValid && !p.IsBot).ToArray();
if (enemies.Length > 0)
{
foreach (var enemy in enemies)
player.PrintToChat($" {ChatColors.Green}⠀⠀⠀[{ChatColors.Red}{enemy.Index}{ChatColors.Green}] {enemy.PlayerName}");
}
else
player.PrintToChat($" {ChatColors.Red}⠀⠀⠀{Localization.GetTranslation("selectplayerskill_incorrect_enemy_index")}");
player.PrintToChat($" {ChatColors.Green}{Localization.GetTranslation("selectplayerskill_command")} {ChatColors.Red}index");
}
public static void DisableSkill(CCSPlayerController player)
{
SetUpPostProcessing(player, true);
}
private static void SetUpPostProcessing(CCSPlayerController player, bool dontCreateNew = false)
{
if (deafultPostProcessing.TryGetValue(player, out var oldPostProcessing))
{
player.PlayerPawn.Value.CameraServices.PostProcessingVolumes.FirstOrDefault().Raw = oldPostProcessing.EntityHandle.Raw;
deafultPostProcessing.Remove(player);
Utilities.SetStateChanged(player.PlayerPawn.Value, "CBasePlayerPawn", "m_pCameraServices");
return;
}
if (dontCreateNew)
return;
var postProcessing = Utilities.CreateEntityByName<CPostProcessingVolume>("post_processing_volume");
postProcessing.ExposureControl = true;
postProcessing.MaxExposure = brightness;
postProcessing.MinExposure = brightness;
deafultPostProcessing.TryAdd(player, player.PlayerPawn.Value.CameraServices.PostProcessingVolumes.FirstOrDefault().Value);
player.PlayerPawn.Value.CameraServices.PostProcessingVolumes.FirstOrDefault().Raw = postProcessing.EntityHandle.Raw;
Utilities.SetStateChanged(player.PlayerPawn.Value, "CBasePlayerPawn", "m_pCameraServices");
}
public class SkillConfig : Config.DefaultSkillInfo
{
public float Brightness { get; set; }
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#383838", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false, float brightness = .01f) : base(skill, active, color, onlyTeam, needsTeammates)
{
Brightness = brightness;
}
}
}
}

View file

@ -3,21 +3,17 @@ using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Utils; using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player; using jRandomSkills.src.player;
using jRandomSkills.src.utils; using jRandomSkills.src.utils;
using static CounterStrikeSharp.API.Core.Listeners;
using static jRandomSkills.jRandomSkills; using static jRandomSkills.jRandomSkills;
namespace jRandomSkills namespace jRandomSkills
{ {
public class Deactivator : ISkill public class Deactivator : ISkill
{ {
private static Skills skillName = Skills.Deactivator; private const Skills skillName = Skills.Deactivator;
public static void LoadSkill() public static void LoadSkill()
{ {
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true) SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"), false);
return;
SkillUtils.RegisterSkill(skillName, "#919191", false);
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) => Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
{ {
@ -83,7 +79,7 @@ namespace jRandomSkills
var enemyInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == enemy.SteamID); var enemyInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == enemy.SteamID);
if (enemyInfo == null) continue; if (enemyInfo == null) continue;
var skillData = SkillData.Skills.FirstOrDefault(s => s.Skill == enemyInfo.Skill); var skillData = SkillData.Skills.FirstOrDefault(s => s.Skill == enemyInfo.Skill);
player.PrintToChat($" {ChatColors.Green}⠀⠀⠀{ChatColors.Red}{enemy.Index}{ChatColors.Green}] {enemy.PlayerName}: {ChatColors.Red}{skillData.Name}"); player.PrintToChat($" {ChatColors.Green}⠀⠀⠀[{ChatColors.Red}{enemy.Index}{ChatColors.Green}] {enemy.PlayerName}: {ChatColors.Red}{skillData.Name}");
} }
} }
else else
@ -117,5 +113,12 @@ namespace jRandomSkills
enemy.PrintToChat($" {ChatColors.Red}" + Localization.GetTranslation("deactivator_enemy_info")); enemy.PrintToChat($" {ChatColors.Red}" + Localization.GetTranslation("deactivator_enemy_info"));
} }
} }
public class SkillConfig : Config.DefaultSkillInfo
{
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#919191", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false) : base(skill, active, color, onlyTeam, needsTeammates)
{
}
}
} }
} }

View file

@ -0,0 +1,119 @@
using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player;
using jRandomSkills.src.utils;
using static jRandomSkills.jRandomSkills;
namespace jRandomSkills
{
public class Deaf : ISkill
{
private const Skills skillName = Skills.Deaf;
private static HashSet<CCSPlayerController> deafPlayers = new HashSet<CCSPlayerController>();
public static void LoadSkill()
{
SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"), false);
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
{
deafPlayers.Clear();
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<EventPlayerDeath>((@event, info) =>
{
DisableSkill(@event.Userid);
return HookResult.Continue;
});
Instance.RegisterEventHandler<EventRoundEnd>((@event, info) =>
{
foreach (var player in deafPlayers)
DisableSkill(player);
return HookResult.Continue;
});
Instance.HookUserMessage(208, um =>
{
var soundevent = um.ReadUInt("soundevent_hash");
var userIndex = um.ReadUInt("source_entity_index");
foreach (var player in deafPlayers)
um.Recipients.Remove(player);
return HookResult.Continue;
}, HookMode.Pre);
}
public static void TypeSkill(CCSPlayerController player, string[] commands)
{
if (player == null || !player.IsValid || !player.PawnIsAlive) return;
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
if (playerInfo?.Skill != skillName) return;
if (playerInfo.SkillChance == 1)
{
player.PrintToChat($" {ChatColors.Red}{Localization.GetTranslation("areareaper_used_info")}");
return;
}
string enemyId = commands[0];
var enemy = Utilities.GetPlayers().FirstOrDefault(p => p.Team != player.Team && p.Index.ToString() == enemyId);
if (enemy == null)
{
player.PrintToChat($" {ChatColors.Red}" + Localization.GetTranslation("selectplayerskill_incorrect_enemy_index"));
return;
}
deafPlayers.Add(enemy);
playerInfo.SkillChance = 1;
player.PrintToChat($" {ChatColors.Green}" + Localization.GetTranslation("deaf_player_info", enemy.PlayerName));
enemy.PrintToChat($" {ChatColors.Red}" + Localization.GetTranslation("deaf_enemy_info"));
}
public static void EnableSkill(CCSPlayerController player)
{
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
playerInfo.SkillChance = 0;
SkillUtils.PrintToChat(player, Localization.GetTranslation("deaf") + ":", false);
player.PrintToChat($" {ChatColors.Green}{Localization.GetTranslation("deaf_select_info")}");
var enemies = Utilities.GetPlayers().Where(p => p.Team != player.Team && p.IsValid && !p.IsBot).ToArray();
if (enemies.Length > 0)
{
foreach (var enemy in enemies)
player.PrintToChat($" {ChatColors.Green}⠀⠀⠀[{ChatColors.Red}{enemy.Index}{ChatColors.Green}] {enemy.PlayerName}");
}
else
player.PrintToChat($" {ChatColors.Red}⠀⠀⠀{Localization.GetTranslation("selectplayerskill_incorrect_enemy_index")}");
player.PrintToChat($" {ChatColors.Green}{Localization.GetTranslation("selectplayerskill_command")} {ChatColors.Red}index");
}
public static void DisableSkill(CCSPlayerController player)
{
deafPlayers.Remove(player);
}
public class SkillConfig : Config.DefaultSkillInfo
{
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#dae01f", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false) : base(skill, active, color, onlyTeam, needsTeammates)
{
}
}
}
}

View file

@ -9,14 +9,11 @@ namespace jRandomSkills
{ {
public class Disarmament : ISkill public class Disarmament : ISkill
{ {
private static Skills skillName = Skills.Disarmament; private const Skills skillName = Skills.Disarmament;
public static void LoadSkill() public static void LoadSkill()
{ {
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true) SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"), false);
return;
SkillUtils.RegisterSkill(skillName, "#FF4500", false);
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) => Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
{ {
@ -40,10 +37,7 @@ namespace jRandomSkills
var attacker = @event.Attacker; var attacker = @event.Attacker;
var victim = @event.Userid; var victim = @event.Userid;
if (attacker == null || !attacker.IsValid || victim == null || !victim.IsValid) return HookResult.Continue; if (!Instance.IsPlayerValid(attacker) || !Instance.IsPlayerValid(victim) || attacker == victim) return HookResult.Continue;
if (attacker == victim) return HookResult.Continue;
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == attacker.SteamID); var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == attacker.SteamID);
if (playerInfo?.Skill == skillName && victim.PawnIsAlive) if (playerInfo?.Skill == skillName && victim.PawnIsAlive)
@ -55,7 +49,8 @@ namespace jRandomSkills
var weaponName = weaponServices?.ActiveWeapon?.Value?.DesignerName; var weaponName = weaponServices?.ActiveWeapon?.Value?.DesignerName;
if (weaponName != null && !weaponName.Contains("weapon_knife") && !weaponName.Contains("weapon_c4")) if (weaponName != null && !weaponName.Contains("weapon_knife") && !weaponName.Contains("weapon_c4"))
victim.DropActiveWeapon(); victim.ExecuteClientCommand("slot3");
//victim.DropActiveWeapon();
} }
} }
return HookResult.Continue; return HookResult.Continue;
@ -64,15 +59,23 @@ namespace jRandomSkills
public static void EnableSkill(CCSPlayerController player) public static void EnableSkill(CCSPlayerController player)
{ {
var skillConfig = Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString());
if (skillConfig == null) return;
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID); var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
float newChance = (float)Instance.Random.NextDouble() * (skillConfig.ChanceTo - skillConfig.ChanceFrom) + skillConfig.ChanceFrom; float newChance = (float)Instance.Random.NextDouble() * (Config.GetValue<float>(skillName, "chanceTo") - Config.GetValue<float>(skillName, "chanceFrom")) + Config.GetValue<float>(skillName, "chanceFrom");
playerInfo.SkillChance = newChance; playerInfo.SkillChance = newChance;
newChance = (float)Math.Round(newChance, 2) * 100; newChance = (float)Math.Round(newChance, 2) * 100;
newChance = (float)Math.Round(newChance); newChance = (float)Math.Round(newChance);
SkillUtils.PrintToChat(player, $"{ChatColors.DarkRed}{Localization.GetTranslation("disarmament")}{ChatColors.Lime}: " + Localization.GetTranslation("disarmament_desc2", newChance), false); SkillUtils.PrintToChat(player, $"{ChatColors.DarkRed}{Localization.GetTranslation("disarmament")}{ChatColors.Lime}: " + Localization.GetTranslation("disarmament_desc2", newChance), false);
} }
public class SkillConfig : Config.DefaultSkillInfo
{
public float ChanceFrom { get; set; }
public float ChanceTo { get; set; }
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#FF4500", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false, float chanceFrom = .65f, float chanceTo = .85f) : base(skill, active, color, onlyTeam, needsTeammates)
{
ChanceFrom = chanceFrom;
ChanceTo = chanceTo;
}
}
} }
} }

View file

@ -0,0 +1,98 @@
using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player;
using jRandomSkills.src.utils;
using static jRandomSkills.jRandomSkills;
namespace jRandomSkills
{
public class Distancer : ISkill
{
private const Skills skillName = Skills.Distancer;
private static HashSet<CCSPlayerController> distancerPlayers = new HashSet<CCSPlayerController>();
public 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<EventRoundEnd>((@event, info) =>
{
foreach (var player in distancerPlayers)
DisableSkill(player);
return HookResult.Continue;
});
Instance.RegisterListener<Listeners.OnTick>(OnTick);
}
private static void OnTick()
{
foreach (var player in distancerPlayers)
{
var playerPawn = player.PlayerPawn.Value;
if (playerPawn == null || !playerPawn.IsValid) return;
if (playerPawn.LifeState != (byte)LifeState_t.LIFE_ALIVE) return;
var skillData = SkillData.Skills.FirstOrDefault(s => s.Skill == skillName);
if (skillData == null) return;
string closetEnemy = "Bot";
double closetDistance = double.MaxValue;
foreach (var enemy in Utilities.GetPlayers().Where(p => p.Team != player.Team))
{
var enemyPawn = enemy.PlayerPawn.Value;
if (enemyPawn == null || !enemyPawn.IsValid) continue;
if (enemyPawn.LifeState != (byte)LifeState_t.LIFE_ALIVE) continue;
double distance = (int)SkillUtils.GetDistance(playerPawn.AbsOrigin, enemyPawn.AbsOrigin);
if (distance >= closetDistance) continue;
closetDistance = distance;
closetEnemy = enemy.PlayerName;
}
string distanceColor = closetDistance > 1500 ? "#00FF00" : closetDistance > 600 ? "#FFFF00" : "#FF0000";
string infoLine = $"<font class='fontSize-l' class='fontWeight-Bold' color='#FFFFFF'>{Localization.GetTranslation("your_skill")}:</font> <br>";
string skillLine = $"<font class='fontSize-l' class='fontWeight-Bold' color='{skillData.Color}'>{skillData.Name}</font> <br>";
string remainingLine = $"<font class='fontSize-m' color='#FFFFFF'>{closetEnemy}: <font color='{distanceColor}'>{closetDistance}</font></font> <br>";
var hudContent = infoLine + skillLine + remainingLine;
player.PrintToCenterHtml(hudContent);
}
}
public static void EnableSkill(CCSPlayerController player)
{
distancerPlayers.Add(player);
}
public static void DisableSkill(CCSPlayerController player)
{
distancerPlayers.Remove(player);
}
public class SkillConfig : Config.DefaultSkillInfo
{
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#00f2ff", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false) : base(skill, active, color, onlyTeam, needsTeammates)
{
}
}
}
}

View file

@ -1,5 +1,6 @@
using CounterStrikeSharp.API; using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player; using jRandomSkills.src.player;
using static jRandomSkills.jRandomSkills; using static jRandomSkills.jRandomSkills;
@ -7,21 +8,19 @@ namespace jRandomSkills
{ {
public class Dracula : ISkill public class Dracula : ISkill
{ {
private static Skills skillName = Skills.Dracula; private const Skills skillName = Skills.Dracula;
private static float healthRegainScale = Config.GetValue<float>(skillName, "healthRegainScale");
public static void LoadSkill() public static void LoadSkill()
{ {
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true) SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
return;
SkillUtils.RegisterSkill(skillName, "#FA050D");
Instance.RegisterEventHandler<EventPlayerHurt>((@event, info) => Instance.RegisterEventHandler<EventPlayerHurt>((@event, info) =>
{ {
var attacker = @event.Attacker; var attacker = @event.Attacker;
var victim = @event.Userid; var victim = @event.Userid;
if (!Instance.IsPlayerValid(attacker) || attacker == victim) return HookResult.Continue; if (!Instance.IsPlayerValid(attacker) || !Instance.IsPlayerValid(victim) || attacker == victim) return HookResult.Continue;
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == attacker.SteamID); var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == attacker.SteamID);
@ -38,7 +37,7 @@ namespace jRandomSkills
var attackerPawn = attacker.PlayerPawn.Value; var attackerPawn = attacker.PlayerPawn.Value;
if (attackerPawn == null) return; if (attackerPawn == null) return;
int newHealth = (int)(attackerPawn.Health + (damage * 0.3)); int newHealth = (int)(attackerPawn.Health + (damage * healthRegainScale));
attackerPawn.MaxHealth = Math.Max(newHealth, 100); attackerPawn.MaxHealth = Math.Max(newHealth, 100);
Utilities.SetStateChanged(attackerPawn, "CBaseEntity", "m_iMaxHealth"); Utilities.SetStateChanged(attackerPawn, "CBaseEntity", "m_iMaxHealth");
@ -46,5 +45,14 @@ namespace jRandomSkills
attackerPawn.Health = newHealth; attackerPawn.Health = newHealth;
Utilities.SetStateChanged(attackerPawn, "CBaseEntity", "m_iHealth"); Utilities.SetStateChanged(attackerPawn, "CBaseEntity", "m_iHealth");
} }
public class SkillConfig : Config.DefaultSkillInfo
{
public float HealthRegainScale { get; set; }
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#FA050D", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false, float healthRegainScale = .3f) : base(skill, active, color, onlyTeam, needsTeammates)
{
HealthRegainScale = healthRegainScale;
}
}
} }
} }

View file

@ -9,14 +9,11 @@ namespace jRandomSkills
{ {
public class Duplicator : ISkill public class Duplicator : ISkill
{ {
private static Skills skillName = Skills.Duplicator; private const Skills skillName = Skills.Duplicator;
public static void LoadSkill() public static void LoadSkill()
{ {
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true) SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"), false);
return;
SkillUtils.RegisterSkill(skillName, "#ffb73b", false);
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) => Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
{ {
@ -98,5 +95,12 @@ namespace jRandomSkills
player.PrintToChat($" {ChatColors.Green}" + Localization.GetTranslation("duplicator_player_info", enemy.PlayerName)); player.PrintToChat($" {ChatColors.Green}" + Localization.GetTranslation("duplicator_player_info", enemy.PlayerName));
} }
} }
public class SkillConfig : Config.DefaultSkillInfo
{
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#ffb73b", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false) : base(skill, active, color, onlyTeam, needsTeammates)
{
}
}
} }
} }

View file

@ -9,14 +9,11 @@ namespace jRandomSkills
{ {
public class Dwarf : ISkill public class Dwarf : ISkill
{ {
private static Skills skillName = Skills.Dwarf; private const Skills skillName = Skills.Dwarf;
public static void LoadSkill() public static void LoadSkill()
{ {
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true) SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"), false);
return;
SkillUtils.RegisterSkill(skillName, "#ffff00", false);
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) => Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
{ {
@ -62,16 +59,12 @@ namespace jRandomSkills
var playerPawn = player.PlayerPawn?.Value; var playerPawn = player.PlayerPawn?.Value;
if (playerPawn != null) if (playerPawn != null)
{ {
var skillConfig = Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString()); float newSize = (float)Instance.Random.NextDouble() * (Config.GetValue<float>(skillName, "maxScale") - Config.GetValue<float>(skillName, "minScale")) + Config.GetValue<float>(skillName, "minScale");
if (skillConfig == null) return;
float newSize = (float)Instance.Random.NextDouble() * (skillConfig.ChanceTo - skillConfig.ChanceFrom) + skillConfig.ChanceFrom;
newSize = (float)Math.Round(newSize, 2); newSize = (float)Math.Round(newSize, 2);
// playerPawn.CBodyComponent.SceneNode.GetSkeletonInstance().Scale = newSize; // playerPawn.CBodyComponent.SceneNode.GetSkeletonInstance().Scale = newSize;
player.PlayerPawn.Value.CBodyComponent.SceneNode.Scale = newSize; playerPawn.CBodyComponent.SceneNode.Scale = newSize;
Utilities.SetStateChanged(playerPawn, "CBaseEntity", "m_CBodyComponent"); Utilities.SetStateChanged(playerPawn, "CBaseEntity", "m_CBodyComponent");
SkillUtils.PrintToChat(player, $"{ChatColors.DarkRed}{Localization.GetTranslation("dwarf")}{ChatColors.Lime}: " + Localization.GetTranslation("dwarf_desc2", newSize), false); SkillUtils.PrintToChat(player, $"{ChatColors.DarkRed}{Localization.GetTranslation("dwarf")}{ChatColors.Lime}: " + Localization.GetTranslation("dwarf_desc2", newSize), false);
} }
} }
@ -82,9 +75,21 @@ namespace jRandomSkills
if (playerPawn != null && playerPawn?.CBodyComponent != null) if (playerPawn != null && playerPawn?.CBodyComponent != null)
{ {
// playerPawn.CBodyComponent.SceneNode.GetSkeletonInstance().Scale = 1; // playerPawn.CBodyComponent.SceneNode.GetSkeletonInstance().Scale = 1;
player.PlayerPawn.Value.CBodyComponent.SceneNode.Scale = 1; playerPawn.CBodyComponent.SceneNode.Scale = 1;
Utilities.SetStateChanged(playerPawn, "CBaseEntity", "m_CBodyComponent"); Utilities.SetStateChanged(playerPawn, "CBaseEntity", "m_CBodyComponent");
} }
} }
public class SkillConfig : Config.DefaultSkillInfo
{
public float MinScale { get; set; }
public float MaxScale { get; set; }
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#ffff00", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false, float minScale = .6f, float maxScale = .95f) : base(skill, active, color, onlyTeam, needsTeammates)
{
MinScale = minScale;
MaxScale = maxScale;
}
}
} }
} }

View file

@ -10,16 +10,13 @@ namespace jRandomSkills
{ {
public class EnemySpawn : ISkill public class EnemySpawn : ISkill
{ {
private static Skills skillName = Skills.EnemySpawn; private const Skills skillName = Skills.EnemySpawn;
private static float timerCooldown = (float)(Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Cooldown); private static float timerCooldown = Config.GetValue<float>(skillName, "cooldown");
private static readonly Dictionary<ulong, PlayerSkillInfo> SkillPlayerInfo = new Dictionary<ulong, PlayerSkillInfo>(); private static readonly Dictionary<ulong, PlayerSkillInfo> SkillPlayerInfo = new Dictionary<ulong, PlayerSkillInfo>();
public static void LoadSkill() public static void LoadSkill()
{ {
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true) SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
return;
SkillUtils.RegisterSkill(skillName, "#ff8c92");
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) => Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
{ {
@ -123,14 +120,6 @@ namespace jRandomSkills
player.PrintToCenterHtml(hudContent); player.PrintToCenterHtml(hudContent);
} }
private static void ActiveUse(CCSPlayerController player)
{
if (SkillPlayerInfo.TryGetValue(player.SteamID, out var skillInfo))
{
skillInfo.CanUse = true;
}
}
public static void UseSkill(CCSPlayerController player) public static void UseSkill(CCSPlayerController player)
{ {
var playerPawn = player.PlayerPawn.Value; var playerPawn = player.PlayerPawn.Value;
@ -169,5 +158,14 @@ namespace jRandomSkills
public DateTime Cooldown { get; set; } public DateTime Cooldown { get; set; }
public DateTime LastClick { get; set; } public DateTime LastClick { get; set; }
} }
public class SkillConfig : Config.DefaultSkillInfo
{
public float Cooldown { get; set; }
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#ff8c92", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false, float cooldown = 15f) : base(skill, active, color, onlyTeam, needsTeammates)
{
Cooldown = cooldown;
}
}
} }
} }

View file

@ -0,0 +1,106 @@
using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Memory;
using CounterStrikeSharp.API.Modules.Memory.DynamicFunctions;
using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player;
using jRandomSkills.src.utils;
using static jRandomSkills.jRandomSkills;
namespace jRandomSkills
{
public class ExplosiveShot : ISkill
{
private const Skills skillName = Skills.ExplosiveShot;
private static float damage = Config.GetValue<float>(skillName, "damage");
private static float damageRadius = Config.GetValue<float>(skillName, "damageRadius");
public static void LoadSkill()
{
SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"), false);
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;
});
VirtualFunctions.CBaseEntity_TakeDamageOldFunc.Hook(OnTakeDamage, HookMode.Pre);
}
public static void EnableSkill(CCSPlayerController player)
{
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
float newChance = (float)Instance.Random.NextDouble() * (Config.GetValue<float>(skillName, "ChanceTo") - Config.GetValue<float>(skillName, "ChanceFrom")) + Config.GetValue<float>(skillName, "ChanceFrom");
playerInfo.SkillChance = newChance;
newChance = (float)Math.Round(newChance, 2) * 100;
newChance = (float)Math.Round(newChance);
SkillUtils.PrintToChat(player, $"{ChatColors.DarkRed}{Localization.GetTranslation("explosiveshot")}{ChatColors.Lime}: " + Localization.GetTranslation("explosiveshot_desc2", newChance), false);
}
private static void SpawnExplosion(Vector vector)
{
var heProjectile = Utilities.CreateEntityByName<CHEGrenadeProjectile>("hegrenade_projectile");
if (heProjectile == null || !heProjectile.IsValid) return;
Vector pos = vector;
heProjectile.TicksAtZeroVelocity = 100;
heProjectile.TeamNum = (byte)CsTeam.None;
heProjectile.Damage = damage;
heProjectile.DmgRadius = damageRadius;
heProjectile.Teleport(pos, null, new Vector(0, 0, -10));
heProjectile.DispatchSpawn();
heProjectile.AcceptInput("InitializeSpawnFromWorld", null, null, "");
heProjectile.DetonateTime = 0;
}
private static HookResult 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 HookResult.Continue;
CCSPlayerPawn attackerPawn = new CCSPlayerPawn(param2.Attacker.Value.Handle);
if (attackerPawn.DesignerName != "player")
return HookResult.Continue;
if (attackerPawn == null || attackerPawn.Controller?.Value == null)
return HookResult.Continue;
CCSPlayerController attacker = attackerPawn.Controller.Value.As<CCSPlayerController>();
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == attacker.SteamID);
if (playerInfo == null || playerInfo.Skill != skillName) return HookResult.Continue;
if (Instance.Random.NextDouble() <= playerInfo.SkillChance)
SpawnExplosion(param2.DamagePosition);
return HookResult.Continue;
}
public class SkillConfig : Config.DefaultSkillInfo
{
public float Damage { get; set; }
public float DamageRadius { get; set; }
public float ChanceFrom { get; set; }
public float ChanceTo { get; set; }
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#9c0000", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false, float damage = 10f, float damageRadius = 190f, float chanceFrom = .15f, float chanceTo = .3f) : base(skill, active, color, onlyTeam, needsTeammates)
{
Damage = damage;
DamageRadius = damageRadius;
ChanceFrom = chanceFrom;
ChanceTo = chanceTo;
}
}
}
}

View file

@ -0,0 +1,147 @@
using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player;
using System.Drawing;
using static jRandomSkills.jRandomSkills;
namespace jRandomSkills
{
public class FalconEye : ISkill
{
private const Skills skillName = Skills.FalconEye;
private static bool blocked = false;
private static float distance = Config.GetValue<float>(skillName, "distance");
private static Dictionary<ulong, (uint, CDynamicProp)> cameras = new Dictionary<ulong, (uint, CDynamicProp)>();
public static void LoadSkill()
{
SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
Instance.RegisterEventHandler<EventRoundEnd>((@event, info) =>
{
blocked = true;
foreach (var player in Utilities.GetPlayers())
if (cameras.TryGetValue(player.SteamID, out _))
DisableSkill(player);
foreach (var camera in cameras)
camera.Value.Item2.Remove();
cameras.Clear();
return HookResult.Continue;
});
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
{
blocked = false;
return HookResult.Continue;
});
Instance.RegisterEventHandler<EventItemPickup>((@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;
if (cameras.TryGetValue(player.SteamID, out var cameraInfo) && cameraInfo.Item1 == player.PlayerPawn.Value.CameraServices!.ViewEntity!.Raw)
BlockWeapon(player, true);
return HookResult.Continue;
});
Instance.RegisterListener<Listeners.OnTick>(OnTick);
}
public static void UseSkill(CCSPlayerController player)
{
var playerPawn = player.PlayerPawn.Value;
if (playerPawn?.CBodyComponent == null || blocked) return;
ChangeCamera(player);
}
public static void DisableSkill(CCSPlayerController player)
{
ChangeCamera(player, true);
}
private static void OnTick()
{
foreach (var player in Utilities.GetPlayers())
if (cameras.TryGetValue(player.SteamID, out var cameraInfo) && cameraInfo.Item2.IsValid)
{
var pawn = player.PlayerPawn.Value;
if (pawn.LifeState != (byte)LifeState_t.LIFE_ALIVE)
{
ChangeCamera(player, true);
continue;
}
Vector pos = new Vector(pawn.AbsOrigin.X, pawn.AbsOrigin.Y, pawn.AbsOrigin.Z + 1000);
QAngle angle = new QAngle(90, 0, -pawn.V_angle.Y);
cameraInfo.Item2.Teleport(pos, angle);
}
}
private static void ChangeCamera(CCSPlayerController player, bool forceToDefault = false)
{
uint orginalCameraRaw;
uint newCameraRaw;
var pawn = player.PlayerPawn.Value;
if (cameras.TryGetValue(player.SteamID, out var cameraInfo) && cameraInfo.Item2.IsValid)
{
orginalCameraRaw = cameraInfo.Item1;
newCameraRaw = cameraInfo.Item2.EntityHandle.Raw;
}
else
{
orginalCameraRaw = pawn!.CameraServices!.ViewEntity.Raw;
newCameraRaw = CreateCamera(player);
}
if (newCameraRaw == 0)
return;
bool defaultCam = forceToDefault ? true : (pawn.CameraServices!.ViewEntity!.Raw == orginalCameraRaw ? false : true);
pawn!.CameraServices!.ViewEntity.Raw = defaultCam ? orginalCameraRaw : newCameraRaw;
Utilities.SetStateChanged(pawn, "CBasePlayerPawn", "m_pCameraServices");
BlockWeapon(player, !defaultCam);
}
private static uint CreateCamera(CCSPlayerController player)
{
var camera = Utilities.CreateEntityByName<CDynamicProp>("prop_dynamic");
if (camera == null || !camera.IsValid) return 0;
var pawn = player.PlayerPawn.Value;
Vector pos = new Vector(pawn.AbsOrigin.X, pawn.AbsOrigin.Y, pawn.AbsOrigin.Z + distance);
camera.Render = Color.FromArgb(0, 255, 255, 255);
camera.Teleport(pos, new QAngle(90, 0, 0));
camera.DispatchSpawn();
cameras[player.SteamID] = (pawn.CameraServices!.ViewEntity.Raw, camera);
return camera.EntityHandle.Raw;
}
private static void BlockWeapon(CCSPlayerController player, bool block)
{
foreach (var weapon in player.Pawn.Value.WeaponServices?.MyWeapons)
if (weapon != null && weapon.IsValid && weapon.Value != null && weapon.Value.IsValid)
{
weapon.Value.NextPrimaryAttackTick = block ? int.MaxValue : Server.TickCount;
weapon.Value.NextSecondaryAttackTick = block ? int.MaxValue : Server.TickCount;
Utilities.SetStateChanged(weapon.Value, "CBasePlayerWeapon", "m_nNextPrimaryAttackTick");
Utilities.SetStateChanged(weapon.Value, "CBasePlayerWeapon", "m_nNextSecondaryAttackTick");
}
}
public class SkillConfig : Config.DefaultSkillInfo
{
public float Distance { get; set; }
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#d1f542", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false, float distance = 1000f) : base(skill, active, color, onlyTeam, needsTeammates)
{
Distance = distance;
}
}
}
}

View file

@ -0,0 +1,46 @@
using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player;
using static jRandomSkills.jRandomSkills;
namespace jRandomSkills
{
public class FastReload : ISkill
{
private const Skills skillName = Skills.FastReload;
public static void LoadSkill()
{
SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
}
public static void UseSkill(CCSPlayerController player)
{
var playerPawn = player.PlayerPawn.Value;
if (playerPawn?.CBodyComponent == null) return;
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
if (playerInfo?.Skill != skillName) return;
if (!player.IsValid || !player.PawnIsAlive) return;
InstaReload(playerPawn);
}
private static void InstaReload(CCSPlayerPawn pawn)
{
var activeWeapon = pawn.WeaponServices.ActiveWeapon.Value;
if (activeWeapon == null || !activeWeapon.IsValid) return;
activeWeapon.Clip1 = activeWeapon.VData.MaxClip1;
Utilities.SetStateChanged(activeWeapon, "CBasePlayerWeapon", "m_iClip1");
}
public class SkillConfig : Config.DefaultSkillInfo
{
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#ffc061", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false, float distance = 1000f) : base(skill, active, color, onlyTeam, needsTeammates)
{
}
}
}
}

View file

@ -10,14 +10,11 @@ namespace jRandomSkills
{ {
public class Flash : ISkill public class Flash : ISkill
{ {
private static Skills skillName = Skills.Flash; private const Skills skillName = Skills.Flash;
public static void LoadSkill() public static void LoadSkill()
{ {
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true) SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"), false);
return;
SkillUtils.RegisterSkill(skillName, "#A31912", false);
Instance.RegisterListener<OnTick>(UpdateSpeed); Instance.RegisterListener<OnTick>(UpdateSpeed);
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) => Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
@ -30,8 +27,6 @@ namespace jRandomSkills
var playerPawn = player.PlayerPawn?.Value; var playerPawn = player.PlayerPawn?.Value;
playerPawn.VelocityModifier = 1; playerPawn.VelocityModifier = 1;
Utilities.SetStateChanged(playerPawn, "CCSPlayerPawn", "m_flVelocityModifier");
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID); var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
if (playerInfo?.Skill != skillName) continue; if (playerInfo?.Skill != skillName) continue;
EnableSkill(player); EnableSkill(player);
@ -74,12 +69,11 @@ namespace jRandomSkills
var skillConfig = Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString()); var skillConfig = Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString());
if (skillConfig == null) return; if (skillConfig == null) return;
float newSpeed = (float)Instance.Random.NextDouble() * (skillConfig.ChanceTo - skillConfig.ChanceFrom) + skillConfig.ChanceFrom; float newSpeed = (float)Instance.Random.NextDouble() * (Config.GetValue<float>(skillName, "ChanceTo") - Config.GetValue<float>(skillName, "ChanceFrom")) + Config.GetValue<float>(skillName, "ChanceFrom");
newSpeed = (float)Math.Round(newSpeed, 2); newSpeed = (float)Math.Round(newSpeed, 2);
playerInfo.SkillChance = newSpeed; playerInfo.SkillChance = newSpeed;
playerPawn.VelocityModifier = newSpeed; playerPawn.VelocityModifier = newSpeed;
Utilities.SetStateChanged(playerPawn, "CCSPlayerPawn", "m_flVelocityModifier");
SkillUtils.PrintToChat(player, $"{ChatColors.DarkRed}{Localization.GetTranslation("flash")}{ChatColors.Lime}: " + Localization.GetTranslation("flash_desc2", newSpeed), false); SkillUtils.PrintToChat(player, $"{ChatColors.DarkRed}{Localization.GetTranslation("flash")}{ChatColors.Lime}: " + Localization.GetTranslation("flash_desc2", newSpeed), false);
} }
@ -88,7 +82,6 @@ namespace jRandomSkills
var playerPawn = player.PlayerPawn.Value; var playerPawn = player.PlayerPawn.Value;
if (playerPawn == null) return; if (playerPawn == null) return;
playerPawn.VelocityModifier = 1; playerPawn.VelocityModifier = 1;
Utilities.SetStateChanged(playerPawn, "CCSPlayerPawn", "m_flVelocityModifier");
} }
private static void UpdateSpeed() private static void UpdateSpeed()
@ -102,10 +95,18 @@ namespace jRandomSkills
var playerPawn = player.PlayerPawn?.Value; var playerPawn = player.PlayerPawn?.Value;
if (playerPawn != null && playerPawn.VelocityModifier != 0) if (playerPawn != null && playerPawn.VelocityModifier != 0)
{
playerPawn.VelocityModifier = Math.Max((float)playerInfo?.SkillChance, 1); playerPawn.VelocityModifier = Math.Max((float)playerInfo?.SkillChance, 1);
Utilities.SetStateChanged(playerPawn, "CCSPlayerPawn", "m_flVelocityModifier"); }
} }
public class SkillConfig : Config.DefaultSkillInfo
{
public float ChanceFrom { get; set; }
public float ChanceTo { get; set; }
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#A31912", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false, float chanceFrom = 1.2f, float chanceTo = 3.0f) : base(skill, active, color, onlyTeam, needsTeammates)
{
ChanceFrom = chanceFrom;
ChanceTo = chanceTo;
} }
} }
} }

View file

@ -0,0 +1,191 @@
using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Memory;
using CounterStrikeSharp.API.Modules.Memory.DynamicFunctions;
using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player;
using jRandomSkills.src.utils;
using static CounterStrikeSharp.API.Core.Listeners;
using static jRandomSkills.jRandomSkills;
namespace jRandomSkills
{
public class Fortnite : ISkill
{
private const Skills skillName = Skills.Fortnite;
private static float timerCooldown = Config.GetValue<float>(skillName, "Cooldown");
private const string propModel = "models/props/de_aztec/hr_aztec/aztec_scaffolding/aztec_scaffold_wall_support_128.vmdl";
private static readonly Dictionary<ulong, PlayerSkillInfo> SkillPlayerInfo = new Dictionary<ulong, PlayerSkillInfo>();
public 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)) return;
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
if (playerInfo?.Skill == skillName)
EnableSkill(player);
}
});
return HookResult.Continue;
});
Instance.RegisterEventHandler<EventRoundEnd>((@event, info) =>
{
SkillPlayerInfo.Clear();
return HookResult.Continue;
});
Instance.RegisterEventHandler<EventPlayerDeath>((@event, info) =>
{
var player = @event.Userid;
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
if (playerInfo?.Skill == skillName)
if (SkillPlayerInfo.ContainsKey(player.SteamID))
SkillPlayerInfo.Remove(player.SteamID);
return HookResult.Continue;
});
Instance.RegisterListener<OnTick>(() =>
{
foreach (var player in Utilities.GetPlayers())
{
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
if (playerInfo?.Skill == skillName)
if (SkillPlayerInfo.TryGetValue(player.SteamID, out var skillInfo))
UpdateHUD(player, skillInfo);
}
});
Instance.RegisterListener<OnServerPrecacheResources>((ResourceManifest manifest) =>
{
manifest.AddResource(propModel);
});
VirtualFunctions.CBaseEntity_TakeDamageOldFunc.Hook(OnTakeDamage, HookMode.Pre);
}
public static void EnableSkill(CCSPlayerController player)
{
SkillPlayerInfo[player.SteamID] = new PlayerSkillInfo
{
SteamID = player.SteamID,
CanUse = true,
Cooldown = DateTime.MinValue,
LastClick = DateTime.MinValue,
};
}
public static void DisableSkill(CCSPlayerController player)
{
if (SkillPlayerInfo.ContainsKey(player.SteamID))
SkillPlayerInfo.Remove(player.SteamID);
}
private static void UpdateHUD(CCSPlayerController player, PlayerSkillInfo skillInfo)
{
float cooldown = 0;
if (skillInfo != null)
{
float time = (int)(skillInfo.Cooldown.AddSeconds(timerCooldown) - DateTime.Now).TotalSeconds;
cooldown = Math.Max(time, 0);
if (cooldown == 0 && skillInfo?.CanUse == false)
skillInfo.CanUse = true;
}
var skillData = SkillData.Skills.FirstOrDefault(s => s.Skill == skillName);
if (skillData == null) return;
string infoLine = $"<font class='fontSize-l' class='fontWeight-Bold' color='#FFFFFF'>{Localization.GetTranslation("your_skill")}:</font> <br>";
string skillLine = $"<font class='fontSize-l' class='fontWeight-Bold' color='{skillData.Color}'>{skillData.Name}</font> <br>";
string remainingLine = cooldown != 0 ? $"<font class='fontSize-m' color='#FFFFFF'>{Localization.GetTranslation("hud_info", $"<font color='#FF0000'>{cooldown}</font>")}</font> <br>" : "";
var hudContent = infoLine + skillLine + remainingLine;
player.PrintToCenterHtml(hudContent);
}
public static void UseSkill(CCSPlayerController player)
{
var playerPawn = player.PlayerPawn.Value;
if (playerPawn?.CBodyComponent == null) return;
if (SkillPlayerInfo.TryGetValue(player.SteamID, out var skillInfo))
{
if (!player.IsValid || !player.PawnIsAlive) return;
if (skillInfo.CanUse)
{
skillInfo.CanUse = false;
skillInfo.Cooldown = DateTime.Now;
CreateBox(player);
}
else
skillInfo.LastClick = DateTime.Now;
}
}
private static void CreateBox(CCSPlayerController player)
{
var playerPawn = player.PlayerPawn.Value;
var box = Utilities.CreateEntityByName<CDynamicProp>("prop_dynamic_override");
if (box == null) return;
float distance = 50;
Vector pos = playerPawn.AbsOrigin + SkillUtils.GetForwardVector(playerPawn.AbsRotation) * distance;
QAngle angle = new QAngle(playerPawn.AbsRotation.X, playerPawn.AbsRotation.Y + 90, playerPawn.AbsRotation.Z);
box.Entity.Name = box.Globalname = $"FortniteWall_{Server.TickCount}";
box.Collision.SolidType = SolidType_t.SOLID_VPHYSICS;
box.CBodyComponent!.SceneNode!.Owner!.Entity!.Flags = (uint)(box.CBodyComponent!.SceneNode!.Owner!.Entity!.Flags & ~(1 << 2));
box.DispatchSpawn();
Server.NextFrame(() =>
{
box.SetModel(propModel);
box.Teleport(pos, angle, null);
});
}
private static HookResult 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 HookResult.Continue;
if (string.IsNullOrEmpty(param.Entity.Name)) return HookResult.Continue;
if (!param.Entity.Name.StartsWith("FortniteWall")) return HookResult.Continue;
var box = param.As<CDynamicProp>();
if (box == null || !box.IsValid) return HookResult.Continue;
box.EmitSound("Wood_Plank.BulletImpact", volume: 1f);
box.Remove();
return HookResult.Continue;
}
public class PlayerSkillInfo
{
public ulong SteamID { get; set; }
public bool CanUse { get; set; }
public DateTime Cooldown { get; set; }
public DateTime LastClick { get; set; }
}
public class SkillConfig : Config.DefaultSkillInfo
{
public float Cooldown { get; set; }
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#1b04cc", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false, float cooldown = 2f) : base(skill, active, color, onlyTeam, needsTeammates)
{
Cooldown = cooldown;
}
}
}
}

View file

@ -0,0 +1,131 @@
using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Entities.Constants;
using CounterStrikeSharp.API.Modules.Memory;
using CounterStrikeSharp.API.Modules.Memory.DynamicFunctions;
using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player;
using jRandomSkills.src.utils;
using static jRandomSkills.jRandomSkills;
namespace jRandomSkills
{
public class FragileBomb : ISkill
{
private const Skills skillName = Skills.FragileBomb;
private static int bombHealth = Config.GetValue<int>(skillName, "maxBombHealth");
private static int maxBombHealth = Config.GetValue<int>(skillName, "maxBombHealth");
private static CPlantedC4 plantedC4;
private static CTriggerMultiple triggerC4;
public static void LoadSkill()
{
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true)
return;
SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
{
bombHealth = maxBombHealth;
plantedC4 = null;
triggerC4 = null;
return HookResult.Continue;
});
Instance.RegisterEventHandler<EventBombPlanted>((@event, info) =>
{
var plantedBomb = Utilities.FindAllEntitiesByDesignerName<CPlantedC4>("planted_c4").FirstOrDefault();
if (plantedBomb == null) return HookResult.Continue;
plantedC4 = plantedBomb;
CreateTrigger();
return HookResult.Continue;
});
VirtualFunctions.CBaseEntity_TakeDamageOldFunc.Hook(OnTakeDamage, HookMode.Pre);
}
private static void CreateTrigger()
{
var trigger = Utilities.CreateEntityByName<CTriggerMultiple>("trigger_multiple");
if (trigger == null || plantedC4 == null) return;
trigger.Collision.SolidType = SolidType_t.SOLID_CAPSULE;
trigger.Collision.SolidFlags = 0;
trigger.Spawnflags = 1;
trigger.Globalname = $"planted_bomb_prop_{trigger.Index}";
trigger.Collision.SolidFlags = 1;
trigger.AbsOrigin.X = plantedC4.AbsOrigin.X;
trigger.AbsOrigin.Y = plantedC4.AbsOrigin.Y;
trigger.AbsOrigin.Z = plantedC4.AbsOrigin.Z;
trigger.Collision.CapsuleRadius = 10;
trigger.Collision.BoundingRadius = 10;
trigger.Collision.CollisionGroup = (byte)CollisionGroup.COLLISION_GROUP_TRIGGER;
trigger.Collision.EnablePhysics = 1;
trigger.Collision.TriggerBloat = 0;
trigger.Collision.SurroundType = SurroundingBoundsType_t.USE_OBB_COLLISION_BOUNDS;
trigger.Collision.CollisionAttribute.CollisionFunctionMask = 39;
trigger.Collision.CollisionAttribute.CollisionGroup = 2;
trigger.DispatchSpawn();
triggerC4 = trigger;
}
private static void RemoveBomb()
{
if (plantedC4 != null && plantedC4.IsValid)
plantedC4.Remove();
if (triggerC4 != null && triggerC4.IsValid)
triggerC4.Remove();
SkillUtils.TerminateRound(CsTeam.CounterTerrorist);
}
private static HookResult 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 HookResult.Continue;
CCSPlayerPawn attackerPawn = new CCSPlayerPawn(param2.Attacker.Value.Handle);
if (attackerPawn.DesignerName != "player" || param.DesignerName != "trigger_multiple")
return HookResult.Continue;
CTriggerMultiple trigger = new CTriggerMultiple(param.Handle);
if (attackerPawn == null || attackerPawn.Controller?.Value == null || trigger == null || !trigger.Globalname.StartsWith("planted_bomb_prop_"))
return HookResult.Continue;
CCSPlayerController attacker = attackerPawn.Controller.Value.As<CCSPlayerController>();
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == attacker.SteamID);
if (playerInfo == null || playerInfo.Skill != skillName) return HookResult.Continue;
bombHealth -= (int)param2.TotalledDamage;
if (bombHealth <= 0)
{
RemoveBomb();
return HookResult.Continue;
}
Server.PrintToChatAll($" {ChatColors.Gold}{Localization.GetTranslation("fragilebomb_bomb_health")}: {ChatColors.Red}{bombHealth}{ChatColors.Gold}/{ChatColors.Green}{maxBombHealth}");
return HookResult.Continue;
}
public class SkillConfig : Config.DefaultSkillInfo
{
public int MaxBombHealth { get; set; }
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#5d00ff", CsTeam onlyTeam = CsTeam.CounterTerrorist, bool needsTeammates = false, int maxBombHealth = 1000) : base(skill, active, color, onlyTeam, needsTeammates)
{
MaxBombHealth = maxBombHealth;
}
}
}
}

View file

@ -0,0 +1,54 @@
using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player;
using static jRandomSkills.jRandomSkills;
namespace jRandomSkills
{
public class FriendlyFire : ISkill
{
private const Skills skillName = Skills.FriendlyFire;
private static float healthMultiplier = Config.GetValue<float>(skillName, "healthMultiplier");
private static string[] nades = { "inferno", "flashbang", "smokegrenade", "decoy", "hegrenade" };
public static void LoadSkill()
{
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true)
return;
SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
Instance.RegisterEventHandler<EventPlayerHurt>((@event, info) =>
{
var damage = @event.DmgHealth;
var victim = @event.Userid;
var attacker = @event.Attacker;
var weapon = @event.Weapon;
HitGroup_t hitgroup = (HitGroup_t)@event.Hitgroup;
if (nades.Contains(weapon)) return HookResult.Continue;
if (!Instance.IsPlayerValid(attacker) || !Instance.IsPlayerValid(victim) || attacker == victim) return HookResult.Continue;
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == attacker.SteamID);
if (playerInfo?.Skill != skillName || attacker.Team != victim.Team) return HookResult.Continue;
Server.ExecuteCommand("mp_autokick 0");
var pawn = victim.PlayerPawn.Value;
SkillUtils.AddHealth(pawn, damage + (int)(damage * healthMultiplier), pawn.MaxHealth);
return HookResult.Continue;
});
}
public class SkillConfig : Config.DefaultSkillInfo
{
public float HealthMultiplier { get; set; }
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#ff0000", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = true, float healthMultiplier = 1.5f) : base(skill, active, color, onlyTeam, needsTeammates)
{
HealthMultiplier = healthMultiplier;
}
}
}
}

View file

@ -1,8 +1,6 @@
using CounterStrikeSharp.API; using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Entities.Constants; using CounterStrikeSharp.API.Modules.Entities.Constants;
using CounterStrikeSharp.API.Modules.Memory;
using CounterStrikeSharp.API.Modules.Memory.DynamicFunctions;
using CounterStrikeSharp.API.Modules.Utils; using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player; using jRandomSkills.src.player;
using static CounterStrikeSharp.API.Core.Listeners; using static CounterStrikeSharp.API.Core.Listeners;
@ -12,22 +10,21 @@ namespace jRandomSkills
{ {
public class FrozenDecoy : ISkill public class FrozenDecoy : ISkill
{ {
private static Skills skillName = Skills.FrozenDecoy; private const Skills skillName = Skills.FrozenDecoy;
private static Dictionary<uint, float> gravities = new Dictionary<uint, float>(); private static float decoyRadius = Config.GetValue<float>(skillName, "triggerRadius");
private static List<CCSPlayerPawn> players = new List<CCSPlayerPawn>(); private static int slownessMultiplier = Config.GetValue<int>(skillName, "slownessMultiplier");
private static Dictionary<int, CTriggerMultiple> triggers = new Dictionary<int, CTriggerMultiple>(); private static List<Vector> decoys = new List<Vector>();
public static void LoadSkill() public static void LoadSkill()
{ {
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true) if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true)
return; return;
SkillUtils.RegisterSkill(skillName, "#00eaff"); SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
Instance.RegisterEventHandler<EventRoundStart>((@event, info) => Instance.RegisterEventHandler<EventRoundStart>((@event, info) =>
{ {
gravities.Clear(); decoys.Clear();
players.Clear();
return HookResult.Continue; return HookResult.Continue;
}); });
@ -47,71 +44,37 @@ namespace jRandomSkills
return HookResult.Continue; return HookResult.Continue;
}); });
Instance.RegisterEventHandler<EventDecoyStarted>((@event, @info) => Instance.RegisterEventHandler<EventDecoyStarted>((@event, info) =>
{ {
var player = @event.Userid; var player = @event.Userid;
if (!Instance.IsPlayerValid(player)) return HookResult.Continue;
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID); var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
if (playerInfo?.Skill != skillName) return HookResult.Continue; if (playerInfo?.Skill != skillName) return HookResult.Continue;
decoys.Add(new Vector(@event.X, @event.Y, @event.Z));
var trigger = Utilities.CreateEntityByName<CTriggerMultiple>("trigger_multiple");
if (trigger == null) return HookResult.Continue;
trigger.Collision.SolidType = SolidType_t.SOLID_CAPSULE;
trigger.Collision.SolidFlags = 0;
trigger.Spawnflags = 1;
trigger.Globalname = $"frozen_decoy_{trigger.Index}";
trigger.Collision.SolidFlags = 1;
trigger.AbsOrigin.X = @event.X;
trigger.AbsOrigin.Y = @event.Y;
trigger.AbsOrigin.Z = @event.Z;
trigger.Collision.CapsuleRadius = 150;
trigger.Collision.BoundingRadius = 150;
trigger.Collision.CollisionGroup = (byte)CollisionGroup.COLLISION_GROUP_TRIGGER;
trigger.Collision.EnablePhysics = 1;
trigger.Collision.TriggerBloat = 0;
trigger.Collision.SurroundType = SurroundingBoundsType_t.USE_OBB_COLLISION_BOUNDS;
trigger.Collision.CollisionAttribute.CollisionFunctionMask = 39;
trigger.Collision.CollisionAttribute.CollisionGroup = 2;
trigger.DispatchSpawn();
triggers.Add(@event.Entityid, trigger);
return HookResult.Continue; return HookResult.Continue;
}); });
Instance.RegisterEventHandler<EventDecoyDetonate>((@event, @info) => Instance.RegisterEventHandler<EventDecoyDetonate>((@event, @info) =>
{ {
var player = @event.Userid; 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;
if (triggers.TryGetValue(@event.Entityid, out var existingTrigger)) decoys.RemoveAll(v => v.X == @event.X && v.Y == @event.Y && v.Z == @event.Z);
{
existingTrigger.AcceptInput("Kill");
triggers.Remove(@event.Entityid);
}
return HookResult.Continue; return HookResult.Continue;
}); });
Instance.RegisterListener<OnTick>(() => Instance.RegisterListener<OnTick>(() =>
{ {
foreach (CCSPlayerPawn player in players) foreach (Vector decoyPos in decoys)
foreach (var player in Utilities.GetPlayers())
{ {
player.VelocityModifier = 0; double distance = SkillUtils.GetDistance(decoyPos, player.PlayerPawn.Value.AbsOrigin);
Utilities.SetStateChanged(player, "CCSPlayerPawn", "m_flVelocityModifier"); if (distance <= decoyRadius)
{
if ((player.Flags & (uint)PlayerFlags.FL_ONGROUND) != 0) double modifier = Math.Clamp(distance / decoyRadius, 0f, 1f);
player.GravityScale = float.MaxValue; player.PlayerPawn.Value.VelocityModifier = (float)Math.Pow(modifier, slownessMultiplier);
}
} }
}); });
VirtualFunctions.CBaseTrigger_StartTouchFunc.Hook(StartTouchFun, HookMode.Post);
VirtualFunctions.CBaseTrigger_EndTouchFunc.Hook(EndTouchFunc, HookMode.Post);
} }
public static void EnableSkill(CCSPlayerController player) public static void EnableSkill(CCSPlayerController player)
@ -119,46 +82,15 @@ namespace jRandomSkills
SkillUtils.TryGiveWeapon(player, CsItem.DecoyGrenade); SkillUtils.TryGiveWeapon(player, CsItem.DecoyGrenade);
} }
private static HookResult StartTouchFun(DynamicHook h) public class SkillConfig : Config.DefaultSkillInfo
{ {
CBaseTrigger trigger = h.GetParam<CBaseTrigger>(0); public float TriggerRadius { get; set; }
CBaseEntity entity = h.GetParam<CBaseEntity>(1); public int SlownessMultiplier { get; set; }
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#00eaff", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false, float triggerRadius = 180, int slownessMultiplier = 5) : base(skill, active, color, onlyTeam, needsTeammates)
if (trigger == null || entity == null)
return HookResult.Continue;
;
CCSPlayerPawn player = new CCSPlayerPawn(entity.Handle);
if (player == null) return HookResult.Continue;
if (string.IsNullOrEmpty(trigger?.Globalname) || trigger?.Globalname?.StartsWith("frozen_decoy_") == false)
return HookResult.Continue;
if (!players.Contains(player))
players.Add(player);
gravities.TryAdd(player.Index, player.GravityScale);
return HookResult.Continue;
}
private static HookResult EndTouchFunc(DynamicHook h)
{ {
var trigger = h.GetParam<CBaseTrigger>(0); TriggerRadius = triggerRadius;
var entity = h.GetParam<CBaseEntity>(1); SlownessMultiplier = slownessMultiplier;
}
if (trigger == null || entity == null) return HookResult.Continue;
CCSPlayerPawn player = new CCSPlayerPawn(entity.Handle);
if (player == null) return HookResult.Continue;
if (string.IsNullOrEmpty(trigger?.Globalname) || trigger?.Globalname?.StartsWith("frozen_decoy_") == false)
return HookResult.Continue;
if (players.Contains(player))
players.Remove(player);
float grav = gravities.GetValueOrDefault(player.Index);
player.GravityScale = Math.Min(grav, 1);
return HookResult.Continue;
} }
} }
} }

View file

@ -1,6 +1,7 @@
using System.Drawing; using System.Drawing;
using CounterStrikeSharp.API; using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player; using jRandomSkills.src.player;
using jRandomSkills.src.utils; using jRandomSkills.src.utils;
using static CounterStrikeSharp.API.Core.Listeners; using static CounterStrikeSharp.API.Core.Listeners;
@ -10,7 +11,7 @@ namespace jRandomSkills
{ {
public class Ghost : ISkill public class Ghost : ISkill
{ {
private static Skills skillName = Skills.Ghost; private const Skills skillName = Skills.Ghost;
private static string[] disabledWeapons = private static string[] disabledWeapons =
{ {
"weapon_deagle", "weapon_deagle",
@ -55,7 +56,7 @@ namespace jRandomSkills
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true) if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true)
return; return;
SkillUtils.RegisterSkill(skillName, "#FFFFFF"); SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) => Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
{ {
@ -110,6 +111,13 @@ namespace jRandomSkills
return HookResult.Continue; return HookResult.Continue;
}); });
Instance.RegisterEventHandler<EventRoundStart>((@event, info) =>
{
foreach (var player in Utilities.GetPlayers())
SetWeaponAttack(player, false);
return HookResult.Continue;
});
Instance.RegisterListener<OnTick>(OnTick); Instance.RegisterListener<OnTick>(OnTick);
} }
@ -199,5 +207,12 @@ namespace jRandomSkills
var hudContent = infoLine + skillLine + remainingLine; var hudContent = infoLine + skillLine + remainingLine;
player.PrintToCenterHtml(hudContent); player.PrintToCenterHtml(hudContent);
} }
public class SkillConfig : Config.DefaultSkillInfo
{
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#FFFFFF", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false) : base(skill, active, color, onlyTeam, needsTeammates)
{
}
}
} }
} }

View file

@ -0,0 +1,89 @@
using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Core.Attributes;
using CounterStrikeSharp.API.Modules.Entities.Constants;
using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player;
using static jRandomSkills.jRandomSkills;
namespace jRandomSkills
{
public class Glaz : ISkill
{
private const Skills skillName = Skills.Glaz;
private static bool exists = false;
private static List<int> smokes = new List<int>();
public static void LoadSkill()
{
SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, @info) =>
{
smokes.Clear();
Instance.AddTimer(2f, () =>
{
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)
EnableSkill(player);
}
if (exists)
Instance.RegisterListener<Listeners.CheckTransmit>(CheckTransmit);
});
return HookResult.Continue;
});
Instance.RegisterEventHandler<EventRoundEnd>((@event, @info) =>
{
smokes.Clear();
if (exists)
Instance.RemoveListener<Listeners.CheckTransmit>(CheckTransmit);
exists = false;
return HookResult.Continue;
});
Instance.RegisterEventHandler<EventSmokegrenadeDetonate>((@event, @info) =>
{
smokes.Add(@event.Entityid);
return HookResult.Continue;
});
Instance.RegisterEventHandler<EventSmokegrenadeExpired>((@event, @info) =>
{
smokes.Remove(@event.Entityid);
return HookResult.Continue;
});
}
public static void CheckTransmit([CastFrom(typeof(nint))] CCheckTransmitInfoList infoList)
{
foreach (var (info, player) in infoList)
{
if (player == null) continue;
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
if (playerInfo?.Skill != skillName) continue;
foreach (var smoke in smokes)
info.TransmitEntities.Remove(smoke);
}
}
public static void EnableSkill(CCSPlayerController player)
{
exists = true;
SkillUtils.TryGiveWeapon(player, CsItem.SmokeGrenade);
}
public class SkillConfig : Config.DefaultSkillInfo
{
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#5d00ff", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false) : base(skill, active, color, onlyTeam, needsTeammates)
{
}
}
}
}

View file

@ -9,12 +9,12 @@ namespace jRandomSkills
{ {
public class Glitch : ISkill public class Glitch : ISkill
{ {
private static Skills skillName = Skills.Glitch; private const Skills skillName = Skills.Glitch;
private static HashSet<CCSPlayerController> glitchedPlayers = new HashSet<CCSPlayerController>(); private static HashSet<CCSPlayerController> glitchedPlayers = new HashSet<CCSPlayerController>();
public static void LoadSkill() public static void LoadSkill()
{ {
SkillUtils.RegisterSkill(skillName, "#f542ef", false); SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"), false);
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) => Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
{ {
@ -80,7 +80,7 @@ namespace jRandomSkills
if (enemies.Length > 0) if (enemies.Length > 0)
{ {
foreach (var enemy in enemies) foreach (var enemy in enemies)
player.PrintToChat($" {ChatColors.Green}⠀⠀⠀{ChatColors.Red}{enemy.Index}{ChatColors.Green}] {enemy.PlayerName}"); player.PrintToChat($" {ChatColors.Green}⠀⠀⠀[{ChatColors.Red}{enemy.Index}{ChatColors.Green}] {enemy.PlayerName}");
} }
else else
player.PrintToChat($" {ChatColors.Red}⠀⠀⠀{Localization.GetTranslation("selectplayerskill_incorrect_enemy_index")}"); player.PrintToChat($" {ChatColors.Red}⠀⠀⠀{Localization.GetTranslation("selectplayerskill_incorrect_enemy_index")}");
@ -92,5 +92,12 @@ namespace jRandomSkills
player.ReplicateConVar("sv_disable_radar", "0"); player.ReplicateConVar("sv_disable_radar", "0");
glitchedPlayers.Remove(player); glitchedPlayers.Remove(player);
} }
public class SkillConfig : Config.DefaultSkillInfo
{
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#f542ef", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false) : base(skill, active, color, onlyTeam, needsTeammates)
{
}
}
} }
} }

View file

@ -0,0 +1,41 @@
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player;
using static jRandomSkills.jRandomSkills;
namespace jRandomSkills
{
public class Glue : ISkill
{
private const Skills skillName = Skills.Glue;
public static void LoadSkill()
{
SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
Instance.RegisterListener<Listeners.OnEntitySpawned>(@event =>
{
var name = @event.DesignerName;
if (!name.EndsWith("_projectile"))
return;
var grenade = @event.As<CBaseCSGrenadeProjectile>();
if (grenade.OwnerEntity.Value == null || !grenade.OwnerEntity.Value.IsValid) return;
var pawn = grenade.OwnerEntity.Value.As<CCSPlayerPawn>();
var player = pawn.Controller.Value.As<CCSPlayerController>();
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
if (playerInfo?.Skill != skillName) return;
grenade.Bounces = 555;
});
}
public class SkillConfig : Config.DefaultSkillInfo
{
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#fff52e", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false) : base(skill, active, color, onlyTeam, needsTeammates)
{
}
}
}
}

View file

@ -10,16 +10,14 @@ namespace jRandomSkills
{ {
public class GodMode : ISkill public class GodMode : ISkill
{ {
private static Skills skillName = Skills.GodMode; private const Skills skillName = Skills.GodMode;
private static float timerCooldown = (float)(Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Cooldown); private static float timerCooldown = Config.GetValue<float>(skillName, "cooldown");
private static float duration = Config.GetValue<float>(skillName, "duration");
private static readonly Dictionary<ulong, PlayerSkillInfo> SkillPlayerInfo = new Dictionary<ulong, PlayerSkillInfo>(); private static readonly Dictionary<ulong, PlayerSkillInfo> SkillPlayerInfo = new Dictionary<ulong, PlayerSkillInfo>();
public static void LoadSkill() public static void LoadSkill()
{ {
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true) SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
return;
SkillUtils.RegisterSkill(skillName, "#e0d83a");
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) => Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
{ {
@ -108,12 +106,6 @@ namespace jRandomSkills
player.PrintToCenterHtml(hudContent); player.PrintToCenterHtml(hudContent);
} }
private static void ActiveUse(CCSPlayerController player)
{
if (SkillPlayerInfo.TryGetValue(player.SteamID, out var skillInfo))
skillInfo.CanUse = true;
}
public static void UseSkill(CCSPlayerController player) public static void UseSkill(CCSPlayerController player)
{ {
var playerPawn = player.PlayerPawn.Value; var playerPawn = player.PlayerPawn.Value;
@ -130,7 +122,7 @@ namespace jRandomSkills
player.PrintToChat($" {ChatColors.Green} {Localization.GetTranslation("godmode_on")}"); player.PrintToChat($" {ChatColors.Green} {Localization.GetTranslation("godmode_on")}");
player.PlayerPawn.Value.TakesDamage = false; player.PlayerPawn.Value.TakesDamage = false;
Instance.AddTimer(2, () => { Instance.AddTimer(duration, () => {
if (player.IsValid && player.PawnIsAlive) if (player.IsValid && player.PawnIsAlive)
{ {
player.PlayerPawn.Value.TakesDamage = true; player.PlayerPawn.Value.TakesDamage = true;
@ -150,5 +142,16 @@ namespace jRandomSkills
public DateTime Cooldown { get; set; } public DateTime Cooldown { get; set; }
public DateTime LastClick { get; set; } public DateTime LastClick { get; set; }
} }
public class SkillConfig : Config.DefaultSkillInfo
{
public float Cooldown { get; set; }
public float Duration { get; set; }
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#e0d83a", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false, float cooldown = 30f, float duration = 2f) : base(skill, active, color, onlyTeam, needsTeammates)
{
Cooldown = cooldown;
Duration = duration;
}
}
} }
} }

View file

@ -0,0 +1,121 @@
using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Entities.Constants;
using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player;
using static CounterStrikeSharp.API.Core.Listeners;
using static jRandomSkills.jRandomSkills;
namespace jRandomSkills
{
public class HealingSmoke : ISkill
{
private const Skills skillName = Skills.HealingSmoke;
private static int smokeHeal = Config.GetValue<int>(skillName, "smokeHeal");
private static float smokeRadius = Config.GetValue<float>(skillName, "smokeRadius");
private static List<Vector> smokes = new List<Vector>();
public static void LoadSkill()
{
SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
Instance.RegisterEventHandler<EventRoundStart>((@event, info) =>
{
smokes.Clear();
return HookResult.Continue;
});
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<EventSmokegrenadeDetonate>((@event, info) =>
{
var player = @event.Userid;
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
if (playerInfo?.Skill != skillName) return HookResult.Continue;
smokes.Add(new Vector(@event.X, @event.Y, @event.Z));
return HookResult.Continue;
});
Instance.RegisterEventHandler<EventSmokegrenadeExpired>((@event, @info) =>
{
var player = @event.Userid;
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
if (playerInfo?.Skill != skillName) return HookResult.Continue;
smokes.RemoveAll(v => v.X == @event.X && v.Y == @event.Y && v.Z == @event.Z);
return HookResult.Continue;
});
Instance.RegisterListener<OnEntitySpawned>(@event =>
{
var name = @event.DesignerName;
if (name != "smokegrenade_projectile") return;
var grenade = @event.As<CBaseCSGrenadeProjectile>();
var pawn = grenade.OwnerEntity.Value.As<CCSPlayerPawn>();
var player = pawn.Controller.Value.As<CCSPlayerController>();
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
if (playerInfo?.Skill != skillName) return;
Server.NextFrame(() =>
{
var smoke = @event.As<CSmokeGrenadeProjectile>();
smoke.SmokeColor.X = 0;
smoke.SmokeColor.Y = 255;
smoke.SmokeColor.Z = 0;
});
});
Instance.RegisterListener<OnTick>(() =>
{
foreach (Vector smokePos in smokes)
foreach (var player in Utilities.GetPlayers())
if (Server.TickCount % 17 == 0)
if (SkillUtils.GetDistance(smokePos, player.PlayerPawn.Value.AbsOrigin) <= smokeRadius)
AddHealth(player.PlayerPawn.Value, smokeHeal);
});
}
public static void EnableSkill(CCSPlayerController player)
{
SkillUtils.TryGiveWeapon(player, CsItem.SmokeGrenade);
}
private static void AddHealth(CCSPlayerPawn player, int health)
{
if (player.LifeState != (byte)LifeState_t.LIFE_ALIVE)
return;
if (player.Health != player.MaxHealth)
player.EmitSound("Healthshot.Success");
player.Health = Math.Min(player.Health + health, player.MaxHealth);
Utilities.SetStateChanged(player, "CBaseEntity", "m_iHealth");
}
public class SkillConfig : Config.DefaultSkillInfo
{
public int SmokeHeal { get; set; }
public float SmokeRadius { get; set; }
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#1fe070", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false, int smokeHeal = 1, float smokeRadius = 180) : base(skill, active, color, onlyTeam, needsTeammates)
{
SmokeHeal = smokeHeal;
SmokeRadius = smokeRadius;
}
}
}
}

View file

@ -1,5 +1,6 @@
using CounterStrikeSharp.API; using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player; using jRandomSkills.src.player;
using static jRandomSkills.jRandomSkills; using static jRandomSkills.jRandomSkills;
@ -7,7 +8,7 @@ namespace jRandomSkills
{ {
public class Hermit : ISkill public class Hermit : ISkill
{ {
private static Skills skillName = Skills.Hermit; private const Skills skillName = Skills.Hermit;
private static readonly Dictionary<string, int> maxReserveAmmo = new Dictionary<string, int> private static readonly Dictionary<string, int> maxReserveAmmo = new Dictionary<string, int>
{ {
{ "weapon_glock", 120 }, { "weapon_glock", 120 },
@ -47,12 +48,11 @@ namespace jRandomSkills
{ "weapon_negev", 300 } { "weapon_negev", 300 }
}; };
private static int healthToAdd = Config.GetValue<int>(skillName, "healthToAdd");
public static void LoadSkill() public static void LoadSkill()
{ {
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true) SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
return;
SkillUtils.RegisterSkill(skillName, "#ded678");
Instance.RegisterEventHandler<EventPlayerDeath>((@event, info) => Instance.RegisterEventHandler<EventPlayerDeath>((@event, info) =>
{ {
@ -74,10 +74,19 @@ namespace jRandomSkills
Utilities.SetStateChanged(weapon, "CBasePlayerWeapon", "m_iClip1"); Utilities.SetStateChanged(weapon, "CBasePlayerWeapon", "m_iClip1");
Utilities.SetStateChanged(weapon, "CBasePlayerWeapon", "m_pReserveAmmo"); Utilities.SetStateChanged(weapon, "CBasePlayerWeapon", "m_pReserveAmmo");
SkillUtils.AddHealth(pawn, 25); SkillUtils.AddHealth(pawn, healthToAdd);
return HookResult.Continue; return HookResult.Continue;
}); });
} }
public class SkillConfig : Config.DefaultSkillInfo
{
public int HealthToAdd { get; set; }
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#ded678", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false, int healthToAdd = 25) : base(skill, active, color, onlyTeam, needsTeammates)
{
HealthToAdd = healthToAdd;
}
}
} }
} }

View file

@ -1,6 +1,7 @@
using CounterStrikeSharp.API; using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Entities.Constants; using CounterStrikeSharp.API.Modules.Entities.Constants;
using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player; using jRandomSkills.src.player;
using static jRandomSkills.jRandomSkills; using static jRandomSkills.jRandomSkills;
@ -8,14 +9,13 @@ namespace jRandomSkills
{ {
public class HolyHandGrenade : ISkill public class HolyHandGrenade : ISkill
{ {
private static Skills skillName = Skills.HolyHandGrenade; private const Skills skillName = Skills.HolyHandGrenade;
private static float damageMultiplier = Config.GetValue<float>(skillName, "damageMultiplier");
private static float damageRadiusMultiplier = Config.GetValue<float>(skillName, "damageRadiusMultiplier");
public static void LoadSkill() public static void LoadSkill()
{ {
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true) SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
return;
SkillUtils.RegisterSkill(skillName, "#ffdd00");
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) => Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
{ {
@ -44,13 +44,14 @@ namespace jRandomSkills
var hegrenade = @event.As<CHEGrenadeProjectile>(); var hegrenade = @event.As<CHEGrenadeProjectile>();
var playerPawn = hegrenade.Thrower.Value; var playerPawn = hegrenade.Thrower.Value;
if (playerPawn == null || !playerPawn.IsValid) return;
var player = Utilities.GetPlayers().FirstOrDefault(p => p.PlayerPawn.Index == playerPawn.Index); var player = Utilities.GetPlayers().FirstOrDefault(p => p.PlayerPawn.Index == playerPawn.Index);
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID); var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
if (playerInfo?.Skill != skillName) if (playerInfo?.Skill != skillName)
return; return;
hegrenade.Damage *= 2; hegrenade.Damage *= damageMultiplier;
hegrenade.DmgRadius *= 2; hegrenade.DmgRadius *= damageRadiusMultiplier;
}); });
}); });
} }
@ -59,5 +60,16 @@ namespace jRandomSkills
{ {
SkillUtils.TryGiveWeapon(player, CsItem.HEGrenade); SkillUtils.TryGiveWeapon(player, CsItem.HEGrenade);
} }
public class SkillConfig : Config.DefaultSkillInfo
{
public float DamageMultiplier { get; set; }
public float DamageRadiusMultiplier { get; set; }
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#ffdd00", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false, float damageMultiplier = 2f, float damageRadiusMultiplier = 2f) : base(skill, active, color, onlyTeam, needsTeammates)
{
DamageMultiplier = damageMultiplier;
DamageRadiusMultiplier = damageRadiusMultiplier;
}
}
} }
} }

View file

@ -9,16 +9,13 @@ namespace jRandomSkills
{ {
public class Impostor : ISkill public class Impostor : ISkill
{ {
private static Skills skillName = Skills.Impostor; private const Skills skillName = Skills.Impostor;
private static readonly string defaultCTModel = "characters/models/ctm_sas/ctm_sas.vmdl"; private static readonly string defaultCTModel = "characters/models/ctm_sas/ctm_sas.vmdl";
private static readonly string defaultTModel = "characters/models/tm_phoenix_heavy/tm_phoenix_heavy.vmdl"; private static readonly string defaultTModel = "characters/models/tm_phoenix_heavy/tm_phoenix_heavy.vmdl";
public static void LoadSkill() public static void LoadSkill()
{ {
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true) SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
return;
SkillUtils.RegisterSkill(skillName, "#99140B");
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) => Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
{ {
@ -75,5 +72,12 @@ namespace jRandomSkills
pawn.Render = Color.FromArgb(255, originalRender.R, originalRender.G, originalRender.B); pawn.Render = Color.FromArgb(255, originalRender.R, originalRender.G, originalRender.B);
}); });
} }
public class SkillConfig : Config.DefaultSkillInfo
{
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#99140B", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false) : base(skill, active, color, onlyTeam, needsTeammates)
{
}
}
} }
} }

View file

@ -1,4 +1,5 @@
using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player; using jRandomSkills.src.player;
using static jRandomSkills.jRandomSkills; using static jRandomSkills.jRandomSkills;
@ -6,14 +7,11 @@ namespace jRandomSkills
{ {
public class InfiniteAmmo : ISkill public class InfiniteAmmo : ISkill
{ {
private static Skills skillName = Skills.InfiniteAmmo; private const Skills skillName = Skills.InfiniteAmmo;
public static void LoadSkill() public static void LoadSkill()
{ {
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true) SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
return;
SkillUtils.RegisterSkill(skillName, "#0000FF");
Instance.RegisterEventHandler<EventWeaponFire>((@event, info) => Instance.RegisterEventHandler<EventWeaponFire>((@event, info) =>
{ {
@ -70,5 +68,12 @@ namespace jRandomSkills
activeWeaponHandle.Value.Clip1 = 100; activeWeaponHandle.Value.Clip1 = 100;
} }
} }
public class SkillConfig : Config.DefaultSkillInfo
{
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#0000FF", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false) : base(skill, active, color, onlyTeam, needsTeammates)
{
}
}
} }
} }

View file

@ -0,0 +1,184 @@
using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Core.Attributes;
using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player;
using jRandomSkills.src.utils;
using System.Drawing;
using static jRandomSkills.jRandomSkills;
namespace jRandomSkills
{
public class Jackal : ISkill
{
private const Skills skillName = Skills.Jackal;
private static int maxStepBeam = Config.GetValue<int>(skillName, "maxStepBeam");
private static bool exists = false;
private static Dictionary<uint, uint> authorBeams = new Dictionary<uint, uint>();
private static Dictionary<CCSPlayerController, List<CBeam>> stepBeams = new Dictionary<CCSPlayerController, List<CBeam>>();
public static void LoadSkill()
{
SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"), false);
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);
}
if (exists)
Instance.RegisterListener<Listeners.CheckTransmit>(CheckTransmit);
});
return HookResult.Continue;
});
Instance.RegisterEventHandler<EventRoundEnd>((@event, info) =>
{
foreach (var beams in stepBeams.Values)
foreach (var beam in beams)
if (beam != null && beam.IsValid)
beam.Remove();
foreach (var player in stepBeams.Keys)
DisableSkill(player);
authorBeams.Clear();
stepBeams.Clear();
if (exists)
Instance.RemoveListener<Listeners.CheckTransmit>(CheckTransmit);
exists = false;
return HookResult.Continue;
});
Instance.RegisterListener<Listeners.OnTick>(OnTick);
}
private static void OnTick()
{
foreach (var step in stepBeams)
{
if (Server.TickCount % 8 != 0) continue;
var pawn = step.Key.PlayerPawn.Value;
var beams = step.Value;
if (pawn.LifeState != (byte)LifeState_t.LIFE_ALIVE) continue;
Vector lastBeamVector = beams.LastOrDefault()?.EndPos ?? pawn.AbsOrigin;
var newBeam = CreateBeamStep(step.Key.Team, lastBeamVector, pawn.AbsOrigin);
if (newBeam != null)
beams.Add(newBeam);
if (beams.Count >= maxStepBeam)
{
beams[0].Remove();
beams.RemoveAt(0);
}
}
}
public static void CheckTransmit([CastFrom(typeof(nint))] CCheckTransmitInfoList infoList)
{
foreach(var (info, player) in infoList)
{
if (player == null) continue;
foreach (var step in stepBeams)
{
var enemy = step.Key;
var beams = step.Value;
foreach (var beam in beams)
if (!authorBeams.TryGetValue(player.Index, out uint enemyIndex) || enemyIndex != enemy.Index)
info.TransmitEntities.Remove(beam);
}
}
}
public static CBeam CreateBeamStep(CsTeam team, Vector start, Vector stop)
{
CBeam beam = Utilities.CreateEntityByName<CBeam>("beam")!;
if (beam == null) return null;
beam.Render = team == CsTeam.Terrorist ? Color.FromArgb(100, 255, 165, 0) : Color.FromArgb(100, 173, 216, 230);
beam.Width = 2.0f;
beam.EndWidth = 2.0f;
beam.Teleport(start);
beam.EndPos.X = stop.X;
beam.EndPos.Y = stop.Y;
beam.EndPos.Z = stop.Z;
beam.DispatchSpawn();
beam.AcceptInput("FollowEntity", beam, null!, "");
return beam;
}
public static void TypeSkill(CCSPlayerController player, string[] commands)
{
if (player == null || !player.IsValid || !player.PawnIsAlive) return;
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
if (playerInfo?.Skill != skillName) return;
if (playerInfo.SkillChance == 1)
{
player.PrintToChat($" {ChatColors.Red}{Localization.GetTranslation("areareaper_used_info")}");
return;
}
string enemyId = commands[0];
var enemy = Utilities.GetPlayers().FirstOrDefault(p => p.Team != player.Team && p.Index.ToString() == enemyId);
if (enemy == null)
{
player.PrintToChat($" {ChatColors.Red}" + Localization.GetTranslation("selectplayerskill_incorrect_enemy_index"));
return;
}
authorBeams.Add(player.Index, enemy.Index);
stepBeams.Add(enemy, new List<CBeam>());
playerInfo.SkillChance = 1;
player.PrintToChat($" {ChatColors.Green}" + Localization.GetTranslation("jackal_player_info", enemy.PlayerName));
}
public static void EnableSkill(CCSPlayerController player)
{
exists = true;
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
playerInfo.SkillChance = 0;
SkillUtils.PrintToChat(player, Localization.GetTranslation("jackal") + ":", false);
player.PrintToChat($" {ChatColors.Green}{Localization.GetTranslation("jackal_select_info")}");
var enemies = Utilities.GetPlayers().Where(p => p.Team != player.Team && p.IsValid && !p.IsBot).ToArray();
if (enemies.Length > 0)
{
foreach (var enemy in enemies)
player.PrintToChat($" {ChatColors.Green}⠀⠀⠀[{ChatColors.Red}{enemy.Index}{ChatColors.Green}] {enemy.PlayerName}");
}
else
player.PrintToChat($" {ChatColors.Red}⠀⠀⠀{Localization.GetTranslation("selectplayerskill_incorrect_enemy_index")}");
player.PrintToChat($" {ChatColors.Green}{Localization.GetTranslation("selectplayerskill_command")} {ChatColors.Red}index");
}
public static void DisableSkill(CCSPlayerController player)
{
authorBeams.Remove(player.Index);
stepBeams.Remove(player);
}
public class SkillConfig : Config.DefaultSkillInfo
{
public int MaxStepBeam { get; set; }
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#f542ef", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false, int maxStepBeam = 50) : base(skill, active, color, onlyTeam, needsTeammates)
{
MaxStepBeam = maxStepBeam;
}
}
}
}

View file

@ -9,12 +9,12 @@ namespace jRandomSkills
{ {
public class Jammer : ISkill public class Jammer : ISkill
{ {
private static Skills skillName = Skills.Jammer; private const Skills skillName = Skills.Jammer;
private static HashSet<CCSPlayerController> jammedPlayers = new HashSet<CCSPlayerController>(); private static HashSet<CCSPlayerController> jammedPlayers = new HashSet<CCSPlayerController>();
public static void LoadSkill() public static void LoadSkill()
{ {
SkillUtils.RegisterSkill(skillName, "#42f5a7", false); SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"), false);
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) => Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
{ {
@ -90,7 +90,7 @@ namespace jRandomSkills
if (enemies.Length > 0) if (enemies.Length > 0)
{ {
foreach (var enemy in enemies) foreach (var enemy in enemies)
player.PrintToChat($" {ChatColors.Green}⠀⠀⠀{ChatColors.Red}{enemy.Index}{ChatColors.Green}] {enemy.PlayerName}"); player.PrintToChat($" {ChatColors.Green}⠀⠀⠀[{ChatColors.Red}{enemy.Index}{ChatColors.Green}] {enemy.PlayerName}");
} }
else else
player.PrintToChat($" {ChatColors.Red}⠀⠀⠀{Localization.GetTranslation("selectplayerskill_incorrect_enemy_index")}"); player.PrintToChat($" {ChatColors.Red}⠀⠀⠀{Localization.GetTranslation("selectplayerskill_incorrect_enemy_index")}");
@ -102,5 +102,12 @@ namespace jRandomSkills
SetCrosshair(player, true); SetCrosshair(player, true);
jammedPlayers.Remove(player); jammedPlayers.Remove(player);
} }
public class SkillConfig : Config.DefaultSkillInfo
{
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#42f5a7", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false) : base(skill, active, color, onlyTeam, needsTeammates)
{
}
}
} }
} }

View file

@ -0,0 +1,121 @@
using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player;
using jRandomSkills.src.utils;
using static jRandomSkills.jRandomSkills;
namespace jRandomSkills
{
public class JumpBan : ISkill
{
private const Skills skillName = Skills.JumpBan;
private static Dictionary<CCSPlayerPawn, int> bannedPlayers = new Dictionary<CCSPlayerPawn, int>();
public 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<EventRoundEnd>((@event, info) =>
{
bannedPlayers.Clear();
return HookResult.Continue;
});
Instance.RegisterEventHandler<EventPlayerJump>((@event, info) =>
{
var player = @event.Userid;
if (!bannedPlayers.TryGetValue(player.PlayerPawn.Value, out _)) return HookResult.Continue;
bannedPlayers[player.PlayerPawn.Value] = Server.TickCount + 10;
return HookResult.Stop;
});
Instance.RegisterListener<Listeners.OnTick>(OnTick);
}
private static void OnTick()
{
foreach (var item in bannedPlayers)
{
var pawn = item.Key;
var time = item.Value;
if (time > Server.TickCount)
pawn.AbsVelocity.Z = -100;
}
}
public static void TypeSkill(CCSPlayerController player, string[] commands)
{
if (player == null || !player.IsValid || !player.PawnIsAlive) return;
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
if (playerInfo?.Skill != skillName) return;
if (playerInfo.SkillChance == 1)
{
player.PrintToChat($" {ChatColors.Red}{Localization.GetTranslation("areareaper_used_info")}");
return;
}
string enemyId = commands[0];
var enemy = Utilities.GetPlayers().FirstOrDefault(p => p.Team != player.Team && p.Index.ToString() == enemyId);
if (enemy == null)
{
player.PrintToChat($" {ChatColors.Red}" + Localization.GetTranslation("selectplayerskill_incorrect_enemy_index"));
return;
}
bannedPlayers[enemy.PlayerPawn.Value] = 0;
playerInfo.SkillChance = 1;
player.PrintToChat($" {ChatColors.Green}" + Localization.GetTranslation("jumpban_player_info", enemy.PlayerName));
enemy.PrintToChat($" {ChatColors.Red}" + Localization.GetTranslation("jumpban_enemy_info"));
}
public static void EnableSkill(CCSPlayerController player)
{
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
playerInfo.SkillChance = 0;
SkillUtils.PrintToChat(player, Localization.GetTranslation("jumpban") + ":", false);
player.PrintToChat($" {ChatColors.Green}{Localization.GetTranslation("jumpban_select_info")}");
var enemies = Utilities.GetPlayers().Where(p => p.Team != player.Team && p.IsValid && !p.IsBot).ToArray();
if (enemies.Length > 0)
{
foreach (var enemy in enemies)
player.PrintToChat($" {ChatColors.Green}⠀⠀⠀[{ChatColors.Red}{enemy.Index}{ChatColors.Green}] {enemy.PlayerName}");
}
else
player.PrintToChat($" {ChatColors.Red}⠀⠀⠀{Localization.GetTranslation("selectplayerskill_incorrect_enemy_index")}");
player.PrintToChat($" {ChatColors.Green}{Localization.GetTranslation("selectplayerskill_command")} {ChatColors.Red}index");
}
public static void DisableSkill(CCSPlayerController player)
{
bannedPlayers.Remove(player.PlayerPawn.Value);
}
public class SkillConfig : Config.DefaultSkillInfo
{
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#b01e5d", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false) : base(skill, active, color, onlyTeam, needsTeammates)
{
}
}
}
}

View file

@ -0,0 +1,37 @@
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player;
using static jRandomSkills.jRandomSkills;
namespace jRandomSkills
{
public class JumpingJack : ISkill
{
private const Skills skillName = Skills.JumpingJack;
private static int addHealth = Config.GetValue<int>(skillName, "healthToAdd");
public static void LoadSkill()
{
SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
Instance.RegisterEventHandler<EventPlayerJump>((@event, info) =>
{
var player = @event.Userid;
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
if (playerInfo?.Skill != skillName) return HookResult.Continue;
SkillUtils.AddHealth(player.PlayerPawn.Value, addHealth);
return HookResult.Continue;
});
}
public class SkillConfig : Config.DefaultSkillInfo
{
public int HealthToAdd { get; set; }
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#a86eff", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false, int healthToAdd = 3) : base(skill, active, color, onlyTeam, needsTeammates)
{
HealthToAdd = healthToAdd;
}
}
}
}

View file

@ -1,6 +1,7 @@
using CounterStrikeSharp.API; using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Entities.Constants; using CounterStrikeSharp.API.Modules.Entities.Constants;
using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player; using jRandomSkills.src.player;
using static jRandomSkills.jRandomSkills; using static jRandomSkills.jRandomSkills;
@ -8,14 +9,12 @@ namespace jRandomSkills
{ {
public class KillerFlash : ISkill public class KillerFlash : ISkill
{ {
private static Skills skillName = Skills.KillerFlash; private const Skills skillName = Skills.KillerFlash;
private static float flashDuration = Config.GetValue<float>(skillName, "flashDuration");
public static void LoadSkill() public static void LoadSkill()
{ {
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true) SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
return;
SkillUtils.RegisterSkill(skillName, "#57bcff");
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) => Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
{ {
@ -42,7 +41,7 @@ namespace jRandomSkills
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID); var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
var attackerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == attacker.SteamID); var attackerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == attacker.SteamID);
if (attackerInfo?.Skill == skillName && playerInfo?.Skill != Skills.AntyFlash && player?.PlayerPawn.Value.FlashDuration >= 1) if (attackerInfo?.Skill == skillName && playerInfo?.Skill != Skills.AntyFlash && player?.PlayerPawn.Value.FlashDuration >= flashDuration)
player?.PlayerPawn?.Value?.CommitSuicide(false, true); player?.PlayerPawn?.Value?.CommitSuicide(false, true);
return HookResult.Continue; return HookResult.Continue;
@ -53,5 +52,14 @@ namespace jRandomSkills
{ {
SkillUtils.TryGiveWeapon(player, CsItem.FlashbangGrenade); SkillUtils.TryGiveWeapon(player, CsItem.FlashbangGrenade);
} }
public class SkillConfig : Config.DefaultSkillInfo
{
public float FlashDuration { get; set; }
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#57bcff", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false, float flashDuration = 1f) : base(skill, active, color, onlyTeam, needsTeammates)
{
FlashDuration = flashDuration;
}
}
} }
} }

View file

@ -0,0 +1,103 @@
using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player;
using jRandomSkills.src.utils;
using static jRandomSkills.jRandomSkills;
namespace jRandomSkills
{
public class LifeSwap : ISkill
{
private const Skills skillName = Skills.LifeSwap;
public static void LoadSkill()
{
SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"), false);
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;
});
}
public static void TypeSkill(CCSPlayerController player, string[] commands)
{
if (player == null || !player.IsValid || !player.PawnIsAlive) return;
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
if (playerInfo?.Skill != skillName) return;
if (playerInfo.SkillChance == 1)
{
player.PrintToChat($" {ChatColors.Red}{Localization.GetTranslation("areareaper_used_info")}");
return;
}
string enemyId = commands[0];
var enemy = Utilities.GetPlayers().FirstOrDefault(p => p.Team != player.Team && p.Index.ToString() == enemyId);
if (enemy == null)
{
player.PrintToChat($" {ChatColors.Red}" + Localization.GetTranslation("selectplayerskill_incorrect_enemy_index"));
return;
}
SwapHealth(player, enemy);
playerInfo.SkillChance = 1;
player.PrintToChat($" {ChatColors.Green}" + Localization.GetTranslation("lifeswap_player_info", enemy.PlayerName));
enemy.PrintToChat($" {ChatColors.Red}" + Localization.GetTranslation("lifeswap_enemy_info"));
}
public static void EnableSkill(CCSPlayerController player)
{
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
playerInfo.SkillChance = 0;
SkillUtils.PrintToChat(player, Localization.GetTranslation("lifeswap") + ":", false);
player.PrintToChat($" {ChatColors.Green}{Localization.GetTranslation("lifeswap_select_info")}");
var enemies = Utilities.GetPlayers().Where(p => p.Team != player.Team && p.IsValid && !p.IsBot).ToArray();
if (enemies.Length > 0)
{
foreach (var enemy in enemies)
player.PrintToChat($" {ChatColors.Green}⠀⠀⠀[{ChatColors.Red}{enemy.Index}{ChatColors.Green}] {enemy.PlayerName}");
}
else
player.PrintToChat($" {ChatColors.Red}⠀⠀⠀{Localization.GetTranslation("selectplayerskill_incorrect_enemy_index")}");
player.PrintToChat($" {ChatColors.Green}{Localization.GetTranslation("selectplayerskill_command")} {ChatColors.Red}index");
}
private static void SwapHealth(CCSPlayerController player, CCSPlayerController enemy)
{
var playerPawn = player.PlayerPawn.Value;
var enemyPawn = enemy.PlayerPawn.Value;
if (playerPawn.LifeState != (byte)LifeState_t.LIFE_ALIVE || enemyPawn.LifeState != (byte)LifeState_t.LIFE_ALIVE)
return;
int playerHealth = playerPawn.Health;
playerPawn.Health = enemyPawn.Health;
enemyPawn.Health = playerHealth;
Utilities.SetStateChanged(playerPawn, "CBaseEntity", "m_iHealth");
Utilities.SetStateChanged(enemyPawn, "CBaseEntity", "m_iHealth");
}
public class SkillConfig : Config.DefaultSkillInfo
{
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#a3651a", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false) : base(skill, active, color, onlyTeam, needsTeammates)
{
}
}
}
}

View file

@ -0,0 +1,74 @@
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 LongKnife : ISkill
{
private const Skills skillName = Skills.LongKnife;
private static float maxDistance = Config.GetValue<float>(skillName, "maxDistance");
public unsafe static void LoadSkill()
{
SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
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_knife") 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 || trace.Distance() <= 70) return HookResult.Continue;
target.PlayerPawn.Value.EmitSound("Player.DamageBody.Onlooker");
SkillUtils.TakeHealth(target.PlayerPawn.Value, Instance.Random.Next(21, 34));
return HookResult.Continue;
});
}
public class SkillConfig : Config.DefaultSkillInfo
{
public float MaxDistance { get; set; }
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#c9f8ff", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false, float maxDistance = 4096f) : base(skill, active, color, onlyTeam, needsTeammates)
{
MaxDistance = maxDistance;
}
}
}
}

View 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;
}
}
}
}

View file

@ -1,21 +1,24 @@
using CounterStrikeSharp.API; using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Entities.Constants; using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player; using jRandomSkills.src.player;
using jRandomSkills.src.utils;
using static CounterStrikeSharp.API.Core.Listeners;
using static jRandomSkills.jRandomSkills; using static jRandomSkills.jRandomSkills;
namespace jRandomSkills namespace jRandomSkills
{ {
public class Medic : ISkill public class Medic : ISkill
{ {
private static Skills skillName = Skills.Medic; private const Skills skillName = Skills.Medic;
private static int healthToAdd = Config.GetValue<int>(skillName, "healthToAdd");
private static int healthShotLimit = Config.GetValue<int>(skillName, "healthShotLimit");
private static float timerCooldown = Config.GetValue<float>(skillName, "cooldown");
private static readonly Dictionary<ulong, PlayerSkillInfo> SkillPlayerInfo = new Dictionary<ulong, PlayerSkillInfo>();
public static void LoadSkill() public static void LoadSkill()
{ {
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true) SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
return;
SkillUtils.RegisterSkill(skillName, "#42FF5F");
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) => Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
{ {
@ -23,10 +26,9 @@ namespace jRandomSkills
{ {
foreach (var player in Utilities.GetPlayers()) foreach (var player in Utilities.GetPlayers())
{ {
if (!Instance.IsPlayerValid(player)) continue; if (!Instance.IsPlayerValid(player)) return;
player.RemoveItemByDesignerName("weapon_healthshot");
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID); var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
if (playerInfo?.Skill != skillName) continue; if (playerInfo?.Skill == skillName)
EnableSkill(player); EnableSkill(player);
} }
}); });
@ -35,26 +37,114 @@ namespace jRandomSkills
}); });
Instance.RegisterEventHandler<EventRoundEnd>((@event, info) => Instance.RegisterEventHandler<EventRoundEnd>((@event, info) =>
{
SkillPlayerInfo.Clear();
return HookResult.Continue;
});
Instance.RegisterEventHandler<EventPlayerDeath>((@event, info) =>
{
var player = @event.Userid;
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
if (playerInfo?.Skill == skillName)
if (SkillPlayerInfo.ContainsKey(player.SteamID))
SkillPlayerInfo.Remove(player.SteamID);
return HookResult.Continue;
});
Instance.RegisterListener<OnTick>(() =>
{ {
foreach (var player in Utilities.GetPlayers()) foreach (var player in Utilities.GetPlayers())
{ {
if (!Instance.IsPlayerValid(player)) return HookResult.Continue; var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
DisableSkill(player); if (playerInfo?.Skill == skillName)
if (SkillPlayerInfo.TryGetValue(player.SteamID, out var skillInfo))
UpdateHUD(player, skillInfo);
} }
return HookResult.Continue;
}); });
} }
public static void EnableSkill(CCSPlayerController player) public static void EnableSkill(CCSPlayerController player)
{ {
int healthshot = Instance.Random.Next(1, 10); SkillPlayerInfo[player.SteamID] = new PlayerSkillInfo
SkillUtils.TryGiveWeapon(player, CsItem.Healthshot, healthshot); {
SteamID = player.SteamID,
CanUse = true,
Cooldown = DateTime.MinValue,
Count = healthShotLimit,
};
} }
public static void DisableSkill(CCSPlayerController player) public static void DisableSkill(CCSPlayerController player)
{ {
player.RemoveItemByDesignerName("weapon_healthshot"); if (SkillPlayerInfo.ContainsKey(player.SteamID))
SkillPlayerInfo.Remove(player.SteamID);
}
private static void UpdateHUD(CCSPlayerController player, PlayerSkillInfo skillInfo)
{
float cooldown = 0;
if (skillInfo != null)
{
float time = (int)(skillInfo.Cooldown.AddSeconds(timerCooldown) - DateTime.Now).TotalSeconds;
cooldown = Math.Max(time, 0);
if (cooldown == 0 && skillInfo?.CanUse == false)
skillInfo.CanUse = true;
}
var skillData = SkillData.Skills.FirstOrDefault(s => s.Skill == skillName);
if (skillData == null) return;
string infoLine = $"<font class='fontSize-l' class='fontWeight-Bold' color='#FFFFFF'>{Localization.GetTranslation("your_skill")}:</font> <br>";
string skillLine = $"<font class='fontSize-l' class='fontWeight-Bold' color='{skillData.Color}'>{skillData.Name}</font> <br>";
string remainingLine = cooldown != 0
? $"<font class='fontSize-m' color='#FFFFFF'>{Localization.GetTranslation("hud_info", $"<font color='#FF0000'>{cooldown}</font>")}</font> <br>"
: $"<font class='fontSize-m' color='#{(skillInfo.Count == 0 ? "FF0000" : "00FF00")}'>{skillInfo.Count}/{healthShotLimit}</font> <br>";
var hudContent = infoLine + skillLine + remainingLine;
player.PrintToCenterHtml(hudContent);
}
public static void UseSkill(CCSPlayerController player)
{
var playerPawn = player.PlayerPawn.Value;
if (playerPawn?.CBodyComponent == null) return;
if (SkillPlayerInfo.TryGetValue(player.SteamID, out var skillInfo))
{
if (!player.IsValid || !player.PawnIsAlive) return;
if (skillInfo.CanUse && skillInfo.Count != 0)
{
skillInfo.CanUse = false;
skillInfo.Cooldown = DateTime.Now;
skillInfo.Count -= 1;
SkillUtils.AddHealth(playerPawn, healthToAdd);
player.EmitSound("Healthshot.Success");
}
}
}
public class PlayerSkillInfo
{
public ulong SteamID { get; set; }
public bool CanUse { get; set; }
public int Count { get; set; }
public DateTime Cooldown { get; set; }
}
public class SkillConfig : Config.DefaultSkillInfo
{
public int HealthToAdd { get; set; }
public int HealthShotLimit { get; set; }
public float Cooldown { get; set; }
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#10c212", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false, int healthToAdd = 50, int healthShotLimit = 3, float cooldown = 1f) : base(skill, active, color, onlyTeam, needsTeammates)
{
HealthToAdd = healthToAdd;
HealthShotLimit = healthShotLimit;
Cooldown = cooldown;
}
} }
} }
} }

View file

@ -0,0 +1,102 @@
using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player;
using jRandomSkills.src.utils;
using static jRandomSkills.jRandomSkills;
namespace jRandomSkills
{
public class MoneySwap : ISkill
{
private const Skills skillName = Skills.MoneySwap;
public static void LoadSkill()
{
SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"), false);
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;
});
}
public static void TypeSkill(CCSPlayerController player, string[] commands)
{
if (player == null || !player.IsValid || !player.PawnIsAlive) return;
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
if (playerInfo?.Skill != skillName) return;
if (playerInfo.SkillChance == 1)
{
player.PrintToChat($" {ChatColors.Red}{Localization.GetTranslation("areareaper_used_info")}");
return;
}
string enemyId = commands[0];
var enemy = Utilities.GetPlayers().FirstOrDefault(p => p.Team != player.Team && p.Index.ToString() == enemyId);
if (enemy == null)
{
player.PrintToChat($" {ChatColors.Red}" + Localization.GetTranslation("selectplayerskill_incorrect_enemy_index"));
return;
}
SwapMoney(player, enemy);
playerInfo.SkillChance = 1;
player.PrintToChat($" {ChatColors.Green}" + Localization.GetTranslation("moneyswap_player_info", enemy.PlayerName));
enemy.PrintToChat($" {ChatColors.Red}" + Localization.GetTranslation("moneyswap_enemy_info"));
}
public static void EnableSkill(CCSPlayerController player)
{
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
playerInfo.SkillChance = 0;
SkillUtils.PrintToChat(player, Localization.GetTranslation("moneyswap") + ":", false);
player.PrintToChat($" {ChatColors.Green}{Localization.GetTranslation("moneyswap_select_info")}");
var enemies = Utilities.GetPlayers().Where(p => p.Team != player.Team && p.IsValid && !p.IsBot).ToArray();
if (enemies.Length > 0)
{
foreach (var enemy in enemies)
player.PrintToChat($" {ChatColors.Green}⠀⠀⠀[{ChatColors.Red}{enemy.Index}{ChatColors.Green}] {enemy.PlayerName}: ${enemy.InGameMoneyServices.Account}");
}
else
player.PrintToChat($" {ChatColors.Red}⠀⠀⠀{Localization.GetTranslation("selectplayerskill_incorrect_enemy_index")}");
player.PrintToChat($" {ChatColors.Green}{Localization.GetTranslation("selectplayerskill_command")} {ChatColors.Red}index");
}
private static void SwapMoney(CCSPlayerController player, CCSPlayerController enemy)
{
var playerMoneyServices = player?.InGameMoneyServices;
var enemyMoneyServices = enemy?.InGameMoneyServices;
if (playerMoneyServices == null || enemyMoneyServices == null) return;
int playerMoney = playerMoneyServices.Account;
playerMoneyServices.Account = enemyMoneyServices.Account;
Utilities.SetStateChanged(player, "CCSPlayerController", "m_pInGameMoneyServices");
enemyMoneyServices.Account = playerMoney;
Utilities.SetStateChanged(enemy, "CCSPlayerController", "m_pInGameMoneyServices");
}
public class SkillConfig : Config.DefaultSkillInfo
{
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#52f54c", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false) : base(skill, active, color, onlyTeam, needsTeammates)
{
}
}
}
}

View file

@ -8,16 +8,13 @@ namespace jRandomSkills
{ {
public class Muhammed : ISkill public class Muhammed : ISkill
{ {
private static Skills skillName = Skills.Muhammed; private const Skills skillName = Skills.Muhammed;
private const float ExplosionRadius = 500.0f; private static float explosionRadius = Config.GetValue<float>(skillName, "explosionRadius");
private const int ExplosionDamage = 999; private static int explosionDamage = Config.GetValue<int>(skillName, "explosionDamage");
public static void LoadSkill() public static void LoadSkill()
{ {
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true) SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
return;
SkillUtils.RegisterSkill(skillName, "#F5CB42");
Instance.RegisterEventHandler<EventPlayerDeath>((@event, info) => Instance.RegisterEventHandler<EventPlayerDeath>((@event, info) =>
{ {
@ -42,8 +39,8 @@ namespace jRandomSkills
heProjectile.TicksAtZeroVelocity = 100; heProjectile.TicksAtZeroVelocity = 100;
heProjectile.TeamNum = player.TeamNum; heProjectile.TeamNum = player.TeamNum;
heProjectile.Damage = ExplosionDamage; heProjectile.Damage = explosionDamage;
heProjectile.DmgRadius = (int)ExplosionRadius; heProjectile.DmgRadius = (int)explosionRadius;
heProjectile.Teleport(pos, null, new Vector(0, 0, -10)); heProjectile.Teleport(pos, null, new Vector(0, 0, -10));
heProjectile.DispatchSpawn(); heProjectile.DispatchSpawn();
heProjectile.AcceptInput("InitializeSpawnFromWorld", player.PlayerPawn.Value, player.PlayerPawn.Value, ""); heProjectile.AcceptInput("InitializeSpawnFromWorld", player.PlayerPawn.Value, player.PlayerPawn.Value, "");
@ -62,5 +59,17 @@ namespace jRandomSkills
{ {
return player != null && player.IsValid && player.PlayerPawn?.Value != null; return player != null && player.IsValid && player.PlayerPawn?.Value != null;
} }
public class SkillConfig : Config.DefaultSkillInfo
{
public float ExplosionRadius { get; set; }
public int ExplosionDamage { get; set; }
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#F5CB42", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false, float explosionRadius = 500.0f, int explosionDamage = 999) : base(skill, active, color, onlyTeam, needsTeammates)
{
ExplosionRadius = explosionRadius;
ExplosionDamage = explosionDamage;
}
}
} }
} }

View file

@ -1,4 +1,4 @@
using CounterStrikeSharp.API; /*using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API.Core;
using jRandomSkills.src.player; using jRandomSkills.src.player;
using static jRandomSkills.jRandomSkills; using static jRandomSkills.jRandomSkills;
@ -7,7 +7,7 @@ namespace jRandomSkills
{ {
public class Mute : ISkill public class Mute : ISkill
{ {
private static Skills skillName = Skills.AntyHead; private const Skills skillName = Skills.Mute;
public static void LoadSkill() public static void LoadSkill()
{ {
@ -19,17 +19,20 @@ namespace jRandomSkills
Instance.RegisterListener<Listeners.OnEntitySpawned>(@event => Instance.RegisterListener<Listeners.OnEntitySpawned>(@event =>
{ {
var name = @event.DesignerName; var name = @event.DesignerName;
if (!name.EndsWith("_projectile") && name != "instanced_scripted_scene") if (!name.EndsWith("_projectile"))
return; return;
if (@event.DesignerName == "instanced_scripted_scene") var grenade = @event.As<CBaseCSGrenadeProjectile>();
{ var pawn = grenade.OwnerEntity.Value.As<CCSPlayerPawn>();
@event.AcceptInput("Kill"); var player = pawn.Controller.Value.As<CCSPlayerController>();
@event.Remove();
return; var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
} if (playerInfo?.Skill != skillName) return;
Server.NextFrame(() => { Server.NextFrame(() => {
var grenade = @event.As<CBaseCSGrenadeProjectile>();
grenade.DetonateTime = float.MaxValue;
switch (name) switch (name)
{ {
case "smokegrenade_projectile": case "smokegrenade_projectile":
@ -39,6 +42,7 @@ namespace jRandomSkills
case "molotov_projectile": case "molotov_projectile":
var molotov = @event.As<CMolotovProjectile>(); var molotov = @event.As<CMolotovProjectile>();
molotov.Detonated = true; molotov.Detonated = true;
molotov.StillTimer.Timestamp = float.MaxValue;
break; break;
case "decoy_projectile": case "decoy_projectile":
var decoy = @event.As<CDecoyProjectile>(); var decoy = @event.As<CDecoyProjectile>();
@ -46,12 +50,8 @@ namespace jRandomSkills
decoy.DecoyShotTick = int.MaxValue; decoy.DecoyShotTick = int.MaxValue;
decoy.ShotsRemaining = int.MaxValue; decoy.ShotsRemaining = int.MaxValue;
break; break;
default:
var grenade = @event.As<CBaseCSGrenadeProjectile>();
grenade.DetonateTime = float.MaxValue;
break;
} }
// deoy smoke molo/inter
Instance.AddTimer(5f, () => Instance.AddTimer(5f, () =>
{ {
if (@event != null && @event.IsValid) if (@event != null && @event.IsValid)
@ -61,4 +61,4 @@ namespace jRandomSkills
}); });
} }
} }
} }*/

View file

@ -10,20 +10,17 @@ namespace jRandomSkills
{ {
public class Ninja : ISkill public class Ninja : ISkill
{ {
private static Skills skillName = Skills.Ninja; private const Skills skillName = Skills.Ninja;
private static float idlePercentInvisibility = 0.3f; private static float idlePercentInvisibility = Config.GetValue<float>(skillName, "idlePercentInvisibility");
private static float duckPercentInvisibility = 0.3f; private static float duckPercentInvisibility = Config.GetValue<float>(skillName, "duckPercentInvisibility");
private static float knifePercentInvisibility = 0.3f; private static float knifePercentInvisibility = Config.GetValue<float>(skillName, "knifePercentInvisibility");
private static Dictionary<nint, float> invisibilityChanged = new Dictionary<nint, float>(); private static Dictionary<nint, float> invisibilityChanged = new Dictionary<nint, float>();
public static void LoadSkill() public static void LoadSkill()
{ {
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true) SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
return;
SkillUtils.RegisterSkill(skillName, "#dedede"); Instance.RegisterEventHandler<EventRoundStart>((@event, info) =>
Instance.RegisterEventHandler<EventRoundEnd>((@event, info) =>
{ {
foreach (var player in Utilities.GetPlayers()) foreach (var player in Utilities.GetPlayers())
DisableSkill(player); DisableSkill(player);
@ -31,6 +28,18 @@ namespace jRandomSkills
return HookResult.Continue; return HookResult.Continue;
}); });
Instance.RegisterEventHandler<EventPlayerDeath>((@event, info) =>
{
var player = @event.Userid;
if (!player.IsValid || player.PlayerPawn.Value == null) return HookResult.Continue;
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
if (playerInfo?.Skill == skillName)
DisableSkill(player);
return HookResult.Continue;
});
Instance.RegisterEventHandler<EventItemPickup>((@event, info) => Instance.RegisterEventHandler<EventItemPickup>((@event, info) =>
{ {
var player = @event.Userid; var player = @event.Userid;
@ -111,5 +120,18 @@ namespace jRandomSkills
} }
} }
} }
public class SkillConfig : Config.DefaultSkillInfo
{
public float IdlePercentInvisibility { get; set; }
public float DuckPercentInvisibility { get; set; }
public float KnifePercentInvisibility { get; set; }
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#dedede", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false, float idlePercentInvisibility = .3f, float duckPercentInvisibility = .3f, float knifePercentInvisibility = .3f) : base(skill, active, color, onlyTeam, needsTeammates)
{
IdlePercentInvisibility = idlePercentInvisibility;
DuckPercentInvisibility = duckPercentInvisibility;
KnifePercentInvisibility = knifePercentInvisibility;
}
}
} }
} }

View file

@ -0,0 +1,43 @@
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player;
using static jRandomSkills.jRandomSkills;
namespace jRandomSkills
{
public class NoNades : ISkill
{
private const Skills skillName = Skills.NoNades;
public static void LoadSkill()
{
SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
Instance.RegisterEventHandler<EventPlayerHurt>((@event, info) =>
{
var damage = @event.DmgHealth;
var player = @event.Userid;
var weapon = @event.Weapon;
if (!Instance.IsPlayerValid(player)) return HookResult.Continue;
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
if (playerInfo?.Skill != skillName) return HookResult.Continue;
if (weapon == "hegrenade" || weapon == "inferno")
{
SkillUtils.AddHealth(player.PlayerPawn.Value, damage);
damage = 0;
return HookResult.Stop;
}
return HookResult.Continue;
});
}
public class SkillConfig : Config.DefaultSkillInfo
{
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#a38c1a", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false) : base(skill, active, color, onlyTeam, needsTeammates)
{
}
}
}
}

View file

@ -1,5 +1,6 @@
using CounterStrikeSharp.API; using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player; using jRandomSkills.src.player;
using static CounterStrikeSharp.API.Core.Listeners; using static CounterStrikeSharp.API.Core.Listeners;
using static jRandomSkills.jRandomSkills; using static jRandomSkills.jRandomSkills;
@ -8,14 +9,11 @@ namespace jRandomSkills
{ {
public class NoRecoil : ISkill public class NoRecoil : ISkill
{ {
private static Skills skillName = Skills.NoRecoil; private const Skills skillName = Skills.NoRecoil;
public static void LoadSkill() public static void LoadSkill()
{ {
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true) SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
return;
SkillUtils.RegisterSkill(skillName, "#8a42f5");
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) => Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
{ {
@ -24,7 +22,6 @@ namespace jRandomSkills
foreach (var player in Utilities.GetPlayers()) foreach (var player in Utilities.GetPlayers())
{ {
if (!Instance.IsPlayerValid(player)) continue; if (!Instance.IsPlayerValid(player)) continue;
player.RemoveItemByDesignerName("weapon_healthshot");
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID); var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
if (playerInfo?.Skill != skillName) continue; if (playerInfo?.Skill != skillName) continue;
EnableSkill(player); EnableSkill(player);
@ -73,5 +70,12 @@ namespace jRandomSkills
} }
} }
} }
public class SkillConfig : Config.DefaultSkillInfo
{
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#8a42f5", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false) : base(skill, active, color, onlyTeam, needsTeammates)
{
}
}
} }
} }

View file

@ -1,5 +1,6 @@
using CounterStrikeSharp.API; using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player; using jRandomSkills.src.player;
using jRandomSkills.src.utils; using jRandomSkills.src.utils;
using static CounterStrikeSharp.API.Core.Listeners; using static CounterStrikeSharp.API.Core.Listeners;
@ -7,18 +8,16 @@ using static jRandomSkills.jRandomSkills;
namespace jRandomSkills namespace jRandomSkills
{ {
public class TimeManipulator : ISkill public class Noclip : ISkill
{ {
private static Skills skillName = Skills.TimeManipulator; private const Skills skillName = Skills.Noclip;
private static float timerCooldown = (float)(Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Cooldown); private static float timerCooldown = Config.GetValue<float>(skillName, "cooldown");
private static float duration = Config.GetValue<float>(skillName, "duration");
private static readonly Dictionary<ulong, PlayerSkillInfo> SkillPlayerInfo = new Dictionary<ulong, PlayerSkillInfo>(); private static readonly Dictionary<ulong, PlayerSkillInfo> SkillPlayerInfo = new Dictionary<ulong, PlayerSkillInfo>();
public static void LoadSkill() public static void LoadSkill()
{ {
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true) SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
return;
SkillUtils.RegisterSkill(skillName, "#2ec761");
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) => Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
{ {
@ -87,11 +86,15 @@ namespace jRandomSkills
private static void UpdateHUD(CCSPlayerController player, PlayerSkillInfo skillInfo) private static void UpdateHUD(CCSPlayerController player, PlayerSkillInfo skillInfo)
{ {
float cooldown = 0; float cooldown = 0;
float flying = 0;
if (skillInfo != null) if (skillInfo != null)
{ {
float time = (int)(skillInfo.Cooldown.AddSeconds(timerCooldown) - DateTime.Now).TotalSeconds; float time = (int)(skillInfo.Cooldown.AddSeconds(timerCooldown) - DateTime.Now).TotalSeconds;
cooldown = Math.Max(time, 0); cooldown = Math.Max(time, 0);
float flyingTime = (int)(skillInfo.Cooldown.AddSeconds(duration) - DateTime.Now).TotalMilliseconds;
flying = Math.Max(flyingTime, 0);
if (cooldown == 0 && skillInfo?.CanUse == false) if (cooldown == 0 && skillInfo?.CanUse == false)
skillInfo.CanUse = true; skillInfo.CanUse = true;
} }
@ -101,7 +104,12 @@ namespace jRandomSkills
string infoLine = $"<font class='fontSize-l' class='fontWeight-Bold' color='#FFFFFF'>{Localization.GetTranslation("your_skill")}:</font> <br>"; string infoLine = $"<font class='fontSize-l' class='fontWeight-Bold' color='#FFFFFF'>{Localization.GetTranslation("your_skill")}:</font> <br>";
string skillLine = $"<font class='fontSize-l' class='fontWeight-Bold' color='{skillData.Color}'>{skillData.Name}</font> <br>"; string skillLine = $"<font class='fontSize-l' class='fontWeight-Bold' color='{skillData.Color}'>{skillData.Name}</font> <br>";
string remainingLine = cooldown != 0 ? $"<font class='fontSize-m' color='#FFFFFF'>{Localization.GetTranslation("hud_info", $"<font color='#FF0000'>{cooldown}</font>")}</font> <br>" : ""; string remainingLine = cooldown != 0
? (
flying != 0
? $"<font class='fontSize-m' color='#FFFFFF'>{Localization.GetTranslation("active_hud_info", $"<font color='#00FF00'>{Math.Round(flying / 100, 2)}</font>")}</font> <br>"
: $"<font class='fontSize-m' color='#FFFFFF'>{Localization.GetTranslation("hud_info", $"<font color='#FF0000'>{cooldown}</font>")}</font> <br>"
) : "";
var hudContent = infoLine + skillLine + remainingLine; var hudContent = infoLine + skillLine + remainingLine;
player.PrintToCenterHtml(hudContent); player.PrintToCenterHtml(hudContent);
@ -120,13 +128,8 @@ namespace jRandomSkills
skillInfo.CanUse = false; skillInfo.CanUse = false;
skillInfo.Cooldown = DateTime.Now; skillInfo.Cooldown = DateTime.Now;
Server.ExecuteCommand("sv_cheats 1"); playerPawn.ActualMoveType = MoveType_t.MOVETYPE_NOCLIP;
Server.ExecuteCommand("host_timescale 0.1"); Instance.AddTimer(duration, () => playerPawn.ActualMoveType = MoveType_t.MOVETYPE_WALK);
Instance.AddTimer(.6f, () =>
{
Server.ExecuteCommand("host_timescale 1");
Server.ExecuteCommand("sv_cheats 0");
});
} }
else else
skillInfo.LastClick = DateTime.Now; skillInfo.LastClick = DateTime.Now;
@ -140,5 +143,16 @@ namespace jRandomSkills
public DateTime Cooldown { get; set; } public DateTime Cooldown { get; set; }
public DateTime LastClick { get; set; } public DateTime LastClick { get; set; }
} }
public class SkillConfig : Config.DefaultSkillInfo
{
public float Cooldown { get; set; }
public float Duration { get; set; }
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#44ebd4", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false, float cooldown = 30f, float duration = 2f) : base(skill, active, color, onlyTeam, needsTeammates)
{
Cooldown = cooldown;
Duration = duration;
}
}
} }
} }

View file

@ -1,14 +1,22 @@
using jRandomSkills.src.player; using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player;
namespace jRandomSkills namespace jRandomSkills
{ {
public class None : ISkill public class None : ISkill
{ {
private static Skills skillName = Skills.None; private const Skills skillName = Skills.None;
public static void LoadSkill() public static void LoadSkill()
{ {
SkillUtils.RegisterSkill(skillName, "#FFFFFF", false); SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"), false);
}
public class SkillConfig : Config.DefaultSkillInfo
{
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#FFFFFF", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false) : base(skill, active, color, onlyTeam, needsTeammates)
{
}
} }
} }
} }

View file

@ -1,7 +1,7 @@
using CounterStrikeSharp.API; using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Memory; using CounterStrikeSharp.API.Modules.Memory;
using CounterStrikeSharp.API.Modules.Memory.DynamicFunctions; using CounterStrikeSharp.API.Modules.Memory.DynamicFunctions;
using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player; using jRandomSkills.src.player;
using static jRandomSkills.jRandomSkills; using static jRandomSkills.jRandomSkills;
@ -9,14 +9,11 @@ namespace jRandomSkills
{ {
public class OneShot : ISkill public class OneShot : ISkill
{ {
private static Skills skillName = Skills.OneShot; private const Skills skillName = Skills.OneShot;
public static void LoadSkill() public static void LoadSkill()
{ {
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true) SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
return;
SkillUtils.RegisterSkill(skillName, "#ff5CD9");
VirtualFunctions.CBaseEntity_TakeDamageOldFunc.Hook(OnTakeDamage, HookMode.Pre); VirtualFunctions.CBaseEntity_TakeDamageOldFunc.Hook(OnTakeDamage, HookMode.Pre);
} }
@ -47,5 +44,12 @@ namespace jRandomSkills
param2.Damage = 1000f; param2.Damage = 1000f;
return HookResult.Changed; return HookResult.Changed;
} }
public class SkillConfig : Config.DefaultSkillInfo
{
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#ff5CD9", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false) : base(skill, active, color, onlyTeam, needsTeammates)
{
}
}
} }
} }

View file

@ -1,5 +1,6 @@
using CounterStrikeSharp.API; using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player; using jRandomSkills.src.player;
using static jRandomSkills.jRandomSkills; using static jRandomSkills.jRandomSkills;
@ -7,14 +8,11 @@ namespace jRandomSkills
{ {
public class OnlyHead : ISkill public class OnlyHead : ISkill
{ {
private static Skills skillName = Skills.OnlyHead; private const Skills skillName = Skills.OnlyHead;
public static void LoadSkill() public static void LoadSkill()
{ {
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true) SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
return;
SkillUtils.RegisterSkill(skillName, "#3c47de");
Instance.RegisterEventHandler<EventPlayerHurt>((@event, info) => Instance.RegisterEventHandler<EventPlayerHurt>((@event, info) =>
{ {
@ -45,5 +43,12 @@ namespace jRandomSkills
playerPawn.Health = (int)newHealth; playerPawn.Health = (int)newHealth;
Utilities.SetStateChanged(playerPawn, "CBaseEntity", "m_iHealth"); Utilities.SetStateChanged(playerPawn, "CBaseEntity", "m_iHealth");
} }
public class SkillConfig : Config.DefaultSkillInfo
{
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#3c47de", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false) : base(skill, active, color, onlyTeam, needsTeammates)
{
}
}
} }
} }

View file

@ -9,17 +9,14 @@ namespace jRandomSkills
{ {
public class PawelJumper : ISkill public class PawelJumper : ISkill
{ {
private static Skills skillName = Skills.PawelJumper; private const Skills skillName = Skills.PawelJumper;
private static readonly PlayerFlags[] LF = new PlayerFlags[64]; private static readonly PlayerFlags[] LF = new PlayerFlags[64];
private static readonly int?[] J = new int?[64]; private static readonly int?[] J = new int?[64];
private static readonly PlayerButtons[] LB = new PlayerButtons[64]; private static readonly PlayerButtons[] LB = new PlayerButtons[64];
public static void LoadSkill() public static void LoadSkill()
{ {
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true) SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
return;
SkillUtils.RegisterSkill(skillName, "#FFA500");
Instance.RegisterListener<OnTick>(() => Instance.RegisterListener<OnTick>(() =>
{ {
@ -58,5 +55,12 @@ namespace jRandomSkills
LF[player.Slot] = flags; LF[player.Slot] = flags;
LB[player.Slot] = buttons; LB[player.Slot] = buttons;
} }
public class SkillConfig : Config.DefaultSkillInfo
{
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#FFA500", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false) : base(skill, active, color, onlyTeam, needsTeammates)
{
}
}
} }
} }

View file

@ -9,14 +9,11 @@ namespace jRandomSkills
{ {
public class Phoenix : ISkill public class Phoenix : ISkill
{ {
private static Skills skillName = Skills.Phoenix; private const Skills skillName = Skills.Phoenix;
public static void LoadSkill() public static void LoadSkill()
{ {
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true) SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"), false);
return;
SkillUtils.RegisterSkill(skillName, "#ff5C0A", false);
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) => Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
{ {
@ -39,7 +36,7 @@ namespace jRandomSkills
{ {
var player = @event.Userid; var player = @event.Userid;
if (!Instance.IsPlayerValid(player)) return HookResult.Continue; if (player == null || !player.IsValid || !player.PlayerPawn.Value.IsValid) return HookResult.Continue;
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID); var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
if (playerInfo?.Skill == skillName) if (playerInfo?.Skill == skillName)
@ -58,11 +55,8 @@ namespace jRandomSkills
public static void EnableSkill(CCSPlayerController player) public static void EnableSkill(CCSPlayerController player)
{ {
var skillConfig = Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString());
if (skillConfig == null) return;
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID); var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
float newChance = (float)Instance.Random.NextDouble() * (skillConfig.ChanceTo - skillConfig.ChanceFrom) + skillConfig.ChanceFrom; float newChance = (float)Instance.Random.NextDouble() * (Config.GetValue<float>(skillName, "ChanceTo") - Config.GetValue<float>(skillName, "ChanceFrom")) + Config.GetValue<float>(skillName, "ChanceFrom");
playerInfo.SkillChance = newChance; playerInfo.SkillChance = newChance;
newChance = (float)Math.Round(newChance, 2) * 100; newChance = (float)Math.Round(newChance, 2) * 100;
newChance = (float)Math.Round(newChance); newChance = (float)Math.Round(newChance);
@ -73,5 +67,16 @@ namespace jRandomSkills
{ {
return player != null && player.IsValid && player.PlayerPawn?.Value != null; return player != null && player.IsValid && player.PlayerPawn?.Value != null;
} }
public class SkillConfig : Config.DefaultSkillInfo
{
public float ChanceFrom { get; set; }
public float ChanceTo { get; set; }
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#ff5C0A", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false, float chanceFrom = .2f, float chanceTo = .4f) : base(skill, active, color, onlyTeam, needsTeammates)
{
ChanceFrom = chanceFrom;
ChanceTo = chanceTo;
}
}
} }
} }

View file

@ -10,15 +10,13 @@ namespace jRandomSkills
{ {
public class Pilot : ISkill public class Pilot : ISkill
{ {
private static Skills skillName = Skills.Pilot; private const Skills skillName = Skills.Pilot;
private static float maximumFuel = Config.GetValue<float>(skillName, "maximumFuel");
private static readonly Dictionary<ulong, Pilot_PlayerInfo> PlayerPilotInfo = new Dictionary<ulong, Pilot_PlayerInfo>(); private static readonly Dictionary<ulong, Pilot_PlayerInfo> PlayerPilotInfo = new Dictionary<ulong, Pilot_PlayerInfo>();
public static void LoadSkill() public static void LoadSkill()
{ {
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true) SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
return;
SkillUtils.RegisterSkill(skillName, "#1466F5");
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) => Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
{ {
@ -107,12 +105,12 @@ namespace jRandomSkills
private static void UpdateHUD(CCSPlayerController player, Pilot_PlayerInfo pilotInfo) private static void UpdateHUD(CCSPlayerController player, Pilot_PlayerInfo pilotInfo)
{ {
var buttons = player.Buttons; var buttons = player.Buttons;
float fuelPercentage = 100.0f; float fuelPercentage = maximumFuel;
if (pilotInfo.PressedUse && pilotInfo.CanUsePilot) if (pilotInfo.PressedUse && pilotInfo.CanUsePilot)
{ {
float elapsedTime = (float)(DateTime.Now - pilotInfo.PilotStartTime).TotalSeconds; float elapsedTime = (float)(DateTime.Now - pilotInfo.PilotStartTime).TotalSeconds;
fuelPercentage = Math.Max(0, 100.0f * (4.0f - elapsedTime) / 4.0f); fuelPercentage = Math.Max(0, maximumFuel * (4.0f - elapsedTime) / 4.0f);
} }
string fuelColor = GetFuelColor(fuelPercentage); string fuelColor = GetFuelColor(fuelPercentage);
@ -129,8 +127,8 @@ namespace jRandomSkills
private static string GetFuelColor(float fuelPercentage) private static string GetFuelColor(float fuelPercentage)
{ {
if (fuelPercentage > 50) return "#00FF00"; if (fuelPercentage > (maximumFuel/2f)) return "#00FF00";
if (fuelPercentage > 25) return "#FFFF00"; if (fuelPercentage > (maximumFuel/4f)) return "#FFFF00";
return "#FF0000"; return "#FF0000";
} }
@ -184,5 +182,14 @@ namespace jRandomSkills
public bool PressedUse { get; set; } public bool PressedUse { get; set; }
public DateTime PilotStartTime { get; set; } public DateTime PilotStartTime { get; set; }
} }
public class SkillConfig : Config.DefaultSkillInfo
{
public float MaximumFuel { get; set; }
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#1466F5", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false, float maximumFuel = 100f) : base(skill, active, color, onlyTeam, needsTeammates)
{
MaximumFuel = maximumFuel;
}
}
} }
} }

View file

@ -1,8 +1,8 @@
using CounterStrikeSharp.API; using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Memory; using CounterStrikeSharp.API.Modules.Memory;
using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player; using jRandomSkills.src.player;
using jRandomSkills.src.utils;
using static CounterStrikeSharp.API.Core.Listeners; using static CounterStrikeSharp.API.Core.Listeners;
using static jRandomSkills.jRandomSkills; using static jRandomSkills.jRandomSkills;
@ -10,14 +10,12 @@ namespace jRandomSkills
{ {
public class Planter : ISkill public class Planter : ISkill
{ {
private static Skills skillName = Skills.Planter; private const Skills skillName = Skills.Planter;
private static int extraC4BlowTime = Config.GetValue<int>(skillName, "extraC4BlowTime");
public static void LoadSkill() public static void LoadSkill()
{ {
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true) SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
return;
SkillUtils.RegisterSkill(skillName, "#7d7d7d");
Instance.RegisterEventHandler<EventRoundStart>((@event, @info) => Instance.RegisterEventHandler<EventRoundStart>((@event, @info) =>
{ {
@ -31,22 +29,15 @@ namespace jRandomSkills
Instance.RegisterEventHandler<EventBombPlanted>((@event, info) => Instance.RegisterEventHandler<EventBombPlanted>((@event, info) =>
{ {
foreach (var player in Utilities.GetPlayers()) var player = @event.Userid;
{ if (!Instance.IsPlayerValid(player)) return HookResult.Continue;
if (!Instance.IsPlayerValid(player)) continue;
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID); var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
if (playerInfo?.Skill != skillName) continue; if (playerInfo?.Skill != skillName) return HookResult.Continue;
var plantedBomb = Utilities.FindAllEntitiesByDesignerName<CPlantedC4>("planted_c4").FirstOrDefault(); var plantedBomb = Utilities.FindAllEntitiesByDesignerName<CPlantedC4>("planted_c4").FirstOrDefault();
if (plantedBomb != null) if (plantedBomb != null)
{ Server.NextFrame(() => plantedBomb.C4Blow = (float)Server.EngineTime + extraC4BlowTime);
Server.NextFrame(() =>
{
plantedBomb.C4Blow = (float)Server.EngineTime + 60;
});
}
}
return HookResult.Continue; return HookResult.Continue;
}); });
@ -70,5 +61,14 @@ namespace jRandomSkills
Schema.SetSchemaValue<bool>(player.Pawn.Value.Handle, "CCSPlayerPawn", "m_bInBombZone", true); Schema.SetSchemaValue<bool>(player.Pawn.Value.Handle, "CCSPlayerPawn", "m_bInBombZone", true);
} }
} }
public class SkillConfig : Config.DefaultSkillInfo
{
public int ExtraC4BlowTime { get; set; }
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#7d7d7d", CsTeam onlyTeam = CsTeam.Terrorist, bool needsTeammates = false, int extraC4BlowTime = 60) : base(skill, active, color, onlyTeam, needsTeammates)
{
ExtraC4BlowTime = extraC4BlowTime;
}
}
} }
} }

View file

@ -0,0 +1,120 @@
using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player;
using jRandomSkills.src.utils;
using static jRandomSkills.jRandomSkills;
namespace jRandomSkills
{
public class Poison : ISkill
{
private const Skills skillName = Skills.Poison;
private static int cooldown = Config.GetValue<int>(skillName, "Cooldown");
private static int healthToDamage = Config.GetValue<int>(skillName, "Damage");
private static HashSet<CCSPlayerController> poisonedPlayers = new HashSet<CCSPlayerController>();
public static void LoadSkill()
{
SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"), false);
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<EventRoundEnd>((@event, info) =>
{
foreach (var player in poisonedPlayers)
DisableSkill(player);
return HookResult.Continue;
});
Instance.RegisterListener<Listeners.OnTick>(OnTick);
}
private static void OnTick()
{
if (Server.TickCount % (64 * cooldown) != 0) return;
foreach (var player in poisonedPlayers)
{
var pawn = player.PlayerPawn.Value;
if (pawn == null || !pawn.IsValid) continue;
SkillUtils.TakeHealth(pawn, healthToDamage);
}
}
public static void TypeSkill(CCSPlayerController player, string[] commands)
{
if (player == null || !player.IsValid || !player.PawnIsAlive) return;
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
if (playerInfo?.Skill != skillName) return;
if (playerInfo.SkillChance == 1)
{
player.PrintToChat($" {ChatColors.Red}{Localization.GetTranslation("areareaper_used_info")}");
return;
}
string enemyId = commands[0];
var enemy = Utilities.GetPlayers().FirstOrDefault(p => p.Team != player.Team && p.Index.ToString() == enemyId);
if (enemy == null)
{
player.PrintToChat($" {ChatColors.Red}" + Localization.GetTranslation("selectplayerskill_incorrect_enemy_index"));
return;
}
poisonedPlayers.Add(enemy);
playerInfo.SkillChance = 1;
player.PrintToChat($" {ChatColors.Green}" + Localization.GetTranslation("poison_player_info", enemy.PlayerName));
enemy.PrintToChat($" {ChatColors.Red}" + Localization.GetTranslation("poison_enemy_info"));
}
public static void EnableSkill(CCSPlayerController player)
{
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
playerInfo.SkillChance = 0;
SkillUtils.PrintToChat(player, Localization.GetTranslation("poison") + ":", false);
player.PrintToChat($" {ChatColors.Green}{Localization.GetTranslation("poison_select_info")}");
var enemies = Utilities.GetPlayers().Where(p => p.Team != player.Team && p.IsValid && !p.IsBot).ToArray();
if (enemies.Length > 0)
{
foreach (var enemy in enemies)
player.PrintToChat($" {ChatColors.Green}⠀⠀⠀[{ChatColors.Red}{enemy.Index}{ChatColors.Green}] {enemy.PlayerName}");
}
else
player.PrintToChat($" {ChatColors.Red}⠀⠀⠀{Localization.GetTranslation("selectplayerskill_incorrect_enemy_index")}");
player.PrintToChat($" {ChatColors.Green}{Localization.GetTranslation("selectplayerskill_command")} {ChatColors.Red}index");
}
public static void DisableSkill(CCSPlayerController player)
{
poisonedPlayers.Remove(player);
}
public class SkillConfig : Config.DefaultSkillInfo
{
public int Damage { get; set; }
public int Cooldown { get; set; }
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#902eff", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false, int cooldown = 2, int damage = 1) : base(skill, active, color, onlyTeam, needsTeammates)
{
Damage = damage;
Cooldown = cooldown;
}
}
}
}

View file

@ -0,0 +1,126 @@
using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player;
using jRandomSkills.src.utils;
using static jRandomSkills.jRandomSkills;
namespace jRandomSkills
{
public class PrimaryBan : ISkill
{
private const Skills skillName = Skills.PrimaryBan;
private static HashSet<ulong> bannedPlayers = new HashSet<ulong>();
private static string[] disabledWeapons =
{
"ak47", "m4a1", "m4a4", "m4a1_silencer", "famas", "galilar", "aug", "sg553", "mp9", "mac10", "bizon", "mp7", "ump45",
"p90", "mp5sd", "ssg08", "awp", "scar20", "g3sg1", "nova", "xm1014", "mag7", "sawedoff", "m249", "negev"
};
public 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<EventRoundEnd>((@event, info) =>
{
bannedPlayers.Clear();
return HookResult.Continue;
});
Instance.RegisterEventHandler<EventItemEquip>((@event, info) =>
{
var player = @event.Userid;
var weapon = @event.Item;
if (!bannedPlayers.Contains(player.SteamID) || !disabledWeapons.Contains(weapon)) return HookResult.Continue;
player.ExecuteClientCommand("slot3");
return HookResult.Stop;
});
}
public static void TypeSkill(CCSPlayerController player, string[] commands)
{
if (player == null || !player.IsValid || !player.PawnIsAlive) return;
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
if (playerInfo?.Skill != skillName) return;
if (playerInfo.SkillChance == 1)
{
player.PrintToChat($" {ChatColors.Red}{Localization.GetTranslation("areareaper_used_info")}");
return;
}
string enemyId = commands[0];
var enemy = Utilities.GetPlayers().FirstOrDefault(p => p.Team != player.Team && p.Index.ToString() == enemyId);
if (enemy == null)
{
player.PrintToChat($" {ChatColors.Red}" + Localization.GetTranslation("selectplayerskill_incorrect_enemy_index"));
return;
}
bannedPlayers.Add(enemy.SteamID);
CheckWeapon(enemy);
playerInfo.SkillChance = 1;
player.PrintToChat($" {ChatColors.Green}" + Localization.GetTranslation("primaryban_player_info", enemy.PlayerName));
enemy.PrintToChat($" {ChatColors.Red}" + Localization.GetTranslation("primaryban_enemy_info"));
}
private static void CheckWeapon(CCSPlayerController player)
{
var activeWeapon = player.PlayerPawn.Value?.WeaponServices?.ActiveWeapon?.Value;
if (activeWeapon == null || !activeWeapon.IsValid) return;
if (activeWeapon.DesignerName == null || string.IsNullOrEmpty(activeWeapon.DesignerName)) return;
if (!bannedPlayers.Contains(player.SteamID) || !disabledWeapons.Contains(activeWeapon.DesignerName?.Replace("weapon_", ""))) return;
player.ExecuteClientCommand("slot3");
}
public static void EnableSkill(CCSPlayerController player)
{
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
playerInfo.SkillChance = 0;
SkillUtils.PrintToChat(player, Localization.GetTranslation("primaryban") + ":", false);
player.PrintToChat($" {ChatColors.Green}{Localization.GetTranslation("primaryban_select_info")}");
var enemies = Utilities.GetPlayers().Where(p => p.Team != player.Team && p.IsValid && !p.IsBot).ToArray();
if (enemies.Length > 0)
{
foreach (var enemy in enemies)
player.PrintToChat($" {ChatColors.Green}⠀⠀⠀[{ChatColors.Red}{enemy.Index}{ChatColors.Green}] {enemy.PlayerName}");
}
else
player.PrintToChat($" {ChatColors.Red}⠀⠀⠀{Localization.GetTranslation("selectplayerskill_incorrect_enemy_index")}");
player.PrintToChat($" {ChatColors.Green}{Localization.GetTranslation("selectplayerskill_command")} {ChatColors.Red}index");
}
public static void DisableSkill(CCSPlayerController player)
{
bannedPlayers.Remove(player.SteamID);
}
public class SkillConfig : Config.DefaultSkillInfo
{
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#ffc061", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false) : base(skill, active, color, onlyTeam, needsTeammates)
{
}
}
}
}

View file

@ -1,7 +1,6 @@
using CounterStrikeSharp.API; using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Memory; using CounterStrikeSharp.API.Modules.Utils;
using CounterStrikeSharp.API.Modules.Memory.DynamicFunctions;
using jRandomSkills.src.player; using jRandomSkills.src.player;
using static jRandomSkills.jRandomSkills; using static jRandomSkills.jRandomSkills;
@ -9,14 +8,11 @@ namespace jRandomSkills
{ {
public class Prosthesis : ISkill public class Prosthesis : ISkill
{ {
private static Skills skillName = Skills.Prosthesis; private const Skills skillName = Skills.Prosthesis;
public static void LoadSkill() public static void LoadSkill()
{ {
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true) SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
return;
SkillUtils.RegisterSkill(skillName, "#9c9c9c");
Instance.RegisterEventHandler<EventPlayerHurt>((@event, info) => Instance.RegisterEventHandler<EventPlayerHurt>((@event, info) =>
{ {
@ -47,5 +43,12 @@ namespace jRandomSkills
playerPawn.Health = (int)newHealth; playerPawn.Health = (int)newHealth;
Utilities.SetStateChanged(playerPawn, "CBaseEntity", "m_iHealth"); Utilities.SetStateChanged(playerPawn, "CBaseEntity", "m_iHealth");
} }
public class SkillConfig : Config.DefaultSkillInfo
{
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#9c9c9c", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false) : base(skill, active, color, onlyTeam, needsTeammates)
{
}
}
} }
} }

View file

@ -0,0 +1,153 @@
using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player;
using jRandomSkills.src.utils;
using static CounterStrikeSharp.API.Core.Listeners;
using static jRandomSkills.jRandomSkills;
namespace jRandomSkills
{
public class PsychicDefusing : ISkill
{
private const Skills skillName = Skills.PsychicDefusing;
private static readonly Dictionary<CCSPlayerPawn, PlayerSkillInfo> SkillPlayerInfo = new Dictionary<CCSPlayerPawn, PlayerSkillInfo>();
private static Vector bombLocation = null;
private static float maxDefusingRange = Config.GetValue<float>(skillName, "maxDefusingRange");
private static float defusingTime = Config.GetValue<float>(skillName, "defusingTime");
private static float tickRate = 64f;
public 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<EventRoundEnd>((@event, info) =>
{
SkillPlayerInfo.Clear();
bombLocation = null;
return HookResult.Continue;
});
Instance.RegisterEventHandler<EventPlayerDeath>((@event, info) =>
{
var player = @event.Userid;
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
if (playerInfo?.Skill == skillName)
if (SkillPlayerInfo.ContainsKey(player.PlayerPawn.Value))
SkillPlayerInfo.Remove(player.PlayerPawn.Value);
return HookResult.Continue;
});
Instance.RegisterEventHandler<EventBombPlanted>((@event, info) =>
{
var plantedBomb = Utilities.FindAllEntitiesByDesignerName<CPlantedC4>("planted_c4").FirstOrDefault();
if (plantedBomb != null)
bombLocation = plantedBomb.AbsOrigin;
return HookResult.Continue;
});
Instance.RegisterListener<OnTick>(() =>
{
if (bombLocation == null) return;
foreach (var skillInfo in SkillPlayerInfo)
{
var player = skillInfo.Key;
var info = skillInfo.Value;
if (SkillUtils.GetDistance(player.AbsOrigin, bombLocation) > maxDefusingRange)
{
info.Defusing = false;
info.DefusingTime = defusingTime;
continue;
}
if (!info.Defusing)
player.EmitSound("c4.disarmstart");
info.Defusing = true;
info.DefusingTime -= (1f / tickRate);
if (info.DefusingTime <= 0)
{
var plantedBomb = Utilities.FindAllEntitiesByDesignerName<CPlantedC4>("planted_c4").FirstOrDefault();
if (plantedBomb != null)
{
plantedBomb.Remove();
SkillUtils.TerminateRound(CsTeam.CounterTerrorist);
}
SkillPlayerInfo.Clear();
}
UpdateHUD(player.Controller.Value.As<CCSPlayerController>(), info);
}
});
}
public static void EnableSkill(CCSPlayerController player)
{
SkillPlayerInfo[player.PlayerPawn.Value] = new PlayerSkillInfo
{
SteamID = player.SteamID,
Defusing = false,
DefusingTime = defusingTime,
};
}
public static void DisableSkill(CCSPlayerController player)
{
if (SkillPlayerInfo.ContainsKey(player.PlayerPawn.Value))
SkillPlayerInfo.Remove(player.PlayerPawn.Value);
}
private static void UpdateHUD(CCSPlayerController player, PlayerSkillInfo skillInfo)
{
if (!skillInfo.Defusing) return;
int cooldown = (int)skillInfo.DefusingTime + 1;
var skillData = SkillData.Skills.FirstOrDefault(s => s.Skill == skillName);
if (skillData == null) return;
string infoLine = $"<font class='fontSize-l' class='fontWeight-Bold' color='#FFFFFF'>{Localization.GetTranslation("your_skill")}:</font> <br>";
string skillLine = $"<font class='fontSize-l' class='fontWeight-Bold' color='{skillData.Color}'>{skillData.Name}</font> <br>";
string remainingLine = cooldown != 0 ? $"<font class='fontSize-m' color='#FFFFFF'>{Localization.GetTranslation("psychicdefusing_hud_info", $"<font color='#00d5ff'>{cooldown}</font>")}</font> <br>" : "";
var hudContent = infoLine + skillLine + remainingLine;
player.PrintToCenterHtml(hudContent);
}
public class PlayerSkillInfo
{
public ulong SteamID { get; set; }
public bool Defusing { get; set; }
public float DefusingTime { get; set; }
}
public class SkillConfig : Config.DefaultSkillInfo
{
public float MaxDefusingRange { get; set; }
public float DefusingTime { get; set; }
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#507529", CsTeam onlyTeam = CsTeam.CounterTerrorist, bool needsTeammates = false, float maxDefusingRange = 80f, float defusingTime = 10f) : base(skill, active, color, onlyTeam, needsTeammates)
{
MaxDefusingRange = maxDefusingRange;
DefusingTime = defusingTime;
}
}
}
}

View file

@ -0,0 +1,96 @@
using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player;
using jRandomSkills.src.utils;
using static jRandomSkills.jRandomSkills;
namespace jRandomSkills
{
public class Push : ISkill
{
private const Skills skillName = Skills.Push;
private static float jumpVelocity = Config.GetValue<float>(skillName, "jumpVelocity");
private static float pushVelocity = Config.GetValue<float>(skillName, "pushVelocity");
public static void LoadSkill()
{
SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"), false);
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<EventPlayerHurt>((@event, info) =>
{
var attacker = @event!.Attacker;
var victim = @event!.Userid;
if (!Instance.IsPlayerValid(attacker) || !Instance.IsPlayerValid(victim) || attacker == victim)
return HookResult.Continue;
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == attacker.SteamID);
if (playerInfo?.Skill == skillName && victim.PawnIsAlive)
{
if (Instance.Random.NextDouble() <= playerInfo.SkillChance)
PushEnemy(victim, attacker.PlayerPawn.Value.EyeAngles);
}
return HookResult.Continue;
});
}
public static void EnableSkill(CCSPlayerController player)
{
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
float newChance = (float)Instance.Random.NextDouble() * (Config.GetValue<float>(skillName, "ChanceTo") - Config.GetValue<float>(skillName, "ChanceFrom")) + Config.GetValue<float>(skillName, "ChanceFrom");
playerInfo.SkillChance = newChance;
newChance = (float)Math.Round(newChance, 2) * 100;
newChance = (float)Math.Round(newChance);
SkillUtils.PrintToChat(player, $"{ChatColors.DarkRed}{Localization.GetTranslation("push")}{ChatColors.Lime}: " + Localization.GetTranslation("push_desc2", newChance), false);
}
private static void PushEnemy(CCSPlayerController player, QAngle attackerAngle)
{
if (player.PlayerPawn.Value.LifeState != (int)LifeState_t.LIFE_ALIVE)
return;
var currentPosition = player.PlayerPawn.Value.AbsOrigin;
var currentAngles = player.PlayerPawn.Value.EyeAngles;
Vector newVelocity = SkillUtils.GetForwardVector(attackerAngle) * pushVelocity;
newVelocity.Z = player.PlayerPawn.Value.AbsVelocity.Z + jumpVelocity;
player.PlayerPawn.Value.Teleport(currentPosition, currentAngles, newVelocity);
}
public class SkillConfig : Config.DefaultSkillInfo
{
public float ChanceFrom { get; set; }
public float ChanceTo { get; set; }
public float JumpVelocity { get; set; }
public float PushVelocity { get; set; }
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#1e9ab0", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false, float chanceFrom = 1f, float chanceTo = 1f, float jumpVelocity = 300f, float pushVelocity = 400f) : base(skill, active, color, onlyTeam, needsTeammates)
{
ChanceFrom = chanceFrom;
ChanceTo = chanceTo;
JumpVelocity = jumpVelocity;
PushVelocity = pushVelocity;
}
}
}
}

View file

@ -0,0 +1,76 @@
using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Entities.Constants;
using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player;
using static jRandomSkills.jRandomSkills;
namespace jRandomSkills
{
public class Pyro : ISkill
{
private const Skills skillName = Skills.Pyro;
private static float regenerationMultiplier = Config.GetValue<float>(skillName, "regenerationMultiplier");
public 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<EventPlayerHurt>((@event, info) =>
{
var victim = @event.Userid;
int damage = @event.DmgHealth;
string weapon = @event.Weapon;
if (weapon != "inferno" || !Instance.IsPlayerValid(victim)) return HookResult.Continue;
var victimInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == victim.SteamID);
if (victimInfo == null || victimInfo.Skill != skillName) return HookResult.Continue;
RestoreHealth(victim, damage * regenerationMultiplier);
return HookResult.Stop;
});
}
public static void EnableSkill(CCSPlayerController player)
{
SkillUtils.TryGiveWeapon(player, player.Team == CsTeam.CounterTerrorist ? CsItem.IncendiaryGrenade : CsItem.Molotov);
}
private static void RestoreHealth(CCSPlayerController victim, float damage)
{
var playerPawn = victim.PlayerPawn.Value;
var newHealth = playerPawn.Health + damage;
if (newHealth > 100)
newHealth = 100;
playerPawn.Health = (int)newHealth;
Utilities.SetStateChanged(playerPawn, "CBaseEntity", "m_iHealth");
}
public class SkillConfig : Config.DefaultSkillInfo
{
public float RegenerationMultiplier { get; set; }
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#3c47de", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false, float regenerationMultiplier = 1.5f) : base(skill, active, color, onlyTeam, needsTeammates)
{
RegenerationMultiplier = regenerationMultiplier;
}
}
}
}

View file

@ -1,5 +1,6 @@
using CounterStrikeSharp.API; using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Modules.Memory; using CounterStrikeSharp.API.Modules.Memory;
using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player; using jRandomSkills.src.player;
using static CounterStrikeSharp.API.Core.Listeners; using static CounterStrikeSharp.API.Core.Listeners;
using static jRandomSkills.jRandomSkills; using static jRandomSkills.jRandomSkills;
@ -8,14 +9,11 @@ namespace jRandomSkills
{ {
public class QuickShot : ISkill public class QuickShot : ISkill
{ {
private static Skills skillName = Skills.QuickShot; private const Skills skillName = Skills.QuickShot;
public static void LoadSkill() public static void LoadSkill()
{ {
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true) SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
return;
SkillUtils.RegisterSkill(skillName, "#8a42f5");
Instance.RegisterListener<OnTick>(OnTick); Instance.RegisterListener<OnTick>(OnTick);
} }
@ -42,5 +40,12 @@ namespace jRandomSkills
} }
} }
} }
public class SkillConfig : Config.DefaultSkillInfo
{
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#8a42f5", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false) : base(skill, active, color, onlyTeam, needsTeammates)
{
}
}
} }
} }

View file

@ -1,5 +1,6 @@
using CounterStrikeSharp.API; using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player; using jRandomSkills.src.player;
using static CounterStrikeSharp.API.Core.Listeners; using static CounterStrikeSharp.API.Core.Listeners;
using static jRandomSkills.jRandomSkills; using static jRandomSkills.jRandomSkills;
@ -8,14 +9,11 @@ namespace jRandomSkills
{ {
public class RadarHack : ISkill public class RadarHack : ISkill
{ {
private static Skills skillName = Skills.RadarHack; private const Skills skillName = Skills.RadarHack;
public static void LoadSkill() public static void LoadSkill()
{ {
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true) SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
return;
SkillUtils.RegisterSkill(skillName, "#2effcb");
Instance.RegisterListener<OnTick>(CheckRadarowiec); Instance.RegisterListener<OnTick>(CheckRadarowiec);
} }
@ -54,5 +52,12 @@ namespace jRandomSkills
bomb.EntitySpottedState.SpottedByMask[0] |= (1u << (int)(playerIndex % 32)); bomb.EntitySpottedState.SpottedByMask[0] |= (1u << (int)(playerIndex % 32));
} }
} }
public class SkillConfig : Config.DefaultSkillInfo
{
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#2effcb", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false) : base(skill, active, color, onlyTeam, needsTeammates)
{
}
}
} }
} }

View file

@ -1,5 +1,6 @@
using CounterStrikeSharp.API; using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player; using jRandomSkills.src.player;
using static jRandomSkills.jRandomSkills; using static jRandomSkills.jRandomSkills;
@ -7,14 +8,13 @@ namespace jRandomSkills
{ {
public class Rambo : ISkill public class Rambo : ISkill
{ {
private static Skills skillName = Skills.Rambo; private const Skills skillName = Skills.Rambo;
private static int minExtraHealth = Config.GetValue<int>(skillName, "minExtraHealth");
private static int maxExtraHealth = Config.GetValue<int>(skillName, "maxExtraHealth");
public static void LoadSkill() public static void LoadSkill()
{ {
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true) SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
return;
SkillUtils.RegisterSkill(skillName, "#009905");
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) => Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
{ {
@ -34,7 +34,7 @@ namespace jRandomSkills
public static void EnableSkill(CCSPlayerController player) public static void EnableSkill(CCSPlayerController player)
{ {
int healthBonus = Instance.Random.Next(50, 501); int healthBonus = Instance.Random.Next(minExtraHealth, maxExtraHealth);
AddHealth(player, healthBonus); AddHealth(player, healthBonus);
} }
@ -66,5 +66,16 @@ namespace jRandomSkills
pawn.Health = Math.Min(pawn.Health, 100); pawn.Health = Math.Min(pawn.Health, 100);
Utilities.SetStateChanged(pawn, "CBaseEntity", "m_iHealth"); Utilities.SetStateChanged(pawn, "CBaseEntity", "m_iHealth");
} }
public class SkillConfig : Config.DefaultSkillInfo
{
public int MinExtraHealth { get; set; }
public int MaxExtraHealth { get; set; }
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#009905", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false, int minExtraHealth = 50, int maxExtraHealth = 501) : base(skill, active, color, onlyTeam, needsTeammates)
{
MinExtraHealth = minExtraHealth;
MaxExtraHealth = maxExtraHealth;
}
}
} }
} }

View file

@ -1,5 +1,6 @@
using CounterStrikeSharp.API; using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player; using jRandomSkills.src.player;
using jRandomSkills.src.utils; using jRandomSkills.src.utils;
using System.Collections.Immutable; using System.Collections.Immutable;
@ -10,8 +11,8 @@ namespace jRandomSkills
{ {
public class RandomWeapon : ISkill public class RandomWeapon : ISkill
{ {
private static Skills skillName = Skills.RandomWeapon; private const Skills skillName = Skills.RandomWeapon;
private static float timerCooldown = (float)(Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Cooldown); private static float timerCooldown = Config.GetValue<float>(skillName, "cooldown");
private static readonly Dictionary<ulong, PlayerSkillInfo> SkillPlayerInfo = new Dictionary<ulong, PlayerSkillInfo>(); private static readonly Dictionary<ulong, PlayerSkillInfo> SkillPlayerInfo = new Dictionary<ulong, PlayerSkillInfo>();
private static string[] pistols = { "weapon_deagle", "weapon_revolver", "weapon_glock", "weapon_usp_silencer", private static string[] pistols = { "weapon_deagle", "weapon_revolver", "weapon_glock", "weapon_usp_silencer",
@ -24,10 +25,7 @@ namespace jRandomSkills
public static void LoadSkill() public static void LoadSkill()
{ {
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true) SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
return;
SkillUtils.RegisterSkill(skillName, "#e0873a");
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) => Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
{ {
@ -179,5 +177,14 @@ namespace jRandomSkills
public DateTime Cooldown { get; set; } public DateTime Cooldown { get; set; }
public DateTime LastClick { get; set; } public DateTime LastClick { get; set; }
} }
public class SkillConfig : Config.DefaultSkillInfo
{
public float Cooldown { get; set; }
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#e0873a", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false, float cooldown = 15f) : base(skill, active, color, onlyTeam, needsTeammates)
{
Cooldown = cooldown;
}
}
} }
} }

View file

@ -0,0 +1,91 @@
using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player;
using System.Drawing;
using static jRandomSkills.jRandomSkills;
namespace jRandomSkills
{
public class ReZombie : ISkill
{
private const Skills skillName = Skills.ReZombie;
private static int zombieHealth = Config.GetValue<int>(skillName, "zombieHealth");
private static HashSet<CCSPlayerController> zombies = new HashSet<CCSPlayerController>();
public static void LoadSkill()
{
SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
Instance.RegisterEventHandler<EventItemEquip>((@event, info) =>
{
var player = @event.Userid;
var weapon = @event.Item;
if (!zombies.Contains(player) || weapon == "c4") return HookResult.Continue;
player.ExecuteClientCommand("slot3");
return HookResult.Stop;
});
Instance.RegisterEventHandler<EventRoundStart>((@event, info) =>
{
foreach(var player in zombies)
DisableSkill(player);
zombies.Clear();
return HookResult.Stop;
});
Instance.RegisterEventHandler<EventPlayerDeath>((@event, info) =>
{
var player = @event.Userid;
if (player == null || !player.IsValid || !player.PlayerPawn.Value.IsValid || zombies.Contains(player)) return HookResult.Continue;
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
if (playerInfo?.Skill != skillName) return HookResult.Continue;
var pawn = player.PlayerPawn.Value;
Vector deadPosition = new Vector(pawn.AbsOrigin.X, pawn.AbsOrigin.Y, pawn.AbsOrigin.Z);
QAngle deadRotation = new QAngle(pawn.EyeAngles.X, pawn.EyeAngles.Y, pawn.EyeAngles.Z);
player.Respawn();
Instance.AddTimer(.2f, () => {
player.Respawn();
zombies.Add(player);
player.ExecuteClientCommand("slot3");
SetPlayerColor(pawn, false);
SkillUtils.AddHealth(pawn, zombieHealth - 100, zombieHealth);
pawn.Teleport(deadPosition, deadRotation);
});
return HookResult.Continue;
});
}
public static void EnableSkill(CCSPlayerController player)
{
zombies.Remove(player);
}
public static void DisableSkill(CCSPlayerController player)
{
zombies.Remove(player);
SetPlayerColor(player.PlayerPawn.Value, true);
}
private static void SetPlayerColor(CCSPlayerPawn pawn, bool normal)
{
var color = normal ? Color.FromArgb(255, 255, 255, 255) : Color.FromArgb(255, 255, 0, 0);
pawn.Render = color;
Utilities.SetStateChanged(pawn, "CBaseModelEntity", "m_clrRender");
}
public class SkillConfig : Config.DefaultSkillInfo
{
public int ZombieHealth { get; set; }
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#ff5C0A", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false, int zombieHealth = 200) : base(skill, active, color, onlyTeam, needsTeammates)
{
ZombieHealth = zombieHealth;
}
}
}
}

View file

@ -1,7 +1,6 @@
using CounterStrikeSharp.API; using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Memory; using CounterStrikeSharp.API.Modules.Utils;
using CounterStrikeSharp.API.Modules.Memory.DynamicFunctions;
using jRandomSkills.src.player; using jRandomSkills.src.player;
using jRandomSkills.src.utils; using jRandomSkills.src.utils;
using static CounterStrikeSharp.API.Core.Listeners; using static CounterStrikeSharp.API.Core.Listeners;
@ -11,16 +10,13 @@ namespace jRandomSkills
{ {
public class ReactiveArmor : ISkill public class ReactiveArmor : ISkill
{ {
private static Skills skillName = Skills.ReactiveArmor; private const Skills skillName = Skills.ReactiveArmor;
private static float timerCooldown = (float)(Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Cooldown); private static float timerCooldown = Config.GetValue<float>(skillName, "cooldown");
private static readonly Dictionary<ulong, PlayerSkillInfo> SkillPlayerInfo = new Dictionary<ulong, PlayerSkillInfo>(); private static readonly Dictionary<ulong, PlayerSkillInfo> SkillPlayerInfo = new Dictionary<ulong, PlayerSkillInfo>();
public static void LoadSkill() public static void LoadSkill()
{ {
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true) SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
return;
SkillUtils.RegisterSkill(skillName, "#3cded3");
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) => Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
{ {
@ -73,7 +69,6 @@ namespace jRandomSkills
int damage = @event.DmgHealth; int damage = @event.DmgHealth;
if (!Instance.IsPlayerValid(attacker) || !Instance.IsPlayerValid(victim)) return HookResult.Continue; if (!Instance.IsPlayerValid(attacker) || !Instance.IsPlayerValid(victim)) return HookResult.Continue;
if (SkillPlayerInfo.TryGetValue(victim.SteamID, out var skillInfo)) if (SkillPlayerInfo.TryGetValue(victim.SteamID, out var skillInfo))
{ {
if (!victim.IsValid || !victim.PawnIsAlive || !skillInfo.CanUse) return HookResult.Continue; if (!victim.IsValid || !victim.PawnIsAlive || !skillInfo.CanUse) return HookResult.Continue;
@ -146,5 +141,14 @@ namespace jRandomSkills
public DateTime Cooldown { get; set; } public DateTime Cooldown { get; set; }
public DateTime LastClick { get; set; } public DateTime LastClick { get; set; }
} }
public class SkillConfig : Config.DefaultSkillInfo
{
public float Cooldown { get; set; }
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#3cded3", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false, float cooldown = 15) : base(skill, active, color, onlyTeam, needsTeammates)
{
Cooldown = cooldown;
}
}
} }
} }

View file

@ -0,0 +1,46 @@
using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player;
using static jRandomSkills.jRandomSkills;
namespace jRandomSkills
{
public class Regeneration : ISkill
{
private const Skills skillName = Skills.Regeneration;
private static int cooldown = Config.GetValue<int>(skillName, "cooldown");
private static int healthToAdd = Config.GetValue<int>(skillName, "healthToAdd");
public static void LoadSkill()
{
SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
Instance.RegisterListener<Listeners.OnTick>(OnTick);
}
private static void OnTick()
{
if (Server.TickCount % (64 * cooldown) != 0) return;
foreach (var player in Utilities.GetPlayers())
{
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
if (playerInfo?.Skill != skillName) continue;
var pawn = player.PlayerPawn.Value;
if (pawn == null || !pawn.IsValid) continue;
SkillUtils.AddHealth(pawn, healthToAdd);
}
}
public class SkillConfig : Config.DefaultSkillInfo
{
public int HealthToAdd { get; set; }
public int Cooldown { get; set; }
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#ff462e", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false, int healthToAdd = 1, int cooldown = 1) : base(skill, active, color, onlyTeam, needsTeammates)
{
HealthToAdd = healthToAdd;
Cooldown = cooldown;
}
}
}
}

View file

@ -12,16 +12,13 @@ namespace jRandomSkills
{ {
public class Replicator : ISkill public class Replicator : ISkill
{ {
private static Skills skillName = Skills.Replicator; private const Skills skillName = Skills.Replicator;
private static float timerCooldown = (float)(Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Cooldown); private static float timerCooldown = Config.GetValue<float>(skillName, "cooldown");
private static readonly Dictionary<ulong, PlayerSkillInfo> SkillPlayerInfo = new Dictionary<ulong, PlayerSkillInfo>(); private static readonly Dictionary<ulong, PlayerSkillInfo> SkillPlayerInfo = new Dictionary<ulong, PlayerSkillInfo>();
public static void LoadSkill() public static void LoadSkill()
{ {
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true) SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
return;
SkillUtils.RegisterSkill(skillName, "#a3000b");
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) => Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
{ {
@ -68,7 +65,6 @@ namespace jRandomSkills
}); });
VirtualFunctions.CBaseEntity_TakeDamageOldFunc.Hook(OnTakeDamage, HookMode.Pre); VirtualFunctions.CBaseEntity_TakeDamageOldFunc.Hook(OnTakeDamage, HookMode.Pre);
} }
public static void EnableSkill(CCSPlayerController player) public static void EnableSkill(CCSPlayerController player)
@ -183,5 +179,14 @@ namespace jRandomSkills
public DateTime Cooldown { get; set; } public DateTime Cooldown { get; set; }
public DateTime LastClick { get; set; } public DateTime LastClick { get; set; }
} }
public class SkillConfig : Config.DefaultSkillInfo
{
public float Cooldown { get; set; }
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#a3000b", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false, float cooldown = 15f) : base(skill, active, color, onlyTeam, needsTeammates)
{
Cooldown = cooldown;
}
}
} }
} }

View file

@ -10,16 +10,13 @@ namespace jRandomSkills
{ {
public class Retreat : ISkill public class Retreat : ISkill
{ {
private static Skills skillName = Skills.Retreat; private const Skills skillName = Skills.Retreat;
private static float timerCooldown = (float)(Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Cooldown); private static float timerCooldown = Config.GetValue<float>(skillName, "cooldown");
private static readonly Dictionary<ulong, PlayerSkillInfo> SkillPlayerInfo = new Dictionary<ulong, PlayerSkillInfo>(); private static readonly Dictionary<ulong, PlayerSkillInfo> SkillPlayerInfo = new Dictionary<ulong, PlayerSkillInfo>();
public static void LoadSkill() public static void LoadSkill()
{ {
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true) SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
return;
SkillUtils.RegisterSkill(skillName, "#a86eff");
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) => Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
{ {
@ -146,5 +143,14 @@ namespace jRandomSkills
public DateTime Cooldown { get; set; } public DateTime Cooldown { get; set; }
public DateTime LastClick { get; set; } public DateTime LastClick { get; set; }
} }
public class SkillConfig : Config.DefaultSkillInfo
{
public float Cooldown { get; set; }
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#a86eff", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false, float cooldown = 15f) : base(skill, active, color, onlyTeam, needsTeammates)
{
Cooldown = cooldown;
}
}
} }
} }

View file

@ -1,7 +1,5 @@
using CounterStrikeSharp.API; using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Memory;
using CounterStrikeSharp.API.Modules.Memory.DynamicFunctions;
using CounterStrikeSharp.API.Modules.Utils; using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player; using jRandomSkills.src.player;
using static jRandomSkills.jRandomSkills; using static jRandomSkills.jRandomSkills;
@ -10,15 +8,12 @@ namespace jRandomSkills
{ {
public class ReturnToSender : ISkill public class ReturnToSender : ISkill
{ {
private static Skills skillName = Skills.ReturnToSender; private const Skills skillName = Skills.ReturnToSender;
private static HashSet<nint> playersToSender = new HashSet<nint>(); private static HashSet<nint> playersToSender = new HashSet<nint>();
public static void LoadSkill() public static void LoadSkill()
{ {
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true) SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
return;
SkillUtils.RegisterSkill(skillName, "#a68132");
Instance.RegisterEventHandler<EventRoundEnd>((@event, info) => Instance.RegisterEventHandler<EventRoundEnd>((@event, info) =>
{ {
@ -32,7 +27,7 @@ namespace jRandomSkills
var victim = @event.Userid; var victim = @event.Userid;
int damage = @event.DmgHealth; int damage = @event.DmgHealth;
if (!Instance.IsPlayerValid(attacker) || !Instance.IsPlayerValid(victim)) return HookResult.Continue; if (!Instance.IsPlayerValid(attacker) || !Instance.IsPlayerValid(victim) || attacker == victim) return HookResult.Continue;
var attackerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == attacker.SteamID); var attackerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == attacker.SteamID);
if (attackerInfo == null || attackerInfo.Skill != skillName) return HookResult.Continue; if (attackerInfo == null || attackerInfo.Skill != skillName) return HookResult.Continue;
@ -61,5 +56,12 @@ namespace jRandomSkills
} }
return new Vector(abs.X, abs.Y, abs.Z); return new Vector(abs.X, abs.Y, abs.Z);
} }
public class SkillConfig : Config.DefaultSkillInfo
{
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#a68132", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false) : base(skill, active, color, onlyTeam, needsTeammates)
{
}
}
} }
} }

View file

@ -1,5 +1,6 @@
using CounterStrikeSharp.API; using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player; using jRandomSkills.src.player;
using static jRandomSkills.jRandomSkills; using static jRandomSkills.jRandomSkills;
@ -7,14 +8,13 @@ namespace jRandomSkills
{ {
public class RichBoy : ISkill public class RichBoy : ISkill
{ {
private static Skills skillName = Skills.RichBoy; private const Skills skillName = Skills.RichBoy;
private static int minMoney = Config.GetValue<int>(skillName, "minMoney");
private static int maxMoney = Config.GetValue<int>(skillName, "maxMoney");
public static void LoadSkill() public static void LoadSkill()
{ {
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true) SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
return;
SkillUtils.RegisterSkill(skillName, "#D4AF37");
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) => Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
{ {
@ -26,7 +26,7 @@ namespace jRandomSkills
if (playerInfo?.Skill == skillName) if (playerInfo?.Skill == skillName)
{ {
int moneyBonus = Instance.Random.Next(5000, 15000); int moneyBonus = Instance.Random.Next(minMoney, maxMoney);
playerInfo.SkillChance = moneyBonus; playerInfo.SkillChance = moneyBonus;
AddMoney(player, moneyBonus); AddMoney(player, moneyBonus);
} }
@ -39,7 +39,7 @@ namespace jRandomSkills
public static void EnableSkill(CCSPlayerController player) public static void EnableSkill(CCSPlayerController player)
{ {
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID); var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
int moneyBonus = Instance.Random.Next(5000, 15000); int moneyBonus = Instance.Random.Next(minMoney, maxMoney);
playerInfo.SkillChance = moneyBonus; playerInfo.SkillChance = moneyBonus;
AddMoney(player, moneyBonus); AddMoney(player, moneyBonus);
} }
@ -59,5 +59,16 @@ namespace jRandomSkills
moneyServices.Account = Math.Max(moneyServices.Account + money, 0); moneyServices.Account = Math.Max(moneyServices.Account + money, 0);
Utilities.SetStateChanged(player, "CCSPlayerController", "m_pInGameMoneyServices"); Utilities.SetStateChanged(player, "CCSPlayerController", "m_pInGameMoneyServices");
} }
public class SkillConfig : Config.DefaultSkillInfo
{
public int MinMoney { get; set; }
public int MaxMoney { get; set; }
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#D4AF37", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false, int minMoney = 5000, int maxMoney = 15000) : base(skill, active, color, onlyTeam, needsTeammates)
{
MinMoney = minMoney;
MaxMoney = maxMoney;
}
}
} }
} }

View file

@ -1,5 +1,6 @@
using CounterStrikeSharp.API; using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player; using jRandomSkills.src.player;
using static jRandomSkills.jRandomSkills; using static jRandomSkills.jRandomSkills;
@ -7,25 +8,24 @@ namespace jRandomSkills
{ {
public class RobinHood : ISkill public class RobinHood : ISkill
{ {
private static Skills skillName = Skills.RobinHood; private const Skills skillName = Skills.RobinHood;
private static int moneyMultiplier = Config.GetValue<int>(skillName, "moneyMultiplier");
public static void LoadSkill() public static void LoadSkill()
{ {
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true) SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
return;
SkillUtils.RegisterSkill(skillName, "#119125");
Instance.RegisterEventHandler<EventPlayerHurt>((@event, info) => Instance.RegisterEventHandler<EventPlayerHurt>((@event, info) =>
{ {
var victim = @event.Userid; var victim = @event.Userid;
var attacker = @event.Attacker; var attacker = @event.Attacker;
var damage = @event.DmgHealth; var damage = @event.DmgHealth;
if (!Instance.IsPlayerValid(victim) || !Instance.IsPlayerValid(attacker)) return HookResult.Continue; if (!Instance.IsPlayerValid(attacker) || !Instance.IsPlayerValid(victim) || attacker == victim) return HookResult.Continue;
var attackerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == attacker.SteamID); var attackerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == attacker.SteamID);
if (attackerInfo?.Skill != skillName) return HookResult.Continue; if (attackerInfo?.Skill != skillName) return HookResult.Continue;
int moneyToSteal = damage * 35; int moneyToSteal = damage * moneyMultiplier;
StealMoney(victim, attacker, moneyToSteal); StealMoney(victim, attacker, moneyToSteal);
return HookResult.Continue; return HookResult.Continue;
@ -45,5 +45,14 @@ namespace jRandomSkills
attackerMoneyServices.Account = Math.Min(attackerMoneyServices.Account + moneyToAdd, 16000); attackerMoneyServices.Account = Math.Min(attackerMoneyServices.Account + moneyToAdd, 16000);
Utilities.SetStateChanged(attacker, "CCSPlayerController", "m_pInGameMoneyServices"); Utilities.SetStateChanged(attacker, "CCSPlayerController", "m_pInGameMoneyServices");
} }
public class SkillConfig : Config.DefaultSkillInfo
{
public int MoneyMultiplier { get; set; }
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#119125", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false, int moneyMultiplier = 35) : base(skill, active, color, onlyTeam, needsTeammates)
{
MoneyMultiplier = moneyMultiplier;
}
}
} }
} }

View file

@ -0,0 +1,74 @@
using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player;
using static jRandomSkills.jRandomSkills;
namespace jRandomSkills
{
public class Rubber: ISkill
{
private const Skills skillName = Skills.Rubber;
private static float rubberTime = Config.GetValue<float>(skillName, "slownessTime");
private static float rubberModifier = Config.GetValue<float>(skillName, "slownessModifier");
private static Dictionary<CCSPlayerPawn, float> playersToSlow = new Dictionary<CCSPlayerPawn, float>();
public static void LoadSkill()
{
SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
Instance.RegisterEventHandler<EventPlayerHurt>((@event, info) =>
{
var attacker = @event.Attacker;
var victim = @event.Userid;
if (!Instance.IsPlayerValid(attacker) || !Instance.IsPlayerValid(victim) || attacker == victim) return HookResult.Continue;
var attackerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == attacker.SteamID);
if (attackerInfo?.Skill == skillName)
playersToSlow.Add(victim.PlayerPawn.Value, Server.TickCount + (64 * rubberTime));
return HookResult.Continue;
});
Instance.RegisterEventHandler<EventRoundEnd>((@event, info) =>
{
playersToSlow.Clear();
return HookResult.Continue;
});
Instance.RegisterListener<Listeners.OnTick>(OnTick);
}
private static void OnTick()
{
foreach(var item in playersToSlow)
{
var pawn = item.Key;
var time = item.Value;
if (time >= Server.TickCount)
ChangeVelocity(pawn);
else
playersToSlow.Remove(item.Key);
}
}
private static void ChangeVelocity(CCSPlayerPawn pawn)
{
if (pawn == null || !pawn.IsValid) return;
pawn.VelocityModifier = rubberModifier;
}
public class SkillConfig : Config.DefaultSkillInfo
{
public float SlownessTime { get; set; }
public float SlownessModifier { get; set; }
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#8B4513", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false, float slownessTime = 2f, float slownessModifier = .2f) : base(skill, active, color, onlyTeam, needsTeammates)
{
SlownessTime = slownessTime;
SlownessModifier = slownessModifier;
}
}
}
}

View file

@ -1,18 +1,18 @@
using CounterStrikeSharp.API; using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player; using jRandomSkills.src.player;
using jRandomSkills.src.utils;
using static jRandomSkills.jRandomSkills; using static jRandomSkills.jRandomSkills;
namespace jRandomSkills namespace jRandomSkills
{ {
public class Saper : ISkill public class Saper : ISkill
{ {
private static Skills skillName = Skills.Saper; private const Skills skillName = Skills.Saper;
public static void LoadSkill() public static void LoadSkill()
{ {
SkillUtils.RegisterSkill(skillName, "#8A2BE2"); SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
Instance.RegisterEventHandler<EventBombBeginplant>((@event, info) => Instance.RegisterEventHandler<EventBombBeginplant>((@event, info) =>
{ {
@ -62,5 +62,12 @@ namespace jRandomSkills
return HookResult.Continue; return HookResult.Continue;
}); });
} }
public class SkillConfig : Config.DefaultSkillInfo
{
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#8A2BE2", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false) : base(skill, active, color, onlyTeam, needsTeammates)
{
}
}
} }
} }

View file

@ -8,16 +8,13 @@ namespace jRandomSkills
{ {
public class SecondLife : ISkill public class SecondLife : ISkill
{ {
private static Skills skillName = Skills.SecondLife; private const Skills skillName = Skills.SecondLife;
private static int secondLifeHealth = 50; private static int secondLifeHealth = Config.GetValue<int>(skillName, "startHealth");
private static HashSet<nint> secondLifePlayers = new HashSet<nint>(); private static HashSet<nint> secondLifePlayers = new HashSet<nint>();
public static void LoadSkill() public static void LoadSkill()
{ {
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true) SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
return;
SkillUtils.RegisterSkill(skillName, "#d41c1c");
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) => Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
{ {
@ -44,21 +41,20 @@ namespace jRandomSkills
Instance.RegisterEventHandler<EventPlayerHurt>((@event, info) => Instance.RegisterEventHandler<EventPlayerHurt>((@event, info) =>
{ {
var attacker = @event.Attacker;
var victim = @event.Userid; var victim = @event.Userid;
int damage = @event.DmgHealth; int damage = @event.DmgHealth;
if (!Instance.IsPlayerValid(attacker) || !Instance.IsPlayerValid(victim)) return HookResult.Continue; if (!Instance.IsPlayerValid(victim)) return HookResult.Continue;
var victimInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == victim.SteamID); var victimInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == victim.SteamID);
if (victimInfo == null || victimInfo.Skill != skillName) return HookResult.Continue; if (victimInfo == null || victimInfo.Skill != skillName) return HookResult.Continue;
var victimPawn = victim.PlayerPawn.Value; var victimPawn = victim.PlayerPawn.Value;
if (victimPawn.Health - damage >= 0 || secondLifePlayers.TryGetValue(victim.Handle, out _)) if (victimPawn.Health > 0 || secondLifePlayers.TryGetValue(victim.Handle, out _) == true)
return HookResult.Continue; return HookResult.Continue;
secondLifePlayers.Add(victim.Handle); secondLifePlayers.Add(victim.Handle);
SetHealth(victim, secondLifeHealth); SetHealth(victim, secondLifeHealth);
victimPawn.Teleport(GetSpawnVector(victim)); victimPawn.Teleport(GetSpawnVector(victim), victimPawn.AbsRotation, null);
return HookResult.Stop; return HookResult.Stop;
}); });
} }
@ -98,5 +94,14 @@ namespace jRandomSkills
} }
return new Vector(abs.X, abs.Y, abs.Z); return new Vector(abs.X, abs.Y, abs.Z);
} }
public class SkillConfig : Config.DefaultSkillInfo
{
public int StartHealth { get; set; }
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#d41c1c", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false, int startHealth = 50) : base(skill, active, color, onlyTeam, needsTeammates)
{
StartHealth = startHealth;
}
}
} }
} }

Some files were not shown because too many files have changed in this diff Show more