new plugin: IncreasedKnockback
This commit is contained in:
parent
73ac24c65c
commit
88294578f9
66
IncreasedKnockback/scripting/IncreasedKnockback.sp
Normal file
66
IncreasedKnockback/scripting/IncreasedKnockback.sp
Normal file
@ -0,0 +1,66 @@
|
||||
#pragma semicolon 1
|
||||
|
||||
#include <sourcemod>
|
||||
#include <sdktools>
|
||||
#include <zombiereloaded>
|
||||
#include <cstrike>
|
||||
#include <ccc>
|
||||
|
||||
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 1.0");
|
||||
}
|
Loading…
Reference in New Issue
Block a user