diff --git a/AutismBotIngame/python/ingamefollowct.py b/AutismBotIngame/python/ingamefollowct.py index 79f8a1c0..0167b32e 100644 --- a/AutismBotIngame/python/ingamefollowct.py +++ b/AutismBotIngame/python/ingamefollowct.py @@ -183,10 +183,14 @@ if __name__ == '__main__': writeCfgInput(response_msg) if ip != ovh_ip: continue + #print("data: ", data) if data == "autismo connected": print('Bot connected!') connection_issue_counter = 0 joinTeam() + elif data == "rtv": + response_msg = "say rtv" + writeCfgInput(response_msg) elif data == "bot kicked server full": print('bot kicked server full: ', datetime.datetime.now().time()) elif "connected to" in data: @@ -248,3 +252,4 @@ if [[ $DISPLAY ]]; then fi """ + diff --git a/AutismBotIngame/scripting/autism_bot_info.sp b/AutismBotIngame/scripting/autism_bot_info.sp index fd0b3a24..5b26dc1c 100644 --- a/AutismBotIngame/scripting/autism_bot_info.sp +++ b/AutismBotIngame/scripting/autism_bot_info.sp @@ -30,7 +30,6 @@ bool chat_cooldown = false; //admins & vips bool admins[MAXPLAYERS + 1]; bool vips[MAXPLAYERS + 1]; -bool rtv; //socket for bot input Handle global_socket; @@ -46,17 +45,17 @@ public Plugin myinfo = public void OnPluginStart() { - rtv = false; for (int i = 1; i <= MaxClients; i++) if (IsValidClient(i)) { targethuman[i] = 0; target_enemy[i] = 0; reset_target_human_tp_coord(i); + OnClientPostAdminCheck(i); } //talking RegConsoleCmd("sm_autism", cmd_talk, "talking to the bot through java application"); - RegConsoleCmd("sm_rtv", cmd_botrtv, "making bots rtv"); + RegConsoleCmd("sm_botrtv", cmd_botrtv, "making bots rtv"); //hooks HookEvent("round_start", Event_RoundStart, EventHookMode_PostNoCopy); @@ -189,21 +188,32 @@ public bool is_autism_bot4(int client) public Action cmd_botrtv(int client, int args) { - if ((vips[client] || admins[client]) && !rtv) + if (vips[client] || admins[client]) { - bool bot_found = false; + char msg[generic_length]; for (int i = 1; i <= MaxClients; i++) { - if (IsValidClient(i) && !IsFakeClient(i) && is_bot_player(i)) + if (IsValidClient(i) && !IsFakeClient(i)) { - FakeClientCommand(i, "sm_say rtv"); - bot_found = true; + Format(msg, sizeof(msg), "rtv"); + if (is_autism_bot1(i)) + { + send_socket_msg(msg, strlen(msg), ports[0]); + } + else if (is_autism_bot2(i)) + { + send_socket_msg(msg, strlen(msg), ports[1]); + } + else if (is_autism_bot3(i)) + { + send_socket_msg(msg, strlen(msg), ports[2]); + } + else if(is_autism_bot4(i)) + { + send_socket_msg(msg, strlen(msg), ports[3]); + } } } - if (bot_found) - { - rtv = true; - } } return Plugin_Handled; } @@ -275,12 +285,10 @@ public void Event_RoundStart(Handle event, const char[] name, bool dontBroadcast public void OnMapStart() { - rtv = true; //0.2 too spammmy, 1.5 too slow chat_cooldown = false; CreateTimer(0.30, recursive_pressing, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE); CreateTimer(15.0, bot_check_connect, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE); - CreateTimer(600.0, bot_allow_rtv); } public void send_socket_msg(char[] query_msg, int len, int port) @@ -290,12 +298,6 @@ public void send_socket_msg(char[] query_msg, int len, int port) SocketSendTo(global_socket, query_msg, len, "127.0.0.1", port); //udp } -public Action bot_allow_rtv(Handle timer, any data) -{ - rtv = false; - return Plugin_Continue; -} - public Action bot_check_connect(Handle timer, any data) { int client_count = GetClientCount(false);