From 8ecbfdc285fda33a9779ee8845fadafaaa810b0c Mon Sep 17 00:00:00 2001 From: rick Date: Sat, 29 May 2021 01:16:18 +0200 Subject: [PATCH] =?UTF-8?q?Patch=20bug=20kick=20au=20d=C3=A9but=20de=20gam?= =?UTF-8?q?e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- infolan.sp | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/infolan.sp b/infolan.sp index 5458646..d2b1fe9 100644 --- a/infolan.sp +++ b/infolan.sp @@ -12,8 +12,10 @@ char teamCT[5][150]; char teamT[5][150]; char clientId[128]; +int allId[20]; +int nbAllId = 0; + int port = -1; -bool needReset; /* pour éviter le kick lors des connexions post veille */ public Plugin myinfo = { @@ -22,7 +24,7 @@ public Plugin myinfo = description = "Bot communiquant avec le bot discord \ https://github.com/Lunki51/cs-picker afin d’automatiser \ l’InfoLan 2021", - version = "1.4", + version = "1.5", url = "https://git.gnous.eu/Rick/infolanBot" }; @@ -55,6 +57,8 @@ public void SetTeamPlayer(Event event, const char[] name, bool dontBroadcast) if (FindAdminByIdentity("steam", clientId) != INVALID_ADMIN_ID) { ChangeClientTeam(client, CS_TEAM_SPECTATOR); + allId[nbAllId] = client; + nbAllId++; } else { @@ -69,12 +73,15 @@ public void SetTeamPlayer(Event event, const char[] name, bool dontBroadcast) { ChangeClientTeam(client, CS_TEAM_CT); allGood = true; - needReset = true; + allId[nbAllId] = client; + nbAllId++; } else if (!strcmp(teamT[i], clientId, false)) { ChangeClientTeam(client, CS_TEAM_T); allGood = true; + allId[nbAllId] = client; + nbAllId++; } i++; } @@ -115,7 +122,6 @@ public Action SetTeam(int args) else teamT[i - 3] = arg; } - needReset = false; } else { @@ -131,6 +137,11 @@ public void OnMapEnd() { // TODO kick tout le monde PrintToServer("======= FIN ======"); + for (int i = 0; i < nbAllId; i++) + { + if (IsClientInGame(allId[i])) + KickClient(allId[i], "Le match est fini."); + } /* kick tout le monde */ } @@ -205,16 +216,6 @@ public void SocketEnvoieVictoire(Handle socket, any arg) public void OnSocketReceive(Handle socket, const char[] datas, const int data, any arg) {} -public void OnClientDisconnect(int client) -{ - int nbClient = GetTeamClientCount(CS_TEAM_SPECTATOR) - + GetTeamClientCount(CS_TEAM_CT) + GetTeamClientCount(CS_TEAM_T); - if (nbClient == 1 && needReset) - { - ServeurLibre(); - } -} - public OnSocketDisconnected(Handle socket, any arg) { CloseHandle(socket);