changed respawning and team joining for gg server
This commit is contained in:
parent
87a053e338
commit
d6fc4b7c38
@ -30,11 +30,6 @@ def exit_handler():
|
|||||||
writeCfgInput('')
|
writeCfgInput('')
|
||||||
#securing the looptest.cfg wont be stuck accidently with commands
|
#securing the looptest.cfg wont be stuck accidently with commands
|
||||||
|
|
||||||
def joinTeam():
|
|
||||||
str = "jointeam 2; joinclass 3; zspawn;"
|
|
||||||
writeCfgInput(str)
|
|
||||||
print('jointeam func: ')
|
|
||||||
|
|
||||||
def bot_process_movement(input_line):
|
def bot_process_movement(input_line):
|
||||||
dist_target = input_line[input_line.index("dist_target:") + len("dist_target:"):input_line.index("targethuman:")]
|
dist_target = input_line[input_line.index("dist_target:") + len("dist_target:"):input_line.index("targethuman:")]
|
||||||
targethuman = input_line[input_line.index("targethuman:") + len("targethuman:"):input_line.index("enemy_distance:")]
|
targethuman = input_line[input_line.index("targethuman:") + len("targethuman:"):input_line.index("enemy_distance:")]
|
||||||
@ -187,7 +182,6 @@ if __name__ == '__main__':
|
|||||||
if data == "autismo connected":
|
if data == "autismo connected":
|
||||||
print('Bot connected!')
|
print('Bot connected!')
|
||||||
connection_issue_counter = 0
|
connection_issue_counter = 0
|
||||||
joinTeam()
|
|
||||||
elif data == "rtv":
|
elif data == "rtv":
|
||||||
response_msg = "say rtv"
|
response_msg = "say rtv"
|
||||||
writeCfgInput(response_msg)
|
writeCfgInput(response_msg)
|
||||||
|
@ -362,7 +362,7 @@ public Action bot_check_connect(Handle timer, any data)
|
|||||||
found_bot4 = true;
|
found_bot4 = true;
|
||||||
Format(msg, sizeof(msg), "connect to gg");
|
Format(msg, sizeof(msg), "connect to gg");
|
||||||
send_socket_msg(msg, strlen(msg), ports[0]);
|
send_socket_msg(msg, strlen(msg), ports[0]);
|
||||||
Format(msg, sizeof(msg), "connect to zr");
|
//Format(msg, sizeof(msg), "connect to zr");
|
||||||
send_socket_msg(msg, strlen(msg), ports[1]);
|
send_socket_msg(msg, strlen(msg), ports[1]);
|
||||||
send_socket_msg(msg, strlen(msg), ports[2]);
|
send_socket_msg(msg, strlen(msg), ports[2]);
|
||||||
send_socket_msg(msg, strlen(msg), ports[3]);
|
send_socket_msg(msg, strlen(msg), ports[3]);
|
||||||
@ -371,30 +371,35 @@ public Action bot_check_connect(Handle timer, any data)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
//respawning bot on the GG server because they dont respawn for whatever reason
|
||||||
if (is_autism_bot1(i))
|
if (is_autism_bot1(i))
|
||||||
{
|
{
|
||||||
Format(msg, sizeof(msg), "connected to gg");
|
Format(msg, sizeof(msg), "connected to gg");
|
||||||
send_socket_msg(msg, strlen(msg), ports[0]);
|
send_socket_msg(msg, strlen(msg), ports[0]);
|
||||||
found_bot1 = true;
|
found_bot1 = true;
|
||||||
|
CreateTimer(1.0, respawn_bot, i);
|
||||||
}
|
}
|
||||||
else if (is_bot_player(i))
|
else if (is_bot_player(i))
|
||||||
{
|
{
|
||||||
Format(msg, sizeof(msg), "connected to zr");
|
Format(msg, sizeof(msg), "connected to gg");
|
||||||
}
|
}
|
||||||
if (is_autism_bot2(i))
|
if (is_autism_bot2(i))
|
||||||
{
|
{
|
||||||
send_socket_msg(msg, strlen(msg), ports[1]);
|
send_socket_msg(msg, strlen(msg), ports[1]);
|
||||||
found_bot2 = true;
|
found_bot2 = true;
|
||||||
|
CreateTimer(1.0, respawn_bot, i);
|
||||||
}
|
}
|
||||||
if (is_autism_bot3(i))
|
if (is_autism_bot3(i))
|
||||||
{
|
{
|
||||||
send_socket_msg(msg, strlen(msg), ports[2]);
|
send_socket_msg(msg, strlen(msg), ports[2]);
|
||||||
found_bot3 = true;
|
found_bot3 = true;
|
||||||
|
CreateTimer(1.0, respawn_bot, i);
|
||||||
}
|
}
|
||||||
if (is_autism_bot4(i))
|
if (is_autism_bot4(i))
|
||||||
{
|
{
|
||||||
send_socket_msg(msg, strlen(msg), ports[3]);
|
send_socket_msg(msg, strlen(msg), ports[3]);
|
||||||
found_bot4 = true;
|
found_bot4 = true;
|
||||||
|
CreateTimer(1.0, respawn_bot, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -407,17 +412,17 @@ public Action bot_check_connect(Handle timer, any data)
|
|||||||
//gg
|
//gg
|
||||||
send_socket_msg(msg, strlen(msg), ports[0]);
|
send_socket_msg(msg, strlen(msg), ports[0]);
|
||||||
}
|
}
|
||||||
if (!found_bot2 && i_port == server_ports[2])
|
if (!found_bot2 && i_port == server_ports[1])
|
||||||
{
|
{
|
||||||
//zr
|
//zr
|
||||||
send_socket_msg(msg, strlen(msg), ports[1]);
|
send_socket_msg(msg, strlen(msg), ports[1]);
|
||||||
}
|
}
|
||||||
if (!found_bot3 && i_port == server_ports[2])
|
if (!found_bot3 && i_port == server_ports[1])
|
||||||
{
|
{
|
||||||
//zr
|
//zr
|
||||||
send_socket_msg(msg, strlen(msg), ports[2]);
|
send_socket_msg(msg, strlen(msg), ports[2]);
|
||||||
}
|
}
|
||||||
if (!found_bot4 && i_port == server_ports[2])
|
if (!found_bot4 && i_port == server_ports[1])
|
||||||
{
|
{
|
||||||
//zr
|
//zr
|
||||||
send_socket_msg(msg, strlen(msg), ports[3]);
|
send_socket_msg(msg, strlen(msg), ports[3]);
|
||||||
@ -522,6 +527,12 @@ public bool is_bot_player(int client)
|
|||||||
|
|
||||||
public Action recursive_pressing(Handle timer, any data)
|
public Action recursive_pressing(Handle timer, any data)
|
||||||
{
|
{
|
||||||
|
int i_port = GetConVarInt(FindConVar("hostport"));
|
||||||
|
bool is_host_ze = false;
|
||||||
|
if (i_port == server_ports[0])
|
||||||
|
{
|
||||||
|
is_host_ze = true;
|
||||||
|
}
|
||||||
bool found_valid_ct = false;
|
bool found_valid_ct = false;
|
||||||
for (int client = 1; client <= MaxClients; client++)
|
for (int client = 1; client <= MaxClients; client++)
|
||||||
{
|
{
|
||||||
@ -534,7 +545,35 @@ public Action recursive_pressing(Handle timer, any data)
|
|||||||
{
|
{
|
||||||
if (GetClientTeam(client) == 1 || GetClientTeam(client) == 0)
|
if (GetClientTeam(client) == 1 || GetClientTeam(client) == 0)
|
||||||
{
|
{
|
||||||
ChangeClientTeam(client, 2);
|
if (is_host_ze)
|
||||||
|
{
|
||||||
|
ChangeClientTeam(client, 2);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int T_client_count = 0;
|
||||||
|
int CT_client_count = 0;
|
||||||
|
for (int clientI = 1; clientI <= MaxClients; clientI++)
|
||||||
|
{
|
||||||
|
if (!IsValidClient(clientI)) continue;
|
||||||
|
if (GetClientTeam(clientI) == 2)
|
||||||
|
{
|
||||||
|
T_client_count++;
|
||||||
|
}
|
||||||
|
else if (GetClientTeam(clientI) == 3)
|
||||||
|
{
|
||||||
|
CT_client_count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (T_client_count > CT_client_count)
|
||||||
|
{
|
||||||
|
ChangeClientTeam(client, 3);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ChangeClientTeam(client, 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (bot_avoid_edge[client] >= 3)
|
if (bot_avoid_edge[client] >= 3)
|
||||||
@ -634,7 +673,7 @@ public Action recursive_pressing(Handle timer, any data)
|
|||||||
for (int client = 1; client <= MaxClients; client++)
|
for (int client = 1; client <= MaxClients; client++)
|
||||||
{
|
{
|
||||||
if (!IsValidClient(client)) continue;
|
if (!IsValidClient(client)) continue;
|
||||||
if (is_bot_player(client) && GetClientTeam(client) == 3)
|
if (is_bot_player(client) && GetClientTeam(client) == 3 && is_host_ze)
|
||||||
{
|
{
|
||||||
ForcePlayerSuicide(client);
|
ForcePlayerSuicide(client);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user