Initial commit
This commit is contained in:
commit
810ca2fa3c
37 changed files with 1998 additions and 0 deletions
|
|
@ -0,0 +1,60 @@
|
|||
using System.Drawing;
|
||||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
{
|
||||
public static class Impostor
|
||||
{
|
||||
public static void LoadImpostor()
|
||||
{
|
||||
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
|
||||
{
|
||||
Instance.AddTimer(0.1f, () =>
|
||||
{
|
||||
foreach (var player in Utilities.GetPlayers())
|
||||
{
|
||||
if (!IsPlayerValid(player)) continue;
|
||||
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill != "Impostor") continue;
|
||||
|
||||
string model = player.Team == CsTeam.Terrorist
|
||||
? "characters/models/ctm_fbi/ctm_fbi_variantb.vmdl"
|
||||
: player.Team == CsTeam.CounterTerrorist
|
||||
? "characters/models/tm_phoenix/tm_phoenix_varianta.vmdl"
|
||||
: null;
|
||||
|
||||
if (model != null)
|
||||
{
|
||||
SetPlayerModel(player, model);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
}
|
||||
|
||||
private static void SetPlayerModel(CCSPlayerController player, string model)
|
||||
{
|
||||
var pawn = player.PlayerPawn?.Value;
|
||||
if (pawn == null) return;
|
||||
|
||||
Server.NextFrame(() =>
|
||||
{
|
||||
pawn.SetModel(model);
|
||||
|
||||
var originalRender = pawn.Render;
|
||||
pawn.Render = Color.FromArgb(255, originalRender.R, originalRender.G, originalRender.B);
|
||||
});
|
||||
}
|
||||
|
||||
private static bool IsPlayerValid(CCSPlayerController player)
|
||||
{
|
||||
return player != null && player.IsValid && player.PlayerPawn?.Value != null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue