Initial commit
This commit is contained in:
commit
810ca2fa3c
37 changed files with 1998 additions and 0 deletions
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
# Auto detect text files and perform LF normalization
|
||||
* text=auto
|
||||
14
[ D3X ] dRandomSkills - SRC Files/dRandomSkills.csproj
Normal file
14
[ D3X ] dRandomSkills - SRC Files/dRandomSkills.csproj
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CounterStrikeSharp.API" Version="1.0.264" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
106
[ D3X ] dRandomSkills - SRC Files/src/command/Command.cs
Normal file
106
[ D3X ] dRandomSkills - SRC Files/src/command/Command.cs
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Admin;
|
||||
using CounterStrikeSharp.API.Modules.Commands;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
{
|
||||
public static class Command
|
||||
{
|
||||
public static void Load()
|
||||
{
|
||||
var config = Config.config?.Settings;
|
||||
if (config == null || config == null) return;
|
||||
|
||||
var commands = new Dictionary<IEnumerable<string>, (string description, CommandInfo.CommandCallback handler)>
|
||||
{
|
||||
{ SplitCommands(config.Set_Skill), ("Delete record", Command_SetSkill) },
|
||||
{ SplitCommands(config.SkillsList_Menu), ("Delete all records", Command_SkillsListMenu) }
|
||||
};
|
||||
|
||||
foreach (var commandPair in commands)
|
||||
{
|
||||
foreach (var command in commandPair.Key)
|
||||
{
|
||||
Instance.AddCommand($"css_{command}", commandPair.Value.description, commandPair.Value.handler);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static IEnumerable<string> SplitCommands(string commands)
|
||||
{
|
||||
return commands.Split(',').Select(c => c.Trim());
|
||||
}
|
||||
|
||||
public static void AddCommands(IEnumerable<string> commands, string description, CommandInfo.CommandCallback commandAction)
|
||||
{
|
||||
foreach (var command in commands)
|
||||
{
|
||||
Instance.AddCommand($"css_{command}", description, commandAction);
|
||||
}
|
||||
}
|
||||
|
||||
[RequiresPermissions("@css/root")]
|
||||
[CommandHelper(minArgs: 0, whoCanExecute: CommandUsage.CLIENT_ONLY)]
|
||||
public static void Command_SetSkill(CCSPlayerController? player, CommandInfo command)
|
||||
{
|
||||
if (player == null) return;
|
||||
|
||||
(List<CCSPlayerController> players, string targetname) = FindTarget.Find(command, 2, false, true);
|
||||
|
||||
if (command.ArgCount < 1)
|
||||
{
|
||||
player.PrintToChat($" {ChatColors.Green}―――――――――――{ChatColors.DarkRed}◥◣◆◢◤{ChatColors.Green}―――――――――――");
|
||||
Utils.PrintToChat(player, $"Poprawne użycie: {ChatColors.DarkRed}!setskill <nick> <supermoc>", true);
|
||||
player.PrintToChat($" {ChatColors.Green}―――――――――――{ChatColors.DarkRed}◥◣◆◢◤{ChatColors.Green}―――――――――――");
|
||||
return;
|
||||
}
|
||||
|
||||
if (command.ArgCount < 2)
|
||||
{
|
||||
player.PrintToChat($" {ChatColors.Green}―――――――――――{ChatColors.DarkRed}◥◣◆◢◤{ChatColors.Green}―――――――――――");
|
||||
Utils.PrintToChat(player, $"Poprawne użycie: {ChatColors.DarkRed}!setskill <nick> <supermoc>", true);
|
||||
player.PrintToChat($" {ChatColors.Green}―――――――――――{ChatColors.DarkRed}◥◣◆◢◤{ChatColors.Green}―――――――――――");
|
||||
return;
|
||||
}
|
||||
|
||||
var skillName = command.GetArg(2);
|
||||
var skill = SkillData.Skills.FirstOrDefault(s => s.Name.Equals(skillName, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (skill == null)
|
||||
{
|
||||
player.PrintToChat($" {ChatColors.Green}―――――――――――{ChatColors.DarkRed}◥◣◆◢◤{ChatColors.Green}―――――――――――");
|
||||
Utils.PrintToChat(player, $"Nie znaleziono takiej {ChatColors.DarkRed}supermocy", true);
|
||||
player.PrintToChat($" {ChatColors.Green}―――――――――――{ChatColors.DarkRed}◥◣◆◢◤{ChatColors.Green}―――――――――――");
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (CCSPlayerController target in players)
|
||||
{
|
||||
var skillPlayer = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == target.SteamID);
|
||||
if (skillPlayer != null)
|
||||
{
|
||||
skillPlayer.Skill = skill.Name;
|
||||
player.PrintToChat($" {ChatColors.Green}―――――――――――{ChatColors.DarkRed}◥◣◆◢◤{ChatColors.Green}―――――――――――");
|
||||
Utils.PrintToChat(player, $"Ustawiono Supermoc: {ChatColors.LightRed}{skill.Name} {ChatColors.Lime}dla {ChatColors.LightRed}{target.PlayerName}", false);
|
||||
player.PrintToChat($" {ChatColors.Green}―――――――――――{ChatColors.DarkRed}◥◣◆◢◤{ChatColors.Green}―――――――――――");
|
||||
}
|
||||
else
|
||||
{
|
||||
player.PrintToChat($" {ChatColors.Green}―――――――――――{ChatColors.DarkRed}◥◣◆◢◤{ChatColors.Green}―――――――――――");
|
||||
Utils.PrintToChat(player, $"Nie udało się ustawić {ChatColors.DarkRed}supermocy", true);
|
||||
player.PrintToChat($" {ChatColors.Green}―――――――――――{ChatColors.DarkRed}◥◣◆◢◤{ChatColors.Green}―――――――――――");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[CommandHelper(minArgs: 0, whoCanExecute: CommandUsage.CLIENT_ONLY)]
|
||||
public static void Command_SkillsListMenu(CCSPlayerController? player, CommandInfo command)
|
||||
{
|
||||
if (player == null) return;
|
||||
Menu.DisplaySkillsList(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
108
[ D3X ] dRandomSkills - SRC Files/src/dRandomSkills.cs
Normal file
108
[ D3X ] dRandomSkills - SRC Files/src/dRandomSkills.cs
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
using CounterStrikeSharp.API.Core;
|
||||
|
||||
namespace dRandomSkills
|
||||
{
|
||||
public partial class dRandomSkills : BasePlugin
|
||||
{
|
||||
public static dRandomSkills Instance { get; private set; }
|
||||
|
||||
public List<dSkill_PlayerInfo> skillPlayer { get; } = new List<dSkill_PlayerInfo>();
|
||||
public Random Random { get; } = new Random();
|
||||
|
||||
public override string ModuleName => "[CS2] D3X - [ Random Skills ]";
|
||||
public override string ModuleAuthor => "D3X";
|
||||
public override string ModuleDescription => "Plugin dodaje na serwer losowe moce co runde na serwery CS2 by D3X";
|
||||
public override string ModuleVersion => "1.0.0";
|
||||
|
||||
public override void Load(bool hotReload)
|
||||
{
|
||||
Instance = this;
|
||||
|
||||
Config.Initialize();
|
||||
Event.Load();
|
||||
PlayerOnTick.Load();
|
||||
Command.Load();
|
||||
|
||||
PawelJumper.LoadPawelJumper();
|
||||
Duszek.LoadDuszek();
|
||||
BunnyHop.LoadBunnyHop();
|
||||
Impostor.LoadImpostor();
|
||||
Phoenix.LoadPhoenix();
|
||||
Muhammed.LoadMuhammed();
|
||||
Pilot.LoadPilot();
|
||||
Rambo.LoadRambo();
|
||||
Bogacz.LoadBogacz();
|
||||
Flash.LoadFlash();
|
||||
Astronauta.LoadAstronauta();
|
||||
Medyk.LoadMedyk();
|
||||
Kurczak.LoadKurczak();
|
||||
OneShot.LoadOneShot();
|
||||
Drakula.LoadDrakula();
|
||||
AntyFlash.LoadAntyFlash();
|
||||
Rozbrojenie.LoadRozbrojenie();
|
||||
ZelaznaGlowa.LoadZelaznaGlowa();
|
||||
NieskonczoneAmmo.LoadNieskonczoneAmmo();
|
||||
Katapulta.LoadKatapulta();
|
||||
ObrotWroga.LoadObrotWroga();
|
||||
Cien.LoadCien();
|
||||
Teleporter.LoadTeleporter();
|
||||
Eliminator.LoadEliminator();
|
||||
}
|
||||
}
|
||||
|
||||
public class dSkill_PlayerInfo
|
||||
{
|
||||
public required ulong SteamID { get; set; }
|
||||
public required string PlayerName { get; set; }
|
||||
public string? Skill { get; set; }
|
||||
public bool IsDrawing { get; set; }
|
||||
}
|
||||
|
||||
public class dSkill_SkillInfo
|
||||
{
|
||||
public string Name { get; }
|
||||
public string Description { get; }
|
||||
public string Color { get; }
|
||||
|
||||
public dSkill_SkillInfo(string name, string description, string color)
|
||||
{
|
||||
Name = name;
|
||||
Description = description;
|
||||
Color = color;
|
||||
}
|
||||
}
|
||||
|
||||
public static class SkillData
|
||||
{
|
||||
public static dSkill_SkillInfo[] Skills { get; } = new[]
|
||||
{
|
||||
new dSkill_SkillInfo("Paweł Jumper", "Otrzymujesz dodatkowy Skok", "#FFA500"),
|
||||
new dSkill_SkillInfo("Duszek", "Jesteś całkowicie niewidzialny", "#FFFFFF"),
|
||||
new dSkill_SkillInfo("BunnyHop", "Otrzymujesz auto BunnyHopa", "#EB4034"),
|
||||
new dSkill_SkillInfo("Impostor", "Otrzymujesz na start rundy model postaci wroga", "#99140B"),
|
||||
new dSkill_SkillInfo("Phoenix", "Masz 35% szans na odrodzenie się po śmierci", "#ff5C0A"),
|
||||
new dSkill_SkillInfo("Muhammed", "Po śmierci wybucha i zabija graczy w obrębie", "#F5CB42"),
|
||||
new dSkill_SkillInfo("Pilot", "Latanie na noclip przez dany czas", "#1466F5"),
|
||||
new dSkill_SkillInfo("Rambo", "Otrzymujesz losową ilość zdrowia na start rundy", "#009905"),
|
||||
new dSkill_SkillInfo("Bogacz", "Otrzymujesz losową ilość kasy na start rundy", "#D4AF37"),
|
||||
new dSkill_SkillInfo("Flash", "Otrzymujesz losową ilość speed na start rundy", "#A31912"),
|
||||
new dSkill_SkillInfo("Astronauta", "Otrzymujesz losową ilość grawitacji na start rundy", "#7E10AD"),
|
||||
new dSkill_SkillInfo("Medyk", "Otrzymujesz losową ilość apteczek na start rundy", "#42FF5F"),
|
||||
new dSkill_SkillInfo("Kurczak", "Otrzymujesz model kurczaka + jesteś o 10% szybszy", "#FF8B42"),
|
||||
new dSkill_SkillInfo("One Shot", "Po trafieniu od razu zabija przeciwnika", "#ff5CD9"),
|
||||
new dSkill_SkillInfo("Drakula", "Po trafieniu ofiary otrzymujesz zwrot zdrowia w postaci danego procentu zadanych obrażeń", "#FA050D"),
|
||||
new dSkill_SkillInfo("Anty Flash", "Posiadasz odporność na flashe", "#D6E6FF"),
|
||||
// new dSkill_SkillInfo("Mini Gun", "Strzelasz 50% szybciej z broni", "#2CF5BF"),
|
||||
new dSkill_SkillInfo("Teleportator", "Zamieniasz się miejscami z trafionym wrogiem", "#8A2BE2"),
|
||||
new dSkill_SkillInfo("Cień", "Teleportujesz się za plecy losowego wroga", "#18171A"),
|
||||
new dSkill_SkillInfo("Katapulta", "Masz 25% szans na podrzucenie wroga", "#FF4500"),
|
||||
new dSkill_SkillInfo("Nieskończone Ammo", "Otrzymujesz nieskończoną ilość ammo do wszystkich swoich broni", "#0000FF"),
|
||||
new dSkill_SkillInfo("Żelazna Głowa", "Nie otrzymujesz obrażeń w głowę", "#8B4513"),
|
||||
new dSkill_SkillInfo("Eliminator", "Możesz szybciej podłożyć bombe oraz ją zdefować", "#8A2BE2"),
|
||||
// new dSkill_SkillInfo("Redukcja Obrażeń", "Redukujesz daną ilość obrażeń, które otrzymujesz", "#696969"),
|
||||
// new dSkill_SkillInfo("Mnożnik Obrażeń", "Zadajesz pomnożoną ilość obrażeń", "#FF0000"),
|
||||
new dSkill_SkillInfo("Obrót Wroga", "Masz 25% szans na obrócenie wroga o 180 stopni po trafieniu", "#00FF00"),
|
||||
new dSkill_SkillInfo("Rozbrojenie", "Masz 25% szans na wyrzucenie broni wroga po trafieniu", "#FF4500")
|
||||
};
|
||||
}
|
||||
}
|
||||
36
[ D3X ] dRandomSkills - SRC Files/src/menu/Menu.cs
Normal file
36
[ D3X ] dRandomSkills - SRC Files/src/menu/Menu.cs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Menu;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
using CounterStrikeSharp.API;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace dRandomSkills
|
||||
{
|
||||
public static class Menu
|
||||
{
|
||||
public static void DisplaySkillsList(CCSPlayerController player)
|
||||
{
|
||||
CenterHtmlMenu menu = new($"[ ★ Lista Super Mocy ★ ]");
|
||||
|
||||
for (int i = 0; i < SkillData.Skills.Length; i++)
|
||||
{
|
||||
var skill = SkillData.Skills[i];
|
||||
string skillName = $"{skill.Name}";
|
||||
menu.AddMenuOption($" ★ {skillName}", (player, option) =>
|
||||
{
|
||||
string selectedSkillName = option.Text;
|
||||
string pattern = "\\[/?color\\b[^\\]]*\\]";
|
||||
string cleanSkillName = Regex.Replace(selectedSkillName, pattern, "");
|
||||
string skillName = cleanSkillName.Replace($" ★ ", "");
|
||||
int intValue = Array.IndexOf(SkillData.Skills.Select(r => r.Name).ToArray(), skillName);
|
||||
string skillDesc = SkillData.Skills[intValue].Description;
|
||||
Utils.PrintToChat(player, $"{ChatColors.DarkRed}{skillName}{ChatColors.Lime}: {skillDesc}", false);
|
||||
MenuManager.CloseActiveMenu(player);
|
||||
});
|
||||
}
|
||||
|
||||
MenuManager.OpenCenterHtmlMenu(Instance, player, menu);
|
||||
}
|
||||
}
|
||||
}
|
||||
129
[ D3X ] dRandomSkills - SRC Files/src/player/PlayerEvents.cs
Normal file
129
[ D3X ] dRandomSkills - SRC Files/src/player/PlayerEvents.cs
Normal file
|
|
@ -0,0 +1,129 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
{
|
||||
public static class Event
|
||||
{
|
||||
public static void Load()
|
||||
{
|
||||
Instance.RegisterEventHandler<EventPlayerConnectFull>((@event, info) =>
|
||||
{
|
||||
var player = @event.Userid;
|
||||
|
||||
if (player == null || !player.IsValid) return HookResult.Continue;
|
||||
|
||||
Instance.skillPlayer.Add(new dSkill_PlayerInfo
|
||||
{
|
||||
SteamID = player.SteamID,
|
||||
PlayerName = player.PlayerName,
|
||||
Skill = "",
|
||||
IsDrawing = false,
|
||||
});
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
|
||||
Instance.RegisterEventHandler<EventPlayerDisconnect>((@event, info) =>
|
||||
{
|
||||
var player = @event.Userid;
|
||||
|
||||
if (player == null || !player.IsValid) return HookResult.Continue;
|
||||
|
||||
var skillPlayer = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (skillPlayer != null)
|
||||
{
|
||||
Instance.skillPlayer.Remove(skillPlayer);
|
||||
}
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
|
||||
Instance.RegisterEventHandler<EventRoundStart>((@event, info) =>
|
||||
{
|
||||
foreach (var player in Utilities.GetPlayers())
|
||||
{
|
||||
var skillPlayer = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
|
||||
if (skillPlayer != null)
|
||||
{
|
||||
skillPlayer.IsDrawing = true;
|
||||
}
|
||||
}
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
|
||||
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
|
||||
{
|
||||
foreach (var player in Utilities.GetPlayers())
|
||||
{
|
||||
var playerTeam = player.Team;
|
||||
var teammates = Utilities.GetPlayers().Where(p => p.Team == playerTeam && p != player);
|
||||
string teammateSkills = "";
|
||||
|
||||
var skillPlayer = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
|
||||
if (skillPlayer != null)
|
||||
{
|
||||
skillPlayer.IsDrawing = false;
|
||||
|
||||
var randomSkill = SkillData.Skills[Instance.Random.Next(SkillData.Skills.Length)];
|
||||
skillPlayer.Skill = randomSkill.Name;
|
||||
|
||||
Utils.PrintToChat(player, $"{ChatColors.DarkRed}{randomSkill.Name}{ChatColors.Lime}: {randomSkill.Description}", false);
|
||||
|
||||
if(Config.config.Settings.TeamMateSkillInfo)
|
||||
{
|
||||
Instance.AddTimer(0.5f, () =>
|
||||
{
|
||||
foreach (var teammate in teammates)
|
||||
{
|
||||
var teammateSkill = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == teammate.SteamID)?.Skill;
|
||||
if (!string.IsNullOrEmpty(teammateSkill))
|
||||
{
|
||||
teammateSkills += $" {ChatColors.DarkRed}{teammate.PlayerName}{ChatColors.Lime}: {teammateSkill}\n";
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(teammateSkills))
|
||||
{
|
||||
player.PrintToChat($" {ChatColors.Lime}Supermoce twoich sojuszników:");
|
||||
player.PrintToChat(teammateSkills.TrimEnd('\n'));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
|
||||
Instance.RegisterEventHandler<EventPlayerDeath>((@event, info) =>
|
||||
{
|
||||
var victim = @event.Userid;
|
||||
var attacker = @event.Attacker;
|
||||
|
||||
if(Config.config.Settings.KillerSkillInfo)
|
||||
{
|
||||
if (victim != null && victim?.IsValid == true && attacker != null && attacker?.IsValid == true && victim != attacker)
|
||||
{
|
||||
var attackerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == attacker.SteamID);
|
||||
if (attackerInfo != null)
|
||||
{
|
||||
var skillData = SkillData.Skills.FirstOrDefault(s => s.Name == attackerInfo.Skill);
|
||||
string skillDesc = skillData?.Description ?? "Brak opisu";
|
||||
|
||||
victim.PrintToChat($"{ChatColors.Lime}Supermoc przeciwnika który cię zabił:");
|
||||
Utils.PrintToChat(victim, $"{ChatColors.DarkRed}{attacker.PlayerName}{ChatColors.Lime} posiada mocy: {ChatColors.DarkRed}{attackerInfo.Skill}{ChatColors.Lime} - {skillDesc}", false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
61
[ D3X ] dRandomSkills - SRC Files/src/player/PlayerOnTick.cs
Normal file
61
[ D3X ] dRandomSkills - SRC Files/src/player/PlayerOnTick.cs
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
using System.Diagnostics;
|
||||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using static CounterStrikeSharp.API.Core.Listeners;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
{
|
||||
public static class PlayerOnTick
|
||||
{
|
||||
private static readonly Stopwatch DrawStopwatch = new Stopwatch();
|
||||
private static readonly float DrawUpdateInterval = 0.5f;
|
||||
|
||||
public static void Load()
|
||||
{
|
||||
DrawStopwatch.Start();
|
||||
|
||||
Instance.RegisterListener<OnTick>(() =>
|
||||
{
|
||||
foreach (var player in Utilities.GetPlayers())
|
||||
{
|
||||
if (player != null && player.IsValid)
|
||||
{
|
||||
UpdatePlayerHud(player);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static void UpdatePlayerHud(CCSPlayerController player)
|
||||
{
|
||||
if (player == null) return;
|
||||
|
||||
var skillPlayer = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (skillPlayer == null) return;
|
||||
|
||||
string infoLine = "";
|
||||
string skillLine = "";
|
||||
|
||||
if (skillPlayer.IsDrawing && DrawStopwatch.Elapsed.TotalSeconds >= DrawUpdateInterval)
|
||||
{
|
||||
var randomSkill = SkillData.Skills[Instance.Random.Next(SkillData.Skills.Length)];
|
||||
infoLine = $"<font class='fontSize-l' class='fontWeight-Bold' color='#FFFFFF'>Losowanie mocy:</font> <br>";
|
||||
skillLine = $"<font class='fontSize-l' class='fontWeight-Bold' color='{randomSkill.Color}'>{randomSkill.Name}</font> <br>";
|
||||
DrawStopwatch.Restart();
|
||||
}
|
||||
else if (!skillPlayer.IsDrawing)
|
||||
{
|
||||
var skillInfo = SkillData.Skills.FirstOrDefault(s => s.Name == skillPlayer.Skill);
|
||||
if (skillInfo != null)
|
||||
{
|
||||
infoLine = $"<font class='fontSize-l' class='fontWeight-Bold' color='#FFFFFF'>Twoja aktualna moc:</font> <br>";
|
||||
skillLine = $"<font class='fontSize-l' class='fontWeight-Bold' color='{skillInfo.Color}'>{skillPlayer.Skill}</font> <br>";
|
||||
}
|
||||
}
|
||||
|
||||
var hudContent = infoLine + skillLine;
|
||||
player.PrintToCenterHtml(hudContent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
using CounterStrikeSharp.API.Core;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
{
|
||||
public static class AntyFlash
|
||||
{
|
||||
public static void LoadAntyFlash()
|
||||
{
|
||||
Instance.RegisterEventHandler<EventPlayerBlind>((@event, info) =>
|
||||
{
|
||||
var player = @event.Userid;
|
||||
var attacker = @event.Attacker;
|
||||
|
||||
var playerPawn = player.PlayerPawn.Value;
|
||||
|
||||
if (!IsPlayerValid(player)) return HookResult.Continue;
|
||||
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
var sameTeam = attacker.Team == player.Team;
|
||||
|
||||
if (playerInfo?.Skill == "Anty Flash")
|
||||
{
|
||||
playerPawn.FlashDuration = 0.0f;
|
||||
}
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
}
|
||||
|
||||
private static bool IsPlayerValid(CCSPlayerController player)
|
||||
{
|
||||
return player != null && player.IsValid && player.PlayerPawn?.Value != null && player.PlayerPawn.Value.LifeState == (byte)LifeState_t.LIFE_ALIVE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
{
|
||||
public static class Astronauta
|
||||
{
|
||||
public static void LoadAstronauta()
|
||||
{
|
||||
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);
|
||||
var playerPawn = player.PlayerPawn.Value;
|
||||
|
||||
if (playerInfo?.Skill == "Astronauta" && playerPawn != null)
|
||||
{
|
||||
ApplyGravityModifier(playerPawn);
|
||||
}
|
||||
}
|
||||
});
|
||||
return HookResult.Continue;
|
||||
});
|
||||
}
|
||||
|
||||
private static void ApplyGravityModifier(CCSPlayerPawn playerPawn)
|
||||
{
|
||||
float gravityModifier = (float)Math.Round(Instance.Random.NextDouble() * (0.7f - 0.2f) + 0.2f, 1);
|
||||
playerPawn.GravityScale = gravityModifier;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
{
|
||||
public static class Bogacz
|
||||
{
|
||||
public static void LoadBogacz()
|
||||
{
|
||||
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 == "Bogacz")
|
||||
{
|
||||
ApplyMoneyBonus(player);
|
||||
}
|
||||
}
|
||||
});
|
||||
return HookResult.Continue;
|
||||
});
|
||||
}
|
||||
|
||||
private static void ApplyMoneyBonus(CCSPlayerController player)
|
||||
{
|
||||
int moneyBonus = Instance.Random.Next(5000, 15000);
|
||||
AddMoney(player, moneyBonus);
|
||||
}
|
||||
|
||||
private static void AddMoney(CCSPlayerController player, int money)
|
||||
{
|
||||
var moneyServices = player?.InGameMoneyServices;
|
||||
|
||||
if (moneyServices == null) return;
|
||||
|
||||
moneyServices.Account += money;
|
||||
Utilities.SetStateChanged(player, "CCSPlayerController", "m_pInGameMoneyServices");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using static CounterStrikeSharp.API.Core.Listeners;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
{
|
||||
public static class BunnyHop
|
||||
{
|
||||
private const float MaxSpeed = 500f;
|
||||
private const float BunnyHopVelocity = 300f;
|
||||
|
||||
public static void LoadBunnyHop()
|
||||
{
|
||||
Instance.RegisterListener<OnTick>(OnTick);
|
||||
}
|
||||
|
||||
private static void OnTick()
|
||||
{
|
||||
foreach (var player in Utilities.GetPlayers())
|
||||
{
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
|
||||
if (playerInfo?.Skill == "BunnyHop")
|
||||
{
|
||||
GiveBunnyHop(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void GiveBunnyHop(CCSPlayerController player)
|
||||
{
|
||||
var playerPawn = player.PlayerPawn.Value;
|
||||
if (playerPawn != null)
|
||||
{
|
||||
if(Math.Round(playerPawn.AbsVelocity.Length2D()) > MaxSpeed && MaxSpeed != 0)
|
||||
ChangeVelocity(playerPawn, MaxSpeed);
|
||||
|
||||
var flags = (PlayerFlags)playerPawn.Flags;
|
||||
var buttons = player.Buttons;
|
||||
|
||||
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;
|
||||
|
||||
var currentVelocity = new Vector(pawn.AbsVelocity.X, pawn.AbsVelocity.Y, pawn.AbsVelocity.Z);
|
||||
var currentSpeed3D = Math.Sqrt(currentVelocity.X * currentVelocity.X + currentVelocity.Y * currentVelocity.Y + currentVelocity.Z * currentVelocity.Z);
|
||||
|
||||
pawn.AbsVelocity.X = (float)(currentVelocity.X / currentSpeed3D) * vel;
|
||||
pawn.AbsVelocity.Y = (float)(currentVelocity.Y / currentSpeed3D) * vel;
|
||||
pawn.AbsVelocity.Z = (float)(currentVelocity.Z / currentSpeed3D) * vel;
|
||||
}
|
||||
}
|
||||
}
|
||||
64
[ D3X ] dRandomSkills - SRC Files/src/player/skills/Cien.cs
Normal file
64
[ D3X ] dRandomSkills - SRC Files/src/player/skills/Cien.cs
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
{
|
||||
public static class Cien
|
||||
{
|
||||
private const float TeleportDistance = 100.0f;
|
||||
|
||||
public static void LoadCien()
|
||||
{
|
||||
Instance.RegisterEventHandler<EventPlayerHurt>((@event, info) =>
|
||||
{
|
||||
var attacker = @event.Attacker;
|
||||
var victim = @event.Userid;
|
||||
|
||||
if (!IsPlayerValid(attacker) || !IsPlayerValid(victim)) return HookResult.Continue;
|
||||
|
||||
var victimInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == victim.SteamID);
|
||||
var attackerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == attacker.SteamID);
|
||||
|
||||
if (attackerInfo?.Skill == "Cień")
|
||||
{
|
||||
TeleportAttackerBehindVictim(attacker, victim);
|
||||
}
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
}
|
||||
|
||||
private static bool IsPlayerValid(CCSPlayerController player)
|
||||
{
|
||||
return player != null && player.IsValid && player.PlayerPawn?.Value != null;
|
||||
}
|
||||
|
||||
private static void TeleportAttackerBehindVictim(CCSPlayerController attacker, CCSPlayerController victim)
|
||||
{
|
||||
var victimPawn = victim.PlayerPawn.Value;
|
||||
var attackerPawn = attacker.PlayerPawn.Value;
|
||||
|
||||
if (victimPawn == null || attackerPawn == null) return;
|
||||
|
||||
Vector victimPosition = victimPawn.AbsOrigin;
|
||||
QAngle victimAngles = victimPawn.AbsRotation;
|
||||
|
||||
Vector behindPosition = victimPosition - GetForwardVector(victimAngles) * TeleportDistance;
|
||||
|
||||
attackerPawn.Teleport(behindPosition, victimAngles, new Vector(0, 0, 0));
|
||||
}
|
||||
|
||||
private static Vector GetForwardVector(QAngle angles)
|
||||
{
|
||||
float pitch = angles.X * (float)(Math.PI / 180);
|
||||
float yaw = angles.Y * (float)(Math.PI / 180);
|
||||
|
||||
float x = (float)(Math.Cos(pitch) * Math.Cos(yaw));
|
||||
float y = (float)(Math.Cos(pitch) * Math.Sin(yaw));
|
||||
float z = (float)Math.Sin(pitch);
|
||||
|
||||
return new Vector(x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
{
|
||||
public static class Drakula
|
||||
{
|
||||
const float VampirePercentage = 0.3f;
|
||||
|
||||
public static void LoadDrakula()
|
||||
{
|
||||
Instance.RegisterEventHandler<EventPlayerHurt>((@event, info) =>
|
||||
{
|
||||
var attacker = @event.Attacker;
|
||||
var victim = @event.Userid;
|
||||
|
||||
if (!IsPlayerValid(attacker) || attacker == victim) return HookResult.Continue;
|
||||
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == attacker.SteamID);
|
||||
|
||||
if (playerInfo?.Skill == "Drakula" && attacker.PawnIsAlive)
|
||||
{
|
||||
HealAttacker(attacker, @event.DmgHealth);
|
||||
}
|
||||
return HookResult.Continue;
|
||||
});
|
||||
}
|
||||
|
||||
private static void HealAttacker(CCSPlayerController attacker, float damage)
|
||||
{
|
||||
var attackerPawn = attacker.PlayerPawn.Value;
|
||||
if (attackerPawn == null) return;
|
||||
|
||||
int healing = (int)(damage * VampirePercentage);
|
||||
int newHealth = Math.Min(attackerPawn.Health + healing, attackerPawn.MaxHealth);
|
||||
|
||||
attackerPawn.Health = newHealth;
|
||||
|
||||
Utilities.SetStateChanged(attackerPawn, "CBaseEntity", "m_iHealth");
|
||||
}
|
||||
|
||||
private static bool IsPlayerValid(CCSPlayerController player)
|
||||
{
|
||||
return player != null && player.IsValid && player.PlayerPawn?.Value != null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
using System.Drawing;
|
||||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
{
|
||||
public static class Duszek
|
||||
{
|
||||
public static void LoadDuszek()
|
||||
{
|
||||
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
|
||||
{
|
||||
Instance.AddTimer(0.1f, () =>
|
||||
{
|
||||
foreach (var player in Utilities.GetPlayers())
|
||||
{
|
||||
if (!IsValidPlayer(player)) continue;
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill == "Duszek")
|
||||
{
|
||||
SetPlayerVisibility(player, false);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
|
||||
Instance.RegisterEventHandler<EventRoundEnd>((@event, info) =>
|
||||
{
|
||||
foreach (var player in Utilities.GetPlayers())
|
||||
{
|
||||
if (!IsValidPlayer(player)) continue;
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill == "Duszek")
|
||||
{
|
||||
SetPlayerVisibility(player, true);
|
||||
}
|
||||
}
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
}
|
||||
|
||||
private static bool IsValidPlayer(CCSPlayerController player)
|
||||
{
|
||||
return player != null && player.IsValid;
|
||||
}
|
||||
|
||||
private static void SetPlayerVisibility(CCSPlayerController player, bool visible)
|
||||
{
|
||||
var playerPawn = player.PlayerPawn.Value;
|
||||
if (playerPawn != null)
|
||||
{
|
||||
var color = visible ? Color.FromArgb(255, 255, 255, 255) : Color.FromArgb(0, 255, 255, 255);
|
||||
var shadowStrength = visible ? 1.0f : 0.0f;
|
||||
|
||||
playerPawn.Render = color;
|
||||
playerPawn.ShadowStrength = shadowStrength;
|
||||
Utilities.SetStateChanged(playerPawn, "CBaseModelEntity", "m_clrRender");
|
||||
|
||||
var activeWeapon = playerPawn.WeaponServices?.ActiveWeapon.Value;
|
||||
if (activeWeapon != null && activeWeapon.IsValid)
|
||||
{
|
||||
activeWeapon.Render = color;
|
||||
activeWeapon.ShadowStrength = shadowStrength;
|
||||
Utilities.SetStateChanged(activeWeapon, "CBaseModelEntity", "m_clrRender");
|
||||
}
|
||||
|
||||
var myWeapons = playerPawn.WeaponServices?.MyWeapons;
|
||||
if (myWeapons != null)
|
||||
{
|
||||
foreach (var gun in myWeapons)
|
||||
{
|
||||
var weapon = gun.Value;
|
||||
if (weapon != null)
|
||||
{
|
||||
weapon.Render = color;
|
||||
weapon.ShadowStrength = shadowStrength;
|
||||
Utilities.SetStateChanged(weapon, "CBaseModelEntity", "m_clrRender");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
{
|
||||
public static class Eliminator
|
||||
{
|
||||
public static void LoadEliminator()
|
||||
{
|
||||
Instance.RegisterEventHandler<EventBombBeginplant>((@event, info) =>
|
||||
{
|
||||
foreach (var player in Utilities.GetPlayers())
|
||||
{
|
||||
if (!IsPlayerValid(player)) continue;
|
||||
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill == "Eliminator")
|
||||
{
|
||||
var bombEntities = Utilities.FindAllEntitiesByDesignerName<CC4>("weapon_c4").ToList();
|
||||
|
||||
if (bombEntities.Any())
|
||||
{
|
||||
var bomb = bombEntities.FirstOrDefault();
|
||||
if (bomb != null)
|
||||
{
|
||||
bomb.BombPlacedAnimation = false;
|
||||
bomb.ArmedTime = 0.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
|
||||
Instance.RegisterEventHandler<EventBombBegindefuse>((@event, info) =>
|
||||
{
|
||||
var player = @event.Userid;
|
||||
|
||||
if (IsPlayerValid(player))
|
||||
{
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill == "Eliminator")
|
||||
{
|
||||
var plantedBomb = Utilities.FindAllEntitiesByDesignerName<CPlantedC4>("planted_c4").FirstOrDefault();
|
||||
if (plantedBomb != null)
|
||||
{
|
||||
Server.NextFrame(() =>
|
||||
{
|
||||
plantedBomb.DefuseCountDown = 0;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
}
|
||||
|
||||
private static bool IsPlayerValid(CCSPlayerController player)
|
||||
{
|
||||
return player != null && player.IsValid && player.PlayerPawn?.Value != null;
|
||||
}
|
||||
}
|
||||
}
|
||||
42
[ D3X ] dRandomSkills - SRC Files/src/player/skills/Flash.cs
Normal file
42
[ D3X ] dRandomSkills - SRC Files/src/player/skills/Flash.cs
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
{
|
||||
public static class Flash
|
||||
{
|
||||
public static void LoadFlash()
|
||||
{
|
||||
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
|
||||
{
|
||||
Instance.AddTimer(0.1f, () =>
|
||||
{
|
||||
foreach (var player in Utilities.GetPlayers())
|
||||
{
|
||||
if (!IsPlayerValid(player)) continue;
|
||||
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill != "Flash") continue;
|
||||
|
||||
var playerPawn = player.PlayerPawn?.Value;
|
||||
|
||||
if (playerPawn != null)
|
||||
{
|
||||
float velocityModifier = (float)Instance.Random.NextDouble() * (2.5f - 1.2f) + 1.2f;
|
||||
playerPawn.VelocityModifier = velocityModifier;
|
||||
Utilities.SetStateChanged(player, "CCSPlayerPawn", "m_flVelocityModifier");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
}
|
||||
|
||||
private static bool IsPlayerValid(CCSPlayerController player)
|
||||
{
|
||||
return player != null && player.IsValid && player.PlayerPawn?.Value != null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
using System.Drawing;
|
||||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
{
|
||||
public static class Impostor
|
||||
{
|
||||
public static void LoadImpostor()
|
||||
{
|
||||
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
|
||||
{
|
||||
Instance.AddTimer(0.1f, () =>
|
||||
{
|
||||
foreach (var player in Utilities.GetPlayers())
|
||||
{
|
||||
if (!IsPlayerValid(player)) continue;
|
||||
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill != "Impostor") continue;
|
||||
|
||||
string model = player.Team == CsTeam.Terrorist
|
||||
? "characters/models/ctm_fbi/ctm_fbi_variantb.vmdl"
|
||||
: player.Team == CsTeam.CounterTerrorist
|
||||
? "characters/models/tm_phoenix/tm_phoenix_varianta.vmdl"
|
||||
: null;
|
||||
|
||||
if (model != null)
|
||||
{
|
||||
SetPlayerModel(player, model);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
}
|
||||
|
||||
private static void SetPlayerModel(CCSPlayerController player, string model)
|
||||
{
|
||||
var pawn = player.PlayerPawn?.Value;
|
||||
if (pawn == null) return;
|
||||
|
||||
Server.NextFrame(() =>
|
||||
{
|
||||
pawn.SetModel(model);
|
||||
|
||||
var originalRender = pawn.Render;
|
||||
pawn.Render = Color.FromArgb(255, originalRender.R, originalRender.G, originalRender.B);
|
||||
});
|
||||
}
|
||||
|
||||
private static bool IsPlayerValid(CCSPlayerController player)
|
||||
{
|
||||
return player != null && player.IsValid && player.PlayerPawn?.Value != null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
using CounterStrikeSharp.API.Core;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
{
|
||||
public static class Katapulta
|
||||
{
|
||||
|
||||
public static void LoadKatapulta()
|
||||
{
|
||||
Instance.RegisterEventHandler<EventPlayerHurt>((@event, info) =>
|
||||
{
|
||||
var attacker = @event.Attacker;
|
||||
var victim = @event.Userid;
|
||||
|
||||
if (attacker == null || !attacker.IsValid || victim == null || !victim.IsValid) return HookResult.Continue;
|
||||
|
||||
if (attacker == victim) return HookResult.Continue;
|
||||
|
||||
var attackerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == attacker.SteamID);
|
||||
|
||||
if (attackerInfo?.Skill == "Katapulta" && attacker.PawnIsAlive)
|
||||
{
|
||||
if (Instance.Random.NextDouble() <= 0.25)
|
||||
{
|
||||
var victimPawn = victim.PlayerPawn?.Value;
|
||||
if (victimPawn != null)
|
||||
{
|
||||
victimPawn.AbsVelocity.Z = 300f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
using System.Drawing;
|
||||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
{
|
||||
public static class Kurczak
|
||||
{
|
||||
public static void LoadKurczak()
|
||||
{
|
||||
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
|
||||
{
|
||||
Instance.AddTimer(0.1f, () =>
|
||||
{
|
||||
foreach (var player in Utilities.GetPlayers())
|
||||
{
|
||||
if (!IsPlayerValid(player)) continue;
|
||||
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill != "Kurczak") continue;
|
||||
|
||||
var playerPawn = player.PlayerPawn?.Value;
|
||||
if (playerPawn != null)
|
||||
{
|
||||
SetPlayerModel(player, "models/chicken/chicken.vmdl");
|
||||
playerPawn.CBodyComponent.SceneNode.GetSkeletonInstance().MaterialGroup.Value = (uint)Instance.Random.Next(1, 4);
|
||||
playerPawn.VelocityModifier = 1.1f;
|
||||
Utilities.SetStateChanged(player, "CCSPlayerPawn", "m_flVelocityModifier");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
}
|
||||
|
||||
public static void SetPlayerModel(CCSPlayerController player, string model)
|
||||
{
|
||||
var pawn = player.PlayerPawn?.Value;
|
||||
if (pawn == null) return;
|
||||
|
||||
Server.NextFrame(() =>
|
||||
{
|
||||
pawn.SetModel(model);
|
||||
|
||||
Color originalRender = pawn.Render;
|
||||
pawn.Render = Color.FromArgb(255, originalRender.R, originalRender.G, originalRender.B);
|
||||
});
|
||||
}
|
||||
|
||||
private static bool IsPlayerValid(CCSPlayerController player)
|
||||
{
|
||||
return player != null && player.IsValid && player.PlayerPawn?.Value != null;
|
||||
}
|
||||
}
|
||||
}
|
||||
53
[ D3X ] dRandomSkills - SRC Files/src/player/skills/Medyk.cs
Normal file
53
[ D3X ] dRandomSkills - SRC Files/src/player/skills/Medyk.cs
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
{
|
||||
public static class Medyk
|
||||
{
|
||||
public static void LoadMedyk()
|
||||
{
|
||||
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
|
||||
{
|
||||
Instance.AddTimer(0.1f, () =>
|
||||
{
|
||||
foreach (var player in Utilities.GetPlayers())
|
||||
{
|
||||
if (!IsPlayerValid(player)) continue;
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill != "Medyk") continue;
|
||||
|
||||
int healthshot = Instance.Random.Next(1, 10);
|
||||
for (int i = 0; i < healthshot; i++)
|
||||
{
|
||||
player.GiveNamedItem("weapon_healthshot");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
|
||||
Instance.RegisterEventHandler<EventRoundEnd>((@event, info) =>
|
||||
{
|
||||
foreach (var player in Utilities.GetPlayers())
|
||||
{
|
||||
if (!IsPlayerValid(player)) continue;
|
||||
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill != "Medyk") continue;
|
||||
|
||||
player.RemoveItemByDesignerName("weapon_healthshot");
|
||||
}
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
}
|
||||
|
||||
private static bool IsPlayerValid(CCSPlayerController player)
|
||||
{
|
||||
return player != null && player.IsValid && player.PlayerPawn?.Value != null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
{
|
||||
public static class Muhammed
|
||||
{
|
||||
private const float ExplosionRadius = 500.0f;
|
||||
private const int ExplosionDamage = 999;
|
||||
|
||||
public static void LoadMuhammed()
|
||||
{
|
||||
Instance.RegisterEventHandler<EventPlayerDeath>((@event, info) =>
|
||||
{
|
||||
CCSPlayerController player = @event.Userid;
|
||||
|
||||
if (!IsPlayerValid(player)) return HookResult.Continue;
|
||||
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill != "Muhammed") return HookResult.Continue;
|
||||
|
||||
SpawnExplosion(player);
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
}
|
||||
|
||||
private static void SpawnExplosion(CCSPlayerController player)
|
||||
{
|
||||
var heProjectile = Utilities.CreateEntityByName<CHEGrenadeProjectile>("hegrenade_projectile");
|
||||
if (heProjectile == null || !heProjectile.IsValid) return;
|
||||
|
||||
Vector pos = player.PlayerPawn.Value.AbsOrigin;
|
||||
pos.Z += 10;
|
||||
|
||||
heProjectile.TicksAtZeroVelocity = 100;
|
||||
heProjectile.TeamNum = player.TeamNum;
|
||||
heProjectile.Damage = ExplosionDamage;
|
||||
heProjectile.DmgRadius = (int)ExplosionRadius;
|
||||
heProjectile.Teleport(pos, null, new Vector(0, 0, -10));
|
||||
heProjectile.DispatchSpawn();
|
||||
heProjectile.AcceptInput("InitializeSpawnFromWorld", player.PlayerPawn.Value, player.PlayerPawn.Value, "");
|
||||
heProjectile.DetonateTime = 0;
|
||||
|
||||
Server.PrintToChatAll($" {ChatColors.DarkRed}► {ChatColors.Green}[{ChatColors.DarkRed} SUPERMOCE {ChatColors.Green}] {ChatColors.DarkRed}{player.PlayerName}: {ChatColors.Lime}ALLAHU AKBAR!!!");
|
||||
|
||||
var fileNames = new[] { "radiobotfallback01", "radiobotfallback02", "radiobotfallback04" };
|
||||
Instance.AddTimer(0.1f, () =>
|
||||
{
|
||||
var randomFile = fileNames[new Random().Next(fileNames.Length)];
|
||||
player.ExecuteClientCommand($"play vo/agents/balkan/{randomFile}.vsnd");
|
||||
});
|
||||
}
|
||||
|
||||
private static bool IsPlayerValid(CCSPlayerController player)
|
||||
{
|
||||
return player != null && player.IsValid && player.PlayerPawn?.Value != null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
using CounterStrikeSharp.API.Core;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
{
|
||||
public static class NieskonczoneAmmo
|
||||
{
|
||||
|
||||
public static void LoadNieskonczoneAmmo()
|
||||
{
|
||||
Instance.RegisterEventHandler<EventWeaponFire>((@event, info) =>
|
||||
{
|
||||
var player = @event.Userid;
|
||||
|
||||
if (!IsValidPlayer(player)) return HookResult.Continue;
|
||||
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
|
||||
if (playerInfo?.Skill == "Nieskończone Ammo")
|
||||
{
|
||||
ApplyInfiniteAmmo(player);
|
||||
}
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
|
||||
Instance.RegisterEventHandler<EventWeaponReload>((@event, info) =>
|
||||
{
|
||||
var player = @event.Userid;
|
||||
|
||||
if (!IsValidPlayer(player)) return HookResult.Continue;
|
||||
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
|
||||
if (playerInfo?.Skill == "Nieskończone Ammo")
|
||||
{
|
||||
ApplyInfiniteAmmo(player);
|
||||
}
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
}
|
||||
|
||||
private static bool IsValidPlayer(CCSPlayerController player)
|
||||
{
|
||||
return player != null && player.IsValid;
|
||||
}
|
||||
|
||||
private static void ApplyInfiniteAmmo(CCSPlayerController player)
|
||||
{
|
||||
var activeWeaponHandle = player.PlayerPawn.Value?.WeaponServices?.ActiveWeapon;
|
||||
if (activeWeaponHandle?.Value != null)
|
||||
{
|
||||
activeWeaponHandle.Value.Clip1 = 100;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
{
|
||||
public static class ObrotWroga
|
||||
{
|
||||
|
||||
public static void LoadObrotWroga()
|
||||
{
|
||||
Instance.RegisterEventHandler<EventPlayerHurt>((@event, info) =>
|
||||
{
|
||||
var attacker = @event.Attacker;
|
||||
var victim = @event.Userid;
|
||||
|
||||
if (!IsPlayerValid(attacker) || !IsPlayerValid(victim) || attacker == victim)
|
||||
return HookResult.Continue;
|
||||
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == attacker.SteamID);
|
||||
|
||||
if (playerInfo?.Skill == "Obrót Wroga" && attacker.PawnIsAlive)
|
||||
{
|
||||
if (Instance.Random.NextDouble() <= 0.25)
|
||||
{
|
||||
RotateEnemy(victim);
|
||||
}
|
||||
}
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
}
|
||||
|
||||
private static bool IsPlayerValid(CCSPlayerController player)
|
||||
{
|
||||
return player != null && player.IsValid && player.PlayerPawn?.Value != null;
|
||||
}
|
||||
|
||||
private static void RotateEnemy(CCSPlayerController player)
|
||||
{
|
||||
if (player.PlayerPawn.Value.LifeState != (int)LifeState_t.LIFE_ALIVE)
|
||||
return;
|
||||
|
||||
var currentPosition = player.PlayerPawn.Value.AbsOrigin;
|
||||
var currentAngles = player.PlayerPawn.Value.EyeAngles;
|
||||
|
||||
QAngle newAngles = new QAngle(
|
||||
currentAngles.X,
|
||||
currentAngles.Y + 180,
|
||||
currentAngles.Z
|
||||
);
|
||||
|
||||
player.PlayerPawn.Value.Teleport(currentPosition, newAngles, new Vector(0, 0, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Memory;
|
||||
using CounterStrikeSharp.API.Modules.Memory.DynamicFunctions;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
{
|
||||
public static class OneShot
|
||||
{
|
||||
public static void LoadOneShot()
|
||||
{
|
||||
VirtualFunctions.CBaseEntity_TakeDamageOldFunc.Hook(OnTakeDamage, HookMode.Pre);
|
||||
}
|
||||
|
||||
private static HookResult OnTakeDamage(DynamicHook h)
|
||||
{
|
||||
CTakeDamageInfo param = h.GetParam<CTakeDamageInfo>(1);
|
||||
|
||||
if (param == null || param?.Attacker == null || !param.Attacker.Value.IsValid) return HookResult.Continue;
|
||||
|
||||
CCSPlayerPawn attackerPawn = new CCSPlayerPawn(param.Attacker.Value.Handle);
|
||||
if (attackerPawn == null || attackerPawn.Controller == null || !attackerPawn.Controller.Value.IsValid) return HookResult.Continue;
|
||||
|
||||
CCSPlayerController attacker = attackerPawn.Controller.Value.As<CCSPlayerController>();
|
||||
if (attacker == null) return HookResult.Continue;
|
||||
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == attacker.SteamID);
|
||||
if (playerInfo == null) return HookResult.Continue;
|
||||
|
||||
if (playerInfo.Skill == "One Shot" && attacker.PawnIsAlive)
|
||||
{
|
||||
param.Damage = 1000f;
|
||||
}
|
||||
|
||||
return HookResult.Continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using static CounterStrikeSharp.API.Core.Listeners;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
{
|
||||
public static class PawelJumper
|
||||
{
|
||||
private static readonly PlayerFlags[] LF = new PlayerFlags[64];
|
||||
private static readonly int?[] J = new int?[64];
|
||||
private static readonly PlayerButtons[] LB = new PlayerButtons[64];
|
||||
|
||||
public static void LoadPawelJumper()
|
||||
{
|
||||
Instance.RegisterListener<OnTick>(() =>
|
||||
{
|
||||
foreach (var player in Utilities.GetPlayers())
|
||||
{
|
||||
if (!IsPlayerValid(player)) continue;
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill == "Paweł Jumper")
|
||||
{
|
||||
GiveAdditionalJump(player);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static void GiveAdditionalJump(CCSPlayerController player)
|
||||
{
|
||||
var playerPawn = player.PlayerPawn.Value;
|
||||
var flags = (PlayerFlags)playerPawn.Flags;
|
||||
var buttons = player.Buttons;
|
||||
|
||||
if ((LF[player.Slot] & PlayerFlags.FL_ONGROUND) != 0 && (flags & PlayerFlags.FL_ONGROUND) == 0 && (LB[player.Slot] & PlayerButtons.Jump) == 0 && (buttons & PlayerButtons.Jump) != 0)
|
||||
{
|
||||
//J[player.Slot] ++;
|
||||
}
|
||||
else if ((flags & PlayerFlags.FL_ONGROUND) != 0)
|
||||
{
|
||||
J[player.Slot] = 0;
|
||||
}
|
||||
else if ((LB[player.Slot] & PlayerButtons.Jump) == 0 && (buttons & PlayerButtons.Jump) != 0 && J[player.Slot] < 1)
|
||||
{
|
||||
J[player.Slot] ++;
|
||||
playerPawn.AbsVelocity.Z = 300;
|
||||
}
|
||||
|
||||
LF[player.Slot] = flags;
|
||||
LB[player.Slot] = buttons;
|
||||
}
|
||||
|
||||
private static bool IsPlayerValid(CCSPlayerController player)
|
||||
{
|
||||
return player != null && player.IsValid && player.PlayerPawn?.Value != null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
{
|
||||
public static class Phoenix
|
||||
{
|
||||
private const double ReviveChance = 0.35;
|
||||
|
||||
public static void LoadPhoenix()
|
||||
{
|
||||
Instance.RegisterEventHandler<EventPlayerDeath>((@event, info) =>
|
||||
{
|
||||
var player = @event.Userid;
|
||||
|
||||
if (!IsValidPlayer(player)) return HookResult.Continue;
|
||||
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill != "Phoenix") return HookResult.Continue;
|
||||
|
||||
if (Instance.Random.NextDouble() <= ReviveChance)
|
||||
{
|
||||
RevivePlayer(player);
|
||||
}
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
}
|
||||
|
||||
private static bool IsValidPlayer(CCSPlayerController player)
|
||||
{
|
||||
return player != null && player.IsValid;
|
||||
}
|
||||
|
||||
private static void RevivePlayer(CCSPlayerController player)
|
||||
{
|
||||
player.Respawn();
|
||||
|
||||
Utils.PrintToChat(player, $"Zostałeś odrodzony z popiołów dzięki mocy: {ChatColors.DarkRed}Phoenix", false);
|
||||
}
|
||||
}
|
||||
}
|
||||
168
[ D3X ] dRandomSkills - SRC Files/src/player/skills/Pilot.cs
Normal file
168
[ D3X ] dRandomSkills - SRC Files/src/player/skills/Pilot.cs
Normal file
|
|
@ -0,0 +1,168 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using static CounterStrikeSharp.API.Core.Listeners;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
{
|
||||
public static class Pilot
|
||||
{
|
||||
private static readonly Dictionary<ulong, Pilot_PlayerInfo> PlayerPilotInfo = new Dictionary<ulong, Pilot_PlayerInfo>();
|
||||
|
||||
public static void LoadPilot()
|
||||
{
|
||||
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 == "Pilot")
|
||||
{
|
||||
PlayerPilotInfo[player.SteamID] = new Pilot_PlayerInfo
|
||||
{
|
||||
SteamID = player.SteamID,
|
||||
PressedUse = false,
|
||||
CanUsePilot = true,
|
||||
PilotStartTime = DateTime.MinValue
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
|
||||
Instance.RegisterEventHandler<EventPlayerDeath>((@event, info) =>
|
||||
{
|
||||
var player = @event.Userid;
|
||||
if (PlayerPilotInfo.ContainsKey(player.SteamID))
|
||||
{
|
||||
PlayerPilotInfo.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 == "Pilot")
|
||||
{
|
||||
HandlePilot(player);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static void HandlePilot(CCSPlayerController player)
|
||||
{
|
||||
var buttons = player.Buttons;
|
||||
if (PlayerPilotInfo.TryGetValue(player.SteamID, out var pilotInfo))
|
||||
{
|
||||
if (buttons.HasFlag(PlayerButtons.Use))
|
||||
{
|
||||
if (!pilotInfo.PressedUse)
|
||||
{
|
||||
pilotInfo.CanUsePilot = true;
|
||||
pilotInfo.PressedUse = true;
|
||||
pilotInfo.PilotStartTime = DateTime.Now;
|
||||
Instance.AddTimer(4.0f, () => ChangeUsePlayerPilot(player));
|
||||
}
|
||||
|
||||
if (pilotInfo.CanUsePilot)
|
||||
{
|
||||
ApplyPilotEffect(player);
|
||||
}
|
||||
}
|
||||
|
||||
UpdateHUD(player, pilotInfo);
|
||||
}
|
||||
}
|
||||
|
||||
private static void UpdateHUD(CCSPlayerController player, Pilot_PlayerInfo pilotInfo)
|
||||
{
|
||||
var buttons = player.Buttons;
|
||||
float fuelPercentage = 100.0f;
|
||||
|
||||
if (pilotInfo.PressedUse && pilotInfo.CanUsePilot)
|
||||
{
|
||||
float elapsedTime = (float)(DateTime.Now - pilotInfo.PilotStartTime).TotalSeconds;
|
||||
fuelPercentage = Math.Max(0, 100.0f * (4.0f - elapsedTime) / 4.0f);
|
||||
}
|
||||
|
||||
string fuelColor = GetFuelColor(fuelPercentage);
|
||||
string infoLine = buttons.HasFlag(PlayerButtons.Use) ? $"<font color='#FFFFFF'>Pilot:</font> <br>" : "";
|
||||
string remainingLine = buttons.HasFlag(PlayerButtons.Use) ?
|
||||
(pilotInfo.CanUsePilot ? $"<font color='{fuelColor}'>{fuelPercentage:F0}%</font> <br>" : "<font color='#FF0000'>W trakcie odnawiania</font> <br>") : "";
|
||||
|
||||
if (buttons.HasFlag(PlayerButtons.Use))
|
||||
{
|
||||
var hudContent = infoLine + remainingLine;
|
||||
player.PrintToCenterHtml(hudContent);
|
||||
}
|
||||
}
|
||||
|
||||
private static string GetFuelColor(float fuelPercentage)
|
||||
{
|
||||
if (fuelPercentage > 50) return "#00FF00";
|
||||
if (fuelPercentage > 25) return "#FFFF00";
|
||||
return "#FF0000";
|
||||
}
|
||||
|
||||
private static void ChangeUsePlayerPilot(CCSPlayerController player)
|
||||
{
|
||||
if (PlayerPilotInfo.TryGetValue(player.SteamID, out var pilotInfo))
|
||||
{
|
||||
pilotInfo.CanUsePilot = false;
|
||||
Instance.AddTimer(2.0f, () =>
|
||||
{
|
||||
pilotInfo.PressedUse = false;
|
||||
pilotInfo.CanUsePilot = true;
|
||||
});
|
||||
|
||||
pilotInfo.PressedUse = true;
|
||||
}
|
||||
}
|
||||
|
||||
private static void ApplyPilotEffect(CCSPlayerController player)
|
||||
{
|
||||
var playerPawn = player.PlayerPawn.Value;
|
||||
if (playerPawn?.CBodyComponent == null) return;
|
||||
|
||||
QAngle eye_angle = playerPawn.EyeAngles;
|
||||
double pitch = (Math.PI / 180) * eye_angle.X;
|
||||
double yaw = (Math.PI / 180) * eye_angle.Y;
|
||||
Vector eye_vector = new Vector((float)(Math.Cos(yaw) * Math.Cos(pitch)), (float)(Math.Sin(yaw) * Math.Cos(pitch)), (float)(-Math.Sin(pitch)));
|
||||
|
||||
Vector currentVelocity = playerPawn.AbsVelocity;
|
||||
|
||||
Vector jetpackVelocity = new Vector(
|
||||
eye_vector.X * 5.0f,
|
||||
eye_vector.Y * 5.0f,
|
||||
0.80f * 15.0f
|
||||
);
|
||||
|
||||
float newVelocityX = currentVelocity.X + jetpackVelocity.X;
|
||||
float newVelocityY = currentVelocity.Y + jetpackVelocity.Y;
|
||||
float newVelocityZ = currentVelocity.Z + jetpackVelocity.Z;
|
||||
|
||||
playerPawn.AbsVelocity.X = newVelocityX;
|
||||
playerPawn.AbsVelocity.Y = newVelocityY;
|
||||
playerPawn.AbsVelocity.Z = newVelocityZ;
|
||||
}
|
||||
|
||||
|
||||
public class Pilot_PlayerInfo
|
||||
{
|
||||
public ulong SteamID { get; set; }
|
||||
public bool CanUsePilot { get; set; }
|
||||
public bool PressedUse { get; set; }
|
||||
public DateTime PilotStartTime { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
52
[ D3X ] dRandomSkills - SRC Files/src/player/skills/Rambo.cs
Normal file
52
[ D3X ] dRandomSkills - SRC Files/src/player/skills/Rambo.cs
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
{
|
||||
public static class Rambo
|
||||
{
|
||||
public static void LoadRambo()
|
||||
{
|
||||
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
|
||||
{
|
||||
Instance.AddTimer(0.1f, () =>
|
||||
{
|
||||
foreach (var player in Utilities.GetPlayers())
|
||||
{
|
||||
if (IsValidPlayer(player)) continue;
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill == "Rambo")
|
||||
{
|
||||
int healthBonus = Instance.Random.Next(50, 501);
|
||||
AddHealth(player, healthBonus);
|
||||
}
|
||||
}
|
||||
});
|
||||
return HookResult.Continue;
|
||||
});
|
||||
}
|
||||
|
||||
private static bool IsValidPlayer(CCSPlayerController player)
|
||||
{
|
||||
return player != null && player.IsValid;
|
||||
}
|
||||
|
||||
public static void AddHealth(CCSPlayerController player, int health)
|
||||
{
|
||||
var pawn = player.PlayerPawn?.Value;
|
||||
if (pawn == null) return;
|
||||
|
||||
player.Health = Math.Min(player.Health + health, player.MaxHealth);
|
||||
pawn.Health = Math.Min(pawn.Health + health, pawn.MaxHealth);
|
||||
|
||||
if (health > 100)
|
||||
{
|
||||
player.MaxHealth = Math.Min(player.MaxHealth + health, 1000);
|
||||
pawn.MaxHealth = Math.Min(pawn.MaxHealth + health, 1000);
|
||||
}
|
||||
|
||||
Utilities.SetStateChanged(pawn, "CBaseEntity", "m_iHealth");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
using CounterStrikeSharp.API.Core;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
{
|
||||
public static class Rozbrojenie
|
||||
{
|
||||
|
||||
public static void LoadRozbrojenie()
|
||||
{
|
||||
Instance.RegisterEventHandler<EventPlayerHurt>((@event, info) =>
|
||||
{
|
||||
var attacker = @event.Attacker;
|
||||
var victim = @event.Userid;
|
||||
|
||||
if (attacker == null || !attacker.IsValid || victim == null || !victim.IsValid) return HookResult.Continue;
|
||||
|
||||
if (attacker == victim) return HookResult.Continue;
|
||||
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == attacker.SteamID);
|
||||
|
||||
if (playerInfo?.Skill == "Rozbrojenie" && attacker.PawnIsAlive)
|
||||
{
|
||||
if (Instance.Random.NextDouble() <= 0.25)
|
||||
{
|
||||
var weaponServices = victim.PlayerPawn?.Value?.WeaponServices;
|
||||
if (weaponServices?.MyWeapons == null) return HookResult.Continue;
|
||||
|
||||
foreach (var weapon in weaponServices.MyWeapons)
|
||||
{
|
||||
var weaponName = weapon.Value.DesignerName;
|
||||
if (weaponName != null && !weaponName.Contains("weapon_knife") && !weaponName.Contains("weapon_c4"))
|
||||
{
|
||||
victim.DropActiveWeapon();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return HookResult.Continue;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
using CounterStrikeSharp.API.Core;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
{
|
||||
public static class Teleporter
|
||||
{
|
||||
public static void LoadTeleporter()
|
||||
{
|
||||
Instance.RegisterEventHandler<EventPlayerHurt>((@event, info) =>
|
||||
{
|
||||
var victim = @event.Userid;
|
||||
var attacker = @event.Attacker;
|
||||
|
||||
if (!IsValidPlayer(victim) || !IsValidPlayer(attacker)) return HookResult.Continue;
|
||||
|
||||
var victimInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == victim.SteamID);
|
||||
var attackerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == attacker.SteamID);
|
||||
|
||||
if (attackerInfo?.Skill == "Teleportator")
|
||||
{
|
||||
TeleportPlayers(attacker, victim);
|
||||
}
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
}
|
||||
|
||||
private static bool IsValidPlayer(CCSPlayerController player)
|
||||
{
|
||||
return player != null && player.IsValid && player.PlayerPawn != null && player.PlayerPawn.Value != null;
|
||||
}
|
||||
|
||||
private static void TeleportPlayers(CCSPlayerController attacker, CCSPlayerController victim)
|
||||
{
|
||||
var attackerPawn = attacker.PlayerPawn.Value;
|
||||
var victimPawn = victim.PlayerPawn.Value;
|
||||
|
||||
var attackerPosition = attackerPawn.AbsOrigin;
|
||||
var attackerAngles = attackerPawn.AbsRotation;
|
||||
var attackerVelocity = attackerPawn.AbsVelocity;
|
||||
|
||||
var victimPosition = victimPawn.AbsOrigin;
|
||||
var victimAngles = victimPawn.AbsRotation;
|
||||
var victimVelocity = victimPawn.AbsVelocity;
|
||||
|
||||
attackerPawn.Teleport(victimPosition, victimAngles, victimVelocity);
|
||||
victimPawn.Teleport(attackerPosition, attackerAngles, attackerVelocity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
using CounterStrikeSharp.API.Core;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
{
|
||||
public static class ZelaznaGlowa
|
||||
{
|
||||
|
||||
public static void LoadZelaznaGlowa()
|
||||
{
|
||||
Instance.RegisterEventHandler<EventPlayerHurt>((@event, info) =>
|
||||
{
|
||||
var attacker = @event.Attacker;
|
||||
var victim = @event.Userid;
|
||||
int hitgroup = @event.Hitgroup;
|
||||
|
||||
if (!IsValidPlayer(attacker) || !IsValidPlayer(victim) || attacker == victim) return HookResult.Continue;
|
||||
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == victim.SteamID);
|
||||
|
||||
if (playerInfo?.Skill == "Żelazna Głowa" && hitgroup != 3)
|
||||
{
|
||||
ApplyIronHeadEffect(victim, @event.DmgHealth);
|
||||
return HookResult.Stop;
|
||||
}
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
}
|
||||
|
||||
private static bool IsValidPlayer(CCSPlayerController player)
|
||||
{
|
||||
return player != null && player.IsValid && player.PlayerPawn != null && player.PlayerPawn.Value != null;
|
||||
}
|
||||
|
||||
private static void ApplyIronHeadEffect(CCSPlayerController victim, float damage)
|
||||
{
|
||||
var playerPawn = victim.PlayerPawn.Value;
|
||||
var newHealth = playerPawn.Health + damage;
|
||||
|
||||
if (newHealth > 100)
|
||||
newHealth = 100;
|
||||
|
||||
playerPawn.Health = (int)newHealth;
|
||||
}
|
||||
}
|
||||
}
|
||||
81
[ D3X ] dRandomSkills - SRC Files/src/utils/Config.cs
Normal file
81
[ D3X ] dRandomSkills - SRC Files/src/utils/Config.cs
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
{
|
||||
public static class Config
|
||||
{
|
||||
private static readonly string configPath = Path.Combine(Instance.ModuleDirectory, "Config.json");
|
||||
public static ConfigModel config;
|
||||
private static FileSystemWatcher fileWatcher;
|
||||
|
||||
public static ConfigModel LoadedConfig => config;
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
config = LoadConfig();
|
||||
SetupFileWatcher();
|
||||
}
|
||||
|
||||
private static ConfigModel LoadConfig()
|
||||
{
|
||||
if (!File.Exists(configPath))
|
||||
{
|
||||
Instance.Logger.LogInformation("Plik konfiguracyjny nie istnieje. Tworzenie nowego pliku konfiguracyjnego...");
|
||||
var defaultConfig = new ConfigModel();
|
||||
SaveConfig(defaultConfig);
|
||||
return defaultConfig;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
string json = File.ReadAllText(configPath);
|
||||
return JsonConvert.DeserializeObject<ConfigModel>(json) ?? new ConfigModel();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Instance.Logger.LogError($"Błąd podczas wczytywania pliku konfiguracyjnego.");
|
||||
return new ConfigModel();
|
||||
}
|
||||
}
|
||||
|
||||
public static void SaveConfig(ConfigModel config)
|
||||
{
|
||||
try
|
||||
{
|
||||
string json = JsonConvert.SerializeObject(config, Formatting.Indented);
|
||||
File.WriteAllText(configPath, json);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Instance.Logger.LogError($"Błąd podczas zapisywania pliku konfiguracyjnego: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
private static void SetupFileWatcher()
|
||||
{
|
||||
fileWatcher = new FileSystemWatcher(Path.GetDirectoryName(configPath))
|
||||
{
|
||||
Filter = Path.GetFileName(configPath),
|
||||
NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.Size
|
||||
};
|
||||
|
||||
fileWatcher.Changed += (sender, e) => config = LoadConfig();
|
||||
fileWatcher.EnableRaisingEvents = true;
|
||||
}
|
||||
|
||||
public class ConfigModel
|
||||
{
|
||||
public Settings Settings { get; set; } = new Settings();
|
||||
}
|
||||
|
||||
public class Settings
|
||||
{
|
||||
public string Set_Skill { get; set; } = "ustawskill, setskill";
|
||||
public string SkillsList_Menu { get; set; } = "supermoc, skille, listamocy, supermoce, losowemoce";
|
||||
public bool KillerSkillInfo { get; set; } = true;
|
||||
public bool TeamMateSkillInfo { get; set; } = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
68
[ D3X ] dRandomSkills - SRC Files/src/utils/Findtarget.cs
Normal file
68
[ D3X ] dRandomSkills - SRC Files/src/utils/Findtarget.cs
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Commands;
|
||||
using CounterStrikeSharp.API.Modules.Commands.Targeting;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
|
||||
namespace dRandomSkills;
|
||||
|
||||
public class FindTarget
|
||||
{
|
||||
public static (List<CCSPlayerController> players, string targetname) Find
|
||||
(
|
||||
CommandInfo command,
|
||||
int minArgCount,
|
||||
bool singletarget,
|
||||
bool ignoreMessage = false
|
||||
)
|
||||
{
|
||||
if (command.ArgCount < minArgCount)
|
||||
{
|
||||
return (new List<CCSPlayerController>(), string.Empty);
|
||||
}
|
||||
|
||||
TargetResult targetresult = command.GetArgTargetResult(1);
|
||||
|
||||
if (targetresult.Players.Count == 0)
|
||||
{
|
||||
if (!ignoreMessage)
|
||||
{
|
||||
command.ReplyToCommand("Nie znaleziono pasującego gracza.");
|
||||
}
|
||||
|
||||
return (new List<CCSPlayerController>(), string.Empty);
|
||||
}
|
||||
else if (singletarget && targetresult.Players.Count > 1)
|
||||
{
|
||||
command.ReplyToCommand("Znaleziono więcej niż jednego gracza o tej samej nazwie.");
|
||||
return (new List<CCSPlayerController>(), string.Empty);
|
||||
}
|
||||
|
||||
string targetname;
|
||||
|
||||
if (targetresult.Players.Count == 1)
|
||||
{
|
||||
targetname = targetresult.Players.Single().PlayerName;
|
||||
}
|
||||
else
|
||||
{
|
||||
Target.TargetTypeMap.TryGetValue(command.GetArg(1), out TargetType type);
|
||||
|
||||
targetname = type switch
|
||||
{
|
||||
TargetType.GroupAll => Instance.Localizer["all"],
|
||||
TargetType.GroupBots => Instance.Localizer["bots"],
|
||||
TargetType.GroupHumans => Instance.Localizer["humans"],
|
||||
TargetType.GroupAlive => Instance.Localizer["alive"],
|
||||
TargetType.GroupDead => Instance.Localizer["dead"],
|
||||
TargetType.GroupNotMe => Instance.Localizer["notme"],
|
||||
TargetType.PlayerMe => targetresult.Players.First().PlayerName,
|
||||
TargetType.TeamCt => Instance.Localizer["ct"],
|
||||
TargetType.TeamT => Instance.Localizer["t"],
|
||||
TargetType.TeamSpec => Instance.Localizer["spec"],
|
||||
_ => targetresult.Players.First().PlayerName
|
||||
};
|
||||
}
|
||||
|
||||
return (targetresult.Players, targetname);
|
||||
}
|
||||
}
|
||||
14
[ D3X ] dRandomSkills - SRC Files/src/utils/Utils.cs
Normal file
14
[ D3X ] dRandomSkills - SRC Files/src/utils/Utils.cs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
|
||||
namespace dRandomSkills
|
||||
{
|
||||
public static class Utils
|
||||
{
|
||||
public static void PrintToChat(CCSPlayerController player, string msg, bool isError)
|
||||
{
|
||||
string checkIcon = isError ? $"{ChatColors.DarkRed}✖{ChatColors.LightRed}" : $"{ChatColors.Green}✔{ChatColors.Lime}";
|
||||
player.PrintToChat($" {ChatColors.DarkRed}► {ChatColors.Green}[{ChatColors.DarkRed} LOSOWE MOCE {ChatColors.Green}] {checkIcon} {msg}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"Settings": {
|
||||
"Set_Skill": "ustawskill, setskill",
|
||||
"SkillsList_Menu": "supermoc, skille, listamocy, supermoce, losowemoce",
|
||||
"KillerSkillInfo": true,
|
||||
"TeamMateSkillInfo": true
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue