From b3cd6f9ee5a93053b306d3e3c42c4dc3e27b3eb6 Mon Sep 17 00:00:00 2001
From: rick <rick@gnous.eu>
Date: Sat, 29 May 2021 01:54:09 +0200
Subject: [PATCH] Test event fin map

---
 infolan.sp | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/infolan.sp b/infolan.sp
index 7ef0e3b..b2ce5fd 100644
--- a/infolan.sp
+++ b/infolan.sp
@@ -32,6 +32,7 @@ public void OnPluginStart()
 {
     HookEvent("player_activate", SetTeamPlayer);
     HookEvent("cs_win_panel_round", UpdateScoreBoard);
+    HookEvent("cs_match_end_restart", TestRestart);
 
     RegServerCmd("!team", SetTeam);
     /* pour le debug
@@ -42,6 +43,25 @@ public void OnPluginStart()
     PrintToServer("Hello world!");
 }
 
+
+public void TestRestart(Event event, const char[] name, bool dontBroadcast)
+{
+    // TODO kick tout le monde
+    PrintToServer("======= FIN ======");
+    for (int i = 0; i < nbAllId; i++)
+    {
+        PrintToServer("On kick %d.", allId[i]);
+        if (IsClientInGame(allId[i])) {
+            PrintToServer("NUUUUUUUL");
+            KickClient(allId[i], "Le match est fini.");
+        }
+        allId[i] = 0;
+    }
+    ServeurLibre();
+    nbAllId = 0;
+    /* kick tout le monde */
+}
+
 public void OnConfigsExecuted()
 {
     if (port < 0)