fixed connecting again

This commit is contained in:
christian 2021-07-29 00:59:36 +02:00
parent 7ff258df50
commit 80ba110c42

View File

@ -253,6 +253,7 @@ public void OnMapStart()
public void send_socket_msg(char[] query_msg, int len, int port)
{
//LogMessage("query_msg: %s port: %i", query_msg, port);
if (global_socket != INVALID_HANDLE && SocketIsConnected(global_socket))
SocketSendTo(global_socket, query_msg, len, "127.0.0.1", port); //udp
}
@ -263,6 +264,10 @@ public Action bot_check_connect(Handle timer, any data)
char msg[generic_length];
//PrintToChatAll("sending UDP message...");
Format(msg, sizeof(msg), "connect to ze");
bool found_bot1 = false;
bool found_bot2 = false;
bool found_bot3 = false;
bool found_bot4 = false;
for (int i = 1; i <= MaxClients; i++)
if (IsValidClient(i) && !IsFakeClient(i))
{
@ -275,25 +280,39 @@ public Action bot_check_connect(Handle timer, any data)
}
else if (client_count < 50)
{
char auth[50];
GetClientAuthId(i, AuthId_Engine, auth, sizeof(auth));
if (is_autism_bot1(i))
{
send_socket_msg(msg, strlen(msg), ports[0]);
found_bot1 = true;
}
if (is_autism_bot2(i))
{
send_socket_msg(msg, strlen(msg), ports[1]);
found_bot2 = true;
}
if (is_autism_bot3(i))
{
send_socket_msg(msg, strlen(msg), ports[2]);
found_bot3 = true;
}
if (is_autism_bot4(i))
{
send_socket_msg(msg, strlen(msg), ports[3]);
found_bot4 = true;
}
}
}
if (!found_bot1)
{
send_socket_msg(msg, strlen(msg), ports[0]);
}
if (!found_bot2)
{
send_socket_msg(msg, strlen(msg), ports[1]);
}
if (!found_bot3)
{
send_socket_msg(msg, strlen(msg), ports[2]);
}
if (!found_bot4)
{
send_socket_msg(msg, strlen(msg), ports[3]);
}
return Plugin_Continue;
}