Skip to content

Infection/survival style gameplay for CS2 in C#

License

Notifications You must be signed in to change notification settings

SparkyCloudy/ZombieSharp

 
 

Repository files navigation

ZombieSharp

This project is linux focusing as Windows has a lot issues with Virtual Functions. However, if Windows issue is solved, the plugin will mostly work fine.

Zombie-Sharp is a Zombie Mode plugin for CS2 referencing the features and functions from the previous SourcePawn Zombie:Reloaded plugin. You can say this is the Zombie:Reloaded remake but in C#. Here is the list of features.

Feature of Zombie-Sharp

  • Basic Zombie Infection Initial with Timer
  • Mother Zombie Cycle
  • Infect and Human Command
  • Respawn Toggle option
  • Player Class Module
  • Weapon Module with purchase command.
  • Hitgroups Module
  • Knockback Module
  • ZTeleport Module
  • Configuration for Infection Settings (ConVar)
  • Repeat Killer Module (Obsolete now)
  • Top Defender
  • Cash on damage zombie
  • API for external plugin
  • Grenade Napalm Effect (NEW! More coming soon.)
  • Player Stats (Work in progress now.)

Requirements

Recommend Plugin

How to Build

  1. Install .NET 8.0 SDK and Git.
  2. Open up Windows Powershell and follow these command
git clone https://github.com/Oylneechan/ZombieSharp
cd ZombieSharp
dotnet build

Installation

  1. Install a Metamod and CounterStrikeSharp with Runtime build.
  2. Drag All files in zip to game/csgo.
  3. Doing command setting and file configuration.
  4. Start server and enjoy.

Command Setting

It's recommend to set these Convar before using the plugin to prevent crashed and issues that may occur.

mp_limitteams 0 // set in server.cfg
mp_autoteambalance 0 // set in server.cfg
mp_disconnect_kills_players 1 // set in gamemode_casual_server.cfg if file is not existed copy gamemode_casual.cfg and rename it.

API Example

Check out ZombieTest for other API usages example.

using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Core.Capabilities;
using ZombieSharpAPI;

namespace ZombieTest
{
    public class ZombieTest : BasePlugin    
    {
        public override string ModuleName => "Zombie Test";
        public override string ModuleVersion => "1.0";

        // Declare Capability First.
        public static PluginCapability<IZombieSharpAPI> ZombieCapability { get; } = new("zombiesharp");

        // Declare API class
        IZombieSharpAPI? API;

        public override void OnAllPluginsLoaded(bool hotReload)
        {
            // Get Capability.
            API = ZombieCapability.Get()!;

            // Excute Hook function 
            API.Hook_OnInfectClient(ZS_OnInfectClient);
        }

        // Hook function is here.
        public HookResult ZS_OnInfectClient(ref CCSPlayerController client, ref CCSPlayerController attacker, ref bool motherzombie, ref bool force, ref bool respawn)
        {
            // check which client is infect.
            Server.PrintToChatAll($"{client.PlayerName} is infected");

            // if client name is Oylsister
            if (client.PlayerName == "Oylsister")
            {
                Server.PrintToChatAll("Oylsister is immunity");

                // Blocking infected
                return HookResult.Handled;
            }
            
            if (force)
                Server.PrintToChatAll($"by forcing.");

            // Always use HookResult.Continue to allowing other player get infect as usual.
            return HookResult.Continue;
        }
    }
}

Configuration

Here is a list of all the config files available and what they do.

weapons.json - Configure specific weapon settings. And purchase settings

{
    "KnockbackMultiply": 1.0, // Knockback Multiply for all weapon
    "WeaponDatas":{
        "glock": { // The weaponname get from event when get fired.
            "WeaponName": "Glock", // weapon name you wish
            "WeaponEntity": "weapon_glock", // weapon entity
            "Knockback": 1.1, // knockback
            "WeaponSlot": 1, // weaponslot (0 = Primary, 1 = Secondary, 2 = knife, 3 = grenade)
            "Price": 200, // price you want
            "MaxPurchase": 0, // Allowing how many time client to purchase in one live.
            "Restrict": false, // Allow client to use or not.
            "PurchaseCommand": [ "css_glock", "css_gs" ] // Purchase command. Set whatever you want.
        }
    }
}

playerclasses.json - Player Classes configuration. Placing Custom model at game/csgo for both server and client (player)

Example: game/csgo/characters/models/nozb1/2b_nier_automata_player_model/2b_nier_player_model.vmdl_c

{
    "PlayerClasses":{
        "human_default": { // Class unique name
            "Name": "Human Default", // class name
            "Description": "Default Class for human", // description
            "Enable": true, // enable it or not
            "Default_Class": true, // If true then player will automatically be assigned with this class when join server for the first time.
            "Team": 1, // Team 0 = zombie, Team 1 = human
            "Model": "characters\\models\\nozb1\\2b_nier_automata_player_model\\2b_nier_player_model.vmdl", // Model path for this class change .vmdl_c to .vmdl in this config
            "MotherZombie": false, // Specify if this class is for mother zombie.
            "Health": 150, // class health
            "Regen_Interval": 0.0, // Specify how much second to regen health
            "Regen_Amount": 0, // Regen Health amount
            "Napalm_Time": 0, // Duration of Napalm grenade, set to 0 meaning no burn.
            "Speed": 250.0, // class speed (not work yet)
            "Knockback": 0.0, // class knockback
            "Jump_Height": 3.0, // Jump height
            "Jump_Distance": 1.0, // Jump Distance
            "Fall_Damage": false // Disable fall damage or not
        }
    }
}

hitgroups.json - Hitgroup configuration for knockback.

{
    "HitGroupDatas": {
        "Generic": { // name of the part, doesn't affect anything
            "HitgroupIndex": 0, // hitgroup index DO NOT CHANGE THIS
            "HitgroupKnockback": 1.0 // knockback multiply when get hit to this hitgroup
        },
        "Head": {
            "HitgroupIndex": 1,
            "HitgroupKnockback": 1.2
        }
    }
}

About

Infection/survival style gameplay for CS2 in C#

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%