I've tried several different ways to get this to work properly but I can't seem to figure out what is causing the crashes. If anyone has an idea of what looks wrong I would appreciate the help:
Code:
public OnMapStart()
{
isMapRunning = true;
}
public OnEntityCreated(entity, const String:classname[])
{
if (!isMapRunning || IsServerProcessing() == false) return;
if (entity > MaxClients && IsValidEdict(entity) && StrEqual(classname, "infected"))
{
new integer = GetRandomInt(1, 5);
CommonType[entity] = integer;
#if DEBUG
PrintToChatAll("Entity is a common infected, type %i.", integer);
#endif
if (integer != 5)
{
CommonSpawnTimer[entity] = CreateTimer(0.5, Timer_CommonSpawn, entity);
}
}
}
public Action:Timer_CommonSpawn(Handle:timer, any:entity)
{
new common = EntRefToEntIndex(entity);
if (common > 0 && IsValidEntity(common) && IsValidEdict(common))
{
switch (CommonType[entity])
{
case 1:
{
#if DEBUG
PrintToChatAll("Zombie type small strong fast low.");
#endif
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
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
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
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);
}
}
}
if (CommonSpawnTimer[entity] != INVALID_HANDLE)
{
KillTimer(CommonSpawnTimer[entity]);
CommonSpawnTimer[entity] = INVALID_HANDLE;
}
return Plugin_Stop;
}
public OnMapEnd()
{
isMapRunning = false;
}
#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;
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, _);
#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;
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, _);
I took your code here, modified it slightly, and threw it into my plugin. I'm not getting crashes anymore which is great! Only problem I'm experiencing is with this line: