From 51600a63a5e928cdf0117d1f7e667a0a154a9c9a Mon Sep 17 00:00:00 2001 From: rick Date: Thu, 3 Jun 2021 14:56:12 +0200 Subject: [PATCH] =?UTF-8?q?update(commande=20team):=20avertissement=20si?= =?UTF-8?q?=20pas=20assez=20ou=20trop=20d=E2=80=99arguments=20&=20log?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- infolan.sp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/infolan.sp b/infolan.sp index 0cadb85..68d7534 100644 --- a/infolan.sp +++ b/infolan.sp @@ -127,6 +127,12 @@ public void SetTeamPlayer(Event event, const char[] name, bool dontBroadcast) */ public Action SetTeam(int args) { + char tmp[2058]; + GetCmdArgString(tmp, 2058); + LogMessage("Commande !team reçu: %s", tmp); + if (args != 7) + LogMessage("!team: pas assez ou trop d’arguments données."); + char arg[128]; GetCmdArg(1, arg, sizeof(arg)); int team = (!strcmp(arg, "ct", false) ? 1 : 2); @@ -136,20 +142,14 @@ public Action SetTeam(int args) else ServerCommand("mp_teamname_2 %s", arg) - if (args == 7) + /* on garde 7 pour éviter de mettre + de 5 personnes / équipe */ + for(int i = 3; i <= 7 && i <= args; i++) { - for(int i = 3; i <= args; i++) - { - GetCmdArg(i, arg, sizeof(arg)); - if (team == 1) - teamCT[i - 3] = arg; - else - teamT[i - 3] = arg; - } - } - else - { - PrintToServer("Erreur, pas assez d’args"); + GetCmdArg(i, arg, sizeof(arg)); + if (team == 1) + teamCT[i - 3] = arg; + else + teamT[i - 3] = arg; } return Plugin_Handled;