Ajout commande pour set les équipes
This commit is contained in:
parent
d21a55c27f
commit
6b0d10ceac
1 changed files with 74 additions and 6 deletions
80
test.sp
80
test.sp
|
@ -1,8 +1,13 @@
|
|||
#include <sourcemod>
|
||||
#include <string>
|
||||
#include "socket.inc"
|
||||
|
||||
#define MY_SOCKET_IP "localhost"
|
||||
#define MY_SOCKET_PORT 3500
|
||||
#define STEAMID_LENGTH 128
|
||||
|
||||
char teamCT[6][150];
|
||||
char teamT[6][150];
|
||||
|
||||
public Plugin myinfo =
|
||||
{
|
||||
|
@ -15,16 +20,80 @@ public Plugin myinfo =
|
|||
url = "https://git.gnous.eu/Rick/infolanBot"
|
||||
};
|
||||
|
||||
public Action TestCommand(int args)
|
||||
/* bool = GetClientAuthId()
|
||||
|
||||
public void OnClientConnected(int client)
|
||||
{
|
||||
char clientId[65];
|
||||
bool allGood = GetClientAuthId(client, AuthId_SteamID64, clientId,
|
||||
sizeof(clientId), true);
|
||||
if (!allGood)
|
||||
{
|
||||
PrintToServer("Erreur Fatale !");
|
||||
}
|
||||
else
|
||||
{
|
||||
allGood = false;
|
||||
int i = 1;
|
||||
while (!allGood && i < sizeof(teamCT))
|
||||
{
|
||||
if (teamCT[i] == clientId)
|
||||
{
|
||||
CS_SwitchTeam(client, 3);
|
||||
CS_SetClientClanTag(client, teamCT[0]);
|
||||
allGood = true;
|
||||
}
|
||||
else if (teamT[i] == clientId)
|
||||
{
|
||||
CS_SwitchTeam(client, 2);
|
||||
CS_SetClientClanTag(client, teamT[0]);
|
||||
allGood = true;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if (!allGood)
|
||||
{
|
||||
KickClient(client, "Vous n’êtes pas autorisé à suivre / jouer \
|
||||
sur ce serveur !");
|
||||
// check si casteur ou admin
|
||||
// sinon ban
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* !team
|
||||
*
|
||||
*
|
||||
*/
|
||||
public Action SetTeam(int args)
|
||||
{
|
||||
char arg[128];
|
||||
char full[256];
|
||||
GetCmdArgString(full, sizeof(full));
|
||||
PrintToServer("Je reçois %d arguments qui sont : %s", args, full);
|
||||
for(int i = 1; i < args; i++)
|
||||
GetCmdArg(1, arg, sizeof(arg));
|
||||
int team = (!strcmp(arg, "ct", false) ? 1 : 2);
|
||||
PrintToServer("L,équipe choisi est %d", team);
|
||||
if (args == 7)
|
||||
{
|
||||
GetCmdArg(i, arg, sizeof(arg));
|
||||
PrintToServer("%d c’est la demande %s", i, arg);
|
||||
for(int i = 2; i <= args; i++)
|
||||
{
|
||||
GetCmdArg(i, arg, sizeof(arg));
|
||||
if (team == 1)
|
||||
{
|
||||
teamCT[i - 2] = arg;
|
||||
}
|
||||
else
|
||||
{
|
||||
teamT[i - 2] = arg;
|
||||
}
|
||||
PrintToServer("%d c’est la demande %s", i - 2, arg);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
PrintToServer("Erreur, pas assez d’args");
|
||||
}
|
||||
|
||||
return Plugin_Handled;
|
||||
|
@ -37,7 +106,6 @@ public void OnSocketReceive(Handle socket, const char[] datas, const int data, a
|
|||
public void OnMapEnd()
|
||||
{
|
||||
/* kick tout le monde */
|
||||
PrintToServer("This is zi end ================");
|
||||
}
|
||||
|
||||
public void OnSocketConnected(Handle socket, any arg)
|
||||
|
@ -82,7 +150,7 @@ public void OnPluginStart()
|
|||
|
||||
HookEvent("cs_win_panel_match", EnvoiInfo);
|
||||
|
||||
RegServerCmd("!test", TestCommand);
|
||||
RegServerCmd("!team", SetTeam);
|
||||
|
||||
PrintToServer("Hello world!");
|
||||
PrintToServer("==== REQUETE ENVOYÉE ====");
|
||||
|
|
Loading…
Reference in a new issue