From bf49ab06c8cfa4a40ab47d14678a1956379a2bb2 Mon Sep 17 00:00:00 2001 From: jenz Date: Sun, 25 Jun 2023 14:02:24 +0200 Subject: [PATCH] redid getclientauthid to be used way less --- AutismBotIngame/scripting/autism_bot_info.sp | 91 ++++++++++---------- 1 file changed, 44 insertions(+), 47 deletions(-) diff --git a/AutismBotIngame/scripting/autism_bot_info.sp b/AutismBotIngame/scripting/autism_bot_info.sp index 567f57d0..cb2e7f5e 100644 --- a/AutismBotIngame/scripting/autism_bot_info.sp +++ b/AutismBotIngame/scripting/autism_bot_info.sp @@ -39,7 +39,7 @@ Handle g_hGetRunCmdPre; //is botplayer bool is_bot_player[MAXPLAYERS + 1]; - +int specific_bot_player[MAXPLAYERS + 1]; public Plugin myinfo = { @@ -134,14 +134,13 @@ public Action OnPlayerRunCmd(int client, int& buttons, int& impulse, float vel[3 return Plugin_Continue; } + //on voodoo island bots managed to skip tp. either due to water or due to ladder if (GetEntProp(client, Prop_Data, "m_nWaterLevel") != 0) { has_to_jump_bots[client] = 2; return Plugin_Continue; } //make sure fell of an edge instead of actually jumping - //the implementation can still fail a bit in some cases but has to do for now. - // problems when using mousewheel, spacebar jumping seems to work if (buttons & IN_JUMP && has_to_jump_bots[client] == 1) { has_to_jump_bots[client] = 2; @@ -228,52 +227,48 @@ public void cmd_talk_help(int port, int client, char[] info) } -public bool is_autism_bot1(int client) +public void is_autism_bot1(int client) { char auth[50]; GetClientAuthId(client, AuthId_Engine, auth, sizeof(auth)); if (StrEqual("[U:1:120378081]", auth, false) || StrEqual("STEAM_0:1:60189040", auth, false)) { is_bot_player[client] = true; - return true; + specific_bot_player[client] = 1; } - return false; } -public bool is_autism_bot2(int client) +public void is_autism_bot2(int client) { char auth[50]; GetClientAuthId(client, AuthId_Engine, auth, sizeof(auth)); if (StrEqual("[U:1:1036189204]", auth, false) || StrEqual("STEAM_0:0:518094602", auth, false)) { is_bot_player[client] = true; - return true; + specific_bot_player[client] = 2; } - return false; } -public bool is_autism_bot3(int client) +public void is_autism_bot3(int client) { char auth[50]; GetClientAuthId(client, AuthId_Engine, auth, sizeof(auth)); if (StrEqual("[U:1:408797742]", auth, false) || StrEqual("STEAM_0:0:204398871", auth, false)) { is_bot_player[client] = true; - return true; + specific_bot_player[client] = 3; } - return false; } -public bool is_autism_bot4(int client) +public void is_autism_bot4(int client) { char auth[50]; GetClientAuthId(client, AuthId_Engine, auth, sizeof(auth)); if (StrEqual("[U:1:1221121532]", auth, false) || StrEqual("STEAM_0:0:610560766", auth, false)) { is_bot_player[client] = true; - return true; + specific_bot_player[client] = 4; } - return false; } public Action cmd_botrtv(int client, int args) @@ -286,19 +281,19 @@ public Action cmd_botrtv(int client, int args) { char msg[generic_length]; Format(msg, sizeof(msg), "rtv"); - if (is_autism_bot1(i)) + if (specific_bot_player[i] == 1) { send_socket_msg(msg, strlen(msg), ports[0]); } - else if (is_autism_bot2(i)) + else if (specific_bot_player[i] == 2) { send_socket_msg(msg, strlen(msg), ports[1]); } - else if (is_autism_bot3(i)) + else if (specific_bot_player[i] == 3) { send_socket_msg(msg, strlen(msg), ports[2]); } - else if(is_autism_bot4(i)) + else if(specific_bot_player[i] == 4) { send_socket_msg(msg, strlen(msg), ports[3]); } @@ -332,22 +327,22 @@ public Action cmd_talk(int client, int args) { if (IsValidClient(i) && !IsFakeClient(i)) { - if (is_autism_bot1(i)) + if (specific_bot_player[i] == 1) { cmd_talk_help(ports[0], client, info); bot_found = true; } - if (is_autism_bot2(i)) + if (specific_bot_player[i] == 2) { cmd_talk_help(ports[1], client, info); bot_found = true; } - if (is_autism_bot3(i)) + if (specific_bot_player[i] == 3) { cmd_talk_help(ports[2], client, info); bot_found = true; } - if (is_autism_bot4(i)) + if (specific_bot_player[i] == 4) { cmd_talk_help(ports[3], client, info); bot_found = true; @@ -390,13 +385,13 @@ public Action bot_check_connect(Handle timer, any data) for (int i = 1; i <= MaxClients; i++) if (IsValidClient(i) && !IsFakeClient(i)) { - if (is_autism_bot1(i)) + if (specific_bot_player[i] == 1) bot1_connected = true; - if (is_autism_bot2(i)) + if (specific_bot_player[i] == 2) bot2_connected = true; - if (is_autism_bot3(i)) + if (specific_bot_player[i] == 3) bot3_connected = true; - if (is_autism_bot4(i)) + if (specific_bot_player[i] == 4) bot4_connected = true; } @@ -623,19 +618,19 @@ public Action recursive_pressing(Handle timer, any data) trace_hulling_bot(client); char message[generic_length * 7]; Format(message, sizeof(message), "dist_target: %f enemy_distance: %f targeteam: %i state: %i", dist_target, enemy_distance, targeteam, state); - if (is_autism_bot1(client)) + if (specific_bot_player[client] == 1) { send_socket_msg(message, strlen(message), ports[0]); } - if (is_autism_bot2(client)) + if (specific_bot_player[client] == 2) { send_socket_msg(message, strlen(message), ports[1]); } - if (is_autism_bot3(client)) + if (specific_bot_player[client] == 3) { send_socket_msg(message, strlen(message), ports[2]); } - if (is_autism_bot4(client)) + if (specific_bot_player[client] == 4) { send_socket_msg(message, strlen(message), ports[3]); } @@ -699,19 +694,19 @@ public void trace_hulling_bot(int client) { //can crouch Format(message, sizeof(message), "hull info:crouch"); - if (is_autism_bot1(client)) + if (specific_bot_player[client] == 1) { send_socket_msg(message, strlen(message), ports[0]); } - if (is_autism_bot2(client)) + if (specific_bot_player[client] == 2) { send_socket_msg(message, strlen(message), ports[1]); } - if (is_autism_bot3(client)) + if (specific_bot_player[client] == 3) { send_socket_msg(message, strlen(message), ports[2]); } - if (is_autism_bot4(client)) + if (specific_bot_player[client] == 4) { send_socket_msg(message, strlen(message), ports[3]); } @@ -734,19 +729,19 @@ public void trace_hulling_bot(int client) { //should not block jump level Format(message, sizeof(message), "hull info:jump"); - if (is_autism_bot1(client)) + if (specific_bot_player[client] == 1) { send_socket_msg(message, strlen(message), ports[0]); } - if (is_autism_bot2(client)) + if (specific_bot_player[client] == 2) { send_socket_msg(message, strlen(message), ports[1]); } - if (is_autism_bot3(client)) + if (specific_bot_player[client] == 3) { send_socket_msg(message, strlen(message), ports[2]); } - if (is_autism_bot4(client)) + if (specific_bot_player[client] == 4) { send_socket_msg(message, strlen(message), ports[3]); } @@ -805,19 +800,19 @@ public void trace_hulling_bot(int client) if (should_jump) { Format(message, sizeof(message), "hull info:jump"); - if (is_autism_bot1(client)) + if (specific_bot_player[client] == 1) { send_socket_msg(message, strlen(message), ports[0]); } - if (is_autism_bot2(client)) + if (specific_bot_player[client] == 2) { send_socket_msg(message, strlen(message), ports[1]); } - if (is_autism_bot3(client)) + if (specific_bot_player[client] == 3) { send_socket_msg(message, strlen(message), ports[2]); } - if (is_autism_bot4(client)) + if (specific_bot_player[client] == 4) { send_socket_msg(message, strlen(message), ports[3]); } @@ -956,6 +951,7 @@ public float get_power_distance(int target_player, float [3]pos) public void OnClientPostAdminCheck(int client) { is_bot_player[client] = false; + specific_bot_player[client] = 0; is_autism_bot1(client); is_autism_bot2(client); is_autism_bot3(client); @@ -996,19 +992,19 @@ public void OnClientPostAdminCheck(int client) bot_follow_tp[client] = false; char auth[64]; GetClientAuthId(client, AuthId_Engine, auth, sizeof(auth)); - if (is_autism_bot1(client)) + if (specific_bot_player[client] == 1) { send_socket_msg(msg, strlen(msg), ports[0]); } - if (is_autism_bot2(client)) + if (specific_bot_player[client] == 2) { send_socket_msg(msg, strlen(msg), ports[1]); } - if (is_autism_bot3(client)) + if (specific_bot_player[client] == 3) { send_socket_msg(msg, strlen(msg), ports[2]); } - if (is_autism_bot4(client)) + if (specific_bot_player[client] == 4) { send_socket_msg(msg, strlen(msg), ports[3]); } @@ -1065,6 +1061,7 @@ public void OnClientDisconnect(int client) } } is_bot_player[client] = false; + specific_bot_player[client] = 0; } //Socket callback