Patch bug kick au début de game

This commit is contained in:
rick 2021-05-29 01:16:18 +02:00
parent 5a8db4a010
commit 8ecbfdc285
Signed by: Rick
GPG key ID: 2B593F087240EE99

View file

@ -12,8 +12,10 @@ char teamCT[5][150];
char teamT[5][150];
char clientId[128];
int allId[20];
int nbAllId = 0;
int port = -1;
bool needReset; /* pour éviter le kick lors des connexions post veille */
public Plugin myinfo =
{
@ -22,7 +24,7 @@ public Plugin myinfo =
description = "Bot communiquant avec le bot discord \
https://github.com/Lunki51/cs-picker afin dautomatiser \
lInfoLan 2021",
version = "1.4",
version = "1.5",
url = "https://git.gnous.eu/Rick/infolanBot"
};
@ -55,6 +57,8 @@ public void SetTeamPlayer(Event event, const char[] name, bool dontBroadcast)
if (FindAdminByIdentity("steam", clientId) != INVALID_ADMIN_ID)
{
ChangeClientTeam(client, CS_TEAM_SPECTATOR);
allId[nbAllId] = client;
nbAllId++;
}
else
{
@ -69,12 +73,15 @@ public void SetTeamPlayer(Event event, const char[] name, bool dontBroadcast)
{
ChangeClientTeam(client, CS_TEAM_CT);
allGood = true;
needReset = true;
allId[nbAllId] = client;
nbAllId++;
}
else if (!strcmp(teamT[i], clientId, false))
{
ChangeClientTeam(client, CS_TEAM_T);
allGood = true;
allId[nbAllId] = client;
nbAllId++;
}
i++;
}
@ -115,7 +122,6 @@ public Action SetTeam(int args)
else
teamT[i - 3] = arg;
}
needReset = false;
}
else
{
@ -131,6 +137,11 @@ public void OnMapEnd()
{
// TODO kick tout le monde
PrintToServer("======= FIN ======");
for (int i = 0; i < nbAllId; i++)
{
if (IsClientInGame(allId[i]))
KickClient(allId[i], "Le match est fini.");
}
/* kick tout le monde */
}
@ -205,16 +216,6 @@ public void SocketEnvoieVictoire(Handle socket, any arg)
public void OnSocketReceive(Handle socket, const char[] datas, const int data, any arg) {}
public void OnClientDisconnect(int client)
{
int nbClient = GetTeamClientCount(CS_TEAM_SPECTATOR)
+ GetTeamClientCount(CS_TEAM_CT) + GetTeamClientCount(CS_TEAM_T);
if (nbClient == 1 && needReset)
{
ServeurLibre();
}
}
public OnSocketDisconnected(Handle socket, any arg)
{
CloseHandle(socket);