This commit is contained in:
Juzlus 2025-02-25 21:38:43 +01:00
parent 262f618b31
commit fc0d2a3265
18 changed files with 515 additions and 143 deletions

View file

@ -17,7 +17,7 @@ namespace jRandomSkills
public override string ModuleName => "[CS2] [ jRandomSkills ]";
public override string ModuleAuthor => "D3X, Juzlus";
public override string ModuleDescription => "Plugin adds random skills to the server 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.3";
public override void Load(bool hotReload)
@ -71,7 +71,7 @@ namespace jRandomSkills
}
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[] silentSoundEvents = { 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 = { 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

View file

@ -5,7 +5,7 @@
"astronaut_desc": "You receive a random gravity value at the start of the round",
"astronaut_desc2": "Your random gravity is: {0}x",
"richboy_desc": "You receive a random amount of money at the start of the round",
"bunnyhop_desc": "You get auto BunnyHop",
"bunnyhop_desc": "You get auto \"BunnyHop\"",
"silent_desc": "Your footsteps and jumps are silent to OTHER players",
"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",
@ -48,7 +48,7 @@
"quickshot_desc": "No cooldown when shooting",
"teleporter_desc": "You swap places with the hit enemy",
"wallhack_desc": "You can see enemies through walls",
"killer_flash_desc": "Every enemy fully blinded by your flashbang dies (including you)",
"killerflash_desc": "Every enemy fully blinded by your flashbang dies (including you)",
"weaponsswap_desc": "Swap weapons with a random enemy. Press [css_useSkill], cooldown 30s",
"weaponsswap_hud_info2": "You have no weapon to swap",
"hud_info_no_enemy": "No enemy found",
@ -93,7 +93,7 @@
"radarhack": "Radar Hack",
"quickshot": "Quick-Shot",
"planter": "Planter",
"silent": "Silent Shadow",
"silent": "Silent",
"frozendecoy": "Freezing Decoy",
"timemanipulator": "Time Slow",
"godmode": "God Mode",
@ -119,7 +119,7 @@
"catapult": "Catapult",
"dracula": "Dracula",
"teleporter": "Teleporter",
"saper": "Saper",
"saper": "Sapper",
"phoenix": "Phoenix",
"pilot": "Pilot",
"shade": "Shade",

View file

@ -5,7 +5,7 @@
"astronaut_desc": "Otrzymujesz losową ilość grawitacji na start rundy",
"astronaut_desc2": "Twoja losowa grawitacja wynosi: {0}x",
"richboy_desc": "Otrzymujesz losową ilość kasy na start rundy",
"bunnyhop_desc": "Otrzymujesz auto BunnyHopa",
"bunnyhop_desc": "Otrzymujesz auto \"BunnyHopa\"",
"silent_desc": "Twoje kroki i skoki są niesłyszalne dla INNYCH graczy",
"shade_desc": "Teleportujesz się za plecy trafionego wroga",
"dracula_desc": "Po trafieniu ofiary otrzymujesz zwrot zdrowia w postaci danego procentu zadanych obrażeń",
@ -48,7 +48,7 @@
"quickshot_desc": "Brak cooldown przy strzelaniu",
"teleporter_desc": "Zamieniasz się miejscami z trafionym wrogiem",
"wallhack_desc": "Widzisz wrogów przez ściany",
"killer_flash_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_desc": "Zamieniasz się bronią z losowym wrogiem. Kliknij [css_useSkill], cooldown 30s",
"weaponsswap_hud_info2": "Nie posiadasz broni na zamiane",
"hud_info_no_enemy": "Nie znaleziono przeciwnika",

View file

@ -35,6 +35,9 @@ namespace jRandomSkills
if (attackerPawn == null || attackerPawn.Controller?.Value == null || victimPawn == null || victimPawn.Controller?.Value == null)
return HookResult.Continue;
if (attackerPawn.DesignerName != "player" || victimPawn.DesignerName != "player")
return HookResult.Continue;
CCSPlayerController attacker = attackerPawn.Controller.Value.As<CCSPlayerController>();
CCSPlayerController victim = victimPawn.Controller.Value.As<CCSPlayerController>();

View file

@ -67,6 +67,9 @@ namespace jRandomSkills
if (attackerPawn == null || attackerPawn.Controller?.Value == null || victimPawn == null || victimPawn.Controller?.Value == null)
return HookResult.Continue;
if (attackerPawn.DesignerName != "player" || victimPawn.DesignerName != "player")
return HookResult.Continue;
CCSPlayerController attacker = attackerPawn.Controller.Value.As<CCSPlayerController>();
CCSPlayerController victim = victimPawn.Controller.Value.As<CCSPlayerController>();

View file

@ -1,4 +1,4 @@
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Memory;
using CounterStrikeSharp.API.Modules.Memory.DynamicFunctions;
using jRandomSkills.src.player;
@ -33,18 +33,18 @@ namespace jRandomSkills
if (attackerPawn == null || attackerPawn.Controller?.Value == null || victimPawn == null || victimPawn.Controller?.Value == null)
return HookResult.Continue;
if (attackerPawn.DesignerName != "player" || victimPawn.DesignerName != "player")
return HookResult.Continue;
CCSPlayerController attacker = attackerPawn.Controller.Value.As<CCSPlayerController>();
CCSPlayerController victim = victimPawn.Controller.Value.As<CCSPlayerController>();
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == attacker.SteamID);
if (playerInfo == null) return HookResult.Continue;
if (playerInfo.Skill == skillName && attacker.PawnIsAlive)
{
param2.Damage = 1000f;
}
return HookResult.Continue;
if (playerInfo.Skill == skillName && attacker.PawnIsAlive)
param2.Damage = 1000f;
return HookResult.Changed;
}
}
}

