Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Name2781 committed Dec 4, 2024
0 parents commit a4ddf38
Show file tree
Hide file tree
Showing 16 changed files with 986 additions and 0 deletions.
400 changes: 400 additions & 0 deletions .gitignore

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions Funnies.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CounterStrikeSharp.API" Version="1.0.287" />
</ItemGroup>

</Project>
25 changes: 25 additions & 0 deletions Funnies.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.002.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Funnies", "Funnies.csproj", "{C30340C9-EB65-4BF4-862D-0AA945D9336F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C30340C9-EB65-4BF4-862D-0AA945D9336F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C30340C9-EB65-4BF4-862D-0AA945D9336F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C30340C9-EB65-4BF4-862D-0AA945D9336F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C30340C9-EB65-4BF4-862D-0AA945D9336F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {D76A2B88-56B8-4C9E-BD76-99AB89891B4A}
EndGlobalSection
EndGlobal
Empty file added LICENSE.md
Empty file.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Funny Plugin

## Overview
This plugin recreates the 1v5 but one person has wallhacks and the invisible man gamemode shown in dima_wallhacks and renyan videos for Counter Strike 2.

## Installation
1. Install [Counter Strike Sharp](https://docs.cssharp.dev/docs/guides/getting-started.html) on your server.
2. Download the plugin from the [releases](https://github.com/Name2781/FunnyPlugin/releases) and put it in `server/game/csgo/addons/counterstrikesharp/plugins`.

## Usage:

### Commands:
1. `!wallhack <player name>` gives a player wallhacks.
2. `!invisible <player name>` makes a player invisible.

### Admin Commands:
1. `!rcon <command>` runs a server command.
2. `!money <amount> <player name>` gives a player money.

## Contact:
If you have any issues, feedback, or feature requests please make an issue on the issues page. If you want to contact me directly about making custom plugins you can through discord (namethempguy).

## License:
This plugin is licensed under the MIT License. Feel free to use, modify, and distribute it in your servers. Attribution is appreciated but not required.
23 changes: 23 additions & 0 deletions src/Commands/CommandDebug.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#if DEBUG
using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Commands;

namespace Funnies.Commands;

public class CommandDebug
{
public static void OnDebugCommand(CCSPlayerController? caller, CommandInfo command)
{
foreach (var ent in Utilities.GetAllEntities())
{
try
{
var name = ent.As<CBaseModelEntity>().CBodyComponent.SceneNode.GetSkeletonInstance().ModelState.ModelName;
Console.WriteLine($"{ent.DesignerName} | {name}");
}
catch {};
}
}
}
#endif
45 changes: 45 additions & 0 deletions src/Commands/CommandInvisible.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
using System.Drawing;
using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Admin;
using CounterStrikeSharp.API.Modules.Commands;

namespace Funnies.Commands;

public class CommandInvisible
{
public static void OnInvisibleCommand(CCSPlayerController? caller, CommandInfo command)
{
if (!AdminManager.PlayerHasPermissions(caller, "@css/generic")) return;

var player = Util.GetPlayerByName(command.ArgString);

if (player != null)
{
if (Util.IsPlayerValid(caller))
Util.ServerPrintToChat(caller!, $"Toggled invisiblity on {command.ArgString}");

if (Globals.InvisiblePlayers.ContainsKey(player))
{
Globals.InvisiblePlayers.Remove(player);

var pawn = player.PlayerPawn.Value;
pawn!.Render = Color.FromArgb(255, pawn.Render);
Utilities.SetStateChanged(pawn, "CBaseModelEntity", "m_clrRender");

foreach (var weapon in pawn.WeaponServices!.MyWeapons)
{
weapon.Value!.Render = pawn!.Render;
Utilities.SetStateChanged(weapon.Value, "CBaseModelEntity", "m_clrRender");
}
}
else
Globals.InvisiblePlayers.Add(player, new());
}
else
{
if (Util.IsPlayerValid(caller))
Util.ServerPrintToChat(caller!, $"Player {command.ArgString} not found");
}
}
}
33 changes: 33 additions & 0 deletions src/Commands/CommandMoney.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Admin;
using CounterStrikeSharp.API.Modules.Commands;

namespace Funnies.Commands;

public class CommandMoney
{
public static void OnMoneyCommand(CCSPlayerController? caller, CommandInfo command)
{
if (!AdminManager.PlayerHasPermissions(caller, "@css/generic")) return;

int index = command.ArgString.IndexOf(' ');
int money = int.Parse(command.ArgString[..index]);
var name = command.ArgString[(index + 1)..];
var player = Util.GetPlayerByName(name);

if (player != null)
{
if (Util.IsPlayerValid(caller))
Util.ServerPrintToChat(caller!, $"Set {name}'s money to ${money}");

player.InGameMoneyServices!.Account = money;
Utilities.SetStateChanged(player, "CCSPlayerController", "m_pInGameMoneyServices");
}
else
{
if (Util.IsPlayerValid(caller))
Util.ServerPrintToChat(caller!, $"Player {name} not found");
}
}
}
16 changes: 16 additions & 0 deletions src/Commands/CommandRcon.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Admin;
using CounterStrikeSharp.API.Modules.Commands;

namespace Funnies.Commands;

public class CommandRcon
{
public static void OnRconCommand(CCSPlayerController? caller, CommandInfo command)
{
if (!AdminManager.PlayerHasPermissions(caller, "@css/rcon")) return;

Server.ExecuteCommand(command.ArgString);
}
}
32 changes: 32 additions & 0 deletions src/Commands/CommandWallhack.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Core.Attributes.Registration;
using CounterStrikeSharp.API.Modules.Admin;
using CounterStrikeSharp.API.Modules.Commands;

namespace Funnies.Commands;

public class CommandWallhack
{
public static void OnWallhackCommand(CCSPlayerController? caller, CommandInfo command)
{
if (!AdminManager.PlayerHasPermissions(caller, "@css/generic")) return;

var player = Util.GetPlayerByName(command.ArgString);

if (player != null)
{
if (Util.IsPlayerValid(caller))
Util.ServerPrintToChat(caller!, $"Toggled wallhacks on {command.ArgString}");

if (Globals.Wallhackers.Contains(player))
Globals.Wallhackers.Remove(player);
else
Globals.Wallhackers.Add(player);
}
else
{
if (Util.IsPlayerValid(caller))
Util.ServerPrintToChat(caller!, $"Player {command.ArgString} not found");
}
}
}
49 changes: 49 additions & 0 deletions src/FunniesPlugin.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
using CounterStrikeSharp.API.Core;
using Funnies.Commands;
using Funnies.Modules;

namespace Funnies;

public class FunniesPlugin : BasePlugin
{
public override string ModuleName => "Funny plugin";

public override string ModuleVersion => "0.0.1";

public override void Load(bool hotReload)
{
Console.WriteLine("So funny :)");

Globals.Plugin = this;

RegisterListener<Listeners.CheckTransmit>(OnCheckTransmit);
RegisterListener<Listeners.OnTick>(OnTick);

AddCommand("css_money", "Gives a player money", CommandMoney.OnMoneyCommand);
AddCommand("css_rcon", "Runs a command", CommandRcon.OnRconCommand);

#if DEBUG
AddCommand("css_debug", "Debug command", CommandDebug.OnDebugCommand);
#endif

Invisible.Setup();
Wallhack.Setup();
}

public void OnTick()
{
Invisible.OnTick();
}

public void OnCheckTransmit(CCheckTransmitInfoList infoList)
{
foreach ((CCheckTransmitInfo info, CCSPlayerController? player) in infoList)
{
if (!Util.IsPlayerValid(player))
continue;

Wallhack.OnPlayerTransmit(info, player!);
Invisible.OnPlayerTransmit(info, player!);
}
}
}
16 changes: 16 additions & 0 deletions src/Globals.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using CounterStrikeSharp.API.Core;
using Funnies.Models;

namespace Funnies;

public static class Globals
{
public static List<CCSPlayerController> Wallhackers = [];
public static Dictionary<CCSPlayerController, CDynamicProp> GlowEntities = [];

public static Dictionary<CCSPlayerController, SoundData> InvisiblePlayers = [];

#pragma warning disable CS8618
public static FunniesPlugin Plugin;
#pragma warning restore CS8618
}
7 changes: 7 additions & 0 deletions src/Models/SoundData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace Funnies.Models;

public struct SoundData(float startTime = -1f, float endTime = -1f)
{
public float StartTime = startTime;
public float EndTime = endTime;
}
Loading

0 comments on commit a4ddf38

Please sign in to comment.