diff --git a/README.md b/README.md index 4546d2a..419b8d0 100644 --- a/README.md +++ b/README.md @@ -31,3 +31,15 @@ Pour les joueurs il faut utiliser la commande suivante: * [ct | t] permet de définir le side * sera le nom de l’équipe (au lieu de terroriste / anti terroriste) * est l’id steam 64 des joueurs de l’équipe + +Pour rajouter un joueur en CT ou T après le début du match: + +``` +!addTeam [ct | t] + +#exemple: +!add ct 744… +``` + +* [ct | t] permet de définir le side +* est l’id steam 64 du joueur à rajouter diff --git a/infolan.sp b/infolan.sp index 68d7534..958298a 100644 --- a/infolan.sp +++ b/infolan.sp @@ -10,6 +10,8 @@ char teamCT[10][128]; char teamT[10][128]; +int nbJoueursCT = 0; +int nbJoueursT = 0; /* liste de tous les clients connectés */ int listClients[20]; @@ -24,7 +26,7 @@ public Plugin myinfo = description = "Plugin communiquant avec le bot discord \ https://github.com/InfoLAN/cs-picker afin d’automatiser \ l’InfoLan 2021", - version = "1.5.9", + version = "1.6.0b", url = "https://git.gnous.eu/Rick/infolanBot" }; @@ -35,6 +37,7 @@ public void OnPluginStart() HookEvent("cs_win_panel_match", FinCarte); RegServerCmd("!team", SetTeam); + RegServerCmd("!addTeam", AjoutJoueur); /* juste pour avoir un truc jolie */ PrintToServer("\n _____ __ _ _ _"); @@ -147,14 +150,37 @@ public Action SetTeam(int args) { GetCmdArg(i, arg, sizeof(arg)); if (team == 1) - teamCT[i - 3] = arg; + { + teamCT[nbJoueursCT] = arg; + nbJoueursCT++; + } else - teamT[i - 3] = arg; + { + teamT[nbJoueursT] = arg; + nbJoueursT++; + } } - return Plugin_Handled; } +public Action AjoutJoueur(int args) +{ + char tmp[128]; + GetCmdArg(1, tmp, sizeof(tmp)); + int team = (!strcmp(tmp, "ct", false) ? 1 : 2); + GetCmdArg(2, tmp, sizeof(tmp)); + if (team == 1) + { + teamCT[nbJoueursCT] = tmp; + nbJoueursCT++; + } + else + { + teamT[nbJoueursT] = tmp; + nbJoueursT++; + } +} + /** * Envoie une requete POST au bot pour lui indiquer que la partie est finie * et que le serveur est libre.