v1.0.3
This commit is contained in:
parent
68776c3382
commit
576cee8cfb
87 changed files with 4957 additions and 1558 deletions
|
|
@ -1,88 +0,0 @@
|
|||
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.2";
|
||||
|
||||
public override void Load(bool hotReload)
|
||||
{
|
||||
Instance = this;
|
||||
|
||||
Config.Initialize();
|
||||
Event.Load();
|
||||
PlayerOnTick.Load();
|
||||
Command.Load();
|
||||
|
||||
// ==== NOWE ====
|
||||
MiniMajk.LoadMiniMajk();
|
||||
ZamianaMiejsc.LoadZamianaMiejsc();
|
||||
|
||||
// ==== POPRAWIONE/NAPRAWIONE ====
|
||||
Flash.LoadFlash();
|
||||
PawelJumper.LoadPawelJumper();
|
||||
BunnyHop.LoadBunnyHop();
|
||||
Impostor.LoadImpostor();
|
||||
OneShot.LoadOneShot();
|
||||
Muhammed.LoadMuhammed();
|
||||
Bogacz.LoadBogacz();
|
||||
Rambo.LoadRambo();
|
||||
Medyk.LoadMedyk();
|
||||
Duszek.LoadDuszek();
|
||||
Kurczak.LoadKurczak();
|
||||
Astronauta.LoadAstronauta();
|
||||
Rozbrojenie.LoadRozbrojenie();
|
||||
AntyFlash.LoadAntyFlash();
|
||||
ObrotWroga.LoadObrotWroga();
|
||||
NieskonczoneAmmo.LoadNieskonczoneAmmo();
|
||||
Katapulta.LoadKatapulta();
|
||||
Drakula.LoadDrakula();
|
||||
Teleporter.LoadTeleporter();
|
||||
Saper.LoadEliminator();
|
||||
Phoenix.LoadPhoenix();
|
||||
Pilot.LoadPilot();
|
||||
Cien.LoadCien();
|
||||
ZelaznaGlowa.LoadZelaznaGlowa();
|
||||
}
|
||||
}
|
||||
|
||||
public class dSkill_PlayerInfo
|
||||
{
|
||||
public required ulong SteamID { get; set; }
|
||||
public required string PlayerName { get; set; }
|
||||
public string? Skill { get; set; }
|
||||
public float? SkillChance { get; set; }
|
||||
public bool IsDrawing { get; set; }
|
||||
}
|
||||
|
||||
public class dSkill_SkillInfo
|
||||
{
|
||||
public string Name { get; }
|
||||
public string Description { get; }
|
||||
public string Color { get; }
|
||||
|
||||
public bool Display { get; }
|
||||
|
||||
public dSkill_SkillInfo(string name, string description, string color, bool display)
|
||||
{
|
||||
Name = name;
|
||||
Description = description;
|
||||
Color = color;
|
||||
Display = display;
|
||||
}
|
||||
}
|
||||
|
||||
public static class SkillData
|
||||
{
|
||||
public static List<dSkill_SkillInfo> Skills { get; } = new List<dSkill_SkillInfo>();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,130 +0,0 @@
|
|||
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,
|
||||
SkillChance = 1,
|
||||
});
|
||||
|
||||
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.Count)];
|
||||
skillPlayer.Skill = randomSkill.Name;
|
||||
|
||||
if (randomSkill.Display)
|
||||
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))
|
||||
{
|
||||
Utils.PrintToChat(player, $" {ChatColors.Lime}Supermoce twoich sojuszników:", false);
|
||||
Utils.PrintToChat(player, teammateSkills.TrimEnd('\n'), false);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
|
||||
Instance.RegisterEventHandler<EventPlayerDeath>((@event, info) =>
|
||||
{
|
||||
var victim = @event.Userid;
|
||||
var attacker = @event.Attacker;
|
||||
|
||||
if (victim == null || attacker == null || victim == attacker) return HookResult.Continue;
|
||||
|
||||
if(Config.config.Settings.KillerSkillInfo)
|
||||
{
|
||||
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";
|
||||
|
||||
Utils.PrintToChat(victim, $"Supermoc przeciwnika {ChatColors.DarkRed}{attacker.PlayerName}{ChatColors.Lime}:", false);
|
||||
Utils.PrintToChat(victim, $"{ChatColors.DarkRed}{attackerInfo.Skill}{ChatColors.Lime} - {skillDesc}", false);
|
||||
}
|
||||
}
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using static CounterStrikeSharp.API.Core.Listeners;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
{
|
||||
public static class PlayerOnTick
|
||||
{
|
||||
public static void Load()
|
||||
{
|
||||
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)
|
||||
{
|
||||
var randomSkill = SkillData.Skills[Instance.Random.Next(SkillData.Skills.Count)];
|
||||
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>";
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
using CounterStrikeSharp.API.Core;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
{
|
||||
public static class AntyFlash
|
||||
{
|
||||
public static void LoadAntyFlash()
|
||||
{
|
||||
Utils.RegisterSkill("Anty Flash", "Posiadasz odporność na flashe i 7 sekund trwają twoje flash'e", "#D6E6FF");
|
||||
|
||||
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);
|
||||
|
||||
if (playerInfo?.Skill == "Anty Flash")
|
||||
playerPawn.FlashDuration = 0.0f;
|
||||
else if (Instance.skillPlayer.Any(s => s.Skill == "Anty Flash"))
|
||||
playerPawn.FlashDuration = 7.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Entities;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
{
|
||||
public static class Astronauta
|
||||
{
|
||||
public static void LoadAstronauta()
|
||||
{
|
||||
Utils.RegisterSkill("Astronauta", "Otrzymujesz losową ilość grawitacji na start rundy", "#7E10AD", false);
|
||||
|
||||
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(player);
|
||||
}
|
||||
}
|
||||
});
|
||||
return HookResult.Continue;
|
||||
});
|
||||
}
|
||||
|
||||
private static void ApplyGravityModifier(CCSPlayerController player)
|
||||
{
|
||||
float gravityModifier = (float)Math.Round(Instance.Random.NextDouble() * (0.7f - 0.1f) + 0.1f, 1);
|
||||
Utils.PrintToChat(player, $"{ChatColors.DarkRed}\"Astronauta\"{ChatColors.Lime}: Twoja losowa grawitacja wynosi: {gravityModifier}x", false);
|
||||
player.Pawn.Value.GravityScale = gravityModifier;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
{
|
||||
public static class Bogacz
|
||||
{
|
||||
public static void LoadBogacz()
|
||||
{
|
||||
Utils.RegisterSkill("Bogacz", "Otrzymujesz losową ilość kasy na start rundy", "#D4AF37");
|
||||
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,68 +0,0 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
{
|
||||
public static class Eliminator
|
||||
{
|
||||
public static void LoadEliminator()
|
||||
{
|
||||
Utils.RegisterSkill("Eliminator", "Możesz szybciej podłożyć bombę oraz ją zdefować", "#8A2BE2");
|
||||
|
||||
Instance.RegisterEventHandler<EventBombBeginplant>((@event, info) =>
|
||||
{
|
||||
foreach (var player in Utilities.GetPlayers())
|
||||
{
|
||||
if (!IsPlayerValid(player)) return HookResult.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
{
|
||||
public static class Flash
|
||||
{
|
||||
public static void LoadFlash()
|
||||
{
|
||||
Utils.RegisterSkill("Flash", "Losowa prędkośc postaci na początku rundy", "#A31912", false);
|
||||
|
||||
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 newSpeed = (float)Instance.Random.NextDouble() * (3.0f - 1.2f) + 1.2f;
|
||||
newSpeed = (float)Math.Round(newSpeed, 2);
|
||||
playerPawn.VelocityModifier = newSpeed;
|
||||
Utilities.SetStateChanged(playerPawn, "CCSPlayerPawn", "m_flVelocityModifier");
|
||||
Utils.PrintToChat(player, $"{ChatColors.DarkRed}\"Flash\"{ChatColors.Lime}: Twój mnożnik prędkości to {newSpeed}x", false);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
}
|
||||
|
||||
private static bool IsPlayerValid(CCSPlayerController player)
|
||||
{
|
||||
return player != null && player.IsValid && player.PlayerPawn?.Value != null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,184 +0,0 @@
|
|||
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
|
||||
{
|
||||
private static readonly List<string> CTModels = new List<string>
|
||||
{
|
||||
// SWAT
|
||||
"characters/models/ctm_swat/ctm_swat_variante.vmdl",
|
||||
"characters/models/ctm_swat/ctm_swat_variantf.vmdl",
|
||||
"characters/models/ctm_swat/ctm_swat_varianth.vmdl",
|
||||
"characters/models/ctm_swat/ctm_swat_varianti.vmdl",
|
||||
"characters/models/ctm_swat/ctm_swat_variantj.vmdl",
|
||||
"characters/models/ctm_swat/ctm_swat_variantk.vmdl",
|
||||
|
||||
// ST6
|
||||
"characters/models/ctm_st6/ctm_st6_variante.vmdl",
|
||||
"characters/models/ctm_st6/ctm_st6_variantg.vmdl",
|
||||
"characters/models/ctm_st6/ctm_st6_varianti.vmdl",
|
||||
"characters/models/ctm_st6/ctm_st6_variantj.vmdl",
|
||||
"characters/models/ctm_st6/ctm_st6_variantk.vmdl",
|
||||
"characters/models/ctm_st6/ctm_st6_variantl.vmdl",
|
||||
"characters/models/ctm_st6/ctm_st6_variantm.vmdl",
|
||||
"characters/models/ctm_st6/ctm_st6_variantn.vmdl",
|
||||
|
||||
// SAS
|
||||
"characters/models/ctm_sas/ctm_sas.vmdl",
|
||||
"characters/models/ctm_sas/ctm_sas_variantf.vmdl",
|
||||
"characters/models/ctm_sas/ctm_sas_variantg.vmdl",
|
||||
|
||||
// CTM_HEAVY
|
||||
"characters/models/ctm_heavy/ctm_heavy.vmdl",
|
||||
|
||||
// GENDARMERIE
|
||||
"characters/models/ctm_gendarmerie/ctm_gendarmerie_varianta.vmdl",
|
||||
"characters/models/ctm_gendarmerie/ctm_gendarmerie_variantb.vmdl",
|
||||
"characters/models/ctm_gendarmerie/ctm_gendarmerie_variantc.vmdl",
|
||||
"characters/models/ctm_gendarmerie/ctm_gendarmerie_variantd.vmdl",
|
||||
"characters/models/ctm_gendarmerie/ctm_gendarmerie_variante.vmdl",
|
||||
|
||||
// FBI
|
||||
"characters/models/ctm_fbi/ctm_fbi.vmdl",
|
||||
"characters/models/ctm_fbi/ctm_fbi_varianta.vmdl",
|
||||
"characters/models/ctm_fbi/ctm_fbi_variantb.vmdl",
|
||||
"characters/models/ctm_fbi/ctm_fbi_variantc.vmdl",
|
||||
"characters/models/ctm_fbi/ctm_fbi_variantd.vmdl",
|
||||
"characters/models/ctm_fbi/ctm_fbi_variante.vmdl",
|
||||
"characters/models/ctm_fbi/ctm_fbi_variantf.vmdl",
|
||||
"characters/models/ctm_fbi/ctm_fbi_variantg.vmdl",
|
||||
"characters/models/ctm_fbi/ctm_fbi_varianth.vmdl",
|
||||
|
||||
// DIVER
|
||||
"characters/models/ctm_diver/ctm_diver_varianta.vmdl",
|
||||
"characters/models/ctm_diver/ctm_diver_variantb.vmdl",
|
||||
"characters/models/ctm_diver/ctm_diver_variantc.vmdl",
|
||||
};
|
||||
|
||||
|
||||
private static readonly List<string> TModels = new List<string>
|
||||
{
|
||||
// BALKAN
|
||||
"characters/models/tm_balkan/tm_balkan_variantf.vmdl",
|
||||
"characters/models/tm_balkan/tm_balkan_variantg.vmdl",
|
||||
"characters/models/tm_balkan/tm_balkan_varianth.vmdl",
|
||||
"characters/models/tm_balkan/tm_balkan_varianti.vmdl",
|
||||
"characters/models/tm_balkan/tm_balkan_variantj.vmdl",
|
||||
"characters/models/tm_balkan/tm_balkan_variantk.vmdl",
|
||||
"characters/models/tm_balkan/tm_balkan_variantl.vmdl",
|
||||
|
||||
// JUMPSUIT
|
||||
"characters/models/tm_jumpsuit/tm_jumpsuit_varianta.vmdl",
|
||||
"characters/models/tm_jumpsuit/tm_jumpsuit_variantb.vmdl",
|
||||
"characters/models/tm_jumpsuit/tm_jumpsuit_variantc.vmdl",
|
||||
|
||||
// JUNGLERAIDER
|
||||
"characters/models/tm_jungle_raider/tm_jungle_raider_varianta.vmdl",
|
||||
"characters/models/tm_jungle_raider/tm_jungle_raider_variantb.vmdl",
|
||||
"characters/models/tm_jungle_raider/tm_jungle_raider_variantb2.vmdl",
|
||||
"characters/models/tm_jungle_raider/tm_jungle_raider_variantc.vmdl",
|
||||
"characters/models/tm_jungle_raider/tm_jungle_raider_variantd.vmdl",
|
||||
"characters/models/tm_jungle_raider/tm_jungle_raider_variante.vmdl",
|
||||
"characters/models/tm_jungle_raider/tm_jungle_raider_variantf.vmdl",
|
||||
"characters/models/tm_jungle_raider/tm_jungle_raider_variantf2.vmdl",
|
||||
|
||||
// LEET
|
||||
"characters/models/tm_leet/tm_leet_varianta.vmdl",
|
||||
"characters/models/tm_leet/tm_leet_variantb.vmdl",
|
||||
"characters/models/tm_leet/tm_leet_variantc.vmdl",
|
||||
"characters/models/tm_leet/tm_leet_variantd.vmdl",
|
||||
"characters/models/tm_leet/tm_leet_variante.vmdl",
|
||||
"characters/models/tm_leet/tm_leet_variantf.vmdl",
|
||||
"characters/models/tm_leet/tm_leet_variantg.vmdl",
|
||||
"characters/models/tm_leet/tm_leet_varianth.vmdl",
|
||||
"characters/models/tm_leet/tm_leet_varianti.vmdl",
|
||||
"characters/models/tm_leet/tm_leet_variantj.vmdl",
|
||||
"characters/models/tm_leet/tm_leet_variantk.vmdl",
|
||||
|
||||
// PHOENIX
|
||||
"characters/models/tm_phoenix/tm_phoenix.vmdl",
|
||||
"characters/models/tm_phoenix/tm_phoenix_varianta.vmdl",
|
||||
"characters/models/tm_phoenix/tm_phoenix_variantb.vmdl",
|
||||
"characters/models/tm_phoenix/tm_phoenix_variantc.vmdl",
|
||||
"characters/models/tm_phoenix/tm_phoenix_variantd.vmdl",
|
||||
"characters/models/tm_phoenix/tm_phoenix_variantf.vmdl",
|
||||
"characters/models/tm_phoenix/tm_phoenix_variantg.vmdl",
|
||||
"characters/models/tm_phoenix/tm_phoenix_varianth.vmdl",
|
||||
"characters/models/tm_phoenix/tm_phoenix_varianti.vmdl",
|
||||
|
||||
// PHOENIX HEAVY
|
||||
"characters/models/tm_phoenix_heavy/tm_phoenix_heavy.vmdl",
|
||||
|
||||
// PROFESSIONAL
|
||||
"characters/models/tm_professional/tm_professional_varf.vmdl",
|
||||
"characters/models/tm_professional/tm_professional_varf1.vmdl",
|
||||
"characters/models/tm_professional/tm_professional_varf2.vmdl",
|
||||
"characters/models/tm_professional/tm_professional_varf3.vmdl",
|
||||
"characters/models/tm_professional/tm_professional_varf4.vmdl",
|
||||
"characters/models/tm_professional/tm_professional_varf5.vmdl",
|
||||
"characters/models/tm_professional/tm_professional_varg.vmdl",
|
||||
"characters/models/tm_professional/tm_professional_varh.vmdl",
|
||||
"characters/models/tm_professional/tm_professional_vari.vmdl",
|
||||
"characters/models/tm_professional/tm_professional_varj.vmdl",
|
||||
};
|
||||
|
||||
|
||||
public static void LoadImpostor()
|
||||
{
|
||||
Utils.RegisterSkill("Impostor", "Otrzymujesz na start rundy model postaci wroga", "#99140B");
|
||||
|
||||
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 == "Impostor")
|
||||
{
|
||||
string model = player.Team == CsTeam.Terrorist
|
||||
? GetRandomModel(CTModels)
|
||||
: player.Team == CsTeam.CounterTerrorist
|
||||
? GetRandomModel(TModels)
|
||||
: null;
|
||||
|
||||
if (model != null)
|
||||
{
|
||||
SetPlayerModel(player, model);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
}
|
||||
|
||||
private static string GetRandomModel(List<string> models)
|
||||
{
|
||||
if (models == null || models.Count == 0) return null;
|
||||
var random = new Random();
|
||||
int index = random.Next(models.Count);
|
||||
return models[index];
|
||||
}
|
||||
|
||||
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);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
{
|
||||
public static class Medyk
|
||||
{
|
||||
public static void LoadMedyk()
|
||||
{
|
||||
Utils.RegisterSkill("Medyk", "Otrzymujesz losową ilość apteczek na start rundy", "#42FF5F");
|
||||
|
||||
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
|
||||
{
|
||||
Instance.AddTimer(0.1f, () =>
|
||||
{
|
||||
foreach (var player in Utilities.GetPlayers())
|
||||
{
|
||||
if (!IsPlayerValid(player)) continue;
|
||||
player.RemoveItemByDesignerName("weapon_healthshot");
|
||||
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)) return HookResult.Continue;
|
||||
player.RemoveItemByDesignerName("weapon_healthshot");
|
||||
}
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
}
|
||||
|
||||
private static bool IsPlayerValid(CCSPlayerController player)
|
||||
{
|
||||
return player != null && player.IsValid && player.PlayerPawn?.Value != null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
{
|
||||
public static class MiniMajk
|
||||
{
|
||||
public static void LoadMiniMajk()
|
||||
{
|
||||
string defaultCT = "characters/models/ctm_sas/ctm_sas.vmdl";
|
||||
string defaultTT = "characters/models/tm_phoenix/tm_phoenix.vmdl";
|
||||
Utils.RegisterSkill("MiniMajk", "Losowa wielkość postaci na początku rundy", "#ffff00", false);
|
||||
|
||||
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 != "MiniMajk") continue;
|
||||
|
||||
var playerPawn = player.PlayerPawn?.Value;
|
||||
|
||||
if (playerPawn != null)
|
||||
{
|
||||
float newSize = (float)Instance.Random.NextDouble() * (.95f - .6f) + .6f;
|
||||
newSize = (float)Math.Round(newSize, 2);
|
||||
|
||||
playerPawn.CBodyComponent.SceneNode.GetSkeletonInstance().Scale = newSize;
|
||||
playerPawn.SetModel(player.Team == CsTeam.CounterTerrorist ? defaultTT : defaultCT);
|
||||
playerPawn.CBodyComponent.SceneNode.GetSkeletonInstance().Scale = newSize;
|
||||
playerPawn.SetModel(player.Team == CsTeam.CounterTerrorist ? defaultCT : defaultTT);
|
||||
|
||||
Utils.PrintToChat(player, $"{ChatColors.DarkRed}\"MiniMajk\"{ChatColors.Lime}: Twój mnożnik wielkości to {newSize}x", false);
|
||||
|
||||
Instance.AddTimer(.2f, () => {
|
||||
if (IsPlayerValid(player))
|
||||
playerPawn.CBodyComponent.SceneNode.GetSkeletonInstance().Scale = 1;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
}
|
||||
|
||||
private static bool IsPlayerValid(CCSPlayerController player)
|
||||
{
|
||||
return player != null && player.IsValid && player.PlayerPawn?.Value != null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,79 +0,0 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
{
|
||||
public static class ObrotWroga
|
||||
{
|
||||
public static void LoadObrotWroga()
|
||||
{
|
||||
Utils.RegisterSkill("Obrót Wroga", "Masz losową szanse na obrócenie wroga o 180 stopni po trafieniu", "#00FF00", false);
|
||||
|
||||
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 != "Obrót Wroga") continue;
|
||||
|
||||
float newChance = (float)Instance.Random.NextDouble() * (.40f - .20f) + .20f;
|
||||
playerInfo.SkillChance = newChance;
|
||||
newChance = (float)Math.Round(newChance, 2) * 100;
|
||||
newChance = (float)Math.Round(newChance);
|
||||
|
||||
Utils.PrintToChat(player, $"{ChatColors.DarkRed}\"Obrót Wroga\"{ChatColors.Lime}: Twoje szanse na obrucenie wroga po trafieniu to: {newChance}%", false);
|
||||
}
|
||||
});
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
|
||||
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" && victim.PawnIsAlive)
|
||||
{
|
||||
if (Instance.Random.NextDouble() <= playerInfo.SkillChance)
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,63 +0,0 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
{
|
||||
public static class Phoenix
|
||||
{
|
||||
public static void LoadPhoenix()
|
||||
{
|
||||
Utils.RegisterSkill("Phoenix", "Masz losową szans na odrodzenie się po śmierci", "#ff5C0A", false);
|
||||
|
||||
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 != "Phoenix") continue;
|
||||
|
||||
float newChance = (float)Instance.Random.NextDouble() * (.40f - .20f) + .20f;
|
||||
playerInfo.SkillChance = newChance;
|
||||
newChance = (float)Math.Round(newChance, 2) * 100;
|
||||
newChance = (float)Math.Round(newChance);
|
||||
|
||||
Utils.PrintToChat(player, $"{ChatColors.DarkRed}\"Phoenix\"{ChatColors.Lime}: Twoje szanse na odrodzenie się po śmierci: {newChance}%", false);
|
||||
}
|
||||
});
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
|
||||
Instance.RegisterEventHandler<EventPlayerDeath>((@event, info) =>
|
||||
{
|
||||
var player = @event.Userid;
|
||||
|
||||
if (!IsPlayerValid(player)) return HookResult.Continue;
|
||||
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill == "Phoenix")
|
||||
{
|
||||
if (Instance.Random.NextDouble() <= playerInfo.SkillChance)
|
||||
{
|
||||
player.Respawn();
|
||||
Instance.AddTimer(.2f, () => player.Respawn());
|
||||
Utils.PrintToChat(player, $"Zostałeś odrodzony z popiołów dzięki mocy: {ChatColors.DarkRed}Phoenix", false);
|
||||
}
|
||||
}
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
}
|
||||
|
||||
private static bool IsPlayerValid(CCSPlayerController player)
|
||||
{
|
||||
return player != null && player.IsValid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
{
|
||||
public static class Rambo
|
||||
{
|
||||
public static void LoadRambo()
|
||||
{
|
||||
Utils.RegisterSkill("Rambo", "Otrzymujesz losową ilość zdrowia na start rundy", "#009905");
|
||||
|
||||
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;
|
||||
|
||||
pawn.MaxHealth = Math.Min(pawn.Health + health, 1000);
|
||||
Utilities.SetStateChanged(pawn, "CBaseEntity", "m_iMaxHealth");
|
||||
|
||||
pawn.Health = pawn.MaxHealth;
|
||||
Utilities.SetStateChanged(pawn, "CBaseEntity", "m_iHealth");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,68 +0,0 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
{
|
||||
public static class Saper
|
||||
{
|
||||
public static void LoadEliminator()
|
||||
{
|
||||
Utils.RegisterSkill("Saper", "Możesz szybciej podłożyć bombę oraz ją zdefować", "#8A2BE2");
|
||||
|
||||
Instance.RegisterEventHandler<EventBombBeginplant>((@event, info) =>
|
||||
{
|
||||
foreach (var player in Utilities.GetPlayers())
|
||||
{
|
||||
if (!IsPlayerValid(player)) return HookResult.Continue;
|
||||
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill == "Saper")
|
||||
{
|
||||
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 == "Saper")
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,164 +0,0 @@
|
|||
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 ZamianaMiejsc
|
||||
{
|
||||
private static float timerCooldown = 30f;
|
||||
private static readonly Dictionary<ulong, ZamianaMiejsc_PlayerInfo> SkillPlayerInfo = new Dictionary<ulong, ZamianaMiejsc_PlayerInfo>();
|
||||
public static void LoadZamianaMiejsc()
|
||||
{
|
||||
Utils.RegisterSkill("ZamianaMiejsc", "Zamiana miejscami z losowym wrogiem. Kliknij [USE - E], cooldown 30s!", "#1466F5");
|
||||
|
||||
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
|
||||
{
|
||||
Instance.RegisterListener<OnTick>(CheckHandle);
|
||||
Instance.AddTimer(0.1f, () =>
|
||||
{
|
||||
foreach (var player in Utilities.GetPlayers())
|
||||
{
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill == "ZamianaMiejsc")
|
||||
{
|
||||
SkillPlayerInfo[player.SteamID] = new ZamianaMiejsc_PlayerInfo
|
||||
{
|
||||
SteamID = player.SteamID,
|
||||
CanUse = true,
|
||||
Cooldown = DateTime.MinValue
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
|
||||
Instance.RegisterEventHandler<EventRoundEnd>((@event, info) =>
|
||||
{
|
||||
Instance.RemoveListener<OnTick>(CheckHandle);
|
||||
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 == "ZamianaMiejsc")
|
||||
if (SkillPlayerInfo.ContainsKey(player.SteamID))
|
||||
SkillPlayerInfo.Remove(player.SteamID);
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
}
|
||||
|
||||
private static void CheckHandle()
|
||||
{
|
||||
foreach (var player in Utilities.GetPlayers())
|
||||
{
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill == "ZamianaMiejsc")
|
||||
{
|
||||
Handle(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void Handle(CCSPlayerController player)
|
||||
{
|
||||
var buttons = player.Buttons;
|
||||
if (SkillPlayerInfo.TryGetValue(player.SteamID, out var skillInfo))
|
||||
{
|
||||
if (buttons.HasFlag(PlayerButtons.Use))
|
||||
{
|
||||
if (skillInfo.CanUse)
|
||||
UseSkill(player, skillInfo);
|
||||
else
|
||||
UpdateHUD(player, skillInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void UpdateHUD(CCSPlayerController player, ZamianaMiejsc_PlayerInfo skillInfo = null)
|
||||
{
|
||||
float cooldown = 0;
|
||||
if (skillInfo != null)
|
||||
{
|
||||
float time = (float)((skillInfo.Cooldown.Second + timerCooldown) - DateTime.Now.Second);
|
||||
cooldown = time > 0 ? time : 0;
|
||||
}
|
||||
|
||||
string infoLine = $"<font color='#FFFFFF'>ZamianaMiejsc:</font> <br>";
|
||||
string remainingLine = skillInfo == null ? "<font color='#FF0000'>Nie znaleziono przeciwnika</font> <br>" : $"<font color='#FFFFFF'>Musisz poczekać jeszcze <font color='#FF0000'>{cooldown}</font> sekund</font> <br>";
|
||||
|
||||
var hudContent = infoLine + remainingLine;
|
||||
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, ZamianaMiejsc_PlayerInfo skillInfo)
|
||||
{
|
||||
var playerPawn = player.PlayerPawn.Value;
|
||||
if (playerPawn?.CBodyComponent == null) return;
|
||||
|
||||
List<CCSPlayerController> enemy = Utilities.GetPlayers().FindAll(p => IsPlayerValid(p) && p.Team != player.Team && p.PawnIsAlive);
|
||||
if (enemy.Count == 0)
|
||||
{
|
||||
UpdateHUD(player);
|
||||
return;
|
||||
}
|
||||
|
||||
CCSPlayerController randomEnemy = enemy[Instance.Random.Next(0, enemy.Count)];
|
||||
if (player.IsValid && player.PawnIsAlive && randomEnemy.IsValid && randomEnemy.PawnIsAlive)
|
||||
{
|
||||
skillInfo.CanUse = false;
|
||||
skillInfo.Cooldown = DateTime.Now;
|
||||
Instance.AddTimer(timerCooldown, () => ActiveUse(player));
|
||||
TeleportPlayers(player, randomEnemy);
|
||||
}
|
||||
else
|
||||
UpdateHUD(player);
|
||||
}
|
||||
|
||||
private static void TeleportPlayers(CCSPlayerController attacker, CCSPlayerController victim)
|
||||
{
|
||||
var attackerPawn = attacker.PlayerPawn.Value;
|
||||
var victimPawn = victim.PlayerPawn.Value;
|
||||
|
||||
Vector attackerPosition = new Vector(attackerPawn.AbsOrigin.X, attackerPawn.AbsOrigin.Y, attackerPawn.AbsOrigin.Z);
|
||||
QAngle attackerAngles = new QAngle(attackerPawn.AbsRotation.X, attackerPawn.AbsRotation.Y, attackerPawn.AbsRotation.Z);
|
||||
Vector attackerVelocity = new Vector(attackerPawn.AbsVelocity.X, attackerPawn.AbsVelocity.Y, attackerPawn.AbsVelocity.Z);
|
||||
|
||||
Vector victimPosition = new Vector(victimPawn.AbsOrigin.X, victimPawn.AbsOrigin.Y, victimPawn.AbsOrigin.Z);
|
||||
QAngle victimAngles = new QAngle(victimPawn.AbsRotation.X, victimPawn.AbsRotation.Y, victimPawn.AbsRotation.Z);
|
||||
Vector victimVelocity = new Vector(victimPawn.AbsVelocity.X, victimPawn.AbsVelocity.Y, victimPawn.AbsVelocity.Z);
|
||||
|
||||
victimPawn.Teleport(attackerPosition, attackerAngles, attackerVelocity);
|
||||
attackerPawn.Teleport(victimPosition, victimAngles, victimVelocity);
|
||||
}
|
||||
|
||||
private static bool IsPlayerValid(CCSPlayerController player)
|
||||
{
|
||||
return player != null && player.IsValid && player.PlayerPawn?.Value != null;
|
||||
}
|
||||
|
||||
public class ZamianaMiejsc_PlayerInfo
|
||||
{
|
||||
public ulong SteamID { get; set; }
|
||||
public bool CanUse { get; set; }
|
||||
public DateTime Cooldown { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,81 +0,0 @@
|
|||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
{
|
||||
"Settings": {
|
||||
"Set_Skill": "ustawskill, setskill",
|
||||
"SkillsList_Menu": "supermoc, skille, listamocy, supermoce, losowemoce",
|
||||
"KillerSkillInfo": true,
|
||||
"TeamMateSkillInfo": true
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
|
@ -8,7 +8,7 @@
|
|||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace dRandomSkills.Properties {
|
||||
namespace jRandomSkills.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
|
|
@ -39,7 +39,7 @@ namespace dRandomSkills.Properties {
|
|||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("dRandomSkills.Properties.Resources", typeof(Resources).Assembly);
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("jRandomSkills.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"profiles": {
|
||||
"dRandomSkills": {
|
||||
"jRandomSkills": {
|
||||
"commandName": "Project",
|
||||
"nativeDebugging": true
|
||||
}
|
||||
|
|
@ -6,6 +6,10 @@
|
|||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="src\player\skills\RespWroga.cs~RF528d210.TMP" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CounterStrikeSharp.API" Version="1.0.305" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
|
|
@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
|||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.9.34728.123
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "dRandomSkills", "dRandomSkills.csproj", "{1412DD25-558C-425A-A7F6-347C970136E5}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "jRandomSkills", "jRandomSkills.csproj", "{1412DD25-558C-425A-A7F6-347C970136E5}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
|
|
@ -1,10 +1,12 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Admin;
|
||||
using CounterStrikeSharp.API.Modules.Commands;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
using jRandomSkills.src.utils;
|
||||
using static jRandomSkills.jRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
namespace jRandomSkills
|
||||
{
|
||||
public static class Command
|
||||
{
|
||||
|
|
@ -26,6 +28,10 @@ namespace dRandomSkills
|
|||
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);
|
||||
}
|
||||
|
||||
private static IEnumerable<string> SplitCommands(string commands)
|
||||
|
|
@ -49,29 +55,21 @@ namespace dRandomSkills
|
|||
|
||||
(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);
|
||||
Utils.PrintToChat(player, Localization.GetTranslation("correct_form_setskill"), 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));
|
||||
var skillName = command.ArgCount > 3 ? $"{command.GetArg(2)} {command.GetArg(3)}" : command.GetArg(2);
|
||||
var skill = SkillData.Skills.FirstOrDefault(s => s.Name.Equals(skillName, StringComparison.OrdinalIgnoreCase) || s.Skill.ToString().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);
|
||||
Utils.PrintToChat(player, Localization.GetTranslation("skill_not_found_setskill"), true);
|
||||
player.PrintToChat($" {ChatColors.Green}―――――――――――{ChatColors.DarkRed}◥◣◆◢◤{ChatColors.Green}―――――――――――");
|
||||
return;
|
||||
}
|
||||
|
|
@ -81,19 +79,23 @@ namespace dRandomSkills
|
|||
var skillPlayer = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == target.SteamID);
|
||||
if (skillPlayer != null)
|
||||
{
|
||||
skillPlayer.Skill = skill.Name;
|
||||
|
||||
Instance.SkillAction(skillPlayer.Skill.ToString(), "DisableSkill", new object[] { target });
|
||||
skillPlayer.Skill = skill.Skill;
|
||||
Instance.SkillAction(skill.Skill.ToString(), "EnableSkill", new object[] { target });
|
||||
|
||||
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);
|
||||
Utils.PrintToChat(player, $"{Localization.GetTranslation("done_setskill")}: {ChatColors.LightRed}{skill.Name} {ChatColors.Lime}{Localization.GetTranslation("for_setskill")} {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);
|
||||
Utils.PrintToChat(player, Localization.GetTranslation("error_setskill"), true);
|
||||
player.PrintToChat($" {ChatColors.Green}―――――――――――{ChatColors.DarkRed}◥◣◆◢◤{ChatColors.Green}―――――――――――");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
[CommandHelper(minArgs: 0, whoCanExecute: CommandUsage.CLIENT_ONLY)]
|
||||
|
|
@ -102,5 +104,57 @@ namespace dRandomSkills
|
|||
if (player == null) return;
|
||||
Menu.DisplaySkillsList(player);
|
||||
}
|
||||
|
||||
[RequiresPermissions("@css/root")]
|
||||
[CommandHelper(minArgs: 1, whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
||||
public static void Command_ChangeMap(CCSPlayerController? player, CommandInfo command)
|
||||
{
|
||||
if (player == null) return;
|
||||
string map = command.GetArg(1);
|
||||
|
||||
if (string.IsNullOrEmpty(map))
|
||||
{
|
||||
command.ReplyToCommand($" {ChatColors.Red}{Localization.GetTranslation("invalid_map")}");
|
||||
return;
|
||||
}
|
||||
|
||||
Server.PrintToChatAll($" {ChatColors.Yellow}{Localization.GetTranslation("loading_map")} ({ChatColors.Green}{map}{ChatColors.Yellow})...");
|
||||
|
||||
if (uint.TryParse(map, out _))
|
||||
Server.ExecuteCommand($"host_workshop_map {map}");
|
||||
else if (!Server.IsMapValid(map))
|
||||
command.ReplyToCommand($" {ChatColors.Red}{Localization.GetTranslation("invalid_map")}");
|
||||
else
|
||||
Server.ExecuteCommand($"changelevel {map}");
|
||||
}
|
||||
|
||||
[RequiresPermissions("@css/root")]
|
||||
[CommandHelper(minArgs: 0, whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
||||
public static void Command_StartGame(CCSPlayerController? player, CommandInfo command)
|
||||
{
|
||||
if (player == null) return;
|
||||
int cheats = command.GetArg(1) == "sv" ? 1 : 0;
|
||||
|
||||
Server.ExecuteCommand($"mp_freezetime {(cheats == 1 ? 0 : 5)}");
|
||||
Server.ExecuteCommand("mp_warmup_end");
|
||||
Server.ExecuteCommand("mp_restartgame 1");
|
||||
|
||||
Instance.AddTimer(2.0f, () => {
|
||||
Server.PrintToChatAll($" {ChatColors.Green}{Localization.GetTranslation("game_start")}");
|
||||
Server.ExecuteCommand("mp_forcecamera 0");
|
||||
Server.ExecuteCommand($"mp_freezetime {(cheats == 1 ? 0 : 5)}");
|
||||
Server.ExecuteCommand("mp_overtime_enable 1");
|
||||
Server.ExecuteCommand($"sv_cheats {cheats}");
|
||||
});
|
||||
}
|
||||
|
||||
[RequiresPermissions("@css/root")]
|
||||
[CommandHelper(minArgs: 1, whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
||||
public static void Command_CustomCommand(CCSPlayerController? player, CommandInfo command)
|
||||
{
|
||||
if (player == null) return;
|
||||
string param = command.GetArg(1);
|
||||
Server.ExecuteCommand(param);
|
||||
}
|
||||
}
|
||||
}
|
||||
109
jRandomSkills - SRC Files/src/jRandomSkills.cs
Normal file
109
jRandomSkills - SRC Files/src/jRandomSkills.cs
Normal file
|
|
@ -0,0 +1,109 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Core.Commands;
|
||||
using CounterStrikeSharp.API.Modules.Commands;
|
||||
using jRandomSkills.src.player;
|
||||
using jRandomSkills.src.utils;
|
||||
using System.Reflection;
|
||||
|
||||
namespace jRandomSkills
|
||||
{
|
||||
public partial class jRandomSkills : BasePlugin
|
||||
{
|
||||
public static jRandomSkills 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] [ 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 ModuleVersion => "1.0.3";
|
||||
|
||||
public override void Load(bool hotReload)
|
||||
{
|
||||
Instance = this;
|
||||
|
||||
Config.Initialize();
|
||||
Localization.Load();
|
||||
Event.Load();
|
||||
PlayerOnTick.Load();
|
||||
Command.Load();
|
||||
|
||||
foreach (var skill in Enum.GetValues(typeof(Skills)))
|
||||
SkillAction(skill.ToString(), "LoadSkill");
|
||||
}
|
||||
|
||||
internal void SkillAction(string skill, string methodName, object[] param = null)
|
||||
{
|
||||
string className = $"jRandomSkills.{skill}";
|
||||
Type? type = Type.GetType(className);
|
||||
|
||||
if (type != null && typeof(ISkill).IsAssignableFrom(type))
|
||||
{
|
||||
MethodInfo? method = type.GetMethod(methodName, BindingFlags.Static | BindingFlags.Public);
|
||||
method?.Invoke(null, param);
|
||||
}
|
||||
else
|
||||
Server.PrintToConsole($"Could not find or load {className}");
|
||||
}
|
||||
|
||||
internal void RegisterListener<T>(Action onTick, HookMode pre)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
internal void RegisterListener<T>(Action<object, object> value)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
internal void AddCommand(string name, string description, CommandInfo.CommandCallback handler)
|
||||
{
|
||||
var definition = new CommandDefinition(name, description, handler);
|
||||
CommandDefinitions.Add(definition);
|
||||
CommandManager.RegisterCommand(definition);
|
||||
}
|
||||
|
||||
internal bool IsPlayerValid(CCSPlayerController player)
|
||||
{
|
||||
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[] 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 class dSkill_PlayerInfo
|
||||
{
|
||||
public required ulong SteamID { get; set; }
|
||||
public required string PlayerName { get; set; }
|
||||
public Skills Skill { get; set; }
|
||||
public float? SkillChance { get; set; }
|
||||
public bool IsDrawing { get; set; }
|
||||
}
|
||||
|
||||
public class dSkill_SkillInfo
|
||||
{
|
||||
public Skills Skill { get; }
|
||||
public string Name { get; }
|
||||
public string Description { get; }
|
||||
public string Color { get; }
|
||||
|
||||
public bool Display { get; }
|
||||
|
||||
public dSkill_SkillInfo(Skills skill, string color, bool display)
|
||||
{
|
||||
Skill = skill;
|
||||
Name = Localization.GetTranslation(skill.ToString().ToLower());
|
||||
Description = Localization.GetTranslation($"{skill.ToString().ToLower()}_desc");
|
||||
Color = color;
|
||||
Display = display;
|
||||
}
|
||||
}
|
||||
|
||||
public static class SkillData
|
||||
{
|
||||
public static List<dSkill_SkillInfo> Skills { get; } = new List<dSkill_SkillInfo>();
|
||||
}
|
||||
}
|
||||
127
jRandomSkills - SRC Files/src/lang/en.json
Normal file
127
jRandomSkills - SRC Files/src/lang/en.json
Normal file
|
|
@ -0,0 +1,127 @@
|
|||
{
|
||||
"none_desc": "You have no skills",
|
||||
"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",
|
||||
"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",
|
||||
"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",
|
||||
"ghost_desc": "You are completely invisible",
|
||||
"flash_desc": "Random player speed at the beginning of the round",
|
||||
"flash_desc2": "Your speed multiplier is {0}x",
|
||||
"godmode_desc": "You are immortal for 2 seconds. Press [css_useSkill], cooldown 30s",
|
||||
"godmode_on": "Immortality enabled",
|
||||
"godmode_off": "Immortality disabled",
|
||||
"armored_desc": "You have a random damage taken multiplier",
|
||||
"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",
|
||||
"dwarf_desc2": "Your size multiplier is {0}x",
|
||||
"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",
|
||||
"chicken_desc": "You get a chicken model + 10% faster movement - 50 HP",
|
||||
"impostor_desc": "You start the round with an enemy player model",
|
||||
"catapult_desc": "You have a random chance to launch an enemy upwards",
|
||||
"catapult_desc2": "Your chance to launch an enemy on hit is: {0}%",
|
||||
"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}%",
|
||||
"retreat_desc": "Return to spawn. Press [css_useSkill], cooldown 15s",
|
||||
"oneshot_desc": "Hitting an enemy instantly kills them",
|
||||
"paweljumper_desc": "You get an extra jump",
|
||||
"phoenix_desc": "You have a random chance to respawn after death",
|
||||
"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",
|
||||
"pilot_desc": "Fly for a limited time. Hold [USE - E] to fly",
|
||||
"pilot_hud_info": "Recharging",
|
||||
"radarhack_desc": "You can see enemies on the radar",
|
||||
"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",
|
||||
"disarmament_desc2": "Your chance to disarm an enemy is: {0}%",
|
||||
"planter_desc": "You can plant the bomb anywhere; bomb detonation time is 60s",
|
||||
"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",
|
||||
"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)",
|
||||
"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",
|
||||
"zeus_desc": "Zeus x27 instantly recharges",
|
||||
"frozendecoy_desc": "Your decoy grenade freezes all nearby players",
|
||||
"antyhead_desc": "You receive no headshot damage",
|
||||
"soldier_desc": "You have a random damage multiplier",
|
||||
"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}",
|
||||
"hud_info": "Wait {0} seconds",
|
||||
"no_player": "No player found.",
|
||||
"duplicate_player": "More than one player found with the same name.",
|
||||
"drawing_skill": "Drawing a skill",
|
||||
"your_skill": "Your current skill",
|
||||
"summary_start": "======SUMMARY=OF=THE=LAST=ROUND======",
|
||||
"summary_end": "=======================================",
|
||||
"enemy_skill": "Enemy's skill",
|
||||
"teammate_skills": "Your teammates' skills",
|
||||
"observer_skill": "Player's power",
|
||||
"game_start": "Game started!",
|
||||
"invalid_map": "Invalid map name!",
|
||||
"loading_map": "Loading a new map",
|
||||
"skills_menu": "Skill List",
|
||||
"correct_form_setskill": "Correct usage: CHATCOLORS.RED!setskill <nickname> <skill>",
|
||||
"skill_not_found_setskill": "Skill CHATCOLORS.REDnot found",
|
||||
"error_setskill": "Failed to set CHATCOLORS.REDskill",
|
||||
"done_setskill": "Skill set",
|
||||
"for_setskill": "for",
|
||||
|
||||
"none": "None",
|
||||
"dwarf": "Dwarf",
|
||||
"swapposition": "Swapper",
|
||||
"killerflash": "Deadly Flash",
|
||||
"soldier": "Soldier",
|
||||
"armored": "Tank",
|
||||
"aimbot": "Aimbot",
|
||||
"retreat": "Retreat",
|
||||
"enemyspawn": "Enemy Spawn",
|
||||
"zeus": "Zeus",
|
||||
"radarhack": "Radar Hack",
|
||||
"quickshot": "Quick-Shot",
|
||||
"planter": "Planter",
|
||||
"silent": "Silent Shadow",
|
||||
"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": "Saper",
|
||||
"phoenix": "Phoenix",
|
||||
"pilot": "Pilot",
|
||||
"shade": "Shade",
|
||||
"antyhead": "Anty Head"
|
||||
}
|
||||
127
jRandomSkills - SRC Files/src/lang/pl.json
Normal file
127
jRandomSkills - SRC Files/src/lang/pl.json
Normal file
|
|
@ -0,0 +1,127 @@
|
|||
{
|
||||
"none_desc": "Nie posiadasz żadnej supermocy",
|
||||
"aimbot_desc": "Każdy twój trafiony pocisk jest liczony jako głowa",
|
||||
"antyflash_desc": "Posiadasz odporność na flashe i 7 sekund trwają twoje flash'e",
|
||||
"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",
|
||||
"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ń",
|
||||
"ghost_desc": "Jesteś całkowicie niewidzialny",
|
||||
"flash_desc": "Losowa prędkośc postaci na początku rundy",
|
||||
"flash_desc2": "Twój mnożnik prędkości to {0}x",
|
||||
"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_desc": "Masz losowy mnożnik otrzymywanych obrażeń",
|
||||
"armored_desc2": "Twój mnożnik otrzymywanych obrażeń wynosi: {0}x",
|
||||
"muhammed_desc": "Po śmierci wybucha i zabija graczy w obrębie",
|
||||
"dwarf_desc": "Losowa wielkość postaci na początku rundy",
|
||||
"dwarf_desc2": "Twój mnożnik wielkości to {0}x",
|
||||
"medic_desc": "Otrzymujesz losową ilość apteczek na start rundy",
|
||||
"randomweapon_desc": "Dostajesz losową broń. Kliknij [css_useSkill], cooldown 15s",
|
||||
"chicken_desc": "Otrzymujesz model kurczaka + jesteś o 10% szybszy - 50hp",
|
||||
"impostor_desc": "Otrzymujesz na start rundy model postaci wroga",
|
||||
"catapult_desc": "Masz losową szanse na podrzucenie wroga",
|
||||
"catapult_desc2": "Twoje szanse na podrzucenie wroga po trafieniu to: {0}%",
|
||||
"infiniteammo_desc": "Otrzymujesz nieskończoną ilość ammo do wszystkich swoich broni",
|
||||
"behind_desc": "Masz losową szanse na obrócenie wroga o 180 stopni po trafieniu",
|
||||
"behind_desc2": "Twoje szanse na obrócenie wroga po trafieniu to: {0}%",
|
||||
"retreat_desc": "Powrót na spawna. Kliknij [css_useSkill], cooldown 15s",
|
||||
"oneshot_desc": "Po trafieniu od razu zabija przeciwnika",
|
||||
"paweljumper_desc": "Otrzymujesz dodatkowy skok",
|
||||
"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",
|
||||
"pilot_desc": "Latanie przez określony czas. Przytrzymaj [USE - E], aby latać",
|
||||
"pilot_hud_info": "W trakcie odnawiania",
|
||||
"radarhack_desc": "Widzisz wrogów na radarze",
|
||||
"rambo_desc": "Otrzymujesz losową ilość zdrowia na start rundy",
|
||||
"enemyspawn_desc": "Teleportacja na spawn wroga. Kliknij [css_useSkill], cooldown 15s",
|
||||
"disarmament_desc": "Masz losową szanse na wyrzucenie broni wroga po trafieniu",
|
||||
"disarmament_desc2": "Twoje szanse na wyrzucenie broni wroga to: {0}%",
|
||||
"planter_desc": "Możesz podłożyć bombę w dowolnym miejscu, czas detonacji bomby trwa 60s",
|
||||
"saper_desc": "Możesz szybciej podłożyć bombę oraz ją zdefować",
|
||||
"timemanipulator_desc": "Spowolnienie czasu dla wszystkich na 6 sekundy. Kliknij [css_useSkill], cooldown 30s",
|
||||
"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)",
|
||||
"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",
|
||||
"zeus_desc": "Zeus x27 natychmiastowo się odnawia",
|
||||
"frozendecoy_desc": "Twój decoy zamraża wszystkich pobliskich graczy",
|
||||
"antyhead_desc": "Nie otrzymujesz obrażeń w głowę",
|
||||
"soldier_desc": "Masz losowy mnożnik obrażeń",
|
||||
"soldier_desc2": "Twój mnożnik obrażeń wynosi: {0}x",
|
||||
"swapposition_desc": "Zamiana miejscami z losowym wrogiem. Kliknij [css_useSkill], cooldown 30s",
|
||||
|
||||
"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",
|
||||
"no_player": "Nie znaleziono pasującego gracza.",
|
||||
"duplicate_player": "Znaleziono więcej niż jednego gracza o tej samej nazwie.",
|
||||
"drawing_skill": "Losowanie mocy",
|
||||
"your_skill": "Twoja aktualna moc",
|
||||
"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>",
|
||||
"skill_not_found_setskill": "Nie znaleziono takiej CHATCOLORS.REDsupermocy",
|
||||
"error_setskill": "Nie udało się ustawić CHATCOLORS.REDsupermocy",
|
||||
"done_setskill": "Ustawiono Supermoc",
|
||||
"for_setskill": "dla",
|
||||
|
||||
"none": "Brak",
|
||||
"dwarf": "MiniMajk",
|
||||
"swapoosition": "Zamiana Miejsc",
|
||||
"killerflash": "Zabójczy Flash",
|
||||
"soldier": "Żołnierz",
|
||||
"armored": "Gruby",
|
||||
"aimbot": "Aimbot",
|
||||
"retreat": "Odwrót",
|
||||
"enemyspawn": "Resp Wroga",
|
||||
"zeus": "Zeus",
|
||||
"radarhack": "Radarowiec",
|
||||
"quickshot": "Szybkostrzelność",
|
||||
"planter": "Samowolka",
|
||||
"silent": "Cichociemny",
|
||||
"frozendecoy": "Zamrażający Decoy",
|
||||
"timemanipulator": "Spowlnienie Czasu",
|
||||
"godmode": "Nieśmiertelność",
|
||||
"randomweapon": "Losowa Broń",
|
||||
"weaponsswap": "Zamiana Broni",
|
||||
"wallhack": "Wallhack",
|
||||
"flash": "Flash",
|
||||
"paweljumper": "Pawel Jumper",
|
||||
"bunnyhop": "Królik",
|
||||
"impostor": "Szpieg",
|
||||
"oneshot": "Jednostrzałowiec",
|
||||
"muhammed": "Muhammed",
|
||||
"richboy": "Bogacz",
|
||||
"rambo": "Rambo",
|
||||
"medic": "Medyk",
|
||||
"ghost": "Duszek",
|
||||
"chicken": "Kurczak",
|
||||
"astronaut": "Astronauta",
|
||||
"disarmament": "Rozbrojenie",
|
||||
"antyflash": "Anty Flash",
|
||||
"behind": "Obrót Wroga",
|
||||
"infiniteammo": "Nieskończone Ammo",
|
||||
"catapult": "Katapulta",
|
||||
"dracula": "Drakula",
|
||||
"teleporter": "Teleporter",
|
||||
"saper": "Saper",
|
||||
"phoenix": "Phoenix",
|
||||
"pilot": "Pilot",
|
||||
"shade": "Cień",
|
||||
"antyhead": "Żelazna Głowa"
|
||||
}
|
||||
|
|
@ -1,17 +1,17 @@
|
|||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Menu;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
using CounterStrikeSharp.API;
|
||||
using static jRandomSkills.jRandomSkills;
|
||||
using System.Text.RegularExpressions;
|
||||
using jRandomSkills.src.utils;
|
||||
|
||||
namespace dRandomSkills
|
||||
namespace jRandomSkills
|
||||
{
|
||||
public static class Menu
|
||||
{
|
||||
public static void DisplaySkillsList(CCSPlayerController player)
|
||||
{
|
||||
CenterHtmlMenu menu = new($"[ ★ Lista Super Mocy ★ ]");
|
||||
CenterHtmlMenu menu = new($"[ ★ {Localization.GetTranslation("skills_menu")} ★ ]");
|
||||
|
||||
for (int i = 0; i < SkillData.Skills.Count; i++)
|
||||
{
|
||||
66
jRandomSkills - SRC Files/src/player/ISkill.cs
Normal file
66
jRandomSkills - SRC Files/src/player/ISkill.cs
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
using CounterStrikeSharp.API.Core;
|
||||
|
||||
namespace jRandomSkills.src.player;
|
||||
|
||||
public interface ISkill
|
||||
{
|
||||
public static void LoadSkill() { }
|
||||
public static void EnableSkill(CCSPlayerController player)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public static void DisableSkill(CCSPlayerController player)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public enum Skills
|
||||
{
|
||||
None,
|
||||
Dwarf,
|
||||
SwapPosition,
|
||||
FrozenDecoy,
|
||||
Soldier,
|
||||
Armored,
|
||||
Aimbot,
|
||||
Retreat,
|
||||
EnemySpawn,
|
||||
Zeus,
|
||||
RadarHack,
|
||||
QuickShot,
|
||||
Planter,
|
||||
Silent,
|
||||
KillerFlash,
|
||||
TimeManipulator,
|
||||
GodMode,
|
||||
RandomWeapon,
|
||||
WeaponsSwap,
|
||||
Wallhack,
|
||||
|
||||
Flash,
|
||||
PawelJumper,
|
||||
BunnyHop,
|
||||
Impostor,
|
||||
OneShot,
|
||||
Muhammed,
|
||||
RichBoy,
|
||||
Rambo,
|
||||
Medic,
|
||||
Ghost,
|
||||
Chicken,
|
||||
Astronaut,
|
||||
Disarmament,
|
||||
AntyFlash,
|
||||
Behind,
|
||||
InfiniteAmmo,
|
||||
Catapult,
|
||||
Dracula,
|
||||
Teleporter,
|
||||
Saper,
|
||||
Phoenix,
|
||||
Pilot,
|
||||
Shade,
|
||||
AntyHead,
|
||||
}
|
||||
199
jRandomSkills - SRC Files/src/player/PlayerEvents.cs
Normal file
199
jRandomSkills - SRC Files/src/player/PlayerEvents.cs
Normal file
|
|
@ -0,0 +1,199 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Cvars;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using jRandomSkills.src.player;
|
||||
using jRandomSkills.src.utils;
|
||||
using System.Text.RegularExpressions;
|
||||
using static jRandomSkills.jRandomSkills;
|
||||
|
||||
namespace jRandomSkills
|
||||
{
|
||||
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 = src.player.Skills.None,
|
||||
IsDrawing = false,
|
||||
SkillChance = 1,
|
||||
});
|
||||
|
||||
const string defaultWelcomeMsg = "Welcome {PLAYER}, to the {SERVER_NAME} server!\n"
|
||||
+ "The current version of the jRandomSkills: {VERSION} ({SKILLS_COUNT} skills).\n\n"
|
||||
+ "Original plugin created by:\n{AUTHOR1}\n"
|
||||
+ "Modified and improved by:\n{AUTHOR2}";
|
||||
string langWelcomeMsg = Localization.GetTranslation("welcome_message", "welcome");
|
||||
string welcomeMsg = Regex.IsMatch(langWelcomeMsg, @"\{AUTHOR1\}", RegexOptions.IgnoreCase) && Regex.IsMatch(langWelcomeMsg, @"\{AUTHOR2\}", RegexOptions.IgnoreCase) ? langWelcomeMsg : defaultWelcomeMsg;
|
||||
|
||||
foreach (string line in welcomeMsg.Split("\n"))
|
||||
player.PrintToChat($" {ChatColors.Green}" + line.Replace("{PLAYER}", $" {ChatColors.Red}{player.PlayerName}{ChatColors.Green}", StringComparison.OrdinalIgnoreCase)
|
||||
.Replace("{SERVER_NAME}", $" {ChatColors.Red}{ConVar.Find("hostname").StringValue ?? "Default Server"}{ChatColors.Green}", StringComparison.OrdinalIgnoreCase)
|
||||
.Replace("{VERSION}", $" {ChatColors.Red}v{Instance.ModuleVersion}{ChatColors.Green}", StringComparison.OrdinalIgnoreCase)
|
||||
.Replace("{SKILLS_COUNT}", $" {ChatColors.Red}{SkillData.Skills.Count - 1}{ChatColors.Green}", StringComparison.OrdinalIgnoreCase)
|
||||
.Replace("{AUTHOR1}", $" {ChatColors.Red}Jakub Bartosik (D3X){ChatColors.Green} ({ChatColors.Red}https://github.com/jakubbartosik/dRandomSkills{ChatColors.Green})", StringComparison.OrdinalIgnoreCase)
|
||||
.Replace("{AUTHOR2}", $" {ChatColors.Red}Juzlus{ChatColors.Green} ({ChatColors.Red}https://github.com/Juzlus/jRandomSkills{ChatColors.Green})", StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
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<EventRoundEnd>((@event, info) =>
|
||||
{
|
||||
foreach (var player in Utilities.GetPlayers())
|
||||
{
|
||||
Instance.AddTimer(0.5f, () =>
|
||||
{
|
||||
var _players = Utilities.GetPlayers().Where(p => p.IsValid).OrderBy(p => p.Team);
|
||||
|
||||
string skillsText = "";
|
||||
foreach (var _player in _players)
|
||||
{
|
||||
var _playerSkill = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == _player.SteamID)?.Skill;
|
||||
if (_playerSkill != null)
|
||||
{
|
||||
var skillInfo = SkillData.Skills.FirstOrDefault(p => p.Skill == _playerSkill);
|
||||
skillsText += $" {ChatColors.DarkRed}{_player.PlayerName}{ChatColors.Lime}: {skillInfo.Name}\n";
|
||||
}
|
||||
}
|
||||
|
||||
if (Config.config.Settings.SummaryAfterTheRound && !string.IsNullOrEmpty(skillsText))
|
||||
{
|
||||
player.PrintToChat(" ");
|
||||
player.PrintToChat($" {ChatColors.Lime}{Localization.GetTranslation("summary_start")}");
|
||||
foreach (string text in skillsText.Split("\n"))
|
||||
if (!string.IsNullOrEmpty(text))
|
||||
player.PrintToChat(text);
|
||||
player.PrintToChat($" {ChatColors.Lime}{Localization.GetTranslation("summary_end")}");
|
||||
player.PrintToChat(" \n");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
List<dSkill_SkillInfo> skillList = new List<dSkill_SkillInfo>(SkillData.Skills);
|
||||
skillList.RemoveAll(s => s?.Skill == skillPlayer?.Skill || s?.Skill == src.player.Skills.None);
|
||||
|
||||
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();
|
||||
skillList.RemoveAll(s => skillsOnly1v1.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)
|
||||
skillList.RemoveAll(s => counterterroristSkills.Any(s2 => s2.Name == s.Skill.ToString()));
|
||||
else
|
||||
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)];
|
||||
skillPlayer.Skill = randomSkill.Skill;
|
||||
|
||||
if (randomSkill.Display)
|
||||
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 (teammateSkill != null)
|
||||
{
|
||||
var skillInfo = SkillData.Skills.FirstOrDefault(p => p.Skill == teammateSkill);
|
||||
teammateSkills += $" {ChatColors.DarkRed}{teammate.PlayerName}{ChatColors.Lime}: {skillInfo.Name}\n";
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(teammateSkills))
|
||||
{
|
||||
Utils.PrintToChat(player, $" {ChatColors.Lime}{Localization.GetTranslation("teammate_skills")}:", false);
|
||||
foreach (string text in teammateSkills.Split("\n"))
|
||||
if (!string.IsNullOrEmpty(text))
|
||||
player.PrintToChat(text);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
|
||||
Instance.RegisterEventHandler<EventPlayerDeath>((@event, info) =>
|
||||
{
|
||||
var victim = @event.Userid;
|
||||
var attacker = @event.Attacker;
|
||||
|
||||
if (victim == null || attacker == null || victim == attacker) return HookResult.Continue;
|
||||
|
||||
if(Config.config.Settings.KillerSkillInfo)
|
||||
{
|
||||
var attackerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == attacker.SteamID);
|
||||
if (attackerInfo != null)
|
||||
{
|
||||
var skillData = SkillData.Skills.FirstOrDefault(s => s.Skill == attackerInfo.Skill);
|
||||
string skillDesc = skillData?.Description;
|
||||
|
||||
Utils.PrintToChat(victim, $"{Localization.GetTranslation("enemy_skill")} {ChatColors.DarkRed}{attacker.PlayerName}{ChatColors.Lime}:", false);
|
||||
Utils.PrintToChat(victim, $"{ChatColors.DarkRed}{skillData.Name}{ChatColors.Lime} - {skillDesc}", false);
|
||||
}
|
||||
}
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
82
jRandomSkills - SRC Files/src/player/PlayerOnTick.cs
Normal file
82
jRandomSkills - SRC Files/src/player/PlayerOnTick.cs
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using jRandomSkills.src.utils;
|
||||
using static CounterStrikeSharp.API.Core.Listeners;
|
||||
using static jRandomSkills.jRandomSkills;
|
||||
|
||||
namespace jRandomSkills
|
||||
{
|
||||
public static class PlayerOnTick
|
||||
{
|
||||
public static void Load()
|
||||
{
|
||||
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 (SkillData.Skills.Count == 0)
|
||||
{
|
||||
infoLine = $"<font class='fontSize-l' class='fontWeight-Bold' color='#FFFFFF'>{Localization.GetTranslation("your_skill")}:</font> <br>";
|
||||
skillLine = $"<font class='fontSize-l' class='fontWeight-Bold' color='#FFFFFF'>{Localization.GetTranslation("none")}</font> <br>";
|
||||
}
|
||||
else if (skillPlayer.IsDrawing)
|
||||
{
|
||||
var randomSkill = SkillData.Skills[Instance.Random.Next(SkillData.Skills.Count)];
|
||||
infoLine = $"<font class='fontSize-l' class='fontWeight-Bold' color='#FFFFFF'>{Localization.GetTranslation("drawing_skill")}:</font> <br>";
|
||||
skillLine = $"<font class='fontSize-l' class='fontWeight-Bold' color='{randomSkill.Color}'>{randomSkill.Name}</font> <br>";
|
||||
}
|
||||
else if (!skillPlayer.IsDrawing)
|
||||
{
|
||||
if (player?.IsValid == true && player?.PawnIsAlive == true)
|
||||
{
|
||||
var skillInfo = SkillData.Skills.FirstOrDefault(s => s.Skill == skillPlayer.Skill);
|
||||
if (skillInfo != null)
|
||||
{
|
||||
infoLine = $"<font class='fontSize-l' class='fontWeight-Bold' color='#FFFFFF'>{Localization.GetTranslation("your_skill")}:</font> <br>";
|
||||
skillLine = $"<font class='fontSize-l' class='fontWeight-Bold' color='{skillInfo.Color}'>{skillInfo.Name}</font> <br>";
|
||||
}
|
||||
} else if (player?.IsValid == true)
|
||||
{
|
||||
var pawn = player.Pawn.Value;
|
||||
if (pawn == null) return;
|
||||
|
||||
var observedPlayer = Utilities.GetPlayers().FirstOrDefault(p => p?.Pawn?.Value?.Handle == pawn?.ObserverServices?.ObserverTarget?.Value?.Handle);
|
||||
if (observedPlayer == null) return;
|
||||
|
||||
var observeredPlayerSkill = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == observedPlayer.SteamID);
|
||||
if (observeredPlayerSkill == null) return;
|
||||
|
||||
var observeredPlayerSkillInfo = SkillData.Skills.FirstOrDefault(s => s.Skill == observeredPlayerSkill.Skill);
|
||||
if (observeredPlayerSkillInfo == null) return;
|
||||
|
||||
infoLine = $"<font class='fontSize-l' class='fontWeight-Bold' color='#FFFFFF'>{Localization.GetTranslation("observer_skill")} {observeredPlayerSkill.PlayerName}:</font> <br>";
|
||||
skillLine = $"<font class='fontSize-l' class='fontWeight-Bold' color='{observeredPlayerSkillInfo.Color}'>{observeredPlayerSkillInfo.Name}</font> <br>";
|
||||
}
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(infoLine) && string.IsNullOrEmpty(skillLine))
|
||||
return;
|
||||
|
||||
var hudContent = infoLine + skillLine;
|
||||
player.PrintToCenterHtml(hudContent);
|
||||
}
|
||||
}
|
||||
}
|
||||
66
jRandomSkills - SRC Files/src/player/skills/Aimbot.cs
Normal file
66
jRandomSkills - SRC Files/src/player/skills/Aimbot.cs
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Memory;
|
||||
using CounterStrikeSharp.API.Modules.Memory.DynamicFunctions;
|
||||
using jRandomSkills.src.player;
|
||||
using System.Runtime.InteropServices;
|
||||
using static jRandomSkills.jRandomSkills;
|
||||
|
||||
namespace jRandomSkills
|
||||
{
|
||||
public class Aimbot : ISkill
|
||||
{
|
||||
private static Skills skillName = Skills.Aimbot;
|
||||
private static Dictionary<nint, int> hitGroups = new Dictionary<nint, int>();
|
||||
|
||||
public static void LoadSkill()
|
||||
{
|
||||
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true)
|
||||
return;
|
||||
|
||||
Utils.RegisterSkill(skillName, "#ff0000");
|
||||
VirtualFunctions.CBaseEntity_TakeDamageOldFunc.Hook(OnTakeDamage, HookMode.Pre);
|
||||
}
|
||||
|
||||
private static HookResult OnTakeDamage(DynamicHook h)
|
||||
{
|
||||
CEntityInstance param = h.GetParam<CEntityInstance>(0);
|
||||
CTakeDamageInfo param2 = h.GetParam<CTakeDamageInfo>(1);
|
||||
|
||||
if (param == null || param2 == null || param2.Attacker == null)
|
||||
return HookResult.Continue;
|
||||
|
||||
CCSPlayerPawn attackerPawn = new CCSPlayerPawn(param2.Attacker.Value.Handle);
|
||||
CCSPlayerPawn victimPawn = new CCSPlayerPawn(param.Handle);
|
||||
|
||||
if (attackerPawn == null || attackerPawn.Controller?.Value == null || victimPawn == null || victimPawn.Controller?.Value == null)
|
||||
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 (attacker.PawnIsAlive)
|
||||
{
|
||||
IntPtr hitGroupPointer = Marshal.ReadIntPtr(param2.Handle, 0x78);
|
||||
if (hitGroupPointer != nint.Zero)
|
||||
{
|
||||
IntPtr hitGroupOffset = Marshal.ReadIntPtr(hitGroupPointer, 16);
|
||||
if (hitGroupOffset != nint.Zero)
|
||||
{
|
||||
if (playerInfo.Skill == skillName)
|
||||
{
|
||||
int oldValue = Marshal.ReadInt32(hitGroupOffset, 56);
|
||||
hitGroups.TryAdd(hitGroupOffset, Marshal.ReadInt32(hitGroupOffset, 56));
|
||||
Marshal.WriteInt32(hitGroupOffset, 56, (int)HitGroup_t.HITGROUP_HEAD);
|
||||
} else if (hitGroups.TryGetValue(hitGroupOffset, out var hitGroup))
|
||||
Marshal.WriteInt32(hitGroupOffset, 56, hitGroup);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return HookResult.Continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
39
jRandomSkills - SRC Files/src/player/skills/AntyFlash.cs
Normal file
39
jRandomSkills - SRC Files/src/player/skills/AntyFlash.cs
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
using CounterStrikeSharp.API.Core;
|
||||
using jRandomSkills.src.player;
|
||||
using static jRandomSkills.jRandomSkills;
|
||||
|
||||
namespace jRandomSkills
|
||||
{
|
||||
public class AntyFlash : ISkill
|
||||
{
|
||||
private static Skills skillName = Skills.AntyFlash;
|
||||
|
||||
public static void LoadSkill()
|
||||
{
|
||||
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true)
|
||||
return;
|
||||
|
||||
Utils.RegisterSkill(skillName, "#D6E6FF");
|
||||
|
||||
Instance.RegisterEventHandler<EventPlayerBlind>((@event, info) =>
|
||||
{
|
||||
var player = @event.Userid;
|
||||
var attacker = @event.Attacker;
|
||||
|
||||
var playerPawn = player.PlayerPawn.Value;
|
||||
|
||||
if (!Instance.IsPlayerValid(player)) return HookResult.Continue;
|
||||
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
var attackerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == attacker.SteamID);
|
||||
|
||||
if (playerInfo?.Skill == skillName)
|
||||
playerPawn.FlashDuration = 0.0f;
|
||||
else if (attackerInfo?.Skill == skillName)
|
||||
playerPawn.FlashDuration = 7.0f;
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,14 +1,19 @@
|
|||
using CounterStrikeSharp.API.Core;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
using jRandomSkills.src.player;
|
||||
using static jRandomSkills.jRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
namespace jRandomSkills
|
||||
{
|
||||
public static class ZelaznaGlowa
|
||||
public class AntyHead : ISkill
|
||||
{
|
||||
private static Skills skillName = Skills.AntyHead;
|
||||
|
||||
public static void LoadZelaznaGlowa()
|
||||
public static void LoadSkill()
|
||||
{
|
||||
Utils.RegisterSkill("Żelazna Głowa", "Nie otrzymujesz obrażeń w głowę", "#8B4513");
|
||||
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true)
|
||||
return;
|
||||
|
||||
Utils.RegisterSkill(skillName, "#8B4513");
|
||||
|
||||
Instance.RegisterEventHandler<EventPlayerHurt>((@event, info) =>
|
||||
{
|
||||
|
|
@ -16,11 +21,11 @@ namespace dRandomSkills
|
|||
var victim = @event.Userid;
|
||||
int hitgroup = @event.Hitgroup;
|
||||
|
||||
if (!IsValidPlayer(attacker) || !IsValidPlayer(victim) || 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 == victim.SteamID);
|
||||
|
||||
if (playerInfo?.Skill == "Żelazna Głowa" && hitgroup != 3)
|
||||
if (playerInfo?.Skill == skillName && hitgroup == (int)HitGroup_t.HITGROUP_HEAD)
|
||||
{
|
||||
ApplyIronHeadEffect(victim, @event.DmgHealth);
|
||||
return HookResult.Stop;
|
||||
|
|
@ -30,11 +35,6 @@ namespace dRandomSkills
|
|||
});
|
||||
}
|
||||
|
||||
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;
|
||||
84
jRandomSkills - SRC Files/src/player/skills/Armored.cs
Normal file
84
jRandomSkills - SRC Files/src/player/skills/Armored.cs
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
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 Armored : ISkill
|
||||
{
|
||||
private static Skills skillName = Skills.Armored;
|
||||
|
||||
public static void LoadSkill()
|
||||
{
|
||||
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true)
|
||||
return;
|
||||
|
||||
Utils.RegisterSkill(skillName, "#d1430a", false);
|
||||
|
||||
VirtualFunctions.CBaseEntity_TakeDamageOldFunc.Hook(OnTakeDamage, HookMode.Pre);
|
||||
|
||||
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 EnableSkill(CCSPlayerController player)
|
||||
{
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
|
||||
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("armored")}{ChatColors.Lime}: " + Localization.GetTranslation("armored_desc2", newScale), false);
|
||||
}
|
||||
|
||||
private static HookResult OnTakeDamage(DynamicHook h)
|
||||
{
|
||||
CEntityInstance param = h.GetParam<CEntityInstance>(0);
|
||||
CTakeDamageInfo param2 = h.GetParam<CTakeDamageInfo>(1);
|
||||
|
||||
if (param == null || param2 == null || param2.Attacker == null)
|
||||
return HookResult.Continue;
|
||||
|
||||
CCSPlayerPawn attackerPawn = new CCSPlayerPawn(param2.Attacker.Value.Handle);
|
||||
CCSPlayerPawn victimPawn = new CCSPlayerPawn(param.Handle);
|
||||
|
||||
if (attackerPawn == null || attackerPawn.Controller?.Value == null || victimPawn == null || victimPawn.Controller?.Value == null)
|
||||
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 *= (float)playerInfo.SkillChance;
|
||||
}
|
||||
|
||||
return HookResult.Continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
60
jRandomSkills - SRC Files/src/player/skills/Astronaut.cs
Normal file
60
jRandomSkills - SRC Files/src/player/skills/Astronaut.cs
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
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 Astronaut : ISkill
|
||||
{
|
||||
private static Skills skillName = Skills.Astronaut;
|
||||
|
||||
public static void LoadSkill()
|
||||
{
|
||||
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true)
|
||||
return;
|
||||
|
||||
Utils.RegisterSkill(skillName, "#7E10AD", false);
|
||||
|
||||
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 == skillName && playerPawn != null)
|
||||
{
|
||||
EnableSkill(player);
|
||||
}
|
||||
}
|
||||
});
|
||||
return HookResult.Continue;
|
||||
});
|
||||
}
|
||||
|
||||
public static void EnableSkill(CCSPlayerController player)
|
||||
{
|
||||
ApplyGravityModifier(player);
|
||||
}
|
||||
|
||||
public static void DisableSkill(CCSPlayerController player)
|
||||
{
|
||||
player.Pawn.Value.GravityScale = 1;
|
||||
}
|
||||
|
||||
private static void ApplyGravityModifier(CCSPlayerController player)
|
||||
{
|
||||
var skillConfig = Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString());
|
||||
if (skillConfig == null) return;
|
||||
|
||||
float gravityModifier = (float)Math.Round(Instance.Random.NextDouble() * (skillConfig.ChanceTo - skillConfig.ChanceFrom) + skillConfig.ChanceFrom, 1);
|
||||
Utils.PrintToChat(player, $"{ChatColors.DarkRed}{Localization.GetTranslation("astronaut")}{ChatColors.Lime}: " + Localization.GetTranslation("astronaut_desc2", gravityModifier), false);
|
||||
player.Pawn.Value.GravityScale = gravityModifier;
|
||||
}
|
||||
}
|
||||
}
|
||||
88
jRandomSkills - SRC Files/src/player/skills/Behind.cs
Normal file
88
jRandomSkills - SRC Files/src/player/skills/Behind.cs
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
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 Behind : ISkill
|
||||
{
|
||||
private static Skills skillName = Skills.Behind;
|
||||
|
||||
public static void LoadSkill()
|
||||
{
|
||||
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true)
|
||||
return;
|
||||
|
||||
Utils.RegisterSkill(skillName, "#00FF00", 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)
|
||||
RotateEnemy(victim);
|
||||
}
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
}
|
||||
|
||||
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);
|
||||
float newChance = (float)Instance.Random.NextDouble() * (skillConfig.ChanceTo - skillConfig.ChanceFrom) + skillConfig.ChanceFrom;
|
||||
playerInfo.SkillChance = newChance;
|
||||
newChance = (float)Math.Round(newChance, 2) * 100;
|
||||
newChance = (float)Math.Round(newChance);
|
||||
Utils.PrintToChat(player, $"{ChatColors.DarkRed}{Localization.GetTranslation("behind")}{ChatColors.Lime}: " + Localization.GetTranslation("behind_desc2", newChance), false);
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,20 +1,24 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using jRandomSkills.src.player;
|
||||
using static CounterStrikeSharp.API.Core.Listeners;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
using static jRandomSkills.jRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
namespace jRandomSkills
|
||||
{
|
||||
public static class BunnyHop
|
||||
public class BunnyHop : ISkill
|
||||
{
|
||||
private static Skills skillName = Skills.BunnyHop;
|
||||
private const float MaxSpeed = 500f;
|
||||
private const float BunnyHopVelocity = 300f;
|
||||
|
||||
public static void LoadBunnyHop()
|
||||
public static void LoadSkill()
|
||||
{
|
||||
Utils.RegisterSkill("BunnyHop", "Otrzymujesz auto BunnyHopa", "#EB4034");
|
||||
|
||||
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true)
|
||||
return;
|
||||
|
||||
Utils.RegisterSkill(skillName, "#EB4034");
|
||||
Instance.RegisterListener<OnTick>(OnTick);
|
||||
}
|
||||
|
||||
|
|
@ -24,7 +28,7 @@ namespace dRandomSkills
|
|||
{
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
|
||||
if (playerInfo?.Skill == "BunnyHop")
|
||||
if (playerInfo?.Skill == skillName)
|
||||
{
|
||||
GiveBunnyHop(player);
|
||||
}
|
||||
|
|
@ -1,16 +1,22 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
using jRandomSkills.src.player;
|
||||
using jRandomSkills.src.utils;
|
||||
using static jRandomSkills.jRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
namespace jRandomSkills
|
||||
{
|
||||
public static class Katapulta
|
||||
public class Catapult : ISkill
|
||||
{
|
||||
private static Skills skillName = Skills.Catapult;
|
||||
|
||||
public static void LoadKatapulta()
|
||||
public static void LoadSkill()
|
||||
{
|
||||
Utils.RegisterSkill("Katapulta", "Masz losow¹ szanse na podrzucenie wroga", "#FF4500");
|
||||
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true)
|
||||
return;
|
||||
|
||||
Utils.RegisterSkill(skillName, "#FF4500", false);
|
||||
|
||||
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
|
||||
{
|
||||
|
|
@ -18,17 +24,11 @@ namespace dRandomSkills
|
|||
{
|
||||
foreach (var player in Utilities.GetPlayers())
|
||||
{
|
||||
if (!IsPlayerValid(player)) continue;
|
||||
if (!Instance.IsPlayerValid(player)) continue;
|
||||
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill != "Katapulta") continue;
|
||||
|
||||
float newChance = (float)Instance.Random.NextDouble() * (.40f - .20f) + .20f;
|
||||
playerInfo.SkillChance = newChance;
|
||||
newChance = (float)Math.Round(newChance, 2) * 100;
|
||||
newChance = (float)Math.Round(newChance);
|
||||
|
||||
Utils.PrintToChat(player, $"{ChatColors.DarkRed}\"Katapulta\"{ChatColors.Lime}: Twoje szanse na podrzucenie wroga po trafieniu to: {newChance}%", false);
|
||||
if (playerInfo?.Skill != skillName) continue;
|
||||
EnableSkill(player);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -46,7 +46,7 @@ namespace dRandomSkills
|
|||
|
||||
var attackerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == attacker.SteamID);
|
||||
|
||||
if (attackerInfo?.Skill == "Katapulta" && victim.PawnIsAlive)
|
||||
if (attackerInfo?.Skill == skillName && victim.PawnIsAlive)
|
||||
{
|
||||
if (Instance.Random.NextDouble() <= attackerInfo.SkillChance)
|
||||
{
|
||||
|
|
@ -61,9 +61,18 @@ namespace dRandomSkills
|
|||
return HookResult.Continue;
|
||||
});
|
||||
}
|
||||
private static bool IsPlayerValid(CCSPlayerController player)
|
||||
|
||||
public static void EnableSkill(CCSPlayerController player)
|
||||
{
|
||||
return player != null && player.IsValid && player.PlayerPawn?.Value != null;
|
||||
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);
|
||||
float newChance = (float)Instance.Random.NextDouble() * (skillConfig.ChanceTo - skillConfig.ChanceFrom) + skillConfig.ChanceFrom;
|
||||
playerInfo.SkillChance = newChance;
|
||||
newChance = (float)Math.Round(newChance, 2) * 100;
|
||||
newChance = (float)Math.Round(newChance);
|
||||
Utils.PrintToChat(player, $"{ChatColors.DarkRed}{Localization.GetTranslation("catapult")}{ChatColors.Lime}: " + Localization.GetTranslation("catapult_desc2", newChance), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,13 +1,17 @@
|
|||
using System.Drawing;
|
||||
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 dRandomSkills.dRandomSkills;
|
||||
using static jRandomSkills.jRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
namespace jRandomSkills
|
||||
{
|
||||
public static class Kurczak
|
||||
public class Chicken : ISkill
|
||||
{
|
||||
private static Skills skillName = Skills.Chicken;
|
||||
private static string[] pistols =
|
||||
{
|
||||
"weapon_deagle",
|
||||
|
|
@ -21,10 +25,15 @@ namespace dRandomSkills
|
|||
"weapon_elite",
|
||||
"weapon_hkp2000"
|
||||
};
|
||||
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";
|
||||
|
||||
public static void LoadKurczak()
|
||||
public static void LoadSkill()
|
||||
{
|
||||
Utils.RegisterSkill("Kurczak", "Otrzymujesz model kurczaka + jesteś o 10% szybszy - 50hp", "#FF8B42");
|
||||
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true)
|
||||
return;
|
||||
|
||||
Utils.RegisterSkill(skillName, "#FF8B42");
|
||||
|
||||
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
|
||||
{
|
||||
|
|
@ -32,22 +41,11 @@ namespace dRandomSkills
|
|||
{
|
||||
foreach (var player in Utilities.GetPlayers())
|
||||
{
|
||||
if (!IsPlayerValid(player)) continue;
|
||||
if (!Instance.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");
|
||||
|
||||
playerPawn.Health = 50;
|
||||
Utilities.SetStateChanged(playerPawn, "CBaseEntity", "m_iHealth");
|
||||
}
|
||||
if (playerInfo?.Skill != skillName) continue;
|
||||
EnableSkill(player);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -57,13 +55,42 @@ namespace dRandomSkills
|
|||
Instance.RegisterListener<OnTick>(OnTick);
|
||||
}
|
||||
|
||||
public static void EnableSkill(CCSPlayerController player)
|
||||
{
|
||||
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");
|
||||
|
||||
playerPawn.Health = 50;
|
||||
Utilities.SetStateChanged(playerPawn, "CBaseEntity", "m_iHealth");
|
||||
}
|
||||
}
|
||||
|
||||
public static void DisableSkill(CCSPlayerController player)
|
||||
{
|
||||
var playerPawn = player.PlayerPawn?.Value;
|
||||
if (playerPawn != null)
|
||||
{
|
||||
SetPlayerModel(player, player.Team == CsTeam.CounterTerrorist ? defaultCTModel : defaultTModel);
|
||||
playerPawn.VelocityModifier = 1f;
|
||||
Utilities.SetStateChanged(player, "CCSPlayerPawn", "m_flVelocityModifier");
|
||||
|
||||
playerPawn.Health += 50;
|
||||
Utilities.SetStateChanged(playerPawn, "CBaseEntity", "m_iHealth");
|
||||
}
|
||||
}
|
||||
|
||||
private static void OnTick()
|
||||
{
|
||||
foreach (var player in Utilities.GetPlayers())
|
||||
{
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
|
||||
if (playerInfo?.Skill == "Kurczak")
|
||||
if (playerInfo?.Skill == skillName)
|
||||
{
|
||||
var activeWeapon = player.Pawn.Value.WeaponServices?.ActiveWeapon.Value;
|
||||
if (activeWeapon != null && activeWeapon.IsValid && activeWeapon.Clip1 != 0 && !pistols.Contains(activeWeapon?.DesignerName))
|
||||
|
|
@ -88,10 +115,5 @@ namespace dRandomSkills
|
|||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,16 +1,22 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
using jRandomSkills.src.player;
|
||||
using jRandomSkills.src.utils;
|
||||
using static jRandomSkills.jRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
namespace jRandomSkills
|
||||
{
|
||||
public static class Rozbrojenie
|
||||
public class Disarmament : ISkill
|
||||
{
|
||||
private static Skills skillName = Skills.Disarmament;
|
||||
|
||||
public static void LoadRozbrojenie()
|
||||
public static void LoadSkill()
|
||||
{
|
||||
Utils.RegisterSkill("Rozbrojenie", "Masz losowš szanse na wyrzucenie broni wroga po trafieniu", "#FF4500", false);
|
||||
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true)
|
||||
return;
|
||||
|
||||
Utils.RegisterSkill(skillName, "#FF4500", false);
|
||||
|
||||
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
|
||||
{
|
||||
|
|
@ -18,17 +24,11 @@ namespace dRandomSkills
|
|||
{
|
||||
foreach (var player in Utilities.GetPlayers())
|
||||
{
|
||||
if (!IsPlayerValid(player)) continue;
|
||||
if (!Instance.IsPlayerValid(player)) continue;
|
||||
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill != "Rozbrojenie") continue;
|
||||
|
||||
float newChance = (float)Instance.Random.NextDouble() * (.40f - .20f) + .20f;
|
||||
playerInfo.SkillChance = newChance;
|
||||
newChance = (float)Math.Round(newChance, 2) * 100;
|
||||
newChance = (float)Math.Round(newChance);
|
||||
|
||||
Utils.PrintToChat(player, $"{ChatColors.DarkRed}\"Rozbrojenie\"{ChatColors.Lime}: Twoje szanse na wyrzucenie broni wroga to: {newChance}%", false);
|
||||
if (playerInfo?.Skill != skillName) continue;
|
||||
EnableSkill(player);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -46,7 +46,7 @@ namespace dRandomSkills
|
|||
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == attacker.SteamID);
|
||||
|
||||
if (playerInfo?.Skill == "Rozbrojenie" && victim.PawnIsAlive)
|
||||
if (playerInfo?.Skill == skillName && victim.PawnIsAlive)
|
||||
{
|
||||
if (Instance.Random.NextDouble() <= playerInfo.SkillChance)
|
||||
{
|
||||
|
|
@ -61,9 +61,18 @@ namespace dRandomSkills
|
|||
return HookResult.Continue;
|
||||
});
|
||||
}
|
||||
private static bool IsPlayerValid(CCSPlayerController player)
|
||||
|
||||
public static void EnableSkill(CCSPlayerController player)
|
||||
{
|
||||
return player != null && player.IsValid && player.PlayerPawn?.Value != null;
|
||||
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);
|
||||
float newChance = (float)Instance.Random.NextDouble() * (skillConfig.ChanceTo - skillConfig.ChanceFrom) + skillConfig.ChanceFrom;
|
||||
playerInfo.SkillChance = newChance;
|
||||
newChance = (float)Math.Round(newChance, 2) * 100;
|
||||
newChance = (float)Math.Round(newChance);
|
||||
Utils.PrintToChat(player, $"{ChatColors.DarkRed}{Localization.GetTranslation("disarmament")}{ChatColors.Lime}: " + Localization.GetTranslation("disarmament_desc2", newChance), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,25 +1,31 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
using jRandomSkills.src.player;
|
||||
using static jRandomSkills.jRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
namespace jRandomSkills
|
||||
{
|
||||
public static class Drakula
|
||||
public class Dracula : ISkill
|
||||
{
|
||||
public static void LoadDrakula()
|
||||
private static Skills skillName = Skills.Dracula;
|
||||
|
||||
public static void LoadSkill()
|
||||
{
|
||||
Utils.RegisterSkill("Drakula", "Po trafieniu ofiary otrzymujesz zwrot zdrowia w postaci danego procentu zadanych obrażeń", "#FA050D");
|
||||
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true)
|
||||
return;
|
||||
|
||||
Utils.RegisterSkill(skillName, "#FA050D");
|
||||
|
||||
Instance.RegisterEventHandler<EventPlayerHurt>((@event, info) =>
|
||||
{
|
||||
var attacker = @event.Attacker;
|
||||
var victim = @event.Userid;
|
||||
|
||||
if (!IsPlayerValid(attacker) || attacker == victim) return HookResult.Continue;
|
||||
if (!Instance.IsPlayerValid(attacker) || attacker == victim) return HookResult.Continue;
|
||||
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == attacker.SteamID);
|
||||
|
||||
if (playerInfo?.Skill == "Drakula" && victim.PawnIsAlive)
|
||||
if (playerInfo?.Skill == skillName && victim.PawnIsAlive)
|
||||
{
|
||||
HealAttacker(attacker, @event.DmgHealth);
|
||||
}
|
||||
|
|
@ -40,10 +46,5 @@ namespace dRandomSkills
|
|||
attackerPawn.Health = newHealth;
|
||||
Utilities.SetStateChanged(attackerPawn, "CBaseEntity", "m_iHealth");
|
||||
}
|
||||
|
||||
private static bool IsPlayerValid(CCSPlayerController player)
|
||||
{
|
||||
return player != null && player.IsValid && player.PlayerPawn?.Value != null;
|
||||
}
|
||||
}
|
||||
}
|
||||
82
jRandomSkills - SRC Files/src/player/skills/Dwarf.cs
Normal file
82
jRandomSkills - SRC Files/src/player/skills/Dwarf.cs
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
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 Dwarf : ISkill
|
||||
{
|
||||
private static Skills skillName = Skills.Dwarf;
|
||||
|
||||
public static void LoadSkill()
|
||||
{
|
||||
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true)
|
||||
return;
|
||||
|
||||
Utils.RegisterSkill(skillName, "#ffff00", 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);
|
||||
player.Respawn();
|
||||
}
|
||||
});
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
|
||||
Instance.RegisterEventHandler<EventRoundEnd>((@event, info) =>
|
||||
{
|
||||
Instance.AddTimer(0.1f, () =>
|
||||
{
|
||||
foreach (var player in Utilities.GetPlayers())
|
||||
{
|
||||
if (!Instance.IsPlayerValid(player)) continue;
|
||||
DisableSkill(player);
|
||||
}
|
||||
});
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
}
|
||||
|
||||
public static void EnableSkill(CCSPlayerController player)
|
||||
{
|
||||
var playerPawn = player.PlayerPawn?.Value;
|
||||
if (playerPawn != null)
|
||||
{
|
||||
var skillConfig = Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString());
|
||||
if (skillConfig == null) return;
|
||||
|
||||
float newSize = (float)Instance.Random.NextDouble() * (skillConfig.ChanceTo - skillConfig.ChanceFrom) + skillConfig.ChanceFrom;
|
||||
newSize = (float)Math.Round(newSize, 2);
|
||||
|
||||
playerPawn.CBodyComponent.SceneNode.GetSkeletonInstance().Scale = newSize;
|
||||
Utilities.SetStateChanged(playerPawn, "CBaseEntity", "m_CBodyComponent");
|
||||
|
||||
Utils.PrintToChat(player, $"{ChatColors.DarkRed}{Localization.GetTranslation("dwarf")}{ChatColors.Lime}: " + Localization.GetTranslation("dwarf_desc2", newSize), false);
|
||||
}
|
||||
}
|
||||
|
||||
public static void DisableSkill(CCSPlayerController player)
|
||||
{
|
||||
var playerPawn = player.PlayerPawn?.Value;
|
||||
if (playerPawn != null && playerPawn?.CBodyComponent != null)
|
||||
{
|
||||
playerPawn.CBodyComponent.SceneNode.GetSkeletonInstance().Scale = 1;
|
||||
Utilities.SetStateChanged(playerPawn, "CBaseEntity", "m_CBodyComponent");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
181
jRandomSkills - SRC Files/src/player/skills/EnemySpawn.cs
Normal file
181
jRandomSkills - SRC Files/src/player/skills/EnemySpawn.cs
Normal file
|
|
@ -0,0 +1,181 @@
|
|||
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 EnemySpawn : ISkill
|
||||
{
|
||||
private static Skills skillName = Skills.EnemySpawn;
|
||||
private static float timerCooldown = (float)(Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Cooldown);
|
||||
private static readonly Dictionary<ulong, PlayerSkillInfo> SkillPlayerInfo = new Dictionary<ulong, PlayerSkillInfo>();
|
||||
|
||||
public static void LoadSkill()
|
||||
{
|
||||
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true)
|
||||
return;
|
||||
|
||||
Utils.RegisterSkill(skillName, "#ff8c92");
|
||||
|
||||
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.AddCommand("css_useSkill", "Use Skill", (player, _) =>
|
||||
{
|
||||
if (player == null) return;
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill == skillName)
|
||||
UseSkill(player);
|
||||
});
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
public static Vector GetEnemySpawn(CCSPlayerController player)
|
||||
{
|
||||
List<CCSPlayerController> enemy = Utilities.GetPlayers().FindAll(p => Instance.IsPlayerValid(p) && p.Team != player.Team && p.PawnIsAlive);
|
||||
if (enemy.Count == 0)
|
||||
{
|
||||
var abs = player.PlayerPawn.Value.AbsOrigin;
|
||||
return new Vector(abs.X, abs.Y, abs.Z);
|
||||
}
|
||||
|
||||
CCSPlayerController randomEnemy = enemy[Instance.Random.Next(0, enemy.Count)];
|
||||
var eAbs = randomEnemy.PlayerPawn.Value.AbsOrigin;
|
||||
return new Vector(eAbs.X, eAbs.Y, eAbs.Z);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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;
|
||||
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;
|
||||
playerPawn.Teleport(GetEnemySpawnVector(player));
|
||||
}
|
||||
else
|
||||
skillInfo.LastClick = DateTime.Now;
|
||||
}
|
||||
}
|
||||
|
||||
private static Vector GetEnemySpawnVector(CCSPlayerController player)
|
||||
{
|
||||
var abs = player.PlayerPawn.Value.AbsOrigin;
|
||||
var spawns = Utilities.FindAllEntitiesByDesignerName<SpawnPoint>(player.Team == CsTeam.CounterTerrorist ? "info_player_terrorist" : "info_player_counterterrorist").ToList();
|
||||
if (spawns.Any())
|
||||
{
|
||||
var randomSpawn = spawns[Instance.Random.Next(spawns.Count)];
|
||||
return randomSpawn.AbsOrigin;
|
||||
}
|
||||
return new Vector(abs.X, abs.Y, abs.Z);
|
||||
}
|
||||
|
||||
public class PlayerSkillInfo
|
||||
{
|
||||
public ulong SteamID { get; set; }
|
||||
public bool CanUse { get; set; }
|
||||
public DateTime Cooldown { get; set; }
|
||||
public DateTime LastClick { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
112
jRandomSkills - SRC Files/src/player/skills/Flash.cs
Normal file
112
jRandomSkills - SRC Files/src/player/skills/Flash.cs
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
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 Flash : ISkill
|
||||
{
|
||||
private static Skills skillName = Skills.Flash;
|
||||
|
||||
public static void LoadSkill()
|
||||
{
|
||||
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true)
|
||||
return;
|
||||
|
||||
Utils.RegisterSkill(skillName, "#A31912", false);
|
||||
Instance.RegisterListener<OnTick>(UpdateSpeed);
|
||||
|
||||
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
|
||||
{
|
||||
Instance.AddTimer(0.1f, () =>
|
||||
{
|
||||
foreach (var player in Utilities.GetPlayers())
|
||||
{
|
||||
if (!Instance.IsPlayerValid(player)) continue;
|
||||
var playerPawn = player.PlayerPawn?.Value;
|
||||
|
||||
playerPawn.VelocityModifier = 1;
|
||||
Utilities.SetStateChanged(playerPawn, "CCSPlayerPawn", "m_flVelocityModifier");
|
||||
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill != skillName) continue;
|
||||
EnableSkill(player);
|
||||
}
|
||||
});
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
|
||||
Instance.HookUserMessage(208, um =>
|
||||
{
|
||||
var soundevent = um.ReadUInt("soundevent_hash");
|
||||
var userIndex = um.ReadUInt("source_entity_index");
|
||||
|
||||
if (userIndex == 0) return HookResult.Continue;
|
||||
if (!Instance.footstepSoundEvents.Contains(soundevent)) return HookResult.Continue;
|
||||
|
||||
var player = Utilities.GetPlayers().FirstOrDefault(p => p.Pawn.Value.Index == userIndex);
|
||||
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 (player.Buttons.HasFlag(PlayerButtons.Speed) || player.Buttons.HasFlag(PlayerButtons.Duck))
|
||||
{
|
||||
um.Recipients.Clear();
|
||||
return HookResult.Handled;
|
||||
}
|
||||
|
||||
return HookResult.Continue;
|
||||
}, HookMode.Pre);
|
||||
}
|
||||
|
||||
public static void EnableSkill(CCSPlayerController player)
|
||||
{
|
||||
var playerPawn = player.PlayerPawn.Value;
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerPawn == null) return;
|
||||
|
||||
var skillConfig = Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString());
|
||||
if (skillConfig == null) return;
|
||||
|
||||
float newSpeed = (float)Instance.Random.NextDouble() * (skillConfig.ChanceTo - skillConfig.ChanceFrom) + skillConfig.ChanceFrom;
|
||||
newSpeed = (float)Math.Round(newSpeed, 2);
|
||||
playerInfo.SkillChance = newSpeed;
|
||||
|
||||
playerPawn.VelocityModifier = newSpeed;
|
||||
Utilities.SetStateChanged(playerPawn, "CCSPlayerPawn", "m_flVelocityModifier");
|
||||
Utils.PrintToChat(player, $"{ChatColors.DarkRed}{Localization.GetTranslation("flash")}{ChatColors.Lime}: " + Localization.GetTranslation("flash_desc2", newSpeed), false);
|
||||
}
|
||||
|
||||
public static void DisableSkill(CCSPlayerController player)
|
||||
{
|
||||
var playerPawn = player.PlayerPawn.Value;
|
||||
if (playerPawn == null) return;
|
||||
playerPawn.VelocityModifier = 1;
|
||||
Utilities.SetStateChanged(playerPawn, "CCSPlayerPawn", "m_flVelocityModifier");
|
||||
}
|
||||
|
||||
private static void UpdateSpeed()
|
||||
{
|
||||
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;
|
||||
|
||||
var playerPawn = player.PlayerPawn?.Value;
|
||||
if (playerPawn != null && playerPawn.VelocityModifier != 0)
|
||||
{
|
||||
playerPawn.VelocityModifier = Math.Max((float)playerInfo?.SkillChance, 1);
|
||||
Utilities.SetStateChanged(playerPawn, "CCSPlayerPawn", "m_flVelocityModifier");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
144
jRandomSkills - SRC Files/src/player/skills/FrozenDecoy.cs
Normal file
144
jRandomSkills - SRC Files/src/player/skills/FrozenDecoy.cs
Normal file
|
|
@ -0,0 +1,144 @@
|
|||
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 CounterStrikeSharp.API.Core.Listeners;
|
||||
using static jRandomSkills.jRandomSkills;
|
||||
|
||||
namespace jRandomSkills
|
||||
{
|
||||
public class FrozenDecoy : ISkill
|
||||
{
|
||||
private static Skills skillName = Skills.FrozenDecoy;
|
||||
private static Dictionary<uint, float> gravities = new Dictionary<uint, float>();
|
||||
private static List<CCSPlayerPawn> players = new List<CCSPlayerPawn>();
|
||||
private static Dictionary<int, CTriggerMultiple> triggers = new Dictionary<int, CTriggerMultiple>();
|
||||
|
||||
public static void LoadSkill()
|
||||
{
|
||||
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true)
|
||||
return;
|
||||
|
||||
Utils.RegisterSkill(skillName, "#00eaff");
|
||||
|
||||
Instance.RegisterEventHandler<EventRoundStart>((@event, info) =>
|
||||
{
|
||||
gravities.Clear();
|
||||
players.Clear();
|
||||
return HookResult.Continue;
|
||||
});
|
||||
|
||||
Instance.RegisterEventHandler<EventDecoyStarted>((@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 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;
|
||||
});
|
||||
|
||||
Instance.RegisterEventHandler<EventDecoyDetonate>((@event, @info) =>
|
||||
{
|
||||
var player = @event.Userid;
|
||||
if (!Instance.IsPlayerValid(player)) return HookResult.Continue;
|
||||
|
||||
if (triggers.TryGetValue(@event.Entityid, out var existingTrigger))
|
||||
{
|
||||
existingTrigger.AcceptInput("Kill");
|
||||
triggers.Remove(@event.Entityid);
|
||||
}
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
|
||||
Instance.RegisterListener<OnTick>(() =>
|
||||
{
|
||||
foreach (CCSPlayerPawn player in players)
|
||||
{
|
||||
player.VelocityModifier = 0;
|
||||
Utilities.SetStateChanged(player, "CCSPlayerPawn", "m_flVelocityModifier");
|
||||
|
||||
if ((player.Flags & (uint)PlayerFlags.FL_ONGROUND) != 0)
|
||||
player.GravityScale = float.MaxValue;
|
||||
}
|
||||
});
|
||||
|
||||
VirtualFunctions.CBaseTrigger_StartTouchFunc.Hook(StartTouchFun, HookMode.Post);
|
||||
VirtualFunctions.CBaseTrigger_EndTouchFunc.Hook(EndTouchFunc, HookMode.Post);
|
||||
}
|
||||
|
||||
private static HookResult StartTouchFun(DynamicHook h)
|
||||
{
|
||||
CBaseTrigger trigger = h.GetParam<CBaseTrigger>(0);
|
||||
CBaseEntity entity = h.GetParam<CBaseEntity>(1);
|
||||
|
||||
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);
|
||||
var entity = h.GetParam<CBaseEntity>(1);
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,16 +1,22 @@
|
|||
using System.Drawing;
|
||||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using jRandomSkills.src.player;
|
||||
using static CounterStrikeSharp.API.Core.Listeners;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
using static jRandomSkills.jRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
namespace jRandomSkills
|
||||
{
|
||||
public static class Duszek
|
||||
public class Ghost : ISkill
|
||||
{
|
||||
public static void LoadDuszek()
|
||||
private static Skills skillName = Skills.Ghost;
|
||||
|
||||
public static void LoadSkill()
|
||||
{
|
||||
Utils.RegisterSkill("Duszek", "Jesteś całkowicie niewidzialny", "#FFFFFF");
|
||||
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true)
|
||||
return;
|
||||
|
||||
Utils.RegisterSkill(skillName, "#FFFFFF");
|
||||
|
||||
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
|
||||
{
|
||||
|
|
@ -18,9 +24,10 @@ namespace dRandomSkills
|
|||
{
|
||||
foreach (var player in Utilities.GetPlayers())
|
||||
{
|
||||
if (!IsValidPlayer(player)) continue;
|
||||
if (!Instance.IsPlayerValid(player)) continue;
|
||||
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill == "Duszek")
|
||||
if (playerInfo?.Skill == skillName)
|
||||
{
|
||||
SetPlayerVisibility(player, false);
|
||||
}
|
||||
|
|
@ -34,11 +41,22 @@ namespace dRandomSkills
|
|||
{
|
||||
foreach (var player in Utilities.GetPlayers())
|
||||
{
|
||||
if (!IsValidPlayer(player)) continue;
|
||||
if (!Instance.IsPlayerValid(player)) continue;
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill == "Duszek")
|
||||
if (playerInfo?.Skill == skillName)
|
||||
SetPlayerVisibility(player, true);
|
||||
}
|
||||
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)
|
||||
SetPlayerVisibility(player, true);
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
|
|
@ -46,10 +64,10 @@ namespace dRandomSkills
|
|||
Instance.RegisterEventHandler<EventItemEquip>((@event, info) =>
|
||||
{
|
||||
var player = @event.Userid;
|
||||
if (!IsValidPlayer(player)) return HookResult.Continue;
|
||||
if (!Instance.IsPlayerValid(player)) return HookResult.Continue;
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
|
||||
if (playerInfo?.Skill != "Duszek") return HookResult.Continue;
|
||||
if (playerInfo?.Skill != skillName) return HookResult.Continue;
|
||||
SetWeaponVisibility(player, false);
|
||||
return HookResult.Continue;
|
||||
});
|
||||
|
|
@ -57,13 +75,23 @@ namespace dRandomSkills
|
|||
Instance.RegisterListener<OnTick>(OnTick);
|
||||
}
|
||||
|
||||
public static void EnableSkill(CCSPlayerController player)
|
||||
{
|
||||
SetPlayerVisibility(player, false);
|
||||
}
|
||||
|
||||
public static void DisableSkill(CCSPlayerController player)
|
||||
{
|
||||
SetPlayerVisibility(player, true);
|
||||
}
|
||||
|
||||
private static void OnTick()
|
||||
{
|
||||
foreach (var player in Utilities.GetPlayers())
|
||||
{
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
|
||||
if (playerInfo?.Skill == "Duszek")
|
||||
if (playerInfo?.Skill == skillName)
|
||||
{
|
||||
var activeWeapon = player.Pawn.Value.WeaponServices?.ActiveWeapon.Value;
|
||||
if (activeWeapon != null && activeWeapon.IsValid && activeWeapon.Clip1 != 0)
|
||||
|
|
@ -75,11 +103,6 @@ namespace dRandomSkills
|
|||
}
|
||||
}
|
||||
|
||||
private static bool IsValidPlayer(CCSPlayerController player)
|
||||
{
|
||||
return player != null && player.IsValid;
|
||||
}
|
||||
|
||||
private static void SetPlayerVisibility(CCSPlayerController player, bool visible)
|
||||
{
|
||||
var playerPawn = player.PlayerPawn.Value;
|
||||
|
|
@ -98,7 +121,7 @@ namespace dRandomSkills
|
|||
|
||||
private static void SetWeaponVisibility(CCSPlayerController player, bool visible)
|
||||
{
|
||||
if (!IsValidPlayer(player)) return;
|
||||
if (!Instance.IsPlayerValid(player)) return;
|
||||
var playerPawn = player.PlayerPawn.Value;
|
||||
|
||||
var color = visible ? Color.FromArgb(255, 255, 255, 255) : Color.FromArgb(0, 255, 255, 255);
|
||||
163
jRandomSkills - SRC Files/src/player/skills/GodMode.cs
Normal file
163
jRandomSkills - SRC Files/src/player/skills/GodMode.cs
Normal 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 GodMode : ISkill
|
||||
{
|
||||
private static Skills skillName = Skills.GodMode;
|
||||
private static float timerCooldown = (float)(Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Cooldown);
|
||||
private static readonly Dictionary<ulong, PlayerSkillInfo> SkillPlayerInfo = new Dictionary<ulong, PlayerSkillInfo>();
|
||||
|
||||
public static void LoadSkill()
|
||||
{
|
||||
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true)
|
||||
return;
|
||||
|
||||
Utils.RegisterSkill(skillName, "#e0d83a");
|
||||
|
||||
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);
|
||||
}
|
||||
});
|
||||
|
||||
Instance.AddCommand("css_useSkill", "Use Skill", (player, _) =>
|
||||
{
|
||||
if (player == null) return;
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill == skillName)
|
||||
UseSkill(player);
|
||||
});
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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;
|
||||
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;
|
||||
|
||||
player.PrintToChat($" {ChatColors.Green} {Localization.GetTranslation("godmode_on")}");
|
||||
player.PlayerPawn.Value.TakesDamage = false;
|
||||
Instance.AddTimer(2, () => {
|
||||
if (player.IsValid && player.PawnIsAlive)
|
||||
{
|
||||
player.PlayerPawn.Value.TakesDamage = true;
|
||||
player.PrintToChat($" {ChatColors.Red} {Localization.GetTranslation("godmode_off")}");
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
skillInfo.LastClick = DateTime.Now;
|
||||
}
|
||||
}
|
||||
|
||||
public class PlayerSkillInfo
|
||||
{
|
||||
public ulong SteamID { get; set; }
|
||||
public bool CanUse { get; set; }
|
||||
public DateTime Cooldown { get; set; }
|
||||
public DateTime LastClick { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
79
jRandomSkills - SRC Files/src/player/skills/Impostor.cs
Normal file
79
jRandomSkills - SRC Files/src/player/skills/Impostor.cs
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
using System.Drawing;
|
||||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using jRandomSkills.src.player;
|
||||
using static jRandomSkills.jRandomSkills;
|
||||
|
||||
namespace jRandomSkills
|
||||
{
|
||||
public class Impostor : ISkill
|
||||
{
|
||||
private static Skills skillName = Skills.Impostor;
|
||||
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";
|
||||
|
||||
public static void LoadSkill()
|
||||
{
|
||||
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true)
|
||||
return;
|
||||
|
||||
Utils.RegisterSkill(skillName, "#99140B");
|
||||
|
||||
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)
|
||||
{
|
||||
string model = GetEnemyModel(player);
|
||||
SetPlayerModel(player, model);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
}
|
||||
|
||||
public static void EnableSkill(CCSPlayerController player)
|
||||
{
|
||||
string model = GetEnemyModel(player);
|
||||
SetPlayerModel(player, model);
|
||||
}
|
||||
|
||||
public static void DisableSkill(CCSPlayerController player)
|
||||
{
|
||||
SetPlayerModel(player, player.Team == CsTeam.Terrorist ? defaultTModel : defaultCTModel);
|
||||
}
|
||||
|
||||
private static string GetEnemyModel(CCSPlayerController player)
|
||||
{
|
||||
CCSPlayerController[] models = Utilities.GetPlayers().FindAll(p => p.IsValid && p.PawnIsAlive && p.Team != player.Team).ToArray();
|
||||
if (models.Length > 0)
|
||||
{
|
||||
string modelName = models[Instance.Random.Next(models.Length)].PlayerPawn.Value.CBodyComponent.SceneNode.GetSkeletonInstance().ModelState.ModelName;
|
||||
if (modelName != null) return modelName;
|
||||
}
|
||||
return player.Team == CsTeam.CounterTerrorist ? defaultTModel : defaultCTModel;
|
||||
}
|
||||
|
||||
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);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,24 +1,29 @@
|
|||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
using jRandomSkills.src.player;
|
||||
using static jRandomSkills.jRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
namespace jRandomSkills
|
||||
{
|
||||
public static class NieskonczoneAmmo
|
||||
public class InfiniteAmmo : ISkill
|
||||
{
|
||||
public static void LoadNieskonczoneAmmo()
|
||||
private static Skills skillName = Skills.InfiniteAmmo;
|
||||
|
||||
public static void LoadSkill()
|
||||
{
|
||||
Utils.RegisterSkill("Nieskończone Ammo", "Otrzymujesz nieskończoną ilość ammo do wszystkich swoich broni", "#0000FF");
|
||||
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true)
|
||||
return;
|
||||
|
||||
Utils.RegisterSkill(skillName, "#0000FF");
|
||||
|
||||
Instance.RegisterEventHandler<EventWeaponFire>((@event, info) =>
|
||||
{
|
||||
var player = @event.Userid;
|
||||
|
||||
if (!IsValidPlayer(player)) return HookResult.Continue;
|
||||
if (!Instance.IsPlayerValid(player)) return HookResult.Continue;
|
||||
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
|
||||
if (playerInfo?.Skill == "Nieskończone Ammo")
|
||||
if (playerInfo?.Skill == skillName)
|
||||
{
|
||||
ApplyInfiniteAmmo(player);
|
||||
}
|
||||
|
|
@ -30,11 +35,11 @@ namespace dRandomSkills
|
|||
{
|
||||
var player = @event.Userid;
|
||||
|
||||
if (!IsValidPlayer(player)) return HookResult.Continue;
|
||||
if (!Instance.IsPlayerValid(player)) return HookResult.Continue;
|
||||
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
|
||||
if (playerInfo?.Skill == "Nieskończone Ammo")
|
||||
if (playerInfo?.Skill == skillName)
|
||||
player.GiveNamedItem($"weapon_{@event.Weapon}");
|
||||
|
||||
return HookResult.Continue;
|
||||
|
|
@ -44,11 +49,11 @@ namespace dRandomSkills
|
|||
{
|
||||
var player = @event.Userid;
|
||||
|
||||
if (!IsValidPlayer(player)) return HookResult.Continue;
|
||||
if (!Instance.IsPlayerValid(player)) return HookResult.Continue;
|
||||
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
|
||||
if (playerInfo?.Skill == "Nieskończone Ammo")
|
||||
if (playerInfo?.Skill == skillName)
|
||||
{
|
||||
ApplyInfiniteAmmo(player);
|
||||
}
|
||||
|
|
@ -57,11 +62,6 @@ namespace dRandomSkills
|
|||
});
|
||||
}
|
||||
|
||||
private static bool IsValidPlayer(CCSPlayerController player)
|
||||
{
|
||||
return player != null && player.IsValid;
|
||||
}
|
||||
|
||||
private static void ApplyInfiniteAmmo(CCSPlayerController player)
|
||||
{
|
||||
var activeWeaponHandle = player.PlayerPawn.Value?.WeaponServices?.ActiveWeapon;
|
||||
35
jRandomSkills - SRC Files/src/player/skills/KillerFlash.cs
Normal file
35
jRandomSkills - SRC Files/src/player/skills/KillerFlash.cs
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
using CounterStrikeSharp.API.Core;
|
||||
using jRandomSkills.src.player;
|
||||
using jRandomSkills.src.utils;
|
||||
using static jRandomSkills.jRandomSkills;
|
||||
|
||||
namespace jRandomSkills
|
||||
{
|
||||
public class KillerFlash : ISkill
|
||||
{
|
||||
private static Skills skillName = Skills.KillerFlash;
|
||||
|
||||
public static void LoadSkill()
|
||||
{
|
||||
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true)
|
||||
return;
|
||||
|
||||
Utils.RegisterSkill(skillName, "#57bcff");
|
||||
|
||||
Instance.RegisterEventHandler<EventPlayerBlind>((@event, info) =>
|
||||
{
|
||||
var player = @event.Userid;
|
||||
var attacker = @event.Attacker;
|
||||
if (!Instance.IsPlayerValid(player)) return HookResult.Continue;
|
||||
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
var attackerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == attacker.SteamID);
|
||||
|
||||
if (attackerInfo?.Skill == skillName && playerInfo?.Skill != Skills.AntyFlash && player?.PlayerPawn.Value.FlashDuration >= 1)
|
||||
player?.PlayerPawn?.Value?.CommitSuicide(false, true);
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
60
jRandomSkills - SRC Files/src/player/skills/Medic.cs
Normal file
60
jRandomSkills - SRC Files/src/player/skills/Medic.cs
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using jRandomSkills.src.player;
|
||||
using static jRandomSkills.jRandomSkills;
|
||||
|
||||
namespace jRandomSkills
|
||||
{
|
||||
public class Medic : ISkill
|
||||
{
|
||||
private static Skills skillName = Skills.Medic;
|
||||
|
||||
public static void LoadSkill()
|
||||
{
|
||||
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true)
|
||||
return;
|
||||
|
||||
Utils.RegisterSkill(skillName, "#42FF5F");
|
||||
|
||||
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
|
||||
{
|
||||
Instance.AddTimer(0.1f, () =>
|
||||
{
|
||||
foreach (var player in Utilities.GetPlayers())
|
||||
{
|
||||
if (!Instance.IsPlayerValid(player)) continue;
|
||||
player.RemoveItemByDesignerName("weapon_healthshot");
|
||||
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 Utilities.GetPlayers())
|
||||
{
|
||||
if (!Instance.IsPlayerValid(player)) return HookResult.Continue;
|
||||
DisableSkill(player);
|
||||
}
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
}
|
||||
|
||||
public static void EnableSkill(CCSPlayerController player)
|
||||
{
|
||||
int healthshot = Instance.Random.Next(1, 10);
|
||||
for (int i = 0; i < healthshot; i++)
|
||||
player.GiveNamedItem("weapon_healthshot");
|
||||
}
|
||||
|
||||
public static void DisableSkill(CCSPlayerController player)
|
||||
{
|
||||
player.RemoveItemByDesignerName("weapon_healthshot");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,27 +1,32 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
using jRandomSkills.src.player;
|
||||
using static jRandomSkills.jRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
namespace jRandomSkills
|
||||
{
|
||||
public static class Muhammed
|
||||
public class Muhammed : ISkill
|
||||
{
|
||||
private static Skills skillName = Skills.Muhammed;
|
||||
private const float ExplosionRadius = 500.0f;
|
||||
private const int ExplosionDamage = 999;
|
||||
|
||||
public static void LoadMuhammed()
|
||||
public static void LoadSkill()
|
||||
{
|
||||
Utils.RegisterSkill("Muhammed", "Po śmierci wybucha i zabija graczy w obrębie", "#F5CB42");
|
||||
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true)
|
||||
return;
|
||||
|
||||
Utils.RegisterSkill(skillName, "#F5CB42");
|
||||
|
||||
Instance.RegisterEventHandler<EventPlayerDeath>((@event, info) =>
|
||||
{
|
||||
CCSPlayerController player = @event.Userid;
|
||||
|
||||
if (!IsPlayerValid(player)) return HookResult.Continue;
|
||||
if (!Instance.IsPlayerValid(player)) return HookResult.Continue;
|
||||
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill == "Muhammed")
|
||||
if (playerInfo?.Skill == skillName)
|
||||
{
|
||||
SpawnExplosion(player);
|
||||
}
|
||||
|
|
@ -47,7 +52,7 @@ namespace dRandomSkills
|
|||
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!!!");
|
||||
Server.PrintToChatAll($" {ChatColors.DarkRed}► {ChatColors.Green}[{ChatColors.DarkRed} qRandomSkills {ChatColors.Green}] {ChatColors.DarkRed}{player.PlayerName}: {ChatColors.Lime}ALLAHU AKBAR!!!");
|
||||
|
||||
var fileNames = new[] { "radiobotfallback01", "radiobotfallback02", "radiobotfallback04" };
|
||||
Instance.AddTimer(0.1f, () =>
|
||||
|
|
@ -56,10 +61,5 @@ namespace dRandomSkills
|
|||
player.ExecuteClientCommand($"play vo/agents/balkan/{randomFile}.vsnd");
|
||||
});
|
||||
}
|
||||
|
||||
private static bool IsPlayerValid(CCSPlayerController player)
|
||||
{
|
||||
return player != null && player.IsValid && player.PlayerPawn?.Value != null;
|
||||
}
|
||||
}
|
||||
}
|
||||
58
jRandomSkills - SRC Files/src/player/skills/Mute.cs
Normal file
58
jRandomSkills - SRC Files/src/player/skills/Mute.cs
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Memory;
|
||||
using jRandomSkills.src.player;
|
||||
using static jRandomSkills.jRandomSkills;
|
||||
|
||||
namespace jRandomSkills
|
||||
{
|
||||
public class Mute : ISkill
|
||||
{
|
||||
private static Skills skillName = Skills.None;
|
||||
private const float ExplosionRadius = 500.0f;
|
||||
private const int ExplosionDamage = 999;
|
||||
|
||||
public static void LoadSkill()
|
||||
{
|
||||
return;
|
||||
|
||||
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true)
|
||||
return;
|
||||
|
||||
Utils.RegisterSkill(skillName, "#F5CB42");
|
||||
|
||||
Instance.RegisterListener<Listeners.OnEntitySpawned>(@event =>
|
||||
{
|
||||
var name = @event.DesignerName;
|
||||
if (!name.EndsWith("_projectile"))
|
||||
return;
|
||||
|
||||
// mp_freezetime 0; mp_warmup_end
|
||||
Server.PrintToChatAll("-> " + name);
|
||||
|
||||
switch (name)
|
||||
{
|
||||
case "flashbang_projectile":
|
||||
var flash = @event.As<CFlashbangProjectile>();
|
||||
break;
|
||||
case "smokegrenade_projectile":
|
||||
var smoke = @event.As<CSmokeGrenadeProjectile>();
|
||||
Schema.SetSchemaValue<int>(smoke.Handle, "CSmokeGrenadeProjectile", "m_nSmokeEffectTickBegin", int.MaxValue);
|
||||
Schema.SetSchemaValue<bool>(smoke.Handle, "CSmokeGrenadeProjectile", "m_bDidSmokeEffect", true);
|
||||
break;
|
||||
case "hegrenade_projectile":
|
||||
var hegrenade = @event.As<CHEGrenadeProjectile>();
|
||||
hegrenade.DetonateTime = 0;
|
||||
break;
|
||||
case "molotov_projectile":
|
||||
var molotov = @event.As<CMolotovProjectile>();
|
||||
molotov.StillTimer.Timestamp = 0;
|
||||
break;
|
||||
case "decoy_projectile":
|
||||
var decoy = @event.As<CDecoyProjectile>();
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
14
jRandomSkills - SRC Files/src/player/skills/None.cs
Normal file
14
jRandomSkills - SRC Files/src/player/skills/None.cs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
using jRandomSkills.src.player;
|
||||
|
||||
namespace jRandomSkills
|
||||
{
|
||||
public class None : ISkill
|
||||
{
|
||||
private static Skills skillName = Skills.None;
|
||||
|
||||
public static void LoadSkill()
|
||||
{
|
||||
Utils.RegisterSkill(skillName, "#FFFFFF", false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,16 +1,21 @@
|
|||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Memory;
|
||||
using CounterStrikeSharp.API.Modules.Memory.DynamicFunctions;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
using jRandomSkills.src.player;
|
||||
using static jRandomSkills.jRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
namespace jRandomSkills
|
||||
{
|
||||
public static class OneShot
|
||||
public class OneShot : ISkill
|
||||
{
|
||||
public static void LoadOneShot()
|
||||
private static Skills skillName = Skills.OneShot;
|
||||
|
||||
public static void LoadSkill()
|
||||
{
|
||||
Utils.RegisterSkill("One Shot", "Po trafieniu od razu zabija przeciwnika", "#ff5CD9");
|
||||
|
||||
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true)
|
||||
return;
|
||||
|
||||
Utils.RegisterSkill(skillName, "#ff5CD9");
|
||||
VirtualFunctions.CBaseEntity_TakeDamageOldFunc.Hook(OnTakeDamage, HookMode.Pre);
|
||||
}
|
||||
|
||||
|
|
@ -34,7 +39,7 @@ namespace dRandomSkills
|
|||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == attacker.SteamID);
|
||||
if (playerInfo == null) return HookResult.Continue;
|
||||
|
||||
if (playerInfo.Skill == "One Shot" && attacker.PawnIsAlive)
|
||||
if (playerInfo.Skill == skillName && attacker.PawnIsAlive)
|
||||
{
|
||||
param2.Damage = 1000f;
|
||||
}
|
||||
|
|
@ -1,28 +1,33 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using jRandomSkills.src.player;
|
||||
using static CounterStrikeSharp.API.Core.Listeners;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
using static jRandomSkills.jRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
namespace jRandomSkills
|
||||
{
|
||||
public static class PawelJumper
|
||||
public class PawelJumper : ISkill
|
||||
{
|
||||
private static Skills skillName = Skills.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()
|
||||
public static void LoadSkill()
|
||||
{
|
||||
Utils.RegisterSkill("Paweł Jumper", "Otrzymujesz dodatkowy Skok", "#FFA500");
|
||||
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true)
|
||||
return;
|
||||
|
||||
Utils.RegisterSkill(skillName, "#FFA500");
|
||||
|
||||
Instance.RegisterListener<OnTick>(() =>
|
||||
{
|
||||
foreach (var player in Utilities.GetPlayers())
|
||||
{
|
||||
if (!IsPlayerValid(player)) return;
|
||||
if (!Instance.IsPlayerValid(player)) return;
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill == "Paweł Jumper")
|
||||
if (playerInfo?.Skill == skillName)
|
||||
{
|
||||
GiveAdditionalJump(player);
|
||||
}
|
||||
|
|
@ -53,10 +58,5 @@ namespace dRandomSkills
|
|||
LF[player.Slot] = flags;
|
||||
LB[player.Slot] = buttons;
|
||||
}
|
||||
|
||||
private static bool IsPlayerValid(CCSPlayerController player)
|
||||
{
|
||||
return player != null && player.IsValid && player.PlayerPawn?.Value != null;
|
||||
}
|
||||
}
|
||||
}
|
||||
72
jRandomSkills - SRC Files/src/player/skills/Phoenix.cs
Normal file
72
jRandomSkills - SRC Files/src/player/skills/Phoenix.cs
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
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 Phoenix : ISkill
|
||||
{
|
||||
private static Skills skillName = Skills.Phoenix;
|
||||
|
||||
public static void LoadSkill()
|
||||
{
|
||||
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true)
|
||||
return;
|
||||
|
||||
Utils.RegisterSkill(skillName, "#ff5C0A", 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<EventPlayerDeath>((@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)
|
||||
{
|
||||
if (Instance.Random.NextDouble() <= playerInfo.SkillChance)
|
||||
{
|
||||
player.Respawn();
|
||||
Instance.AddTimer(.2f, () => player.Respawn());
|
||||
Utils.PrintToChat(player, Localization.GetTranslation("phoenix_respawn"), false); ;
|
||||
}
|
||||
}
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
}
|
||||
|
||||
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);
|
||||
float newChance = (float)Instance.Random.NextDouble() * (skillConfig.ChanceTo - skillConfig.ChanceFrom) + skillConfig.ChanceFrom;
|
||||
playerInfo.SkillChance = newChance;
|
||||
newChance = (float)Math.Round(newChance, 2) * 100;
|
||||
newChance = (float)Math.Round(newChance);
|
||||
Utils.PrintToChat(player, $"{ChatColors.DarkRed}{Localization.GetTranslation("phoenix")}{ChatColors.Lime}: " + Localization.GetTranslation("phoenix_desc2", newChance), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,18 +1,24 @@
|
|||
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 dRandomSkills.dRandomSkills;
|
||||
using static jRandomSkills.jRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
namespace jRandomSkills
|
||||
{
|
||||
public static class Pilot
|
||||
public class Pilot : ISkill
|
||||
{
|
||||
private static Skills skillName = Skills.Pilot;
|
||||
private static readonly Dictionary<ulong, Pilot_PlayerInfo> PlayerPilotInfo = new Dictionary<ulong, Pilot_PlayerInfo>();
|
||||
|
||||
public static void LoadPilot()
|
||||
public static void LoadSkill()
|
||||
{
|
||||
Utils.RegisterSkill("Pilot", "Latanie przez okreœlony czas. Przytrzymaj [USE - E], aby lataæ!", "#1466F5");
|
||||
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true)
|
||||
return;
|
||||
|
||||
Utils.RegisterSkill(skillName, "#1466F5");
|
||||
|
||||
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
|
||||
{
|
||||
|
|
@ -21,15 +27,9 @@ namespace dRandomSkills
|
|||
foreach (var player in Utilities.GetPlayers())
|
||||
{
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill == "Pilot")
|
||||
if (playerInfo?.Skill == skillName)
|
||||
{
|
||||
PlayerPilotInfo[player.SteamID] = new Pilot_PlayerInfo
|
||||
{
|
||||
SteamID = player.SteamID,
|
||||
PressedUse = false,
|
||||
CanUsePilot = true,
|
||||
PilotStartTime = DateTime.MinValue
|
||||
};
|
||||
EnableSkill(player);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -42,12 +42,10 @@ namespace dRandomSkills
|
|||
var player = @event.Userid;
|
||||
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill == "Pilot")
|
||||
if (playerInfo?.Skill == skillName)
|
||||
{
|
||||
if (PlayerPilotInfo.ContainsKey(player.SteamID))
|
||||
{
|
||||
PlayerPilotInfo.Remove(player.SteamID);
|
||||
}
|
||||
}
|
||||
|
||||
return HookResult.Continue;
|
||||
|
|
@ -58,14 +56,29 @@ namespace dRandomSkills
|
|||
foreach (var player in Utilities.GetPlayers())
|
||||
{
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill == "Pilot")
|
||||
{
|
||||
if (playerInfo?.Skill == skillName)
|
||||
HandlePilot(player);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void EnableSkill(CCSPlayerController player)
|
||||
{
|
||||
PlayerPilotInfo[player.SteamID] = new Pilot_PlayerInfo
|
||||
{
|
||||
SteamID = player.SteamID,
|
||||
PressedUse = false,
|
||||
CanUsePilot = true,
|
||||
PilotStartTime = DateTime.MinValue
|
||||
};
|
||||
}
|
||||
|
||||
public static void DisableSkill(CCSPlayerController player)
|
||||
{
|
||||
if (PlayerPilotInfo.ContainsKey(player.SteamID))
|
||||
PlayerPilotInfo.Remove(player.SteamID);
|
||||
}
|
||||
|
||||
private static void HandlePilot(CCSPlayerController player)
|
||||
{
|
||||
var buttons = player.Buttons;
|
||||
|
|
@ -103,9 +116,9 @@ namespace dRandomSkills
|
|||
}
|
||||
|
||||
string fuelColor = GetFuelColor(fuelPercentage);
|
||||
string infoLine = buttons.HasFlag(PlayerButtons.Use) ? $"<font color='#FFFFFF'>Pilot:</font> <br>" : "";
|
||||
string infoLine = buttons.HasFlag(PlayerButtons.Use) ? $"<font color='#FFFFFF'>{Localization.GetTranslation("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>") : "";
|
||||
(pilotInfo.CanUsePilot ? $"<font color='{fuelColor}'>{fuelPercentage:F0}%</font> <br>" : $"<font color='#FF0000'>{Localization.GetTranslation("pilot_hud_info")}</font> <br>") : "";
|
||||
|
||||
if (buttons.HasFlag(PlayerButtons.Use))
|
||||
{
|
||||
74
jRandomSkills - SRC Files/src/player/skills/Planter.cs
Normal file
74
jRandomSkills - SRC Files/src/player/skills/Planter.cs
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Memory;
|
||||
using jRandomSkills.src.player;
|
||||
using jRandomSkills.src.utils;
|
||||
using static CounterStrikeSharp.API.Core.Listeners;
|
||||
using static jRandomSkills.jRandomSkills;
|
||||
|
||||
namespace jRandomSkills
|
||||
{
|
||||
public class Planter : ISkill
|
||||
{
|
||||
private static Skills skillName = Skills.Planter;
|
||||
|
||||
public static void LoadSkill()
|
||||
{
|
||||
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true)
|
||||
return;
|
||||
|
||||
Utils.RegisterSkill(skillName, "#7d7d7d");
|
||||
|
||||
Instance.RegisterEventHandler<EventRoundStart>((@event, @info) =>
|
||||
{
|
||||
foreach (var player in Utilities.GetPlayers())
|
||||
{
|
||||
if (!Instance.IsPlayerValid(player)) continue;
|
||||
Schema.SetSchemaValue<bool>(player.Pawn.Value.Handle, "CCSPlayerPawn", "m_bInBombZone", false);
|
||||
}
|
||||
return HookResult.Continue;
|
||||
});
|
||||
|
||||
Instance.RegisterEventHandler<EventBombPlanted>((@event, info) =>
|
||||
{
|
||||
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;
|
||||
|
||||
var plantedBomb = Utilities.FindAllEntitiesByDesignerName<CPlantedC4>("planted_c4").FirstOrDefault();
|
||||
if (plantedBomb != null)
|
||||
{
|
||||
Server.NextFrame(() =>
|
||||
{
|
||||
plantedBomb.C4Blow = (float)Server.EngineTime + 60;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
|
||||
Instance.RegisterListener<OnTick>(OnTick);
|
||||
}
|
||||
|
||||
public static void DisableSkill(CCSPlayerController player)
|
||||
{
|
||||
Schema.SetSchemaValue<bool>(player.Pawn.Value.Handle, "CCSPlayerPawn", "m_bInBombZone", false);
|
||||
}
|
||||
|
||||
private static void OnTick()
|
||||
{
|
||||
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)
|
||||
Schema.SetSchemaValue<bool>(player.Pawn.Value.Handle, "CCSPlayerPawn", "m_bInBombZone", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
41
jRandomSkills - SRC Files/src/player/skills/QuickShot.cs
Normal file
41
jRandomSkills - SRC Files/src/player/skills/QuickShot.cs
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Modules.Memory;
|
||||
using jRandomSkills.src.player;
|
||||
using jRandomSkills.src.utils;
|
||||
using static CounterStrikeSharp.API.Core.Listeners;
|
||||
using static jRandomSkills.jRandomSkills;
|
||||
|
||||
namespace jRandomSkills
|
||||
{
|
||||
public class QuickShot : ISkill
|
||||
{
|
||||
private static Skills skillName = Skills.QuickShot;
|
||||
|
||||
public static void LoadSkill()
|
||||
{
|
||||
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true)
|
||||
return;
|
||||
|
||||
Utils.RegisterSkill(skillName, "#8a42f5");
|
||||
Instance.RegisterListener<OnTick>(OnTick);
|
||||
}
|
||||
|
||||
private static void OnTick()
|
||||
{
|
||||
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)
|
||||
{
|
||||
var weapon = player.Pawn.Value.WeaponServices?.ActiveWeapon.Value;
|
||||
if (weapon == null) continue;
|
||||
|
||||
Schema.SetSchemaValue<Int32>(weapon.Handle, "CBasePlayerWeapon", "m_nNextPrimaryAttackTick", Server.TickCount);
|
||||
Schema.SetSchemaValue<Int32>(weapon.Handle, "CBasePlayerWeapon", "m_nNextSecondaryAttackTick", Server.TickCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
58
jRandomSkills - SRC Files/src/player/skills/RadarHack.cs
Normal file
58
jRandomSkills - SRC Files/src/player/skills/RadarHack.cs
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using jRandomSkills.src.player;
|
||||
using static CounterStrikeSharp.API.Core.Listeners;
|
||||
using static jRandomSkills.jRandomSkills;
|
||||
|
||||
namespace jRandomSkills
|
||||
{
|
||||
public class RadarHack : ISkill
|
||||
{
|
||||
private static Skills skillName = Skills.RadarHack;
|
||||
|
||||
public static void LoadSkill()
|
||||
{
|
||||
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true)
|
||||
return;
|
||||
|
||||
Utils.RegisterSkill(skillName, "#2effcb");
|
||||
Instance.RegisterListener<OnTick>(CheckRadarowiec);
|
||||
}
|
||||
|
||||
private static void CheckRadarowiec()
|
||||
{
|
||||
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)
|
||||
{
|
||||
SetEnemiesVisibleOnRadar(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void SetEnemiesVisibleOnRadar(CCSPlayerController player)
|
||||
{
|
||||
if (player == null || !player.IsValid || player.PlayerPawn?.Value == null) return;
|
||||
int playerIndex = (int)player.Index - 1;
|
||||
|
||||
foreach (var enemy in Utilities.GetPlayers().FindAll(p => p.Team != player.Team && p.PawnIsAlive))
|
||||
{
|
||||
var enemyPawn = enemy.PlayerPawn.Value;
|
||||
if (enemyPawn == null) continue;
|
||||
enemyPawn.EntitySpottedState.SpottedByMask[0] |= (1u << (int)(playerIndex % 32));
|
||||
|
||||
}
|
||||
|
||||
var bombEntities = Utilities.FindAllEntitiesByDesignerName<CC4>("weapon_c4").ToList();
|
||||
if (bombEntities.Any())
|
||||
{
|
||||
var bomb = bombEntities.FirstOrDefault();
|
||||
if (bomb != null)
|
||||
bomb.EntitySpottedState.SpottedByMask[0] |= (1u << (int)(playerIndex % 32));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
70
jRandomSkills - SRC Files/src/player/skills/Rambo.cs
Normal file
70
jRandomSkills - SRC Files/src/player/skills/Rambo.cs
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using jRandomSkills.src.player;
|
||||
using static jRandomSkills.jRandomSkills;
|
||||
|
||||
namespace jRandomSkills
|
||||
{
|
||||
public class Rambo : ISkill
|
||||
{
|
||||
private static Skills skillName = Skills.Rambo;
|
||||
|
||||
public static void LoadSkill()
|
||||
{
|
||||
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true)
|
||||
return;
|
||||
|
||||
Utils.RegisterSkill(skillName, "#009905");
|
||||
|
||||
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)
|
||||
EnableSkill(player);
|
||||
}
|
||||
});
|
||||
return HookResult.Continue;
|
||||
});
|
||||
}
|
||||
|
||||
public static void EnableSkill(CCSPlayerController player)
|
||||
{
|
||||
int healthBonus = Instance.Random.Next(50, 501);
|
||||
AddHealth(player, healthBonus);
|
||||
}
|
||||
|
||||
public static void DisableSkill(CCSPlayerController player)
|
||||
{
|
||||
ResetHealth(player);
|
||||
}
|
||||
|
||||
public static void AddHealth(CCSPlayerController player, int health)
|
||||
{
|
||||
var pawn = player.PlayerPawn?.Value;
|
||||
if (pawn == null) return;
|
||||
|
||||
pawn.MaxHealth = Math.Min(pawn.Health + health, 1000);
|
||||
Utilities.SetStateChanged(pawn, "CBaseEntity", "m_iMaxHealth");
|
||||
|
||||
pawn.Health = pawn.MaxHealth;
|
||||
Utilities.SetStateChanged(pawn, "CBaseEntity", "m_iHealth");
|
||||
}
|
||||
|
||||
public static void ResetHealth(CCSPlayerController player)
|
||||
{
|
||||
var pawn = player.PlayerPawn?.Value;
|
||||
if (pawn == null) return;
|
||||
|
||||
pawn.MaxHealth = 100;
|
||||
Utilities.SetStateChanged(pawn, "CBaseEntity", "m_iMaxHealth");
|
||||
|
||||
pawn.Health = Math.Min(pawn.Health, 100);
|
||||
Utilities.SetStateChanged(pawn, "CBaseEntity", "m_iHealth");
|
||||
}
|
||||
}
|
||||
}
|
||||
191
jRandomSkills - SRC Files/src/player/skills/RandomWeapon.cs
Normal file
191
jRandomSkills - SRC Files/src/player/skills/RandomWeapon.cs
Normal file
|
|
@ -0,0 +1,191 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using jRandomSkills.src.player;
|
||||
using jRandomSkills.src.utils;
|
||||
using System.Collections.Immutable;
|
||||
using static CounterStrikeSharp.API.Core.Listeners;
|
||||
using static jRandomSkills.jRandomSkills;
|
||||
|
||||
namespace jRandomSkills
|
||||
{
|
||||
public class RandomWeapon : ISkill
|
||||
{
|
||||
private static Skills skillName = Skills.RandomWeapon;
|
||||
private static float timerCooldown = (float)(Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Cooldown);
|
||||
private static readonly Dictionary<ulong, PlayerSkillInfo> SkillPlayerInfo = new Dictionary<ulong, PlayerSkillInfo>();
|
||||
|
||||
private static string[] pistols = { "weapon_deagle", "weapon_revolver", "weapon_glock", "weapon_usp_silencer",
|
||||
"weapon_cz75a", "weapon_fiveseven", "weapon_p250", "weapon_tec9", "weapon_elite", "weapon_hkp2000" };
|
||||
|
||||
private static string[] rifles = { "weapon_mp9", "weapon_mac10", "weapon_bizon", "weapon_mp7", "weapon_ump45", "weapon_p90",
|
||||
"weapon_mp5sd", "weapon_famas", "weapon_galilar", "weapon_m4a1", "weapon_m4a1_silencer", "weapon_ak47",
|
||||
"weapon_aug", "weapon_sg553", "weapon_ssg08", "weapon_awp", "weapon_scar20", "weapon_g3sg1",
|
||||
"weapon_nova", "weapon_xm1014", "weapon_mag7", "weapon_sawedoff", "weapon_m249", "weapon_negev" };
|
||||
|
||||
public static void LoadSkill()
|
||||
{
|
||||
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true)
|
||||
return;
|
||||
|
||||
Utils.RegisterSkill(skillName, "#e0873a");
|
||||
|
||||
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);
|
||||
}
|
||||
});
|
||||
|
||||
Instance.AddCommand("css_useSkill", "Use Skill", (player, _) =>
|
||||
{
|
||||
if (player == null) return;
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill == skillName)
|
||||
UseSkill(player);
|
||||
});
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
private 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;
|
||||
RemoveAndGiveWeapon(player);
|
||||
}
|
||||
else
|
||||
skillInfo.LastClick = DateTime.Now;
|
||||
}
|
||||
}
|
||||
|
||||
private static void RemoveAndGiveWeapon(CCSPlayerController player)
|
||||
{
|
||||
List<string> playerWeapons = new List<string>();
|
||||
foreach (var item in player?.PlayerPawn?.Value?.WeaponServices?.MyWeapons)
|
||||
if (!string.IsNullOrEmpty(item?.Value?.DesignerName))
|
||||
playerWeapons.Add(item?.Value?.DesignerName);
|
||||
|
||||
if (playerWeapons.Count == 0)
|
||||
return;
|
||||
|
||||
List<string> weaponList = new List<string>(pistols.Concat(rifles));
|
||||
weaponList.RemoveAll(w => playerWeapons.Contains(w));
|
||||
|
||||
if (weaponList.Count == 0)
|
||||
return;
|
||||
|
||||
string weapon = weaponList[Instance.Random.Next(weaponList.Count)];
|
||||
bool isPistol = pistols.Contains(weapon);
|
||||
|
||||
string? weaponToRemove = playerWeapons.FirstOrDefault(itemName =>
|
||||
(isPistol && pistols.Contains(itemName)) || (!isPistol && rifles.Contains(itemName)));
|
||||
|
||||
if (!string.IsNullOrEmpty(weaponToRemove))
|
||||
{
|
||||
foreach (var item in player.PlayerPawn.Value.WeaponServices.MyWeapons)
|
||||
{
|
||||
if (item != null && item.Value != null && item.Value.DesignerName == weaponToRemove)
|
||||
item.Value.Remove();
|
||||
}
|
||||
}
|
||||
|
||||
Instance.AddTimer(.1f, () =>
|
||||
{
|
||||
player.GiveNamedItem(weapon);
|
||||
});
|
||||
}
|
||||
|
||||
public class PlayerSkillInfo
|
||||
{
|
||||
public ulong SteamID { get; set; }
|
||||
public bool CanUse { get; set; }
|
||||
public DateTime Cooldown { get; set; }
|
||||
public DateTime LastClick { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
166
jRandomSkills - SRC Files/src/player/skills/Retreat.cs
Normal file
166
jRandomSkills - SRC Files/src/player/skills/Retreat.cs
Normal file
|
|
@ -0,0 +1,166 @@
|
|||
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 Retreat : ISkill
|
||||
{
|
||||
private static Skills skillName = Skills.Retreat;
|
||||
private static float timerCooldown = (float)(Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Cooldown);
|
||||
private static readonly Dictionary<ulong, PlayerSkillInfo> SkillPlayerInfo = new Dictionary<ulong, PlayerSkillInfo>();
|
||||
|
||||
public static void LoadSkill()
|
||||
{
|
||||
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true)
|
||||
return;
|
||||
|
||||
Utils.RegisterSkill(skillName, "#a86eff");
|
||||
|
||||
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);
|
||||
}
|
||||
});
|
||||
|
||||
Instance.AddCommand("css_useSkill", "Use Skill", (player, _) =>
|
||||
{
|
||||
if (player == null) return;
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill == skillName)
|
||||
UseSkill(player);
|
||||
});
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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;
|
||||
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;
|
||||
playerPawn.Teleport(GetSpawnVector(player));
|
||||
}
|
||||
else
|
||||
skillInfo.LastClick = DateTime.Now;
|
||||
}
|
||||
}
|
||||
|
||||
private static Vector GetSpawnVector(CCSPlayerController player)
|
||||
{
|
||||
var abs = player.PlayerPawn.Value.AbsOrigin;
|
||||
var spawns = Utilities.FindAllEntitiesByDesignerName<SpawnPoint>(player.Team == CsTeam.Terrorist ? "info_player_terrorist" : "info_player_counterterrorist").ToList();
|
||||
if (spawns.Any())
|
||||
{
|
||||
var randomSpawn = spawns[Instance.Random.Next(spawns.Count)];
|
||||
return randomSpawn.AbsOrigin;
|
||||
}
|
||||
return new Vector(abs.X, abs.Y, abs.Z);
|
||||
}
|
||||
|
||||
public class PlayerSkillInfo
|
||||
{
|
||||
public ulong SteamID { get; set; }
|
||||
public bool CanUse { get; set; }
|
||||
public DateTime Cooldown { get; set; }
|
||||
public DateTime LastClick { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
63
jRandomSkills - SRC Files/src/player/skills/RichBoy.cs
Normal file
63
jRandomSkills - SRC Files/src/player/skills/RichBoy.cs
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using jRandomSkills.src.player;
|
||||
using static jRandomSkills.jRandomSkills;
|
||||
|
||||
namespace jRandomSkills
|
||||
{
|
||||
public class RichBoy : ISkill
|
||||
{
|
||||
private static Skills skillName = Skills.RichBoy;
|
||||
|
||||
public static void LoadSkill()
|
||||
{
|
||||
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true)
|
||||
return;
|
||||
|
||||
Utils.RegisterSkill(skillName, "#D4AF37");
|
||||
|
||||
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)
|
||||
{
|
||||
int moneyBonus = Instance.Random.Next(5000, 15000);
|
||||
playerInfo.SkillChance = moneyBonus;
|
||||
AddMoney(player, moneyBonus);
|
||||
}
|
||||
}
|
||||
});
|
||||
return HookResult.Continue;
|
||||
});
|
||||
}
|
||||
|
||||
public static void EnableSkill(CCSPlayerController player)
|
||||
{
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
int moneyBonus = Instance.Random.Next(5000, 15000);
|
||||
playerInfo.SkillChance = moneyBonus;
|
||||
AddMoney(player, moneyBonus);
|
||||
}
|
||||
|
||||
public static void DisableSkill(CCSPlayerController player)
|
||||
{
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
AddMoney(player, -(int)playerInfo.SkillChance);
|
||||
}
|
||||
|
||||
private static void AddMoney(CCSPlayerController player, int money)
|
||||
{
|
||||
var moneyServices = player?.InGameMoneyServices;
|
||||
|
||||
if (moneyServices == null) return;
|
||||
|
||||
moneyServices.Account = Math.Max(moneyServices.Account + money, 0);
|
||||
Utilities.SetStateChanged(player, "CCSPlayerController", "m_pInGameMoneyServices");
|
||||
}
|
||||
}
|
||||
}
|
||||
66
jRandomSkills - SRC Files/src/player/skills/Saper.cs
Normal file
66
jRandomSkills - SRC Files/src/player/skills/Saper.cs
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using jRandomSkills.src.player;
|
||||
using jRandomSkills.src.utils;
|
||||
using static jRandomSkills.jRandomSkills;
|
||||
|
||||
namespace jRandomSkills
|
||||
{
|
||||
public class Saper : ISkill
|
||||
{
|
||||
private static Skills skillName = Skills.Saper;
|
||||
|
||||
public static void LoadSkill()
|
||||
{
|
||||
Utils.RegisterSkill(skillName, "#8A2BE2");
|
||||
|
||||
Instance.RegisterEventHandler<EventBombBeginplant>((@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)
|
||||
{
|
||||
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 (Instance.IsPlayerValid(player))
|
||||
{
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill == skillName)
|
||||
{
|
||||
var plantedBomb = Utilities.FindAllEntitiesByDesignerName<CPlantedC4>("planted_c4").FirstOrDefault();
|
||||
if (plantedBomb != null)
|
||||
{
|
||||
Server.NextFrame(() =>
|
||||
{
|
||||
plantedBomb.DefuseCountDown = 0;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,41 +1,39 @@
|
|||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
using jRandomSkills.src.player;
|
||||
using static jRandomSkills.jRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
namespace jRandomSkills
|
||||
{
|
||||
public static class Cien
|
||||
public class Shade : ISkill
|
||||
{
|
||||
private static Skills skillName = Skills.Shade;
|
||||
private const float TeleportDistance = 100.0f;
|
||||
|
||||
public static void LoadCien()
|
||||
public static void LoadSkill()
|
||||
{
|
||||
Utils.RegisterSkill("Cień", "Teleportujesz się za plecy trafionego wroga", "#18171A");
|
||||
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true)
|
||||
return;
|
||||
|
||||
Utils.RegisterSkill(skillName, "#18171A");
|
||||
|
||||
Instance.RegisterEventHandler<EventPlayerHurt>((@event, info) =>
|
||||
{
|
||||
var attacker = @event.Attacker;
|
||||
var victim = @event.Userid;
|
||||
|
||||
if (!IsPlayerValid(attacker) || !IsPlayerValid(victim)) return HookResult.Continue;
|
||||
if (!Instance.IsPlayerValid(attacker) || !Instance.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ń")
|
||||
{
|
||||
if (attackerInfo?.Skill == skillName)
|
||||
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;
|
||||
41
jRandomSkills - SRC Files/src/player/skills/Silent.cs
Normal file
41
jRandomSkills - SRC Files/src/player/skills/Silent.cs
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using jRandomSkills.src.player;
|
||||
using jRandomSkills.src.utils;
|
||||
using static jRandomSkills.jRandomSkills;
|
||||
|
||||
namespace jRandomSkills
|
||||
{
|
||||
public class Silent : ISkill
|
||||
{
|
||||
private static Skills skillName = Skills.Silent;
|
||||
|
||||
public static void LoadSkill()
|
||||
{
|
||||
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true)
|
||||
return;
|
||||
|
||||
Utils.RegisterSkill(skillName, "#333333");
|
||||
|
||||
Instance.HookUserMessage(208, um =>
|
||||
{
|
||||
var soundevent = um.ReadUInt("soundevent_hash");
|
||||
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;
|
||||
|
||||
var player = Utilities.GetPlayers().FirstOrDefault(p => p.Pawn.Value.Index == userIndex);
|
||||
if (!Instance.IsPlayerValid(player)) return HookResult.Continue;
|
||||
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill != skillName) return HookResult.Continue;
|
||||
|
||||
um.Recipients.Clear();
|
||||
return HookResult.Handled;
|
||||
}, HookMode.Pre);
|
||||
}
|
||||
}
|
||||
}
|
||||
79
jRandomSkills - SRC Files/src/player/skills/Soldier.cs
Normal file
79
jRandomSkills - SRC Files/src/player/skills/Soldier.cs
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
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 Soldier : ISkill
|
||||
{
|
||||
private static Skills skillName = Skills.Soldier;
|
||||
|
||||
public static void LoadSkill()
|
||||
{
|
||||
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true)
|
||||
return;
|
||||
|
||||
Utils.RegisterSkill(skillName, "#09ba00", false);
|
||||
VirtualFunctions.CBaseEntity_TakeDamageOldFunc.Hook(OnTakeDamage, HookMode.Pre);
|
||||
|
||||
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 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;
|
||||
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);
|
||||
}
|
||||
|
||||
private static HookResult OnTakeDamage(DynamicHook h)
|
||||
{
|
||||
CEntityInstance param = h.GetParam<CEntityInstance>(0);
|
||||
CTakeDamageInfo param2 = h.GetParam<CTakeDamageInfo>(1);
|
||||
|
||||
if (param == null || param2 == null || param2.Attacker == null)
|
||||
return HookResult.Continue;
|
||||
|
||||
CCSPlayerPawn attackerPawn = new CCSPlayerPawn(param2.Attacker.Value.Handle);
|
||||
CCSPlayerPawn victimPawn = new CCSPlayerPawn(param.Handle);
|
||||
|
||||
if (attackerPawn == null || attackerPawn.Controller?.Value == null || victimPawn == null || victimPawn.Controller?.Value == null)
|
||||
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 *= (float)playerInfo.SkillChance;
|
||||
}
|
||||
|
||||
return HookResult.Continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
193
jRandomSkills - SRC Files/src/player/skills/SwapPosition.cs
Normal file
193
jRandomSkills - SRC Files/src/player/skills/SwapPosition.cs
Normal file
|
|
@ -0,0 +1,193 @@
|
|||
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 SwapPosition : ISkill
|
||||
{
|
||||
private static Skills skillName = Skills.SwapPosition;
|
||||
private static float timerCooldown = (float)(Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Cooldown);
|
||||
private static readonly Dictionary<ulong, ZamianaMiejsc_PlayerInfo> SkillPlayerInfo = new Dictionary<ulong, ZamianaMiejsc_PlayerInfo>();
|
||||
|
||||
public static void LoadSkill()
|
||||
{
|
||||
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true)
|
||||
return;
|
||||
|
||||
Utils.RegisterSkill(skillName, "#1466F5");
|
||||
|
||||
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))
|
||||
if (skillInfo.LastClick.AddSeconds(4) >= DateTime.Now)
|
||||
UpdateHUD(player, skillInfo, true);
|
||||
else
|
||||
UpdateHUD(player, skillInfo, false);
|
||||
}
|
||||
});
|
||||
|
||||
Instance.AddCommand("css_useSkill", "Use Skill", (player, _) =>
|
||||
{
|
||||
if (player == null) return;
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill == skillName)
|
||||
UseSkill(player);
|
||||
});
|
||||
}
|
||||
|
||||
public static void EnableSkill(CCSPlayerController player)
|
||||
{
|
||||
SkillPlayerInfo[player.SteamID] = new ZamianaMiejsc_PlayerInfo
|
||||
{
|
||||
SteamID = player.SteamID,
|
||||
CanUse = true,
|
||||
Cooldown = DateTime.MinValue,
|
||||
LastClick = DateTime.MinValue,
|
||||
FindedEnemy = false,
|
||||
};
|
||||
}
|
||||
|
||||
public static void DisableSkill(CCSPlayerController player)
|
||||
{
|
||||
if (SkillPlayerInfo.ContainsKey(player.SteamID))
|
||||
SkillPlayerInfo.Remove(player.SteamID);
|
||||
}
|
||||
|
||||
private static void UpdateHUD(CCSPlayerController player, ZamianaMiejsc_PlayerInfo skillInfo, bool showInfo)
|
||||
{
|
||||
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 = "";
|
||||
|
||||
if (showInfo)
|
||||
remainingLine = cooldown != 0 ? $"<font class='fontSize-m' color='#FFFFFF'>{Localization.GetTranslation("hud_info", $"<font color='#FF0000'>{cooldown}</font>")}</font> <br>"
|
||||
: !skillInfo.FindedEnemy ? $"<font class='fontSize-m' color='#FF0000'>{Localization.GetTranslation("hud_info_no_enemy")}</font> <br>"
|
||||
: "";
|
||||
else
|
||||
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);
|
||||
}
|
||||
|
||||
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;
|
||||
if (playerPawn?.CBodyComponent == null) return;
|
||||
|
||||
if (SkillPlayerInfo.TryGetValue(player.SteamID, out var skillInfo))
|
||||
{
|
||||
List<CCSPlayerController> enemy = Utilities.GetPlayers().FindAll(p => Instance.IsPlayerValid(p) && p.Team != player.Team && p.PawnIsAlive);
|
||||
if (enemy.Count == 0)
|
||||
{
|
||||
skillInfo.FindedEnemy = false;
|
||||
skillInfo.LastClick = DateTime.Now;
|
||||
return;
|
||||
}
|
||||
|
||||
CCSPlayerController randomEnemy = enemy[Instance.Random.Next(0, enemy.Count)];
|
||||
if (!player.IsValid || !player.PawnIsAlive || !randomEnemy.IsValid || !randomEnemy.PawnIsAlive) return;
|
||||
if (skillInfo.CanUse)
|
||||
{
|
||||
skillInfo.FindedEnemy = true;
|
||||
skillInfo.CanUse = false;
|
||||
skillInfo.Cooldown = DateTime.Now;
|
||||
TeleportPlayers(player, randomEnemy);
|
||||
}
|
||||
else
|
||||
skillInfo.LastClick = DateTime.Now;
|
||||
}
|
||||
}
|
||||
|
||||
private static void TeleportPlayers(CCSPlayerController attacker, CCSPlayerController victim)
|
||||
{
|
||||
var attackerPawn = attacker.PlayerPawn.Value;
|
||||
var victimPawn = victim.PlayerPawn.Value;
|
||||
|
||||
Vector attackerPosition = new Vector(attackerPawn.AbsOrigin.X, attackerPawn.AbsOrigin.Y, attackerPawn.AbsOrigin.Z);
|
||||
QAngle attackerAngles = new QAngle(attackerPawn.AbsRotation.X, attackerPawn.AbsRotation.Y, attackerPawn.AbsRotation.Z);
|
||||
Vector attackerVelocity = new Vector(attackerPawn.AbsVelocity.X, attackerPawn.AbsVelocity.Y, attackerPawn.AbsVelocity.Z);
|
||||
|
||||
Vector victimPosition = new Vector(victimPawn.AbsOrigin.X, victimPawn.AbsOrigin.Y, victimPawn.AbsOrigin.Z);
|
||||
QAngle victimAngles = new QAngle(victimPawn.AbsRotation.X, victimPawn.AbsRotation.Y, victimPawn.AbsRotation.Z);
|
||||
Vector victimVelocity = new Vector(victimPawn.AbsVelocity.X, victimPawn.AbsVelocity.Y, victimPawn.AbsVelocity.Z);
|
||||
|
||||
victimPawn.Teleport(attackerPosition, attackerAngles, attackerVelocity);
|
||||
attackerPawn.Teleport(victimPosition, victimAngles, victimVelocity);
|
||||
}
|
||||
|
||||
public class ZamianaMiejsc_PlayerInfo
|
||||
{
|
||||
public ulong SteamID { get; set; }
|
||||
public bool CanUse { get; set; }
|
||||
public DateTime Cooldown { get; set; }
|
||||
public DateTime LastClick { get; set; }
|
||||
public bool FindedEnemy { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,27 +1,32 @@
|
|||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using System.Numerics;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
using jRandomSkills.src.player;
|
||||
using static jRandomSkills.jRandomSkills;
|
||||
using Vector = CounterStrikeSharp.API.Modules.Utils.Vector;
|
||||
|
||||
namespace dRandomSkills
|
||||
namespace jRandomSkills
|
||||
{
|
||||
public static class Teleporter
|
||||
public class Teleporter : ISkill
|
||||
{
|
||||
public static void LoadTeleporter()
|
||||
private static Skills skillName = Skills.Teleporter;
|
||||
|
||||
public static void LoadSkill()
|
||||
{
|
||||
Utils.RegisterSkill("Teleportator", "Zamieniasz się miejscami z trafionym wrogiem", "#8A2BE2");
|
||||
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true)
|
||||
return;
|
||||
|
||||
Utils.RegisterSkill(skillName, "#8A2BE2");
|
||||
|
||||
Instance.RegisterEventHandler<EventPlayerHurt>((@event, info) =>
|
||||
{
|
||||
var victim = @event.Userid;
|
||||
var attacker = @event.Attacker;
|
||||
|
||||
if (!IsValidPlayer(victim) || !IsValidPlayer(attacker)) 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 == "Teleportator")
|
||||
if (attackerInfo?.Skill == skillName)
|
||||
{
|
||||
TeleportPlayers(attacker, victim);
|
||||
}
|
||||
|
|
@ -30,11 +35,6 @@ namespace dRandomSkills
|
|||
});
|
||||
}
|
||||
|
||||
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;
|
||||
155
jRandomSkills - SRC Files/src/player/skills/TimeManipulator.cs
Normal file
155
jRandomSkills - SRC Files/src/player/skills/TimeManipulator.cs
Normal file
|
|
@ -0,0 +1,155 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using jRandomSkills.src.player;
|
||||
using jRandomSkills.src.utils;
|
||||
using static CounterStrikeSharp.API.Core.Listeners;
|
||||
using static jRandomSkills.jRandomSkills;
|
||||
|
||||
namespace jRandomSkills
|
||||
{
|
||||
public class TimeManipulator : ISkill
|
||||
{
|
||||
private static Skills skillName = Skills.TimeManipulator;
|
||||
private static float timerCooldown = (float)(Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Cooldown);
|
||||
private static readonly Dictionary<ulong, PlayerSkillInfo> SkillPlayerInfo = new Dictionary<ulong, PlayerSkillInfo>();
|
||||
|
||||
public static void LoadSkill()
|
||||
{
|
||||
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true)
|
||||
return;
|
||||
|
||||
Utils.RegisterSkill(skillName, "#2ec761");
|
||||
|
||||
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);
|
||||
}
|
||||
});
|
||||
|
||||
Instance.AddCommand("css_useSkill", "Use Skill", (player, _) =>
|
||||
{
|
||||
if (player == null) return;
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill == skillName)
|
||||
UseSkill(player);
|
||||
});
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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;
|
||||
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;
|
||||
|
||||
Server.ExecuteCommand("host_timescale 0.1");
|
||||
Instance.AddTimer(.6f, () => Server.ExecuteCommand("host_timescale 1"));
|
||||
}
|
||||
else
|
||||
skillInfo.LastClick = DateTime.Now;
|
||||
}
|
||||
}
|
||||
|
||||
public class PlayerSkillInfo
|
||||
{
|
||||
public ulong SteamID { get; set; }
|
||||
public bool CanUse { get; set; }
|
||||
public DateTime Cooldown { get; set; }
|
||||
public DateTime LastClick { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
92
jRandomSkills - SRC Files/src/player/skills/Wallhack.cs
Normal file
92
jRandomSkills - SRC Files/src/player/skills/Wallhack.cs
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using jRandomSkills.src.player;
|
||||
using jRandomSkills.src.utils;
|
||||
using System.Drawing;
|
||||
using static jRandomSkills.jRandomSkills;
|
||||
|
||||
namespace jRandomSkills
|
||||
{
|
||||
public class Wallhack : ISkill
|
||||
{
|
||||
private static Skills skillName = Skills.Wallhack;
|
||||
private static List<CDynamicProp> glows = new List<CDynamicProp>();
|
||||
|
||||
public static void LoadSkill()
|
||||
{
|
||||
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true)
|
||||
return;
|
||||
|
||||
Utils.RegisterSkill(skillName, "#5d00ff");
|
||||
|
||||
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, @info) =>
|
||||
{
|
||||
glows.Clear();
|
||||
Instance.AddTimer(.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)
|
||||
{
|
||||
EnableSkill(player);
|
||||
}
|
||||
}
|
||||
});
|
||||
return HookResult.Continue;
|
||||
});
|
||||
}
|
||||
|
||||
public static void EnableSkill(CCSPlayerController player)
|
||||
{
|
||||
SetGlowEffectForEnemies(player);
|
||||
}
|
||||
|
||||
public static void DisableSkill(CCSPlayerController player)
|
||||
{
|
||||
foreach (var glow in glows)
|
||||
{
|
||||
glows.Remove(glow);
|
||||
glow.Remove();
|
||||
}
|
||||
}
|
||||
|
||||
private static void SetGlowEffectForEnemies(CCSPlayerController player)
|
||||
{
|
||||
foreach (var enemy in Utilities.GetPlayers().FindAll(p => p.Team != player.Team && p.PawnIsAlive))
|
||||
{
|
||||
var enemyPawn = enemy.PlayerPawn.Value;
|
||||
var modelGlow = Utilities.CreateEntityByName<CDynamicProp>("prop_dynamic");
|
||||
var modelRelay = Utilities.CreateEntityByName<CDynamicProp>("prop_dynamic");
|
||||
|
||||
if (modelGlow == null || modelRelay == null)
|
||||
return;
|
||||
|
||||
modelRelay.CBodyComponent!.SceneNode!.Owner!.Entity!.Flags = (uint)(modelRelay.CBodyComponent!.SceneNode!.Owner!.Entity!.Flags & ~(1 << 2));
|
||||
modelRelay.SetModel(enemyPawn!.CBodyComponent!.SceneNode!.GetSkeletonInstance().ModelState.ModelName);
|
||||
modelRelay.Spawnflags = 256u;
|
||||
modelRelay.RenderMode = RenderMode_t.kRenderNone;
|
||||
modelRelay.DispatchSpawn();
|
||||
|
||||
modelGlow.CBodyComponent!.SceneNode!.Owner!.Entity!.Flags = (uint)(modelGlow.CBodyComponent!.SceneNode!.Owner!.Entity!.Flags & ~(1 << 2));
|
||||
modelGlow.SetModel(enemyPawn!.CBodyComponent!.SceneNode!.GetSkeletonInstance().ModelState.ModelName);
|
||||
modelGlow.Spawnflags = 256u;
|
||||
modelGlow.Render = Color.FromArgb(1, 255, 255, 255);
|
||||
modelGlow.DispatchSpawn();
|
||||
|
||||
modelGlow.Glow.GlowColorOverride = enemy.Team == CsTeam.Terrorist ? Color.FromArgb(255, 255, 165, 0) : Color.FromArgb(255, 173, 216, 230);
|
||||
modelGlow.Glow.GlowRange = 5000;
|
||||
modelGlow.Glow.GlowTeam = (int)player.Team;
|
||||
modelGlow.Glow.GlowType = 3;
|
||||
modelGlow.Glow.GlowRangeMin = 100;
|
||||
|
||||
modelRelay.AcceptInput("FollowEntity", enemyPawn, modelRelay, "!activator");
|
||||
modelGlow.AcceptInput("FollowEntity", modelRelay, modelGlow, "!activator");
|
||||
glows.Add(modelRelay);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
224
jRandomSkills - SRC Files/src/player/skills/WeaponsSwap.cs
Normal file
224
jRandomSkills - SRC Files/src/player/skills/WeaponsSwap.cs
Normal file
|
|
@ -0,0 +1,224 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using jRandomSkills.src.player;
|
||||
using jRandomSkills.src.utils;
|
||||
using static CounterStrikeSharp.API.Core.Listeners;
|
||||
using static jRandomSkills.jRandomSkills;
|
||||
|
||||
namespace jRandomSkills
|
||||
{
|
||||
public class WeaponsSwap : ISkill
|
||||
{
|
||||
private static Skills skillName = Skills.WeaponsSwap;
|
||||
private static float timerCooldown = (float)(Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Cooldown);
|
||||
private static readonly Dictionary<ulong, PlayerSkillInfo> SkillPlayerInfo = new Dictionary<ulong, PlayerSkillInfo>();
|
||||
|
||||
private static string[] weapons = { "weapon_deagle", "weapon_revolver", "weapon_glock", "weapon_usp_silencer",
|
||||
"weapon_cz75a", "weapon_fiveseven", "weapon_p250", "weapon_tec9", "weapon_elite", "weapon_hkp2000",
|
||||
"weapon_mp9", "weapon_mac10", "weapon_bizon", "weapon_mp7", "weapon_ump45", "weapon_p90",
|
||||
"weapon_mp5sd", "weapon_famas", "weapon_galilar", "weapon_m4a4", "weapon_m4a1_silencer", "weapon_ak47",
|
||||
"weapon_aug", "weapon_sg553", "weapon_ssg08", "weapon_awp", "weapon_scar20", "weapon_g3sg1",
|
||||
"weapon_nova", "weapon_xm1014", "weapon_mag7", "weapon_sawedoff", "weapon_m249", "weapon_negev" };
|
||||
|
||||
public static void LoadSkill()
|
||||
{
|
||||
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true)
|
||||
return;
|
||||
|
||||
Utils.RegisterSkill(skillName, "#c7e03a");
|
||||
|
||||
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))
|
||||
if (skillInfo.LastClick.AddSeconds(4) >= DateTime.Now)
|
||||
UpdateHUD(player, skillInfo, true);
|
||||
else
|
||||
UpdateHUD(player, skillInfo, false);
|
||||
}
|
||||
});
|
||||
|
||||
Instance.AddCommand("css_useSkill", "Use Skill", (player, _) =>
|
||||
{
|
||||
if (player == null) return;
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill == skillName)
|
||||
UseSkill(player);
|
||||
});
|
||||
}
|
||||
|
||||
public static void EnableSkill(CCSPlayerController player)
|
||||
{
|
||||
SkillPlayerInfo[player.SteamID] = new PlayerSkillInfo
|
||||
{
|
||||
SteamID = player.SteamID,
|
||||
CanUse = true,
|
||||
Cooldown = DateTime.MinValue,
|
||||
LastClick = DateTime.MinValue,
|
||||
FindedEnemy = true,
|
||||
HaveWeapon = true,
|
||||
};
|
||||
}
|
||||
|
||||
public static void DisableSkill(CCSPlayerController player)
|
||||
{
|
||||
if (SkillPlayerInfo.ContainsKey(player.SteamID))
|
||||
SkillPlayerInfo.Remove(player.SteamID);
|
||||
}
|
||||
|
||||
private static void UpdateHUD(CCSPlayerController player, PlayerSkillInfo skillInfo, bool showInfo)
|
||||
{
|
||||
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 = "";
|
||||
|
||||
if (showInfo)
|
||||
remainingLine = cooldown != 0 ? $"<font class='fontSize-m' color='#FFFFFF'>{Localization.GetTranslation("hud_info", $"<font color='#FF0000'>{cooldown}</font>")}</font> <br>"
|
||||
: !skillInfo.FindedEnemy ? $"<font class='fontSize-m' color='#FF0000'>{Localization.GetTranslation("hud_info_no_enemy")}</font> <br>"
|
||||
: !skillInfo.HaveWeapon ? $"<font class='fontSize-m' color='#FF0000'>{Localization.GetTranslation("weaponsswap_hud_info")}</font> <br>"
|
||||
: "";
|
||||
else
|
||||
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);
|
||||
}
|
||||
|
||||
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;
|
||||
if (playerPawn?.CBodyComponent == null) return;
|
||||
|
||||
if (SkillPlayerInfo.TryGetValue(player.SteamID, out var skillInfo))
|
||||
{
|
||||
if (!player.IsValid || !player.PawnIsAlive) return;
|
||||
if (skillInfo.CanUse)
|
||||
{
|
||||
CCSPlayerController enemy = GetRandomEnemy(player);
|
||||
if (enemy == null)
|
||||
{
|
||||
skillInfo.FindedEnemy = false;
|
||||
skillInfo.LastClick = DateTime.Now;
|
||||
return;
|
||||
}
|
||||
|
||||
string[]? playerWeapon = GetWeapons(player);
|
||||
string[]? enemyWeapon = GetWeapons(enemy);
|
||||
|
||||
if (playerWeapon.FirstOrDefault(w => weapons.Contains(w)) == null)
|
||||
{
|
||||
skillInfo.FindedEnemy = true;
|
||||
skillInfo.HaveWeapon = false;
|
||||
skillInfo.LastClick = DateTime.Now;
|
||||
return;
|
||||
}
|
||||
|
||||
skillInfo.HaveWeapon = true;
|
||||
skillInfo.FindedEnemy = true;
|
||||
skillInfo.CanUse = false;
|
||||
skillInfo.Cooldown = DateTime.Now;
|
||||
|
||||
player.RemoveWeapons();
|
||||
enemy.RemoveWeapons();
|
||||
GiveWeapons(player, enemyWeapon, playerWeapon.Contains("weapon_c4"));
|
||||
GiveWeapons(enemy, playerWeapon, enemyWeapon.Contains("weapon_c4"));
|
||||
}
|
||||
else
|
||||
skillInfo.LastClick = DateTime.Now;
|
||||
}
|
||||
}
|
||||
|
||||
private static string[]? GetWeapons(CCSPlayerController player)
|
||||
{
|
||||
List<string> playerWeapons = new List<string>();
|
||||
foreach (var weapon in player.PlayerPawn.Value.WeaponServices.MyWeapons)
|
||||
playerWeapons.Add(weapon?.Value?.DesignerName);
|
||||
return playerWeapons.Count == 0 ? null : playerWeapons.ToArray();
|
||||
}
|
||||
|
||||
private static void GiveWeapons(CCSPlayerController player, string[] weapons, bool addC4)
|
||||
{
|
||||
foreach (var weapon in weapons)
|
||||
if (weapon != "weapon_c4")
|
||||
player.GiveNamedItem(weapon);
|
||||
if (addC4)
|
||||
player.GiveNamedItem("weapon_c4");
|
||||
}
|
||||
|
||||
private static CCSPlayerController GetRandomEnemy(CCSPlayerController player)
|
||||
{
|
||||
CCSPlayerController[] enemies = Utilities.GetPlayers().FindAll(e => e.Team != player.Team).ToArray();
|
||||
if (enemies.Length == 0) return null;
|
||||
return enemies[Instance.Random.Next(enemies.Length)];
|
||||
}
|
||||
|
||||
public class PlayerSkillInfo
|
||||
{
|
||||
public ulong SteamID { get; set; }
|
||||
public bool CanUse { get; set; }
|
||||
public DateTime Cooldown { get; set; }
|
||||
public DateTime LastClick { get; set; }
|
||||
public bool FindedEnemy { get; set; }
|
||||
public bool HaveWeapon { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
44
jRandomSkills - SRC Files/src/player/skills/Zeus.cs
Normal file
44
jRandomSkills - SRC Files/src/player/skills/Zeus.cs
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
using CounterStrikeSharp.API.Core;
|
||||
using jRandomSkills.src.player;
|
||||
using static jRandomSkills.jRandomSkills;
|
||||
|
||||
namespace jRandomSkills
|
||||
{
|
||||
public class Zeus : ISkill
|
||||
{
|
||||
private static Skills skillName = Skills.Zeus;
|
||||
|
||||
public static void LoadSkill()
|
||||
{
|
||||
if (Config.config.SkillsInfo.FirstOrDefault(s => s.Name == skillName.ToString())?.Active != true)
|
||||
return;
|
||||
|
||||
Utils.RegisterSkill(skillName, "#fbff00");
|
||||
|
||||
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)
|
||||
{
|
||||
var activeWeapon = player.Pawn.Value.WeaponServices.ActiveWeapon.Value;
|
||||
if (activeWeapon?.DesignerName != "weapon_taser") return HookResult.Continue;
|
||||
var taser = activeWeapon.As<CWeaponTaser>();
|
||||
Instance.AddTimer(.1f, () =>
|
||||
{
|
||||
if (taser.IsValid)
|
||||
{
|
||||
taser.LastAttackTick = 0;
|
||||
taser.FireTime = 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
153
jRandomSkills - SRC Files/src/utils/Config.cs
Normal file
153
jRandomSkills - SRC Files/src/utils/Config.cs
Normal file
|
|
@ -0,0 +1,153 @@
|
|||
using jRandomSkills.src.player;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using System.Diagnostics.Metrics;
|
||||
using static jRandomSkills.jRandomSkills;
|
||||
|
||||
namespace jRandomSkills
|
||||
{
|
||||
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("Config file does not exist. Create a new config file...");
|
||||
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($"Error when loading the config file.");
|
||||
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($"Error when saving the config file: {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 SkillInfo[] SkillsInfo = {
|
||||
new SkillInfo(Skills.None),
|
||||
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.Armored, chanceFrom : .65f, chanceTo : .85f),
|
||||
new SkillInfo(Skills.Aimbot, only1v1: true),
|
||||
new SkillInfo(Skills.Retreat, cooldown: 15),
|
||||
new SkillInfo(Skills.EnemySpawn, cooldown: 15),
|
||||
new SkillInfo(Skills.Zeus),
|
||||
new SkillInfo(Skills.RadarHack),
|
||||
new SkillInfo(Skills.QuickShot),
|
||||
new SkillInfo(Skills.Planter, team: 2),
|
||||
new SkillInfo(Skills.Silent),
|
||||
new SkillInfo(Skills.KillerFlash),
|
||||
new SkillInfo(Skills.TimeManipulator, cooldown: 30),
|
||||
new SkillInfo(Skills.GodMode, cooldown: 30),
|
||||
new SkillInfo(Skills.RandomWeapon, cooldown: 15),
|
||||
new SkillInfo(Skills.WeaponsSwap, cooldown: 30),
|
||||
new SkillInfo(Skills.Wallhack),
|
||||
new SkillInfo(Skills.Flash, chanceFrom : 1.2f, chanceTo : 3.0f),
|
||||
new SkillInfo(Skills.PawelJumper),
|
||||
new SkillInfo(Skills.BunnyHop),
|
||||
new SkillInfo(Skills.Impostor),
|
||||
new SkillInfo(Skills.OneShot),
|
||||
new SkillInfo(Skills.Muhammed),
|
||||
new SkillInfo(Skills.RichBoy),
|
||||
new SkillInfo(Skills.Rambo),
|
||||
new SkillInfo(Skills.Medic),
|
||||
new SkillInfo(Skills.Ghost),
|
||||
new SkillInfo(Skills.Chicken),
|
||||
new SkillInfo(Skills.Astronaut, chanceFrom : .1f, chanceTo : .7f),
|
||||
new SkillInfo(Skills.Disarmament, chanceFrom: .2f, chanceTo: .4f),
|
||||
new SkillInfo(Skills.AntyFlash),
|
||||
new SkillInfo(Skills.Behind, chanceFrom: .2f, chanceTo: .4f),
|
||||
new SkillInfo(Skills.InfiniteAmmo),
|
||||
new SkillInfo(Skills.Catapult, chanceFrom : .2f, chanceTo : .4f),
|
||||
new SkillInfo(Skills.Dracula),
|
||||
new SkillInfo(Skills.Teleporter),
|
||||
new SkillInfo(Skills.Saper),
|
||||
new SkillInfo(Skills.Phoenix, chanceFrom: .2f, chanceTo: .4f),
|
||||
new SkillInfo(Skills.Pilot),
|
||||
new SkillInfo(Skills.Shade),
|
||||
new SkillInfo(Skills.AntyHead),
|
||||
};
|
||||
}
|
||||
|
||||
public class Settings
|
||||
{
|
||||
public string LangCode { get; set; } = "en";
|
||||
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;
|
||||
public bool SummaryAfterTheRound { get; set; } = true;
|
||||
}
|
||||
|
||||
public class SkillInfo
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public bool Active { get; set; }
|
||||
public float Cooldown { get; set; }
|
||||
public float ChanceFrom { get; set; }
|
||||
public float ChanceTo { get; set; }
|
||||
public int Team { get; set; }
|
||||
public bool Only1v1 { get; set; }
|
||||
|
||||
public SkillInfo(Skills skill, bool active = true, float cooldown = 15f, float chanceFrom = 1, float chanceTo = 1, int team = 1, bool only1v1 = false)
|
||||
{
|
||||
Name = skill.ToString();
|
||||
Active = active;
|
||||
Cooldown = cooldown;
|
||||
ChanceFrom = chanceFrom;
|
||||
ChanceTo = chanceTo;
|
||||
Team = team;
|
||||
Only1v1 = only1v1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,9 +1,10 @@
|
|||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Commands;
|
||||
using CounterStrikeSharp.API.Modules.Commands.Targeting;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
using jRandomSkills.src.utils;
|
||||
using static jRandomSkills.jRandomSkills;
|
||||
|
||||
namespace dRandomSkills;
|
||||
namespace jRandomSkills;
|
||||
|
||||
public class FindTarget
|
||||
{
|
||||
|
|
@ -26,14 +27,14 @@ public class FindTarget
|
|||
{
|
||||
if (!ignoreMessage)
|
||||
{
|
||||
command.ReplyToCommand("Nie znaleziono pasującego gracza.");
|
||||
command.ReplyToCommand(Localization.GetTranslation("no_player"));
|
||||
}
|
||||
|
||||
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.");
|
||||
command.ReplyToCommand(Localization.GetTranslation("duplicate_player"));
|
||||
return (new List<CCSPlayerController>(), string.Empty);
|
||||
}
|
||||
|
||||
57
jRandomSkills - SRC Files/src/utils/Localization.cs
Normal file
57
jRandomSkills - SRC Files/src/utils/Localization.cs
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace jRandomSkills.src.utils
|
||||
{
|
||||
public static class Localization
|
||||
{
|
||||
private static readonly string path = Path.Combine(jRandomSkills.Instance.ModuleDirectory, "lang");
|
||||
private static readonly Dictionary<string, Dictionary<string, string>> _translations = new Dictionary<string, Dictionary<string, string>>();
|
||||
private static string langCode = "pl";
|
||||
|
||||
public static void Load()
|
||||
{
|
||||
_translations.Clear();
|
||||
SetLangCode();
|
||||
LoadAllLanguages();
|
||||
}
|
||||
|
||||
private static void SetLangCode()
|
||||
{
|
||||
langCode = Config.config.Settings.LangCode;
|
||||
}
|
||||
|
||||
private static void LoadAllLanguages()
|
||||
{
|
||||
if (!Directory.Exists(path))
|
||||
return;
|
||||
|
||||
foreach (var file in Directory.GetFiles(path, "*.json"))
|
||||
LoadLanguage(file);
|
||||
}
|
||||
|
||||
private static void LoadLanguage(string langPath)
|
||||
{
|
||||
if (!File.Exists(langPath))
|
||||
return;
|
||||
|
||||
var code = Path.GetFileNameWithoutExtension(langPath);
|
||||
var jsonText = File.ReadAllText(langPath);
|
||||
var translations = JsonSerializer.Deserialize<Dictionary<string, string>>(jsonText);
|
||||
|
||||
if (translations != null)
|
||||
_translations[code] = translations;
|
||||
}
|
||||
|
||||
public static string GetTranslation(string key, params object[] args)
|
||||
{
|
||||
if (_translations.TryGetValue(langCode, out var langDict) && langDict.TryGetValue(key, out var translation))
|
||||
if (args.Length != 0 && args[0] == "welcome")
|
||||
return translation;
|
||||
else
|
||||
return string.Format(translation, args).Replace("CHATCOLORS.RED", ChatColors.Red.ToString());
|
||||
|
||||
return key;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,22 +1,22 @@
|
|||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using System.Diagnostics;
|
||||
using jRandomSkills.src.player;
|
||||
|
||||
namespace dRandomSkills
|
||||
namespace jRandomSkills
|
||||
{
|
||||
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}");
|
||||
player.PrintToChat($" {ChatColors.DarkRed}► {ChatColors.Green}[{ChatColors.DarkRed} jRadnomSkills {ChatColors.Green}] {checkIcon} {msg}");
|
||||
}
|
||||
|
||||
public static void RegisterSkill(string name, string description, string color, bool display = true)
|
||||
public static void RegisterSkill(Skills skill, string color, bool display = true)
|
||||
{
|
||||
if (!SkillData.Skills.Any(skill => skill.Name == name))
|
||||
if (!SkillData.Skills.Any(s => s.Skill == skill))
|
||||
{
|
||||
SkillData.Skills.Add(new dSkill_SkillInfo(name, description, color, display));
|
||||
SkillData.Skills.Add(new dSkill_SkillInfo(skill, color, display));
|
||||
}
|
||||
}
|
||||
}
|
||||
408
jRandomSkills - Server Files/plugins/dRandomSkills/Config.json
Normal file
408
jRandomSkills - Server Files/plugins/dRandomSkills/Config.json
Normal file
|
|
@ -0,0 +1,408 @@
|
|||
{
|
||||
"SkillsInfo": [
|
||||
{
|
||||
"Name": "None",
|
||||
"Active": true,
|
||||
"Cooldown": 15.0,
|
||||
"ChanceFrom": 1.0,
|
||||
"ChanceTo": 1.0,
|
||||
"Team": 1,
|
||||
"Only1v1": false
|
||||
},
|
||||
{
|
||||
"Name": "Dwarf",
|
||||
"Active": true,
|
||||
"Cooldown": 15.0,
|
||||
"ChanceFrom": 0.6,
|
||||
"ChanceTo": 0.95,
|
||||
"Team": 1,
|
||||
"Only1v1": false
|
||||
},
|
||||
{
|
||||
"Name": "SwapPosition",
|
||||
"Active": true,
|
||||
"Cooldown": 30.0,
|
||||
"ChanceFrom": 1.0,
|
||||
"ChanceTo": 1.0,
|
||||
"Team": 1,
|
||||
"Only1v1": false
|
||||
},
|
||||
{
|
||||
"Name": "FrozenDecoy",
|
||||
"Active": true,
|
||||
"Cooldown": 15.0,
|
||||
"ChanceFrom": 1.0,
|
||||
"ChanceTo": 1.0,
|
||||
"Team": 1,
|
||||
"Only1v1": false
|
||||
},
|
||||
{
|
||||
"Name": "Soldier",
|
||||
"Active": true,
|
||||
"Cooldown": 15.0,
|
||||
"ChanceFrom": 1.0,
|
||||
"ChanceTo": 1.0,
|
||||
"Team": 1,
|
||||
"Only1v1": false
|
||||
},
|
||||
{
|
||||
"Name": "Armored",
|
||||
"Active": true,
|
||||
"Cooldown": 15.0,
|
||||
"ChanceFrom": 0.65,
|
||||
"ChanceTo": 0.85,
|
||||
"Team": 1,
|
||||
"Only1v1": false
|
||||
},
|
||||
{
|
||||
"Name": "Aimbot",
|
||||
"Active": true,
|
||||
"Cooldown": 15.0,
|
||||
"ChanceFrom": 1.0,
|
||||
"ChanceTo": 1.0,
|
||||
"Team": 1,
|
||||
"Only1v1": true
|
||||
},
|
||||
{
|
||||
"Name": "Retreat",
|
||||
"Active": true,
|
||||
"Cooldown": 15.0,
|
||||
"ChanceFrom": 1.0,
|
||||
"ChanceTo": 1.0,
|
||||
"Team": 1,
|
||||
"Only1v1": false
|
||||
},
|
||||
{
|
||||
"Name": "EnemySpawn",
|
||||
"Active": true,
|
||||
"Cooldown": 15.0,
|
||||
"ChanceFrom": 1.0,
|
||||
"ChanceTo": 1.0,
|
||||
"Team": 1,
|
||||
"Only1v1": false
|
||||
},
|
||||
{
|
||||
"Name": "Zeus",
|
||||
"Active": true,
|
||||
"Cooldown": 15.0,
|
||||
"ChanceFrom": 1.0,
|
||||
"ChanceTo": 1.0,
|
||||
"Team": 1,
|
||||
"Only1v1": false
|
||||
},
|
||||
{
|
||||
"Name": "RadarHack",
|
||||
"Active": true,
|
||||
"Cooldown": 15.0,
|
||||
"ChanceFrom": 1.0,
|
||||
"ChanceTo": 1.0,
|
||||
"Team": 1,
|
||||
"Only1v1": false
|
||||
},
|
||||
{
|
||||
"Name": "QuickShot",
|
||||
"Active": true,
|
||||
"Cooldown": 15.0,
|
||||
"ChanceFrom": 1.0,
|
||||
"ChanceTo": 1.0,
|
||||
"Team": 1,
|
||||
"Only1v1": false
|
||||
},
|
||||
{
|
||||
"Name": "Planter",
|
||||
"Active": true,
|
||||
"Cooldown": 15.0,
|
||||
"ChanceFrom": 1.0,
|
||||
"ChanceTo": 1.0,
|
||||
"Team": 2,
|
||||
"Only1v1": false
|
||||
},
|
||||
{
|
||||
"Name": "Silent",
|
||||
"Active": true,
|
||||
"Cooldown": 15.0,
|
||||
"ChanceFrom": 1.0,
|
||||
"ChanceTo": 1.0,
|
||||
"Team": 1,
|
||||
"Only1v1": false
|
||||
},
|
||||
{
|
||||
"Name": "KillerFlash",
|
||||
"Active": true,
|
||||
"Cooldown": 15.0,
|
||||
"ChanceFrom": 1.0,
|
||||
"ChanceTo": 1.0,
|
||||
"Team": 1,
|
||||
"Only1v1": false
|
||||
},
|
||||
{
|
||||
"Name": "TimeManipulator",
|
||||
"Active": true,
|
||||
"Cooldown": 30.0,
|
||||
"ChanceFrom": 1.0,
|
||||
"ChanceTo": 1.0,
|
||||
"Team": 1,
|
||||
"Only1v1": false
|
||||
},
|
||||
{
|
||||
"Name": "GodMode",
|
||||
"Active": true,
|
||||
"Cooldown": 30.0,
|
||||
"ChanceFrom": 1.0,
|
||||
"ChanceTo": 1.0,
|
||||
"Team": 1,
|
||||
"Only1v1": false
|
||||
},
|
||||
{
|
||||
"Name": "RandomWeapon",
|
||||
"Active": true,
|
||||
"Cooldown": 15.0,
|
||||
"ChanceFrom": 1.0,
|
||||
"ChanceTo": 1.0,
|
||||
"Team": 1,
|
||||
"Only1v1": false
|
||||
},
|
||||
{
|
||||
"Name": "WeaponsSwap",
|
||||
"Active": true,
|
||||
"Cooldown": 30.0,
|
||||
"ChanceFrom": 1.0,
|
||||
"ChanceTo": 1.0,
|
||||
"Team": 1,
|
||||
"Only1v1": false
|
||||
},
|
||||
{
|
||||
"Name": "Wallhack",
|
||||
"Active": true,
|
||||
"Cooldown": 15.0,
|
||||
"ChanceFrom": 1.0,
|
||||
"ChanceTo": 1.0,
|
||||
"Team": 1,
|
||||
"Only1v1": false
|
||||
},
|
||||
{
|
||||
"Name": "Flash",
|
||||
"Active": true,
|
||||
"Cooldown": 15.0,
|
||||
"ChanceFrom": 1.2,
|
||||
"ChanceTo": 3.0,
|
||||
"Team": 1,
|
||||
"Only1v1": false
|
||||
},
|
||||
{
|
||||
"Name": "PawelJumper",
|
||||
"Active": true,
|
||||
"Cooldown": 15.0,
|
||||
"ChanceFrom": 1.0,
|
||||
"ChanceTo": 1.0,
|
||||
"Team": 1,
|
||||
"Only1v1": false
|
||||
},
|
||||
{
|
||||
"Name": "BunnyHop",
|
||||
"Active": true,
|
||||
"Cooldown": 15.0,
|
||||
"ChanceFrom": 1.0,
|
||||
"ChanceTo": 1.0,
|
||||
"Team": 1,
|
||||
"Only1v1": false
|
||||
},
|
||||
{
|
||||
"Name": "Impostor",
|
||||
"Active": true,
|
||||
"Cooldown": 15.0,
|
||||
"ChanceFrom": 1.0,
|
||||
"ChanceTo": 1.0,
|
||||
"Team": 1,
|
||||
"Only1v1": false
|
||||
},
|
||||
{
|
||||
"Name": "OneShot",
|
||||
"Active": true,
|
||||
"Cooldown": 15.0,
|
||||
"ChanceFrom": 1.0,
|
||||
"ChanceTo": 1.0,
|
||||
"Team": 1,
|
||||
"Only1v1": false
|
||||
},
|
||||
{
|
||||
"Name": "Muhammed",
|
||||
"Active": true,
|
||||
"Cooldown": 15.0,
|
||||
"ChanceFrom": 1.0,
|
||||
"ChanceTo": 1.0,
|
||||
"Team": 1,
|
||||
"Only1v1": false
|
||||
},
|
||||
{
|
||||
"Name": "RichBoy",
|
||||
"Active": true,
|
||||
"Cooldown": 15.0,
|
||||
"ChanceFrom": 1.0,
|
||||
"ChanceTo": 1.0,
|
||||
"Team": 1,
|
||||
"Only1v1": false
|
||||
},
|
||||
{
|
||||
"Name": "Rambo",
|
||||
"Active": true,
|
||||
"Cooldown": 15.0,
|
||||
"ChanceFrom": 1.0,
|
||||
"ChanceTo": 1.0,
|
||||
"Team": 1,
|
||||
"Only1v1": false
|
||||
},
|
||||
{
|
||||
"Name": "Medic",
|
||||
"Active": true,
|
||||
"Cooldown": 15.0,
|
||||
"ChanceFrom": 1.0,
|
||||
"ChanceTo": 1.0,
|
||||
"Team": 1,
|
||||
"Only1v1": false
|
||||
},
|
||||
{
|
||||
"Name": "Ghost",
|
||||
"Active": true,
|
||||
"Cooldown": 15.0,
|
||||
"ChanceFrom": 1.0,
|
||||
"ChanceTo": 1.0,
|
||||
"Team": 1,
|
||||
"Only1v1": false
|
||||
},
|
||||
{
|
||||
"Name": "Chicken",
|
||||
"Active": true,
|
||||
"Cooldown": 15.0,
|
||||
"ChanceFrom": 1.0,
|
||||
"ChanceTo": 1.0,
|
||||
"Team": 1,
|
||||
"Only1v1": false
|
||||
},
|
||||
{
|
||||
"Name": "Astronaut",
|
||||
"Active": true,
|
||||
"Cooldown": 15.0,
|
||||
"ChanceFrom": 0.1,
|
||||
"ChanceTo": 0.7,
|
||||
"Team": 1,
|
||||
"Only1v1": false
|
||||
},
|
||||
{
|
||||
"Name": "Disarmament",
|
||||
"Active": true,
|
||||
"Cooldown": 15.0,
|
||||
"ChanceFrom": 0.2,
|
||||
"ChanceTo": 0.4,
|
||||
"Team": 1,
|
||||
"Only1v1": false
|
||||
},
|
||||
{
|
||||
"Name": "AntyFlash",
|
||||
"Active": true,
|
||||
"Cooldown": 15.0,
|
||||
"ChanceFrom": 1.0,
|
||||
"ChanceTo": 1.0,
|
||||
"Team": 1,
|
||||
"Only1v1": false
|
||||
},
|
||||
{
|
||||
"Name": "Behind",
|
||||
"Active": true,
|
||||
"Cooldown": 15.0,
|
||||
"ChanceFrom": 0.2,
|
||||
"ChanceTo": 0.4,
|
||||
"Team": 1,
|
||||
"Only1v1": false
|
||||
},
|
||||
{
|
||||
"Name": "InfiniteAmmo",
|
||||
"Active": true,
|
||||
"Cooldown": 15.0,
|
||||
"ChanceFrom": 1.0,
|
||||
"ChanceTo": 1.0,
|
||||
"Team": 1,
|
||||
"Only1v1": false
|
||||
},
|
||||
{
|
||||
"Name": "Catapult",
|
||||
"Active": true,
|
||||
"Cooldown": 15.0,
|
||||
"ChanceFrom": 0.2,
|
||||
"ChanceTo": 0.4,
|
||||
"Team": 1,
|
||||
"Only1v1": false
|
||||
},
|
||||
{
|
||||
"Name": "Dracula",
|
||||
"Active": true,
|
||||
"Cooldown": 15.0,
|
||||
"ChanceFrom": 1.0,
|
||||
"ChanceTo": 1.0,
|
||||
"Team": 1,
|
||||
"Only1v1": false
|
||||
},
|
||||
{
|
||||
"Name": "Teleporter",
|
||||
"Active": true,
|
||||
"Cooldown": 15.0,
|
||||
"ChanceFrom": 1.0,
|
||||
"ChanceTo": 1.0,
|
||||
"Team": 1,
|
||||
"Only1v1": false
|
||||
},
|
||||
{
|
||||
"Name": "Saper",
|
||||
"Active": true,
|
||||
"Cooldown": 15.0,
|
||||
"ChanceFrom": 1.0,
|
||||
"ChanceTo": 1.0,
|
||||
"Team": 1,
|
||||
"Only1v1": false
|
||||
},
|
||||
{
|
||||
"Name": "Phoenix",
|
||||
"Active": true,
|
||||
"Cooldown": 15.0,
|
||||
"ChanceFrom": 0.2,
|
||||
"ChanceTo": 0.4,
|
||||
"Team": 1,
|
||||
"Only1v1": false
|
||||
},
|
||||
{
|
||||
"Name": "Pilot",
|
||||
"Active": true,
|
||||
"Cooldown": 15.0,
|
||||
"ChanceFrom": 1.0,
|
||||
"ChanceTo": 1.0,
|
||||
"Team": 1,
|
||||
"Only1v1": false
|
||||
},
|
||||
{
|
||||
"Name": "Shade",
|
||||
"Active": true,
|
||||
"Cooldown": 15.0,
|
||||
"ChanceFrom": 1.0,
|
||||
"ChanceTo": 1.0,
|
||||
"Team": 1,
|
||||
"Only1v1": false
|
||||
},
|
||||
{
|
||||
"Name": "AntyHead",
|
||||
"Active": true,
|
||||
"Cooldown": 15.0,
|
||||
"ChanceFrom": 1.0,
|
||||
"ChanceTo": 1.0,
|
||||
"Team": 1,
|
||||
"Only1v1": false
|
||||
}
|
||||
],
|
||||
"Settings": {
|
||||
"LangCode": "en",
|
||||
"Set_Skill": "ustawskill, setskill",
|
||||
"SkillsList_Menu": "supermoc, skille, listamocy, supermoce, losowemoce",
|
||||
"KillerSkillInfo": true,
|
||||
"TeamMateSkillInfo": true,
|
||||
"SummaryAfterTheRound": true
|
||||
}
|
||||
}
|
||||
Binary file not shown.
127
jRandomSkills - Server Files/plugins/dRandomSkills/lang/en.json
Normal file
127
jRandomSkills - Server Files/plugins/dRandomSkills/lang/en.json
Normal file
|
|
@ -0,0 +1,127 @@
|
|||
{
|
||||
"none_desc": "You have no skills",
|
||||
"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",
|
||||
"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",
|
||||
"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",
|
||||
"ghost_desc": "You are completely invisible",
|
||||
"flash_desc": "Random player speed at the beginning of the round",
|
||||
"flash_desc2": "Your speed multiplier is {0}x",
|
||||
"godmode_desc": "You are immortal for 2 seconds. Press [css_useSkill], cooldown 30s",
|
||||
"godmode_on": "Immortality enabled",
|
||||
"godmode_off": "Immortality disabled",
|
||||
"armored_desc": "You have a random damage taken multiplier",
|
||||
"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",
|
||||
"dwarf_desc2": "Your size multiplier is {0}x",
|
||||
"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",
|
||||
"chicken_desc": "You get a chicken model + 10% faster movement - 50 HP",
|
||||
"impostor_desc": "You start the round with an enemy player model",
|
||||
"catapult_desc": "You have a random chance to launch an enemy upwards",
|
||||
"catapult_desc2": "Your chance to launch an enemy on hit is: {0}%",
|
||||
"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}%",
|
||||
"retreat_desc": "Return to spawn. Press [css_useSkill], cooldown 15s",
|
||||
"oneshot_desc": "Hitting an enemy instantly kills them",
|
||||
"paweljumper_desc": "You get an extra jump",
|
||||
"phoenix_desc": "You have a random chance to respawn after death",
|
||||
"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",
|
||||
"pilot_desc": "Fly for a limited time. Hold [USE - E] to fly",
|
||||
"pilot_hud_info": "Recharging",
|
||||
"radarhack_desc": "You can see enemies on the radar",
|
||||
"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",
|
||||
"disarmament_desc2": "Your chance to disarm an enemy is: {0}%",
|
||||
"planter_desc": "You can plant the bomb anywhere; bomb detonation time is 60s",
|
||||
"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",
|
||||
"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)",
|
||||
"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",
|
||||
"zeus_desc": "Zeus x27 instantly recharges",
|
||||
"frozendecoy_desc": "Your decoy grenade freezes all nearby players",
|
||||
"antyhead_desc": "You receive no headshot damage",
|
||||
"soldier_desc": "You have a random damage multiplier",
|
||||
"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}",
|
||||
"hud_info": "Wait {0} seconds",
|
||||
"no_player": "No player found.",
|
||||
"duplicate_player": "More than one player found with the same name.",
|
||||
"drawing_skill": "Drawing a skill",
|
||||
"your_skill": "Your current skill",
|
||||
"summary_start": "======SUMMARY=OF=THE=LAST=ROUND======",
|
||||
"summary_end": "=======================================",
|
||||
"enemy_skill": "Enemy's skill",
|
||||
"teammate_skills": "Your teammates' skills",
|
||||
"observer_skill": "Player's power",
|
||||
"game_start": "Game started!",
|
||||
"invalid_map": "Invalid map name!",
|
||||
"loading_map": "Loading a new map",
|
||||
"skills_menu": "Skill List",
|
||||
"correct_form_setskill": "Correct usage: CHATCOLORS.RED!setskill <nickname> <skill>",
|
||||
"skill_not_found_setskill": "Skill CHATCOLORS.REDnot found",
|
||||
"error_setskill": "Failed to set CHATCOLORS.REDskill",
|
||||
"done_setskill": "Skill set",
|
||||
"for_setskill": "for",
|
||||
|
||||
"none": "None",
|
||||
"dwarf": "Dwarf",
|
||||
"swapposition": "Swapper",
|
||||
"killerflash": "Deadly Flash",
|
||||
"soldier": "Soldier",
|
||||
"armored": "Tank",
|
||||
"aimbot": "Aimbot",
|
||||
"retreat": "Retreat",
|
||||
"enemyspawn": "Enemy Spawn",
|
||||
"zeus": "Zeus",
|
||||
"radarhack": "Radar Hack",
|
||||
"quickshot": "Quick-Shot",
|
||||
"planter": "Planter",
|
||||
"silent": "Silent Shadow",
|
||||
"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": "Saper",
|
||||
"phoenix": "Phoenix",
|
||||
"pilot": "Pilot",
|
||||
"shade": "Shade",
|
||||
"antyhead": "Anty Head"
|
||||
}
|
||||
127
jRandomSkills - Server Files/plugins/dRandomSkills/lang/pl.json
Normal file
127
jRandomSkills - Server Files/plugins/dRandomSkills/lang/pl.json
Normal file
|
|
@ -0,0 +1,127 @@
|
|||
{
|
||||
"none_desc": "Nie posiadasz żadnej supermocy",
|
||||
"aimbot_desc": "Każdy twój trafiony pocisk jest liczony jako głowa",
|
||||
"antyflash_desc": "Posiadasz odporność na flashe i 7 sekund trwają twoje flash'e",
|
||||
"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",
|
||||
"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ń",
|
||||
"ghost_desc": "Jesteś całkowicie niewidzialny",
|
||||
"flash_desc": "Losowa prędkośc postaci na początku rundy",
|
||||
"flash_desc2": "Twój mnożnik prędkości to {0}x",
|
||||
"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_desc": "Masz losowy mnożnik otrzymywanych obrażeń",
|
||||
"armored_desc2": "Twój mnożnik otrzymywanych obrażeń wynosi: {0}x",
|
||||
"muhammed_desc": "Po śmierci wybucha i zabija graczy w obrębie",
|
||||
"dwarf_desc": "Losowa wielkość postaci na początku rundy",
|
||||
"dwarf_desc2": "Twój mnożnik wielkości to {0}x",
|
||||
"medic_desc": "Otrzymujesz losową ilość apteczek na start rundy",
|
||||
"randomweapon_desc": "Dostajesz losową broń. Kliknij [css_useSkill], cooldown 15s",
|
||||
"chicken_desc": "Otrzymujesz model kurczaka + jesteś o 10% szybszy - 50hp",
|
||||
"impostor_desc": "Otrzymujesz na start rundy model postaci wroga",
|
||||
"catapult_desc": "Masz losową szanse na podrzucenie wroga",
|
||||
"catapult_desc2": "Twoje szanse na podrzucenie wroga po trafieniu to: {0}%",
|
||||
"infiniteammo_desc": "Otrzymujesz nieskończoną ilość ammo do wszystkich swoich broni",
|
||||
"behind_desc": "Masz losową szanse na obrócenie wroga o 180 stopni po trafieniu",
|
||||
"behind_desc2": "Twoje szanse na obrócenie wroga po trafieniu to: {0}%",
|
||||
"retreat_desc": "Powrót na spawna. Kliknij [css_useSkill], cooldown 15s",
|
||||
"oneshot_desc": "Po trafieniu od razu zabija przeciwnika",
|
||||
"paweljumper_desc": "Otrzymujesz dodatkowy skok",
|
||||
"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",
|
||||
"pilot_desc": "Latanie przez określony czas. Przytrzymaj [USE - E], aby latać",
|
||||
"pilot_hud_info": "W trakcie odnawiania",
|
||||
"radarhack_desc": "Widzisz wrogów na radarze",
|
||||
"rambo_desc": "Otrzymujesz losową ilość zdrowia na start rundy",
|
||||
"enemyspawn_desc": "Teleportacja na spawn wroga. Kliknij [css_useSkill], cooldown 15s",
|
||||
"disarmament_desc": "Masz losową szanse na wyrzucenie broni wroga po trafieniu",
|
||||
"disarmament_desc2": "Twoje szanse na wyrzucenie broni wroga to: {0}%",
|
||||
"planter_desc": "Możesz podłożyć bombę w dowolnym miejscu, czas detonacji bomby trwa 60s",
|
||||
"saper_desc": "Możesz szybciej podłożyć bombę oraz ją zdefować",
|
||||
"timemanipulator_desc": "Spowolnienie czasu dla wszystkich na 6 sekundy. Kliknij [css_useSkill], cooldown 30s",
|
||||
"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)",
|
||||
"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",
|
||||
"zeus_desc": "Zeus x27 natychmiastowo się odnawia",
|
||||
"frozendecoy_desc": "Twój decoy zamraża wszystkich pobliskich graczy",
|
||||
"antyhead_desc": "Nie otrzymujesz obrażeń w głowę",
|
||||
"soldier_desc": "Masz losowy mnożnik obrażeń",
|
||||
"soldier_desc2": "Twój mnożnik obrażeń wynosi: {0}x",
|
||||
"swapposition_desc": "Zamiana miejscami z losowym wrogiem. Kliknij [css_useSkill], cooldown 30s",
|
||||
|
||||
"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",
|
||||
"no_player": "Nie znaleziono pasującego gracza.",
|
||||
"duplicate_player": "Znaleziono więcej niż jednego gracza o tej samej nazwie.",
|
||||
"drawing_skill": "Losowanie mocy",
|
||||
"your_skill": "Twoja aktualna moc",
|
||||
"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>",
|
||||
"skill_not_found_setskill": "Nie znaleziono takiej CHATCOLORS.REDsupermocy",
|
||||
"error_setskill": "Nie udało się ustawić CHATCOLORS.REDsupermocy",
|
||||
"done_setskill": "Ustawiono Supermoc",
|
||||
"for_setskill": "dla",
|
||||
|
||||
"none": "Brak",
|
||||
"dwarf": "MiniMajk",
|
||||
"swapoosition": "Zamiana Miejsc",
|
||||
"killerflash": "Zabójczy Flash",
|
||||
"soldier": "Żołnierz",
|
||||
"armored": "Gruby",
|
||||
"aimbot": "Aimbot",
|
||||
"retreat": "Odwrót",
|
||||
"enemyspawn": "Resp Wroga",
|
||||
"zeus": "Zeus",
|
||||
"radarhack": "Radarowiec",
|
||||
"quickshot": "Szybkostrzelność",
|
||||
"planter": "Samowolka",
|
||||
"silent": "Cichociemny",
|
||||
"frozendecoy": "Zamrażający Decoy",
|
||||
"timemanipulator": "Spowlnienie Czasu",
|
||||
"godmode": "Nieśmiertelność",
|
||||
"randomweapon": "Losowa Broń",
|
||||
"weaponsswap": "Zamiana Broni",
|
||||
"wallhack": "Wallhack",
|
||||
"flash": "Flash",
|
||||
"paweljumper": "Pawel Jumper",
|
||||
"bunnyhop": "Królik",
|
||||
"impostor": "Szpieg",
|
||||
"oneshot": "Jednostrzałowiec",
|
||||
"muhammed": "Muhammed",
|
||||
"richboy": "Bogacz",
|
||||
"rambo": "Rambo",
|
||||
"medic": "Medyk",
|
||||
"ghost": "Duszek",
|
||||
"chicken": "Kurczak",
|
||||
"astronaut": "Astronauta",
|
||||
"disarmament": "Rozbrojenie",
|
||||
"antyflash": "Anty Flash",
|
||||
"behind": "Obrót Wroga",
|
||||
"infiniteammo": "Nieskończone Ammo",
|
||||
"catapult": "Katapulta",
|
||||
"dracula": "Drakula",
|
||||
"teleporter": "Teleporter",
|
||||
"saper": "Saper",
|
||||
"phoenix": "Phoenix",
|
||||
"pilot": "Pilot",
|
||||
"shade": "Cień",
|
||||
"antyhead": "Żelazna Głowa"
|
||||
}
|
||||
97
readme.md
Normal file
97
readme.md
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
# 🤔 Opis
|
||||
##### Link do [orginalnego projektu](https://github.com/Juzlus/dRandomSkills) stworzonego przez [jakubbartosik](https://github.com/jakubbartosik).
|
||||
|
||||
## ✨ Aktualne moce (26)
|
||||
- **MiniMajk:** Losowa wielkość postaci na początku rundy (0.6 - 0.95)
|
||||
- **ZamianaMiejsc:** Zamiana miejscami z losowym wrogiem. Kliknij [USE - E], cooldown 30s
|
||||
- **Flash:** Losowa prędkośc postaci na początku rundy (1.2 - 3.0)
|
||||
- **PawelJumper:** Otrzymujesz dodatkowy skok
|
||||
- **BunnyHop:** Otrzymujesz auto "BunnyHopa"
|
||||
- **Impostor:** Otrzymujesz na start rundy model postaci wroga
|
||||
- **OneShot:** Po trafieniu od razu zabija przeciwnika
|
||||
- **Muhammed:** Po śmierci wybucha i zabija graczy w obrębie
|
||||
- **Bogacz:** Otrzymujesz losową ilość kasy na start rundy (+5000 - +14999)
|
||||
- **Rambo:** Otrzymujesz losową ilość zdrowia na start rundy (+50 - +500)
|
||||
- **Medyk:** Otrzymujesz losową ilość apteczek na start rundy (1 - 4)
|
||||
- **Duszek:** Jesteś całkowicie niewidzialny
|
||||
- **Kurczak:** Otrzymujesz model kurczaka + jesteś o 10% szybszy - 50hp
|
||||
- **Astronauta:** Otrzymujesz losową ilość grawitacji na start rundy (0.1 - 0.7)x
|
||||
- **Rozbrojenie:** Masz losową szanse na wyrzucenie broni wroga po trafieniu (20% - 40%)
|
||||
- **AntyFlash:** Posiadasz odporność na flashe i 7 sekund trwają twoje flash'e
|
||||
- **ObrotWroga:** Masz losową szanse na obrócenie wroga o 180 stopni po trafieniu (20% - 40%)
|
||||
- **NieskonczoneAmmo:** Otrzymujesz nieskończoną ilość ammo do wszystkich swoich broni
|
||||
- **Katapulta:** Masz losową szanse na podrzucenie wroga (20% - 40%)
|
||||
- **Drakula:** Po trafieniu ofiary otrzymujesz zwrot zdrowia w postaci danego procentu zadanych obrażeń (0.3x)
|
||||
- **Teleporter:** Zamieniasz się miejscami z trafionym wrogiem
|
||||
- **Saper:** Możesz szybciej podłożyć bombę oraz ją zdefować
|
||||
- **Phoenix:** Masz losową szans na odrodzenie się po śmierci
|
||||
- **Pilot:** Latanie przez określony czas. Przytrzymaj [USE - E], aby latać
|
||||
- **Cien:** Teleportujesz się za plecy trafionego wroga
|
||||
- **ZelaznaGlowa:** Nie otrzymujesz obrażeń w głowę
|
||||
|
||||
## 💻 Instalacja
|
||||
|
||||
|
||||
## 📋 Lista zmian
|
||||
|
||||
### v1.0.3 (by Juzlus)
|
||||
- #### Poprawki mocy:
|
||||
- ##### Saper:
|
||||
- ###### Naprawiono bład z natychmiastowym podkładaniem bomby jak ktokolwiek na serwerze miał moc 'Saper'.
|
||||
|
||||
### v1.0.2 (by Juzlus)
|
||||
- #### Nowe moce:
|
||||
- ##### MiniMajk:
|
||||
- ###### Losowa wielkość postaci w przedziale (60% - 95%).
|
||||
- ##### ZamianaMiejsc:
|
||||
- ###### Zamiana miejscami z losowym wrogiem, po kliknięciu przyciska akcji (E). Cooldown to 30s.
|
||||
- #### Poprawki mocy:
|
||||
- ##### AntyFlash:
|
||||
- ###### Dodano: Twoje flash'e trwają dłużej (7s).
|
||||
- ##### Astronauta:
|
||||
- ###### Zmieniono: Mnożnik grawitacji z (0.2 - 0.7) na (0.1 - 0.7).
|
||||
- ###### Dodano: Gracz widzi teraz mnożnik swojej grawitacji na czacie.
|
||||
- ##### Drakula:
|
||||
- ###### Zmieniono: Drakula od teraz może mieć nadwyżkę zdrowia.
|
||||
- ##### Duszek:
|
||||
- ###### Dodano: Zabklokowanie korzystania z broni innej niż nóż.
|
||||
- ###### Dodano: Każda podniesiona broń przez duszka staje się niewidzialna.
|
||||
- ##### Flash:
|
||||
- ###### Naprawiono nie dostawanie prędkości.
|
||||
- ###### Zmieniono: Mnożnik prędkości z (1.2 - 2.5) na (1.2 - 3.0).
|
||||
- ###### Dodano: Gracz widzi teraz mnożnik swojej prędkości na czacie.
|
||||
- ##### Katapulta:
|
||||
- ###### Dodano: Losowe szanse na podrzucenie (20% - 40%).
|
||||
- ###### Dodano: Gracz widzi teraz swoje szanse na czacie.
|
||||
- ##### Kurczak:
|
||||
- ###### Naprawiono nie dostawanie modelu kurczaka.
|
||||
- ###### Dodano: Zabklokowanie korzystania z broni innej niż nóż lub pistolet.
|
||||
- ###### Dodano: Kurczak może posiadać tylko 50 hp.
|
||||
- ##### Medyk:
|
||||
- ###### Naprawiono nie dostawanie apteczek.
|
||||
- ###### Zmieniono: Od teraz wszyscy tracą apteczki na końcu rundy.
|
||||
- ##### NieskonczoneAmmo:
|
||||
- ###### Dodano: Od teraz granaty również są nieskończone.
|
||||
- ##### ObrotWroga:
|
||||
- ###### Dodano: Losowe szanse na obrót wroga (20% - 40%).
|
||||
- ###### Dodano: Gracz widzi teraz swoje szanse na czacie.
|
||||
- ##### Phoenix:
|
||||
- ###### Naprawiono nie odradzanie się po śmierci.
|
||||
- ###### Dodano: Losowe szanse na odrodzenie (20% - 40%).
|
||||
- ###### Dodano: Gracz widzi teraz swoje szanse na czacie.
|
||||
- ##### Pilot:
|
||||
- ###### Zmieniono: Poprawiono opis supermocy.
|
||||
- ##### Rambo:
|
||||
- ###### Naprawiono nie dostawanie dodatkowego życia.
|
||||
- ##### Rozbrojenie:
|
||||
- ###### Dodano: Losowe szanse na wyrzucenie broni wroga (20% - 40%).
|
||||
- ###### Dodano: Gracz widzi teraz swoje szanse na czacie.
|
||||
- ###### Zmieniono: Wyrzuca teraz tylko aktywną broń wroga (naprawiono błąd wyrzucenia kosy).
|
||||
- ##### Eliminator -> Saper:
|
||||
- ###### Zmieniono: Zmineiono nazwę mocy z 'Eliminator' na 'Saper'.
|
||||
- ##### Teleporter:
|
||||
- ###### Naprawiono błąd, gdzie tylko gracz z supermocą był przeteleportowywany.
|
||||
|
||||
## 📝 Kontakt
|
||||
|
||||
Jeśli masz jakieś pytanie, napisz na juzlus.biznes@gmail.com lub [Discord](https://discordapp.com/users/284780352042434570).
|
||||
Loading…
Add table
Add a link
Reference in a new issue