update(commande team): avertissement si pas assez ou trop d’arguments & log
check issue #7
This commit is contained in:
parent
5bfc39ef9c
commit
b29d437882
1 changed files with 13 additions and 13 deletions
16
infolan.sp
16
infolan.sp
|
@ -127,6 +127,12 @@ public void SetTeamPlayer(Event event, const char[] name, bool dontBroadcast)
|
||||||
*/
|
*/
|
||||||
public Action SetTeam(int args)
|
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];
|
char arg[128];
|
||||||
GetCmdArg(1, arg, sizeof(arg));
|
GetCmdArg(1, arg, sizeof(arg));
|
||||||
int team = (!strcmp(arg, "ct", false) ? 1 : 2);
|
int team = (!strcmp(arg, "ct", false) ? 1 : 2);
|
||||||
|
@ -136,9 +142,8 @@ public Action SetTeam(int args)
|
||||||
else
|
else
|
||||||
ServerCommand("mp_teamname_2 %s", arg)
|
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));
|
GetCmdArg(i, arg, sizeof(arg));
|
||||||
if (team == 1)
|
if (team == 1)
|
||||||
|
@ -146,11 +151,6 @@ public Action SetTeam(int args)
|
||||||
else
|
else
|
||||||
teamT[i - 3] = arg;
|
teamT[i - 3] = arg;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
PrintToServer("Erreur, pas assez d’args");
|
|
||||||
}
|
|
||||||
|
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue