From 8e1f44544915bce90daeab23b7c93873e7c8fe22 Mon Sep 17 00:00:00 2001
From: neon <xxx@yyy.de>
Date: Mon, 23 Jul 2018 10:51:04 +0200
Subject: [PATCH] initial commit

---
 MVP_Stars/scripting/MVP_Stars.sp | 111 +++++++++++++++++++++++++++++++
 1 file changed, 111 insertions(+)
 create mode 100644 MVP_Stars/scripting/MVP_Stars.sp

diff --git a/MVP_Stars/scripting/MVP_Stars.sp b/MVP_Stars/scripting/MVP_Stars.sp
new file mode 100644
index 00000000..c8067d5f
--- /dev/null
+++ b/MVP_Stars/scripting/MVP_Stars.sp
@@ -0,0 +1,111 @@
+#include <sourcemod>
+#include <cstrike>
+#include <zombiereloaded>
+
+new bool:G_bIsHuman[66];
+new bool:G_bIsZombie[66];
+
+public Plugin myinfo =
+{
+	name			= "MVP_Stars",
+	author			= "zaCade",
+	description		= "",
+	version			= "1.0",
+	url				= ""
+};
+
+public void OnPluginStart()
+{
+	HookEvent("round_start", Event_RoundStart, EventHookMode:1);
+	HookEvent("round_end", Event_RoundEnd, EventHookMode:1);
+}
+
+public void ZR_OnClientInfected(int client, int attacker, bool motherInfect, bool respawnOverride, bool respawn)
+{
+	G_bIsHuman[client] = 0;
+	G_bIsZombie[client] = 1;
+}
+
+public ZR_OnClientHumanPost(client, bool:respawn, bool:protect)
+{
+	G_bIsHuman[client] = 1;
+	G_bIsZombie[client] = 0;
+}
+
+public Action:Event_RoundStart(Handle:event, String:name[], bool:dontBroadcast)
+{
+	new client = 1;
+	while (client <= MaxClients)
+	{
+		G_bIsHuman[client] = 1;
+		G_bIsZombie[client] = 0;
+		client++;
+	}
+	return Action:0;
+}
+
+public Action:Event_RoundEnd(Handle:event, String:name[], bool:dontBroadcast)
+{
+	switch (GetEventInt(event, "winner"))
+	{
+		case 2:
+		{
+			CreateTimer(0.2, OnZombiesWin, any:0, 2);
+		}
+		case 3:
+		{
+			CreateTimer(0.2, OnHumansWin, any:0, 2);
+		}
+		default:
+		{
+		}
+	}
+	return Action:0;
+}
+
+public Action:OnHumansWin(Handle:timer)
+{
+	new client = 1;
+	while (client <= MaxClients)
+	{
+		new var1;
+		if (IsClientInGame(client) && IsPlayerAlive(client) && !IsClientObserver(client) && !IsFakeClient(client))
+		{
+			new var2;
+			if (G_bIsHuman[client] && !G_bIsZombie[client])
+			{
+				CS_SetMVPCount(client, CS_GetMVPCount(client) + 1);
+				new String:sAuthID[64];
+				if (!GetClientAuthString(client, sAuthID, 64, true))
+				{
+					Format(sAuthID, 64, "UNKNOWN");
+				}
+			}
+		}
+		client++;
+	}
+	return Action:0;
+}
+
+public Action:OnZombiesWin(Handle:timer)
+{
+	new client = 1;
+	while (client <= MaxClients)
+	{
+		new var1;
+		if (IsClientInGame(client) && IsPlayerAlive(client) && !IsClientObserver(client) && !IsFakeClient(client))
+		{
+			new var2;
+			if (G_bIsZombie[client] && !G_bIsHuman[client])
+			{
+				new String:sAuthID[64];
+				if (!GetClientAuthString(client, sAuthID, 64, true))
+				{
+					Format(sAuthID, 64, "UNKNOWN");
+				}
+			}
+		}
+		client++;
+	}
+	return Action:0;
+}
\ No newline at end of file