update(commande team): avertissement si pas assez ou trop d’arguments & log

This commit is contained in:
rick 2021-06-03 14:56:12 +02:00
parent 5bfc39ef9c
commit 51600a63a5
Signed by: Rick
GPG key ID: 2B593F087240EE99

View file

@ -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 darguments 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 dargs");
GetCmdArg(i, arg, sizeof(arg));
if (team == 1)
teamCT[i - 3] = arg;
else
teamT[i - 3] = arg;
}
return Plugin_Handled;