clean up and rename

This commit is contained in:
Dogan 2019-10-06 01:33:50 +02:00
parent fd7ddd5508
commit 0f503647ed
2 changed files with 19 additions and 18 deletions

View File

@ -33,7 +33,7 @@ int g_iMaxPopulation;
float g_fKnockbackPopulationBoost; float g_fKnockbackPopulationBoost;
float g_fNapalmPopulationReduction; float g_fNapalmPopulationReduction;
int g_iAntiNoob; bool g_bAntiNoob;
char g_cAntiNoobHelp[64]; char g_cAntiNoobHelp[64];
char g_cAntiNoobPopulation[32]; char g_cAntiNoobPopulation[32];
@ -52,7 +52,7 @@ public void OnPluginStart()
ConVar cvar; ConVar cvar;
HookConVarChange((cvar = CreateConVar("sm_an_help", "1", "1 = AntiNoob performs help, 0 = AntiNoob is disabled", FCVAR_NONE, true, 0.0, true, 1.0)), g_cvAntiNoob); HookConVarChange((cvar = CreateConVar("sm_an_help", "1", "1 = AntiNoob performs help, 0 = AntiNoob is disabled", FCVAR_NONE, true, 0.0, true, 1.0)), g_cvAntiNoob);
g_iAntiNoob = cvar.IntValue; g_bAntiNoob = cvar.BoolValue;
HookConVarChange((cvar = CreateConVar("sm_an_maxplayers", "40", "max active players until the kb should be increased")), g_cvMaxPopulation); HookConVarChange((cvar = CreateConVar("sm_an_maxplayers", "40", "max active players until the kb should be increased")), g_cvMaxPopulation);
g_iMaxPopulation = cvar.IntValue; g_iMaxPopulation = cvar.IntValue;
HookConVarChange((cvar = CreateConVar("sm_an_kb_population", "5.0", "knockback boost during low population in procent (stacks with the helps)")), g_cvKnockbackPopulationBoost); HookConVarChange((cvar = CreateConVar("sm_an_kb_population", "5.0", "knockback boost during low population in procent (stacks with the helps)")), g_cvKnockbackPopulationBoost);
@ -95,7 +95,7 @@ public void OnPluginStart()
public void g_cvAntiNoob(ConVar convar, const char[] oldValue, const char[] newValue) public void g_cvAntiNoob(ConVar convar, const char[] oldValue, const char[] newValue)
{ {
g_iAntiNoob = convar.IntValue; g_bAntiNoob = convar.BoolValue;
} }
public void g_cvMaxPopulation(ConVar convar, const char[] oldValue, const char[] newValue) public void g_cvMaxPopulation(ConVar convar, const char[] oldValue, const char[] newValue)
@ -218,7 +218,7 @@ public void OnRoundStart(Event hEvent, const char[] sEvent, bool bDontBroadcast)
} }
} }
if(g_iAntiNoob == 0) if(!g_bAntiNoob)
{ {
g_cAntiNoobHelp = "{cyan}[AntiNoob]{white} Currently disabled"; g_cAntiNoobHelp = "{cyan}[AntiNoob]{white} Currently disabled";
g_cAntiNoobPopulation = "{white}."; g_cAntiNoobPopulation = "{white}.";
@ -315,7 +315,7 @@ public void PerformLowHelp()
public void PerformReset() public void PerformReset()
{ {
if(g_bLowPopulation && g_iAntiNoob != 0) if(g_bLowPopulation && g_bAntiNoob)
{ {
ServerCommand("zr_class_set_multiplier zombies knockback %f", 1.0 + g_fKnockbackPopulationBoost); ServerCommand("zr_class_set_multiplier zombies knockback %f", 1.0 + g_fKnockbackPopulationBoost);
ServerCommand("zr_napalm_time_scale %f", 50.0 - g_fNapalmPopulationReduction); ServerCommand("zr_napalm_time_scale %f", 50.0 - g_fNapalmPopulationReduction);

View File

@ -5,8 +5,8 @@
#include <sdktools> #include <sdktools>
#include <zombiereloaded> #include <zombiereloaded>
int g_iZAbuse; bool g_bZAbuse;
int g_iSlayKnifer; bool g_bSlayKnifer;
float g_fMaxDistance; float g_fMaxDistance;
float g_fMaxTime; float g_fMaxTime;
@ -17,10 +17,10 @@ bool g_bInfectedInRadius[MAXPLAYERS + 1];
public Plugin myinfo = public Plugin myinfo =
{ {
name = "ZAbuse", name = "KnifeRevert",
author = "Dogan", author = "Dogan",
description = "Tool for Admins to prevent teamkilling cause of zombie knifing (ZE)", description = "Tool for Admins to prevent teamkilling cause of zombie knifing (ZE)",
version = "1.0.0", version = "1.1.0",
url = "" url = ""
} }
@ -28,9 +28,9 @@ public void OnPluginStart()
{ {
ConVar cvar; ConVar cvar;
HookConVarChange((cvar = CreateConVar("sm_zabuse_enabled", "1", "1 = sm_zabuse is available, 0 = sm_zabuse is not available", FCVAR_NONE, true, 0.0, true, 1.0)), g_cvZAbuse); HookConVarChange((cvar = CreateConVar("sm_zabuse_enabled", "1", "1 = sm_zabuse is available, 0 = sm_zabuse is not available", FCVAR_NONE, true, 0.0, true, 1.0)), g_cvZAbuse);
g_iZAbuse = cvar.IntValue; g_bZAbuse = cvar.BoolValue;
HookConVarChange((cvar = CreateConVar("sm_zabuse_slay", "1", "1 = slays the knifer automatically when sm_zabuse is used, 0 = don't do anything to the knifer", FCVAR_NONE, true, 0.0, true, 1.0)), g_cvSlayKnifer); HookConVarChange((cvar = CreateConVar("sm_zabuse_slay", "1", "1 = slays the knifer automatically when sm_zabuse is used, 0 = don't do anything to the knifer", FCVAR_NONE, true, 0.0, true, 1.0)), g_cvSlayKnifer);
g_iSlayKnifer = cvar.IntValue; g_bSlayKnifer = cvar.BoolValue;
HookConVarChange((cvar = CreateConVar("sm_zabuse_maxdistance", "150.0", "max distance from the zombie that got knifed forward where infected humans will be rezurrected")), g_cvMaxDistance); HookConVarChange((cvar = CreateConVar("sm_zabuse_maxdistance", "150.0", "max distance from the zombie that got knifed forward where infected humans will be rezurrected")), g_cvMaxDistance);
g_fMaxDistance = cvar.FloatValue; g_fMaxDistance = cvar.FloatValue;
HookConVarChange((cvar = CreateConVar("sm_zabuse_time", "5.0", "max time until sm_zabuse is available after a knife")), g_cvMaxTime); HookConVarChange((cvar = CreateConVar("sm_zabuse_time", "5.0", "max time until sm_zabuse is available after a knife")), g_cvMaxTime);
@ -39,7 +39,8 @@ public void OnPluginStart()
HookEvent("player_hurt", OnPlayerHurt); HookEvent("player_hurt", OnPlayerHurt);
RegAdminCmd("sm_zabuse", Command_ZAbuse, ADMFLAG_GENERIC, "Undoes the damage caused by a zombie after being knifed forward"); RegAdminCmd("sm_kr", Command_ZAbuse, ADMFLAG_GENERIC, "Undoes the damage caused by a zombie after being knifed forward");
RegAdminCmd("sm_kniferevert", Command_ZAbuse, ADMFLAG_GENERIC, "Undoes the damage caused by a zombie after being knifed forward");
AutoExecConfig(true, "plugin.ZAbuse"); AutoExecConfig(true, "plugin.ZAbuse");
@ -49,12 +50,12 @@ public void OnPluginStart()
public void g_cvZAbuse(ConVar convar, const char[] oldValue, const char[] newValue) public void g_cvZAbuse(ConVar convar, const char[] oldValue, const char[] newValue)
{ {
g_iZAbuse = convar.IntValue; g_bZAbuse = convar.BoolValue;
} }
public void g_cvSlayKnifer(ConVar convar, const char[] oldValue, const char[] newValue) public void g_cvSlayKnifer(ConVar convar, const char[] oldValue, const char[] newValue)
{ {
g_iSlayKnifer = convar.IntValue; g_bSlayKnifer = convar.BoolValue;
} }
public void g_cvMaxDistance(ConVar convar, const char[] oldValue, const char[] newValue) public void g_cvMaxDistance(ConVar convar, const char[] oldValue, const char[] newValue)
@ -69,7 +70,7 @@ public void g_cvMaxTime(ConVar convar, const char[] oldValue, const char[] newVa
public void OnPlayerHurt(Handle hEvent, const char[] name, bool dontBroadcast) public void OnPlayerHurt(Handle hEvent, const char[] name, bool dontBroadcast)
{ {
if(g_iZAbuse == 0) if(!g_bZAbuse)
return; return;
int attacker; int attacker;
@ -124,7 +125,7 @@ public Action OnClientKnife(Handle timer)
public void ZR_OnClientInfected(int client, int attacker, bool motherInfect, bool respawnOverride, bool respawn) public void ZR_OnClientInfected(int client, int attacker, bool motherInfect, bool respawnOverride, bool respawn)
{ {
if(g_iZAbuse == 0 || !g_bKnife) if(!g_bZAbuse || !g_bKnife)
return; return;
static float fVec1[3]; static float fVec1[3];
@ -140,7 +141,7 @@ public void ZR_OnClientInfected(int client, int attacker, bool motherInfect, boo
public Action Command_ZAbuse(int client, int argc) public Action Command_ZAbuse(int client, int argc)
{ {
if(g_iZAbuse == 0) if(!g_bZAbuse)
{ {
ReplyToCommand(client, "[SM] Disabled on this Map."); ReplyToCommand(client, "[SM] Disabled on this Map.");
return Plugin_Handled; return Plugin_Handled;
@ -156,7 +157,7 @@ public Action Command_ZAbuse(int client, int argc)
PrintToChatAll("[SM] %N undid the damage from the previous Zombie Knife.", client); PrintToChatAll("[SM] %N undid the damage from the previous Zombie Knife.", client);
LogAction(client, -1, "\"%L\" undid the damage from the previous Zombie Knife.", client); LogAction(client, -1, "\"%L\" undid the damage from the previous Zombie Knife.", client);
if(g_iSlayKnifer == 1) if(g_bSlayKnifer)
{ {
ForcePlayerSuicide(g_iClientIndexKnifer); ForcePlayerSuicide(g_iClientIndexKnifer);
PrintToChat(g_iClientIndexKnifer, "[SM] You got slayed for knifing a Zombie forward!"); PrintToChat(g_iClientIndexKnifer, "[SM] You got slayed for knifing a Zombie forward!");