#pragma semicolon 1 #include #include #include #include #include ConVar g_iIncreasedKnockback; ConVar g_iDefineMaxPopulation; Handle CheckTimer; public Plugin myinfo = { name = "IncreasedKnockback", author = "Dogan", description = "Increase the knockback during low population", version = "1.0.0", url = "" } public void OnPluginStart() { g_iIncreasedKnockback = CreateConVar("sm_knockback_boost", "1.05", "knockback boost during low population"); g_iDefineMaxPopulation = CreateConVar("sm_knockback_maxpopulation", "32", "max amount of players until the knockback should be increased"); AutoExecConfig(true, "plugin.IncreasedKnockback"); GetConVars(); } public void GetConVars() { if (CheckTimer != INVALID_HANDLE && CloseHandle(CheckTimer)) CheckTimer = INVALID_HANDLE; CheckTimer = CreateTimer(30.0, CheckServerPopulation, _, TIMER_REPEAT); } public void ConVarChange(ConVar convar, char[] oldValue, char[] newValue) { GetConVars(); } public Action CheckServerPopulation(Handle timer) { int Population = GetClientCount(true); if(Population <= g_iDefineMaxPopulation.IntValue) { PerformKnockbackIncrease(); } else { PerformKnockbackDecrease(); } } public void PerformKnockbackIncrease() { ServerCommand("zr_class_set_multiplier zombies knockback %f", g_iIncreasedKnockback.FloatValue); } public void PerformKnockbackDecrease() { ServerCommand("zr_class_set_multiplier zombies knockback 1.0"); }