#pragma semicolon 1 #define DEBUG #define PLUGIN_AUTHOR "jenz" #define PLUGIN_VERSION "1.00" #include #include #pragma newdecls required bool outputspam[MAXPLAYERS + 1]; int ticksCooldown = 48; // 66 tick per second int botTicker; int targethuman = 0; public Plugin myinfo = { name = "coordinates for the bot", author = PLUGIN_AUTHOR, description = "hello ", version = PLUGIN_VERSION, url = "" }; public void OnPluginStart() { RegConsoleCmd("sm_botfindString", Cmd_findBotString); } //---------------------------------------------------------------------------------------------------- // Purpose: //---------------------------------------------------------------------------------------------------- public Action Cmd_findBotString(int client, int args) { if (!IsValidClient(client)) return Plugin_Handled; if (!outputspam[client]) return Plugin_Handled; if (args != 1) { ReplyToCommand(client, "[SM] Usage botfindString "); return Plugin_Handled; } char sTarget[65]; GetCmdArg(1, sTarget, sizeof(sTarget)); PrintToChat(client, sTarget); return Plugin_Handled; } public void OnClientDisconnect(int client) { outputspam[client] = false; } stock void TraceEye(const int client, float pos[3]) { float vAngles[3], vOrigin[3]; GetClientEyePosition(client, vOrigin); GetClientEyeAngles(client, vAngles); TR_TraceRayFilter(vOrigin, vAngles, MASK_SHOT, RayType_Infinite, TraceEntityFilterPlayer); if(TR_DidHit()) TR_GetEndPosition(pos); } public bool TraceEntityFilterPlayer( int entity, int contentsMask ) { return ( entity > GetMaxClients() || !entity ); } //TODO FINISH MOVING OVER, RECURSIVE OR 1 SEC TIMER JUST instead of using OnPlayerRunCmdPost public void recursivePressing() { if (targethuman && (GetClientTeam(targethuman) != 3 || !IsPlayerAlive(targethuman))) { targethuman = 0; } if (!targethuman) { float pos_client[3]; TraceEye(client, pos_client); float lowest_distance = 1000000.0; for (int i = 1; i <= MaxClients; i++) if (IsValidClient(i) && IsPlayerAlive(i) && GetClientTeam(i) == 3 && i != client) { float pos_i[3]; TraceEye(client, pos_i); float dx = pos_client[0] - pos_i[0]; float dy = pos_client[1] - pos_i[1]; float dz = FloatAbs(pos_client[2] - pos_i[2]); float dist = SquareRoot(dx*dx + dy*dy + dz*dz); if (dist < lowest_distance) { lowest_distance = dist; targethuman = i; } } } //maybe this holds some order? float clientorigin[3]; float clientangles[3]; GetClientAbsOrigin(targethuman, clientorigin); GetClientAbsAngles(targethuman, clientangles); //PrintToChat(client, "player_start_origin: %f %f %f", clientorigin[0], clientorigin[1], clientorigin[2]); int keys = GetClientButtons(targethuman); if (keys & IN_FORWARD) { ServerCommand("sm_psay #[U:1:120378081] movement_input_specific:+forward"); } if (keys & IN_BACK) { ServerCommand("sm_psay #[U:1:120378081] movement_input_specific:+back"); } if (keys & IN_LEFT) { ServerCommand("sm_psay #[U:1:120378081] movement_input_specific:+moveleft"); } if (keys & IN_RIGHT) { ServerCommand("sm_psay #[U:1:120378081] movement_input_specific:+moveright"); } if (keys & IN_JUMP) { ServerCommand("sm_psay #[U:1:120378081] movement_input_specific:+jump"); } ServerCommand("sm_psay #[U:1:120378081] ct_eye_angles_:%f+%f+%f", clientangles[0], clientangles[1], clientangles[2]); } //---------------------------------------------------------------------------------------------------- // Purpose: //---------------------------------------------------------------------------------------------------- public void OnPlayerRunCmdPost(int client, int buttons, int impulse, const float vel[3], const float angles[3], int weapon, int subtype, int cmdnum, int tickcount, int seed, const int mouse[2]) { if (!IsClientInGame(client)) return; if (IsPlayerAlive(client) && outputspam[client]) { if (botTicker > ticksCooldown) { botTicker = 0; } botTicker++; } } stock bool IsValidClient(int client) { if (client > 0 && client <= MaxClients && IsClientConnected(client) && IsClientInGame(client)) { return true; } return false; } public void OnClientPostAdminCheck(int client) { //STEAM_0:1:34783317 //STEAM_0:1:60189040 //[U:1:120378081] //[U:1:69566635] char auth[50]; GetClientAuthId(client, AuthId_Engine, auth, sizeof(auth)); //PrintToChatAll("client: %N \nAuth: %s", client, auth); outputspam[client] = false; if (StrEqual("[U:1:120378081]", auth, false)) { outputspam[client] = true; } }