View file

@ -23,7 +23,7 @@ namespace jRandomSkills
var userIndex = um.ReadUInt("source_entity_index");
if (userIndex == 0) return HookResult.Continue;
if (!Instance.footstepSoundEvents.Contains(soundevent) && !Instance.silentSoundEvents.Contains(soundevent))
return HookResult.Continue;

View file

@ -42,7 +42,11 @@ namespace jRandomSkills
public static void EnableSkill(CCSPlayerController player)
{
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
float newScale = (float)Instance.Random.NextDouble() * (1.35f - 1.15f) + 1.15f;
var skillConfig = Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString());
if (skillConfig == null) return;
float newScale = (float)Instance.Random.NextDouble() * (skillConfig.ChanceTo - skillConfig.ChanceFrom) + skillConfig.ChanceFrom;
playerInfo.SkillChance = newScale;
newScale = (float)Math.Round(newScale, 2);
Utils.PrintToChat(player, $"{ChatColors.DarkRed}{Localization.GetTranslation("soldier")}{ChatColors.Lime}: " + Localization.GetTranslation("soldier_desc2", newScale), false);
@ -62,6 +66,9 @@ namespace jRandomSkills
if (attackerPawn == null || attackerPawn.Controller?.Value == null || victimPawn == null || victimPawn.Controller?.Value == null)
return HookResult.Continue;
if (attackerPawn.DesignerName != "player" || victimPawn.DesignerName != "player")
return HookResult.Continue;
CCSPlayerController attacker = attackerPawn.Controller.Value.As<CCSPlayerController>();
CCSPlayerController victim = victimPawn.Controller.Value.As<CCSPlayerController>();

View file

@ -127,14 +127,6 @@ namespace jRandomSkills
player.PrintToCenterHtml(hudContent);
}
private static void ActiveUse(CCSPlayerController player)
{
if (SkillPlayerInfo.TryGetValue(player.SteamID, out var skillInfo))
{
skillInfo.CanUse = true;
}
}
private static void UseSkill(CCSPlayerController player)
{
var playerPawn = player.PlayerPawn.Value;

View file

@ -115,14 +115,6 @@ namespace jRandomSkills
player.PrintToCenterHtml(hudContent);
}
private static void ActiveUse(CCSPlayerController player)
{
if (SkillPlayerInfo.TryGetValue(player.SteamID, out var skillInfo))
{
skillInfo.CanUse = true;
}
}
private static void UseSkill(CCSPlayerController player)
{
var playerPawn = player.PlayerPawn.Value;
@ -136,8 +128,13 @@ namespace jRandomSkills
skillInfo.CanUse = false;
skillInfo.Cooldown = DateTime.Now;
Server.ExecuteCommand("sv_cheats 1");
Server.ExecuteCommand("host_timescale 0.1");
Instance.AddTimer(.6f, () => Server.ExecuteCommand("host_timescale 1"));
Instance.AddTimer(.6f, () =>
{
Server.ExecuteCommand("host_timescale 1");
Server.ExecuteCommand("sv_cheats 0");
});
}
else
skillInfo.LastClick = DateTime.Now;

View file

@ -75,7 +75,7 @@ namespace jRandomSkills
new SkillInfo(Skills.Dwarf, chanceFrom : .6f, chanceTo : .95f),
new SkillInfo(Skills.SwapPosition, cooldown: 30),
new SkillInfo(Skills.FrozenDecoy),
new SkillInfo(Skills.Soldier),
new SkillInfo(Skills.Soldier, chanceFrom: 1.15f, chanceTo: 1.35f),
new SkillInfo(Skills.Armored, chanceFrom : .65f, chanceTo : .85f),
new SkillInfo(Skills.Aimbot, only1v1: true),
new SkillInfo(Skills.Retreat, cooldown: 15),