update(commande team): avertissement si pas assez ou trop d’arguments & log
This commit is contained in:
parent
5bfc39ef9c
commit
51600a63a5
1 changed files with 13 additions and 13 deletions
26
infolan.sp
26
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;
|
||||
|
|
Loading…
Reference in a new issue