diff --git a/infolan.sp b/infolan.sp index 8e68759..b684327 100644 --- a/infolan.sp +++ b/infolan.sp @@ -1,4 +1,5 @@ #include +#include #include #include "socket.inc" @@ -7,8 +8,8 @@ #define MY_SOCKET_PORT 3000 #define STEAMID_LENGTH 128 -char teamCT[6][150]; -char teamT[6][150]; +char teamCT[5][150]; +char teamT[5][150]; char clientId[128]; int port = -1; @@ -195,6 +196,17 @@ 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) + { + Handle socket = SocketCreate(SOCKET_TCP, OnSocketError); + SocketConnect(socket, SocketEnvoieVictoire, OnSocketReceive, OnSocketDisconnected, MY_SOCKET_IP, MY_SOCKET_PORT); + } +} + public OnSocketDisconnected(Handle socket, any arg) { CloseHandle(socket);