leader2 + ZombieManager + Status: fix

This commit is contained in:
DoganGFL 2019-07-24 10:10:38 +02:00
parent 326428915a
commit 2d53504807
3 changed files with 56 additions and 32 deletions

View File

@ -38,13 +38,9 @@ public void OnPluginStart()
public Action Command_Status(int client, const char[] command, int args)
{
if(!client)
if(!client || !IsClientInGame(client))
return Plugin_Continue;
// hopefully fixing some dumb exploit?!
if(!IsClientInGame(client))
return Plugin_Stop;
static char sServerName[128];
static char sServerTags[128];
static char sServerAdress[128];

View File

@ -14,7 +14,7 @@ public Plugin myinfo =
name = "Zombie Manager",
author = "Dogan",
description = "Tools to manage testround and zombies",
version = "1.0.0",
version = "1.1.0",
url = ""
};
@ -56,11 +56,27 @@ public void ZR_OnClientHumanPost(int client, bool respawn, bool protect)
g_bMotherZM[client] = false;
}
public Action ZR_OnClientInfect(int &client, int &attacker, bool &motherInfect, bool &respawnOverride, bool &respawn)
{
if(g_bTestRound)
return Plugin_Handled;
return Plugin_Continue;
}
public void ZR_OnClientInfected(int client, int attacker, bool motherInfect, bool respawnOverride, bool respawn)
{
g_bMotherZM[client] = motherInfect;
}
public Action ZR_OnInfectCountdown()
{
if(g_bTestRound)
return Plugin_Handled;
return Plugin_Continue;
}
public void OnClientSpawn(Event hEvent, const char[] sName, bool bDontBroadcast)
{
int client = GetClientOfUserId(hEvent.GetInt("userid"));
@ -72,10 +88,7 @@ public Action OnPlayerTeam(Event event, const char[] name, bool dontBroadcast)
{
int client = GetClientOfUserId(GetEventInt(event, "userid"));
if(g_bMotherZM[client])
{
g_bMotherZM[client] = false;
}
g_bMotherZM[client] = false;
}
public bool Filter_Motherzombies(const char[] sPattern, Handle hClients, int client)
@ -123,7 +136,7 @@ public Action Command_DisplayMotherzombies(int client, int args)
public Action Command_Testround(int client, int args)
{
if(GetClientTeam(client) == CS_TEAM_SPECTATOR)
/*if(GetClientTeam(client) == CS_TEAM_SPECTATOR)
{
ReplyToCommand(client, "[SM] Please join a Team first.");
return Plugin_Handled;
@ -133,7 +146,7 @@ public Action Command_Testround(int client, int args)
{
ReplyToCommand(client, "[SM] Please respawn yourself first.");
return Plugin_Handled;
}
}*/
ToggleTestRound(client);
return Plugin_Handled;
@ -159,12 +172,9 @@ public void ToggleTestRound(int client)
CPrintToChatAll("[SM] %N activated a Test Round!", client);
LogAction(client, -1, "\"%L\" activated a Test Round.", client);
if(ZR_IsClientHuman(client))
ZR_InfectClient(client);
for(int i = 1; i <= MaxClients; i++)
{
if(i != client && IsClientInGame(i) && !IsFakeClient(i))
if(IsClientInGame(i) && !IsFakeClient(i) && IsPlayerAlive(i) && ZR_IsClientZombie(i))
{
ZR_HumanClient(i, false, false);
}
@ -172,6 +182,14 @@ public void ToggleTestRound(int client)
}
}
public Action CS_OnTerminateRound(float &delay, CSRoundEndReason &reason)
{
if(g_bTestRound)
return Plugin_Handled;
return Plugin_Continue;
}
public Action ZR_OnClientRespawn(int &client, ZR_RespawnCondition &condition)
{
if(g_bTestRound)

View File

@ -495,7 +495,17 @@ public Action Leader(int client, int args)
}
else
{
if(IsPlayerAlive(target))
if(!IsPlayerAlive(target))
{
ReplyToCommand(client, "[SM] The target has to be alive!");
return Plugin_Handled;
}
else if(ZR_IsClientZombie(target))
{
ReplyToCommand(client, "[SM] The target has to be a human!");
return Plugin_Handled;
}
else
{
SetLeader(target);
PrintToChatAll("[SM] %N is the new leader!", target);
@ -503,11 +513,6 @@ public Action Leader(int client, int args)
LeaderMenu(target);
return Plugin_Handled;
}
else
{
ReplyToCommand(client, "[SM] The target has to be alive!");
return Plugin_Handled;
}
}
}
else if(args == 0)
@ -517,7 +522,17 @@ public Action Leader(int client, int args)
LeaderMenu(client);
return Plugin_Handled;
}
if(IsPlayerAlive(client))
if(!IsPlayerAlive(client))
{
ReplyToCommand(client, "[SM] The target has to be alive!");
return Plugin_Handled;
}
else if(ZR_IsClientZombie(client))
{
ReplyToCommand(client, "[SM] The target has to be a human!");
return Plugin_Handled;
}
else
{
SetLeader(client);
PrintToChatAll("[SM] %N is the new leader!", client);
@ -525,11 +540,6 @@ public Action Leader(int client, int args)
LeaderMenu(client);
return Plugin_Handled;
}
else
{
ReplyToCommand(client, "[SM] The target has to be alive!");
return Plugin_Handled;
}
}
else
{