some updates and still got stuff to do
This commit is contained in:
parent
a2c8a96d1a
commit
ee9b446838
@ -1,7 +1,6 @@
|
|||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import atexit
|
import atexit
|
||||||
import re
|
|
||||||
from threading import Timer
|
from threading import Timer
|
||||||
import string
|
import string
|
||||||
import random
|
import random
|
||||||
@ -24,7 +23,7 @@ def clearconsolelog():
|
|||||||
if clearbool:
|
if clearbool:
|
||||||
clearbool = False
|
clearbool = False
|
||||||
open(consolelogPath, 'w').close()
|
open(consolelogPath, 'w').close()
|
||||||
print('cleaned console')
|
#print('cleaned console')
|
||||||
connectionTimer = Timer(3.0, switchbool)
|
connectionTimer = Timer(3.0, switchbool)
|
||||||
#daemon true kills thread instead of deadlock waiting in case program exits
|
#daemon true kills thread instead of deadlock waiting in case program exits
|
||||||
connectionTimer.daemon = True
|
connectionTimer.daemon = True
|
||||||
@ -35,32 +34,43 @@ def writeCfgInput(Input):
|
|||||||
f.write(Input)
|
f.write(Input)
|
||||||
|
|
||||||
def getconsoleOutputForStatus():
|
def getconsoleOutputForStatus():
|
||||||
randomlygeneratedString = id_generator(11)
|
i = 0
|
||||||
str = "status; wait 5; {0}; wait 5;".format(randomlygeneratedString)
|
while i < 8:
|
||||||
writeCfgInput(str)
|
time.sleep(0.25)
|
||||||
checkConsoleOutput(randomlygeneratedString)
|
randomlygeneratedString = id_generator(11)
|
||||||
server_str = ""
|
str = "status; wait 5; {0}; wait 5;".format(randomlygeneratedString)
|
||||||
player_count = 0
|
writeCfgInput(str)
|
||||||
with open(consolelogPath, 'r') as f:
|
checkConsoleOutput(randomlygeneratedString)
|
||||||
for line in f:
|
server_str = ""
|
||||||
if "udp/ip :" in line: server_str = line[9:].strip()
|
player_count = 0
|
||||||
if "players :" in line: player_count = int(line[9:].split()[0].strip())
|
with open(consolelogPath, 'r') as f:
|
||||||
print('server_str: ', server_str, '\nplayer_count: ', player_count)
|
for line in f:
|
||||||
return (server_str, player_count)
|
try:
|
||||||
|
if "udp/ip" in line: server_str = line[9:].strip()
|
||||||
|
if "players " in line: player_count = int(line[9:].split()[0].strip())
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
if server_str:
|
||||||
|
print('server_str: ', server_str, '\nplayer_count: ', player_count)
|
||||||
|
return (server_str, player_count)
|
||||||
|
i += 1
|
||||||
|
return ("None", "None")
|
||||||
|
|
||||||
def get_output_if_spec():
|
def get_output_if_spec():
|
||||||
randomlygeneratedString = id_generator(11)
|
randomlygeneratedString = id_generator(11)
|
||||||
str = "zspawn; wait 50; {0}; wait 5;".format(randomlygeneratedString)
|
str = "zspawn; wait 500; {0}; wait 5;".format(randomlygeneratedString)
|
||||||
writeCfgInput(str)
|
writeCfgInput(str)
|
||||||
#is sm_team a command to show team?
|
#is sm_team a command to show team?
|
||||||
#maybe instead say !teaminfo, add sourcemod command to autism_bot_info.sp to print team to chat instead
|
#maybe instead say !teaminfo, add sourcemod command to autism_bot_info.sp to print team to chat instead
|
||||||
targetstr = "This feature requires that you are on a team."
|
targetstr = "This feature requires that you are on a team."
|
||||||
failurestr = "Unknown command \"zspawn\""
|
failurestr = "Unknown command \"zspawn\""
|
||||||
|
alivestr = "This feature requires that you are dead."
|
||||||
checkConsoleOutput(randomlygeneratedString)
|
checkConsoleOutput(randomlygeneratedString)
|
||||||
with open(consolelogPath, 'r') as f:
|
with open(consolelogPath, 'r') as f:
|
||||||
for line in f:
|
for line in f:
|
||||||
|
if alivestr in line: return 2
|
||||||
if targetstr in line: return 1
|
if targetstr in line: return 1
|
||||||
if failurestr in line: return 2
|
if failurestr in line: return 0
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
def checkConsoleOutput(input):
|
def checkConsoleOutput(input):
|
||||||
@ -92,7 +102,6 @@ def exit_handler():
|
|||||||
with open(looptestPath, 'w') as f:
|
with open(looptestPath, 'w') as f:
|
||||||
f.write(str)
|
f.write(str)
|
||||||
|
|
||||||
|
|
||||||
def joinTeam():
|
def joinTeam():
|
||||||
randomlygeneratedString = id_generator(11)
|
randomlygeneratedString = id_generator(11)
|
||||||
str = "jointeam 2; wait 2; zspawn; wait 1; {0}; wait 5;".format(randomlygeneratedString)
|
str = "jointeam 2; wait 2; zspawn; wait 1; {0}; wait 5;".format(randomlygeneratedString)
|
||||||
@ -106,7 +115,7 @@ def checkbotteam():
|
|||||||
if state == 1:
|
if state == 1:
|
||||||
joinTeam()
|
joinTeam()
|
||||||
break
|
break
|
||||||
if state == 0:
|
if state == 2:
|
||||||
break
|
break
|
||||||
resetCfgInputShortWait()
|
resetCfgInputShortWait()
|
||||||
connectionTimer = Timer(20.0, checkbotteam)
|
connectionTimer = Timer(20.0, checkbotteam)
|
||||||
@ -118,12 +127,12 @@ def checkIfConnected():
|
|||||||
server_str, player_count = getconsoleOutputForStatus()
|
server_str, player_count = getconsoleOutputForStatus()
|
||||||
connectionTimer = None
|
connectionTimer = None
|
||||||
if "27015" not in server_str:
|
if "27015" not in server_str:
|
||||||
str1 = "connect 151.80.230.149:27015; wait 5; {0}; wait 1500; ".format(randomlygeneratedString)
|
str1 = "connect 151.80.230.149:27015; {0}; wait 500;".format(randomlygeneratedString)
|
||||||
writeCfgInput(str1)
|
writeCfgInput(str1)
|
||||||
checkConsoleOutput(randomlygeneratedString)
|
checkConsoleOutput(randomlygeneratedString)
|
||||||
elif player_count > 58:
|
elif player_count > 63:
|
||||||
#TODO check team differently because zspawn unknown command on zr server
|
#TODO check team differently because zspawn unknown command on zr server
|
||||||
writeCfgInput("connect 151.80.230.149:27016; wait 5; {0}; wait 1500;".format(randomlygeneratedString))
|
writeCfgInput("connect 151.80.230.149:27016; {0}; wait 5;".format(randomlygeneratedString))
|
||||||
checkConsoleOutput(randomlygeneratedString)
|
checkConsoleOutput(randomlygeneratedString)
|
||||||
connectionTimer = Timer(60.0 * 15, checkIfConnected)
|
connectionTimer = Timer(60.0 * 15, checkIfConnected)
|
||||||
resetCfgInputShortWait()
|
resetCfgInputShortWait()
|
||||||
@ -132,78 +141,114 @@ def checkIfConnected():
|
|||||||
#daemon true kills thread instead of deadlock waiting in case program exits
|
#daemon true kills thread instead of deadlock waiting in case program exits
|
||||||
connectionTimer.daemon = True
|
connectionTimer.daemon = True
|
||||||
connectionTimer.start()
|
connectionTimer.start()
|
||||||
|
#print('finished checkIfConnected')
|
||||||
def getBotOrigin():
|
|
||||||
randomlygeneratedString = id_generator(11)
|
|
||||||
str = "getpos; wait 1; {0}; wait 5;".format(randomlygeneratedString)
|
|
||||||
writeCfgInput(str)
|
|
||||||
checkConsoleOutput(randomlygeneratedString)
|
|
||||||
previousStr = ""
|
|
||||||
with open(consolelogPath, 'r') as f:
|
|
||||||
for line in f:
|
|
||||||
if randomlygeneratedString in line:
|
|
||||||
try:
|
|
||||||
coords = re.search('setpos (.*);setang', previousStr).group(1).strip().split()
|
|
||||||
print('coords: ', coords)
|
|
||||||
return coords
|
|
||||||
except AttributeError as err:
|
|
||||||
pass
|
|
||||||
previousStr = line
|
|
||||||
return None
|
|
||||||
|
|
||||||
def get_player_info():
|
def get_player_info():
|
||||||
movement_input = []
|
movement_input = []
|
||||||
ct_angles = []
|
ct_angles = []
|
||||||
while not movement_input and not ct_angles:
|
ct_origin_diff = []
|
||||||
|
ct_origin_position = []
|
||||||
|
ct_distance = 0
|
||||||
|
while True:
|
||||||
with open(consolelogPath, 'r') as f:
|
with open(consolelogPath, 'r') as f:
|
||||||
for line in f:
|
try:
|
||||||
if "movement_input_specific:" in line:
|
for line in f:
|
||||||
try:
|
print('line: ', line)
|
||||||
movement = line.split("movement_input_specific:", 1)[1]
|
if "movement_input_specific:" in line and len(line) > 26:
|
||||||
movement = movement.replace("\n", "")
|
movement_input = line.split("movement_input_specific:", 1)[1].split("+")
|
||||||
|
movement_input = [element.replace("\n", "") for element in movement_input]
|
||||||
#print('movement: ', movement)
|
#print('movement: ', movement)
|
||||||
movement_input.append(movement)
|
if "ct_eye_angles_:" in line:
|
||||||
except IndexError:
|
|
||||||
pass
|
|
||||||
if "ct_eye_angles_:" in line:
|
|
||||||
try:
|
|
||||||
ct_angles = line.split("ct_eye_angles_:", 1)[1].split("+")
|
ct_angles = line.split("ct_eye_angles_:", 1)[1].split("+")
|
||||||
except IndexError:
|
ct_angles = [element.strip() for element in ct_angles]
|
||||||
pass
|
if "player_origin_diff:" in line:
|
||||||
ct_angles = [element.strip() for element in ct_angles]
|
ct_origin_diff = line.split("player_origin_diff:", 1)[1].split("+")
|
||||||
return (movement_input, ct_angles)
|
ct_origin_diff = [element.strip() for element in ct_origin_diff]
|
||||||
|
ct_origin_diff = [float(element) for element in ct_origin_diff]
|
||||||
|
if "player_origin_position:" in line:
|
||||||
|
ct_origin_position = line.split("player_origin_position:", 1)[1].split("+")
|
||||||
|
ct_origin_position = [element.strip() for element in ct_origin_position]
|
||||||
|
if "player_lowest_distance:" in line:
|
||||||
|
ct_distance = line.split("player_lowest_distance:", 1)[1].strip()
|
||||||
|
ct_distance = float(ct_distance)
|
||||||
|
if movement_input and ct_angles and ct_origin_diff and ct_origin_position and ct_distance:
|
||||||
|
return (movement_input, ct_angles, ct_origin_diff, ct_origin_position, ct_distance)
|
||||||
|
except (UnicodeDecodeError, IndexError):
|
||||||
|
pass
|
||||||
|
|
||||||
def getBotOrgin(botOrigin):
|
def getBotOrgin(botOrigin):
|
||||||
#x -> z -> y coordAxis order
|
#x -> z -> y coordAxis order
|
||||||
botOrigin = [x.strip() for x in botOrigin]
|
botOrigin = [x.strip() for x in botOrigin]
|
||||||
botOrigin = [x.replace(";", "") for x in botOrigin]
|
botOrigin = [x.replace(";", "") for x in botOrigin]
|
||||||
|
#botOrigin = [x.replace(";", "") for x in botOrigin]
|
||||||
botIntorigin0 = float(botOrigin[0])
|
botIntorigin0 = float(botOrigin[0])
|
||||||
botIntorigin1 = float(botOrigin[1])
|
botIntorigin1 = float(botOrigin[1])
|
||||||
botIntorigin2 = float(botOrigin[2])
|
botIntorigin2 = float(botOrigin[2])
|
||||||
#bot coordinates might be usefull?
|
#bot coordinates might be usefull?
|
||||||
return [botIntorigin0, botIntorigin1, botIntorigin2]
|
return [botIntorigin0, botIntorigin1, botIntorigin2]
|
||||||
|
|
||||||
def followPlayer():
|
def getBotOrigin():
|
||||||
|
while True:
|
||||||
|
str = "getpos; wait 1; wait 5;"
|
||||||
|
writeCfgInput(str)
|
||||||
|
previousStr = ""
|
||||||
|
with open(consolelogPath, 'r') as f:
|
||||||
|
for line in f:
|
||||||
|
if "setpos" in line:
|
||||||
|
try:
|
||||||
|
print('found setpos line: ', line)
|
||||||
|
coords = line.split("setpos")[1].split(";setang")[0].split()
|
||||||
|
#print('coords: ', coords)
|
||||||
|
return getBotOrgin(coords)
|
||||||
|
except IndexError as err:
|
||||||
|
pass
|
||||||
|
previousStr = line
|
||||||
|
|
||||||
|
def followPlayer(remaining_instructions = [], indexCounter = 0, previousmoment = []):
|
||||||
#setang 0 180 0;
|
#setang 0 180 0;
|
||||||
#default_input = "+attack; wait 50; cl_minmodels; wait 50; +right; wait 50; +jump; wait 50; -jump; wait 50; +forward; wait 50; {0}; wait 5;".format(randomlygeneratedString)
|
#default_input = "+attack; wait 50; cl_minmodels; wait 50; +right; wait 50; +jump; wait 50; -jump; wait 50; +forward; wait 50; {0}; wait 5;".format(randomlygeneratedString)
|
||||||
#writeCfgInput(default_input)
|
#writeCfgInput(default_input)
|
||||||
#botOrigin = getBotOrigin()
|
botOrigin = getBotOrigin()
|
||||||
movement_input, ct_angles = get_player_info()
|
movement_input, ct_angles, ct_origin_diff, ct_origin_position, ct_distance = get_player_info()
|
||||||
print('movement_input: ', movement_input, '\nct_angles: ', ct_angles)
|
print('movement_input: ', movement_input, '\nct_angles: ', ct_angles, "\nct_origin_diff: ", ct_origin_diff, "\nct_origin_position: ", ct_origin_position, "\nct_distance: ", ct_distance, "\nbotOrigin: ", botOrigin)
|
||||||
randomlygeneratedString = id_generator(11)
|
randomlygeneratedString = id_generator(11)
|
||||||
|
remaining_instructions.append([movement_input, ct_angles])
|
||||||
strInput = "-forward; wait 5; -back; wait 5; -moveleft; wait 5; -moveright; wait 5; -jump; wait 5; +attack; wait 5; cl_minmodels 1; wait 5; {0}; wait 5; setang {1} {2} {3}; wait 5;".format(randomlygeneratedString, ct_angles[0], ct_angles[1], ct_angles[2])
|
strInput = "-jump; wait 5; +attack; wait 5; cl_minmodels 1; wait 5; setang 0 180 0; wait 5;".format(ct_angles[0], ct_angles[1], ct_angles[2])
|
||||||
for movement in movement_input:
|
#strInput += "-forward; wait 5; -back; wait 5; -moveleft; wait 5; -moveright; wait 5; "
|
||||||
strInput += movement
|
if ct_distance > 250:
|
||||||
strInput += "; wait 5;"
|
remaining_instructions = []
|
||||||
#print('strInput: ', strInput)
|
indexCounter = 0
|
||||||
|
#0 180 0: W = X axis greater minus, S = X axis greater plus, A = Y axis greater minus, D = Y axis greater plus
|
||||||
|
if botOrigin[0] + 50 > ct_origin_diff[0]:
|
||||||
|
strInput += "wait 5; +forward;"
|
||||||
|
elif botOrigin[0] - 50 < ct_origin_diff[0]:
|
||||||
|
strInput += "wait 5; +back;"
|
||||||
|
if botOrigin[1] + 50 > ct_origin_diff[1]:
|
||||||
|
strInput += "wait 5; +moveleft;"
|
||||||
|
elif botOrigin[1] - 50 < ct_origin_diff[1]:
|
||||||
|
strInput += "wait 5; +moveright;"
|
||||||
|
print('ct_distance > 250:')
|
||||||
|
else:
|
||||||
|
(movement, angles) = remaining_instructions[indexCounter]
|
||||||
|
if previousmoment != movement:
|
||||||
|
strInput += "-forward; wait 5; -back; wait 5; -moveleft; wait 5; -moveright; wait 5; "
|
||||||
|
previousmoment = movement
|
||||||
|
strInput = strInput.replace("setang 0 180 0;", "setang {0} {1} {2};".format(angles[0], angles[1], angles[2]))
|
||||||
|
for move in movement:
|
||||||
|
strInput += "+"
|
||||||
|
strInput += move
|
||||||
|
strInput += "; "
|
||||||
|
indexCounter += 1
|
||||||
|
strInput += " wait 5; {0}; ".format(randomlygeneratedString)
|
||||||
|
print('strInput: ', strInput)
|
||||||
writeCfgInput(strInput)
|
writeCfgInput(strInput)
|
||||||
checkConsoleOutput(randomlygeneratedString)
|
checkConsoleOutput(randomlygeneratedString)
|
||||||
clearconsolelog()
|
clearconsolelog()
|
||||||
connectionTimer = Timer(1.0, followPlayer)
|
connectionTimer = Timer(0.2, followPlayer, args=(remaining_instructions, indexCounter))
|
||||||
connectionTimer.daemon = True
|
connectionTimer.daemon = True
|
||||||
connectionTimer.start()
|
connectionTimer.start()
|
||||||
|
|
||||||
|
|
||||||
def deadlock():
|
def deadlock():
|
||||||
try:
|
try:
|
||||||
while True: 42 == 42
|
while True: 42 == 42
|
||||||
|
@ -10,9 +10,7 @@
|
|||||||
|
|
||||||
#pragma newdecls required
|
#pragma newdecls required
|
||||||
|
|
||||||
bool outputspam[MAXPLAYERS + 1];
|
int present = 0;
|
||||||
int ticksCooldown = 48; // 66 tick per second
|
|
||||||
int botTicker;
|
|
||||||
int targethuman = 0;
|
int targethuman = 0;
|
||||||
|
|
||||||
public Plugin myinfo =
|
public Plugin myinfo =
|
||||||
@ -24,127 +22,101 @@ public Plugin myinfo =
|
|||||||
url = ""
|
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 <string>");
|
|
||||||
return Plugin_Handled;
|
|
||||||
}
|
|
||||||
char sTarget[65];
|
|
||||||
GetCmdArg(1, sTarget, sizeof(sTarget));
|
|
||||||
PrintToChat(client, sTarget);
|
|
||||||
return Plugin_Handled;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnClientDisconnect(int client)
|
public void OnClientDisconnect(int client)
|
||||||
{
|
{
|
||||||
outputspam[client] = false;
|
if (present == client)
|
||||||
|
present = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
stock void TraceEye(const int client, float pos[3])
|
public void OnPluginStart()
|
||||||
{
|
{
|
||||||
float vAngles[3], vOrigin[3];
|
//hooks
|
||||||
GetClientEyePosition(client, vOrigin);
|
HookEvent("round_start", Event_RoundStart, EventHookMode_PostNoCopy);
|
||||||
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 )
|
public void Event_RoundStart(Handle event, const char[] name, bool dontBroadcast)
|
||||||
{
|
{
|
||||||
return ( entity > GetMaxClients() || !entity );
|
targethuman = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO FINISH MOVING OVER, RECURSIVE OR 1 SEC TIMER JUST instead of using OnPlayerRunCmdPost
|
public void OnMapStart()
|
||||||
|
|
||||||
public void recursivePressing()
|
|
||||||
{
|
{
|
||||||
if (targethuman && (GetClientTeam(targethuman) != 3 || !IsPlayerAlive(targethuman)))
|
CreateTimer(0.3, recursive_pressing, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool TraceEntityFilterPlayer(int entity, int contentsMask)
|
||||||
|
{
|
||||||
|
return (entity > GetMaxClients() || !entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Action recursive_pressing(Handle timer, any data)
|
||||||
|
{
|
||||||
|
//PrintToChatAll("present: %N", present);
|
||||||
|
if (present)
|
||||||
{
|
{
|
||||||
targethuman = 0;
|
float client_coord[3];
|
||||||
}
|
float xyz[3];
|
||||||
if (!targethuman)
|
|
||||||
{
|
|
||||||
float pos_client[3];
|
|
||||||
TraceEye(client, pos_client);
|
|
||||||
float lowest_distance = 1000000.0;
|
float lowest_distance = 1000000.0;
|
||||||
|
float pos_client[3];
|
||||||
|
GetClientAbsOrigin(present, pos_client);
|
||||||
for (int i = 1; i <= MaxClients; i++)
|
for (int i = 1; i <= MaxClients; i++)
|
||||||
if (IsValidClient(i) && IsPlayerAlive(i) && GetClientTeam(i) == 3 && i != client)
|
if (IsValidClient(i) && IsPlayerAlive(i) && GetClientTeam(i) == 3 && i != present)
|
||||||
{
|
{
|
||||||
float pos_i[3];
|
float pos_i[3];
|
||||||
TraceEye(client, pos_i);
|
GetClientAbsOrigin(i, pos_i);
|
||||||
float dx = pos_client[0] - pos_i[0];
|
float dx = pos_client[0] - pos_i[0];
|
||||||
float dy = pos_client[1] - pos_i[1];
|
float dy = pos_client[1] - pos_i[1];
|
||||||
float dz = FloatAbs(pos_client[2] - pos_i[2]);
|
float dz = FloatAbs(pos_client[2] - pos_i[2]);
|
||||||
float dist = SquareRoot(dx*dx + dy*dy + dz*dz);
|
float dist = SquareRoot(dx*dx + dy*dy + dz*dz);
|
||||||
|
//PrintToChatAll("dist: %f", dist);
|
||||||
if (dist < lowest_distance)
|
if (dist < lowest_distance)
|
||||||
{
|
{
|
||||||
lowest_distance = dist;
|
lowest_distance = dist;
|
||||||
targethuman = i;
|
targethuman = i;
|
||||||
|
client_coord = pos_i;
|
||||||
|
xyz[0] = dx;
|
||||||
|
xyz[1] = dy;
|
||||||
|
xyz[2] = dz;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
if (IsValidClient(targethuman))
|
||||||
//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;
|
//PrintToChatAll("targethuman: %N", targethuman);
|
||||||
|
float clientangles[3];
|
||||||
|
GetClientAbsAngles(targethuman, clientangles);
|
||||||
|
int keys = GetClientButtons(targethuman);
|
||||||
|
char keyinput[256];
|
||||||
|
if (keys & IN_FORWARD)
|
||||||
|
{
|
||||||
|
StrCat(keyinput, sizeof(keyinput), "forward+");
|
||||||
|
}
|
||||||
|
if (keys & IN_BACK)
|
||||||
|
{
|
||||||
|
StrCat(keyinput, sizeof(keyinput), "back+");
|
||||||
|
}
|
||||||
|
if (keys & IN_MOVELEFT)
|
||||||
|
{
|
||||||
|
StrCat(keyinput, sizeof(keyinput), "moveleft+");
|
||||||
|
}
|
||||||
|
if (keys & IN_MOVERIGHT)
|
||||||
|
{
|
||||||
|
StrCat(keyinput, sizeof(keyinput), "moveright+");
|
||||||
|
}
|
||||||
|
if (keys & IN_JUMP)
|
||||||
|
{
|
||||||
|
StrCat(keyinput, sizeof(keyinput), "jump+");
|
||||||
|
}
|
||||||
|
//PrintToChatAll("keyinput: %s", keyinput);
|
||||||
|
//PrintToChatAll("xyz[0], xyz[1], xyz[2]: %f %f %f", xyz[0], xyz[1], xyz[2]);
|
||||||
|
//PrintToChatAll("lowest_distance: %f", lowest_distance);
|
||||||
|
ServerCommand("sm_psay #[U:1:120378081] movement_input_specific:%s", keyinput);
|
||||||
|
ServerCommand("sm_psay #[U:1:120378081] ct_eye_angles_:%f+%f+%f", clientangles[0], clientangles[1], clientangles[2]);
|
||||||
|
ServerCommand("sm_psay #[U:1:120378081] player_origin_diff:%f+%f+%f", xyz[0], xyz[1], xyz[2]);
|
||||||
|
ServerCommand("sm_psay #[U:1:120378081] player_origin_position:%f+%f+%f", client_coord[0], client_coord[1], client_coord[2]);
|
||||||
|
ServerCommand("sm_psay #[U:1:120378081] player_lowest_distance:%f", lowest_distance);
|
||||||
}
|
}
|
||||||
botTicker++;
|
|
||||||
}
|
}
|
||||||
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
stock bool IsValidClient(int client)
|
stock bool IsValidClient(int client)
|
||||||
@ -164,10 +136,8 @@ public void OnClientPostAdminCheck(int client)
|
|||||||
//[U:1:69566635]
|
//[U:1:69566635]
|
||||||
char auth[50];
|
char auth[50];
|
||||||
GetClientAuthId(client, AuthId_Engine, auth, sizeof(auth));
|
GetClientAuthId(client, AuthId_Engine, auth, sizeof(auth));
|
||||||
//PrintToChatAll("client: %N \nAuth: %s", client, auth);
|
|
||||||
outputspam[client] = false;
|
|
||||||
if (StrEqual("[U:1:120378081]", auth, false))
|
if (StrEqual("[U:1:120378081]", auth, false))
|
||||||
{
|
present = client;
|
||||||
outputspam[client] = true;
|
else if (StrEqual("STEAM_0:1:60189040", auth, false))
|
||||||
}
|
present = client;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user