PHP Code:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#pragma semicolon 1
#define L4D2 Nightmarish Common
#define PLUGIN_VERSION "1.0"
#define DEBUG 1
new Handle:cvarType1HPMin;
new Handle:cvarType1HPMax;
new Handle:cvarType1SpeedMin;
new Handle:cvarType1SpeedMax;
new Handle:cvarType1Damage;
new Handle:cvarType1Armor;
new Handle:cvarType2HPMin;
new Handle:cvarType2HPMax;
new Handle:cvarType2SpeedMin;
new Handle:cvarType2SpeedMax;
new Handle:cvarType2Damage;
new Handle:cvarType2Armor;
new Handle:cvarType3HPMin;
new Handle:cvarType3HPMax;
new Handle:cvarType3SpeedMin;
new Handle:cvarType3SpeedMax;
new Handle:cvarType3Damage;
new Handle:cvarType3Armor;
new Handle:cvarType4HPMin;
new Handle:cvarType4HPMax;
new Handle:cvarType4SpeedMin;
new Handle:cvarType4SpeedMax;
new Handle:cvarType4Damage;
new Handle:cvarType4Armor;
//new CommonType[4097];
//new bool:isMapRunning = false;
//new Handle:PluginStartTimer = INVALID_HANDLE;
//new Handle:CommonSpawnTimer[4097] = INVALID_HANDLE;
//static laggedMovementOffset = 0;
public Plugin:myinfo =
{
name = "[L4D2] Nightmarish Common",
author = "Mortiegama",
description = "Brining a new meaning of fear to the most dangerous infected.",
version = PLUGIN_VERSION,
url = ""
}
//AtomicStryker - Damage Mod (SDK Hooks):
//https://forums.alliedmods.net/showthread.php?p=1184761
public OnPluginStart()
{
CreateConVar("l4d_pwm_version", PLUGIN_VERSION, "Pscyhotic Common Version", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
cvarType1HPMin= CreateConVar("l4d_pwm_type1hpmin", "20", "Minimum HP for the Common. (Def 20)", FCVAR_PLUGIN, true, 0.0, false, _);
cvarType1HPMax= CreateConVar("l4d_pwm_type1hpmax", "40", "Maximum HP for the Common. (Def 40)", FCVAR_PLUGIN, true, 0.0, false, _);
cvarType1SpeedMin= CreateConVar("l4d_pwm_type1speedmin", "1.5", "Minimum speed adjustment for the Common. (Def 1.5)", FCVAR_PLUGIN, true, 0.0, false, _);
cvarType1SpeedMax= CreateConVar("l4d_pwm_type1speedmax", "1.8", "Maximum speed adjustment for the Common. (Def 1.8)", FCVAR_PLUGIN, true, 0.0, false, _);
cvarType1Damage= CreateConVar("l4d_pwm_type1damage", "1.5", "Multiplier for damage done to the Survivors (Def 1.5)", FCVAR_PLUGIN, true, 0.0, false, _);
cvarType1Armor= CreateConVar("l4d_pwm_type1armor", "1.8", "Multiplier for damage done by the Survivors. (Def 1.2)", FCVAR_PLUGIN, true, 0.0, false, _);
cvarType2HPMin= CreateConVar("l4d_pwm_type2hpmin", "65", "Minimum HP for the Common. (Def 65)", FCVAR_PLUGIN, true, 0.0, false, _);
cvarType2HPMax= CreateConVar("l4d_pwm_type2hpmax", "85", "Maximum HP for the Common. (Def 85)", FCVAR_PLUGIN, true, 0.0, false, _);
cvarType2SpeedMin= CreateConVar("l4d_pwm_type2speedmin", "1.2", "Minimum speed adjustment for the Common. (Def 1.2)", FCVAR_PLUGIN, true, 0.0, false, _);
cvarType2SpeedMax= CreateConVar("l4d_pwm_type2speedmax", "1.6", "Maximum speed adjustment for the Common. (Def 1.6)", FCVAR_PLUGIN, true, 0.0, false, _);
cvarType2Damage= CreateConVar("l4d_pwm_type2damage", "0.8", "Multiplier for damage done to the Survivors (Def 0.8)", FCVAR_PLUGIN, true, 0.0, false, _);
cvarType2Armor= CreateConVar("l4d_pwm_type2armor", "0.7", "Multiplier for damage done by the Survivors. (Def 0.7)", FCVAR_PLUGIN, true, 0.0, false, _);
cvarType3HPMin= CreateConVar("l4d_pwm_type3hpmin", "30", "Minimum HP for the Common. (Def 30)", FCVAR_PLUGIN, true, 0.0, false, _);
cvarType3HPMax= CreateConVar("l4d_pwm_type3hpmax", "60", "Maximum HP for the Common. (Def 60)", FCVAR_PLUGIN, true, 0.0, false, _);
cvarType3SpeedMin= CreateConVar("l4d_pwm_type3speedmin", "1.1", "Minimum speed adjustment for the Common. (Def 1.1)", FCVAR_PLUGIN, true, 0.0, false, _);
cvarType3SpeedMax= CreateConVar("l4d_pwm_type3speedmax", "1.5", "Maximum speed adjustment for the Common. (Def 1.5)", FCVAR_PLUGIN, true, 0.0, false, _);
cvarType3Damage= CreateConVar("l4d_pwm_type3damage", "1.3", "Multiplier for damage done to the Survivors (Def 1.3)", FCVAR_PLUGIN, true, 0.0, false, _);
cvarType3Armor= CreateConVar("l4d_pwm_type3armor", "1.1", "Multiplier for damage done by the Survivors. (Def 1.1)", FCVAR_PLUGIN, true, 0.0, false, _);
cvarType4HPMin= CreateConVar("l4d_pwm_type4hpmin", "80", "Minimum HP for the Common. (Def 80)", FCVAR_PLUGIN, true, 0.0, false, _);
cvarType4HPMax= CreateConVar("l4d_pwm_type4hpmax", "110", "Maximum HP for the Common. (Def 110)", FCVAR_PLUGIN, true, 0.0, false, _);
cvarType4SpeedMin= CreateConVar("l4d_pwm_type4speedmin", "0.4", "Minimum speed adjustment for the Common. (Def 0.4)", FCVAR_PLUGIN, true, 0.0, false, _);
cvarType4SpeedMax= CreateConVar("l4d_pwm_type4speedmax", "0.7", "Maximum speed adjustment for the Common. (Def 0.7)", FCVAR_PLUGIN, true, 0.0, false, _);
cvarType4Damage= CreateConVar("l4d_pwm_type4damage", "0.6", "Multiplier for damage done to the Survivors (Def 0.6)", FCVAR_PLUGIN, true, 0.0, false, _);
cvarType4Armor= CreateConVar("l4d_pwm_type4armor", "0.5", "Multiplier for damage done by the Survivors. (Def 0.5)", FCVAR_PLUGIN, true, 0.0, false, _);
AutoExecConfig(true, "plugin.L4D2.NightmarishCommon");
}
public OnEntityCreated(entity, const String:classname[])
{
if (StrEqual(classname, "infected", false))
{
CreateTimer(0.5, Timer_CommonSpawn, EntIndexToEntRef(entity), TIMER_FLAG_NO_MAPCHANGE);
}
}
public Action:Timer_CommonSpawn(Handle:timer, any:ref)
{
new entity = EntRefToEntIndex(ref);
if(entity == INVALID_ENT_REFERENCE)
{
return Plugin_Stop;
}
new integer = GetRandomInt(0, 5); // yeh, it was (1,5)
#if DEBUG
PrintToChatAll("Entity is a common infected, type %i.", integer);
#endif
new HP;
new Float:SPEED;
new Float:SCALE;
switch (integer)
{
case 1:
{
#if DEBUG
PrintToChatAll("Zombie type small strong fast low.");
#endif
HP = GetRandomInt( GetConVarInt(cvarType1HPMin), GetConVarInt(cvarType1HPMax) );
SPEED = GetRandomFloat( GetConVarFloat(cvarType1SpeedMin), GetConVarFloat(cvarType1SpeedMax) );
SCALE = 0.7;
//SetEntPropFloat(entity, Prop_Data, "m_flModelScale", 0.7);
//
//new iHPMin = GetConVarInt(cvarType1HPMin);
//new iHPMax = GetConVarInt(cvarType1HPMax);
//new iHP = GetRandomInt(iHPMin, iHPMax);
//SetEntProp(entity, Prop_Data, "m_iMaxHealth", iHP);//Set max and
//SetEntProp(entity, Prop_Data, "m_iHealth", iHP); //current health of Common to defined health.
//
//new Float:iSpeedMin = GetConVarFloat(cvarType1SpeedMin);
//new Float:iSpeedMax = GetConVarFloat(cvarType1SpeedMax);
//new Float:iSpeed = GetRandomFloat(iSpeedMin, iSpeedMax);
//SetEntDataFloat(entity, laggedMovementOffset, 1.0*iSpeed);
}
case 2:
{
#if DEBUG
PrintToChatAll("Zombie type small weak quick sturdy.");
#endif
HP = GetRandomInt( GetConVarInt(cvarType2HPMin), GetConVarInt(cvarType2HPMax) );
SPEED = GetRandomFloat( GetConVarFloat(cvarType2SpeedMin), GetConVarFloat(cvarType2SpeedMax) );
SCALE = 0.9;
//SetEntPropFloat(entity, Prop_Data, "m_flModelScale", 0.9);
//
//new iHPMin = GetConVarInt(cvarType2HPMin);
//new iHPMax = GetConVarInt(cvarType2HPMax);
//new iHP = GetRandomInt(iHPMin, iHPMax);
//SetEntProp(entity, Prop_Data, "m_iMaxHealth", iHP);//Set max and
//SetEntProp(entity, Prop_Data, "m_iHealth", iHP); //current health of Common to defined health.
//
//new Float:iSpeedMin = GetConVarFloat(cvarType2SpeedMin);
//new Float:iSpeedMax = GetConVarFloat(cvarType2SpeedMax);
//new Float:iSpeed = GetRandomFloat(iSpeedMin, iSpeedMax);
//SetEntDataFloat(entity, laggedMovementOffset, 1.0*iSpeed);
}
case 3:
{
#if DEBUG
PrintToChatAll("Zombie type big tough quick weak.");
#endif
HP = GetRandomInt( GetConVarInt(cvarType3HPMin), GetConVarInt(cvarType3HPMax) );
SPEED = GetRandomFloat( GetConVarFloat(cvarType3SpeedMin), GetConVarFloat(cvarType3SpeedMax) );
SCALE = 1.1;
//SetEntPropFloat(entity, Prop_Data, "m_flModelScale", 1.1);
//
//new iHPMin = GetConVarInt(cvarType3HPMin);
//new iHPMax = GetConVarInt(cvarType3HPMax);
//new iHP = GetRandomInt(iHPMin, iHPMax);
//SetEntProp(entity, Prop_Data, "m_iMaxHealth", iHP);//Set max and
//SetEntProp(entity, Prop_Data, "m_iHealth", iHP); //current health of Common to defined health.
//
//new Float:iSpeedMin = GetConVarFloat(cvarType3SpeedMin);
//new Float:iSpeedMax = GetConVarFloat(cvarType3SpeedMax);
//new Float:iSpeed = GetRandomFloat(iSpeedMin, iSpeedMax);
//SetEntDataFloat(entity, laggedMovementOffset, 1.0*iSpeed);
}
case 4:
{
#if DEBUG
PrintToChatAll("Zombie type large titanic slow titanic.");
#endif
HP = GetRandomInt( GetConVarInt(cvarType4HPMin), GetConVarInt(cvarType4HPMax) );
SPEED = GetRandomFloat( GetConVarFloat(cvarType4SpeedMin), GetConVarFloat(cvarType4SpeedMax) );
SCALE = 1.2;
//SetEntPropFloat(entity, Prop_Data, "m_flModelScale", 1.2);
//
//new iHPMin = GetConVarInt(cvarType4HPMin);
//new iHPMax = GetConVarInt(cvarType4HPMax);
//new iHP = GetRandomInt(iHPMin, iHPMax);
//SetEntProp(entity, Prop_Data, "m_iMaxHealth", iHP);//Set max and
//SetEntProp(entity, Prop_Data, "m_iHealth", iHP); //current health of Common to defined health.
//
//new Float:iSpeedMin = GetConVarFloat(cvarType4SpeedMin);
//new Float:iSpeedMax = GetConVarFloat(cvarType4SpeedMax);
//new Float:iSpeed = GetRandomFloat(iSpeedMin, iSpeedMax);
//SetEntDataFloat(entity, laggedMovementOffset, 1.0*iSpeed);
}
default:
{
#if DEBUG
PrintToChatAll("Zombie type NOPE!.");
#endif
return Plugin_Stop;
}
}
SetEntPropFloat(entity, Prop_Send, "m_flModelScale", SCALE);
SetEntProp(entity, Prop_Send, "m_iMaxHealth", HP);
SetEntProp(entity, Prop_Send, "m_iHealth", HP);
SetEntPropFloat(entity, Prop_Data, "m_flLaggedMovementValue", SPEED);
return Plugin_Continue;
}