still missing the !autism command to work on discord part
This commit is contained in:
parent
4c26d46016
commit
70475bc58f
@ -7,38 +7,26 @@ import string
|
|||||||
import random
|
import random
|
||||||
import time
|
import time
|
||||||
import mysql.connector
|
import mysql.connector
|
||||||
from mysql.connector import pooling
|
|
||||||
from mysql.connector import Error
|
from mysql.connector import Error
|
||||||
|
from contextlib import closing
|
||||||
from settings import mysql_connection_ip, mysql_connection_user, mysql_connection_pw, mysql_connection_database
|
from settings import mysql_connection_ip, mysql_connection_user, mysql_connection_pw, mysql_connection_database
|
||||||
|
|
||||||
looptestPath = '/home/nonroot/.steam/steam/steamapps/common/Counter-Strike Source/cstrike/cfg/looptest.cfg'
|
looptestPath = '/home/gameservers/.steam/steam/steamapps/common/Counter-Strike Source/cstrike/cfg/looptest.cfg'
|
||||||
chatmsg = ""
|
chatmsg = ""
|
||||||
|
|
||||||
mysql_connection_pool = mysql.connector.pooling.MySQLConnectionPool(pool_name="mypool", host=mysql_connection_ip, database=mysql_connection_database, user=mysql_connection_user, passwd=mysql_connection_pw)
|
|
||||||
|
|
||||||
def get_connection_obsolete():
|
|
||||||
return mysql.connector.connect(
|
|
||||||
host=mysql_connection_ip,
|
|
||||||
user=mysql_connection_user,
|
|
||||||
passwd=mysql_connection_pw,
|
|
||||||
database=mysql_connection_database)
|
|
||||||
|
|
||||||
def writeCfgInput(Input):
|
def writeCfgInput(Input):
|
||||||
with open(looptestPath, 'w') as f:
|
with open(looptestPath, 'w') as f:
|
||||||
f.write(Input)
|
f.write(Input)
|
||||||
|
|
||||||
|
|
||||||
def resetCfgInputShortWait():
|
def resetCfgInputShortWait():
|
||||||
str = "{0}; wait 5;"
|
str = "wait 5; "
|
||||||
with open(looptestPath, 'w') as f:
|
with open(looptestPath, 'w') as f:
|
||||||
f.write(str)
|
f.write(str)
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
|
|
||||||
def exit_handler():
|
def exit_handler():
|
||||||
print('reached exithandler')
|
print('reached exithandler')
|
||||||
str = "wait 5;"
|
resetCfgInputShortWait()
|
||||||
with open(looptestPath, 'w') as f:
|
|
||||||
f.write(str)
|
|
||||||
|
|
||||||
def joinTeam():
|
def joinTeam():
|
||||||
str = "jointeam 2; wait 2; zspawn; wait 1; {0}; wait 5;"
|
str = "jointeam 2; wait 2; zspawn; wait 1; {0}; wait 5;"
|
||||||
@ -47,185 +35,197 @@ def joinTeam():
|
|||||||
print('jointeam func: ')
|
print('jointeam func: ')
|
||||||
|
|
||||||
def checkbotteam():
|
def checkbotteam():
|
||||||
mysql_check_spectator()
|
with closing(mysql.connector.connect(host=mysql_connection_ip, database=mysql_connection_database, user=mysql_connection_user, password=mysql_connection_pw,
|
||||||
resetCfgInputShortWait()
|
auth_plugin='mysql_native_password')) as cnx:
|
||||||
connectionTimer = Timer(20.0, checkbotteam)
|
with closing(cnx.cursor()) as cur:
|
||||||
connectionTimer.daemon = True
|
mysql_check_spectator(cur)
|
||||||
connectionTimer.start()
|
resetCfgInputShortWait()
|
||||||
|
connectionTimer = Timer(20.0, checkbotteam)
|
||||||
|
connectionTimer.daemon = True
|
||||||
|
connectionTimer.start()
|
||||||
|
|
||||||
def mysql_check_spectator():
|
def mysql_check_spectator(cur):
|
||||||
cnx = mysql_connection_pool.get_connection()
|
sql_statement = f"""SELECT spectate from unloze_css_autism_bot.`bot status`"""
|
||||||
cur = cnx.cursor()
|
cur.execute(sql_statement)
|
||||||
sql_statement = f"""SELECT spectate from unloze_css_autism_bot.`bot status`"""
|
result = cur.fetchall()[0]
|
||||||
cur.execute(sql_statement)
|
spectate = result[0]
|
||||||
result = cur.fetchall()[0]
|
print('spectate: ', spectate)
|
||||||
spectate = result[0]
|
if spectate != 0:
|
||||||
print('spectate: ', spectate)
|
joinTeam()
|
||||||
if spectate != 0:
|
|
||||||
joinTeam()
|
|
||||||
cur.close()
|
|
||||||
cnx.close()
|
|
||||||
|
|
||||||
def mysql_get_player_info(movement_list):
|
def organize_player_info(movement_list):
|
||||||
cnx = mysql_connection_pool.get_connection()
|
strInput = "-attack; wait 5; -jump; wait 5; -duck; wait 5; +attack; wait 5; cl_minmodels 1; "
|
||||||
cur = cnx.cursor()
|
writeCfgInput(strInput)
|
||||||
sql_statement = f"""SELECT * from unloze_css_autism_bot.`bot movement input` ORDER BY entry_time LIMIT 1"""
|
time.sleep(0.2)
|
||||||
sql_row_count = "SELECT COUNT(*) FROM unloze_css_autism_bot.`bot movement input`"
|
writeCfgInput("wait 5;")
|
||||||
cur.execute(sql_statement)
|
mysql_get_player_info(movement_list)
|
||||||
result = cur.fetchall()
|
mysql_delete_rows()
|
||||||
cur.execute(sql_row_count)
|
post_chatmsg()
|
||||||
result_count = cur.fetchone()[0]
|
|
||||||
if result:
|
|
||||||
result = result[0]
|
|
||||||
movement_input = result[0]
|
|
||||||
client_angles = [result[1], result[2], result[3]]
|
|
||||||
xyz_difference = [result[4], result[5], result[6]]
|
|
||||||
client_coordinates = result[7], result[8], result[9]
|
|
||||||
hunt_or_mimic = result[10]
|
|
||||||
stuckX = result[11]
|
|
||||||
stuckY = result[12]
|
|
||||||
strInput = "-attack; wait 5; -jump; wait 5; -duck; wait 5; +attack; wait 5; cl_minmodels 1; "
|
|
||||||
print('movement_list[0]: ', movement_list[0], '#0 = forward, 1 = back, 2 = none')
|
|
||||||
print('movement_list[1]: ', movement_list[1], '#0 = left, 1 = right, 2 = none')
|
|
||||||
print('result_count: ', result_count)
|
|
||||||
axis_distance = 105
|
|
||||||
print('stuckX: ', stuckX, ' stuckY: ', stuckY)
|
|
||||||
if stuckX:
|
|
||||||
if movement_list[0] == 0:
|
|
||||||
movement_list[0] = 1
|
|
||||||
elif movement_list[0] == 1:
|
|
||||||
movement_list[0] = 0
|
|
||||||
strInput += " +jump; wait 3; +duck; wait 5;"
|
|
||||||
if stuckY:
|
|
||||||
if movement_list[1] == 0:
|
|
||||||
movement_list[1] = 1
|
|
||||||
elif movement_list[1] == 1:
|
|
||||||
movement_list[1] = 0
|
|
||||||
strInput += " +jump; wait 3; +duck; wait 5;"
|
|
||||||
if hunt_or_mimic:
|
|
||||||
print('hunt_or_mimic enabled')
|
|
||||||
sql_statement = f"""SELECT entry_time FROM unloze_css_autism_bot.`bot movement input` where client_coord_0 = '{client_coordinates[0]}' and
|
|
||||||
client_coord_1 = '{client_coordinates[1]}' and client_coord_2 = '{client_coordinates[2]}' LIMIT 1"""
|
|
||||||
cur.execute(sql_statement)
|
|
||||||
entry_time = cur.fetchall()[0][0]
|
|
||||||
if not hunt_or_mimic:
|
|
||||||
if xyz_difference[0] > axis_distance:
|
|
||||||
movement_list[0] = 1
|
|
||||||
elif xyz_difference[0] < -axis_distance:
|
|
||||||
movement_list[0] = 0
|
|
||||||
else:
|
|
||||||
movement_list[0] = 2 #strInput += " -back; wait 5; -forward; wait 5;"
|
|
||||||
|
|
||||||
if xyz_difference[1] < -axis_distance:
|
run_delay = 0.2 #0.05
|
||||||
movement_list[1] = 1
|
connectionTimer = Timer(run_delay, organize_player_info, args=[movement_list])
|
||||||
elif xyz_difference[1] > axis_distance:
|
connectionTimer.daemon = True
|
||||||
movement_list[1] = 0
|
connectionTimer.start()
|
||||||
else:
|
|
||||||
movement_list[1] = 2 #strInput += " -moveright; wait 5; -moveleft; wait 5;"
|
def post_chatmsg():
|
||||||
print('xyz_difference[0]: ', xyz_difference[0])
|
global chatmsg
|
||||||
print('xyz_difference[1]: ', xyz_difference[1])
|
strInput = f"""{chatmsg}"""
|
||||||
strInput += f""" setang 0 180 0; wait 5; """
|
chatmsg = ""
|
||||||
else:
|
writeCfgInput(strInput)
|
||||||
#print('client_angles: ', client_angles)
|
time.sleep(0.5)
|
||||||
print('movement_input: ', movement_input)
|
writeCfgInput("wait 5;")
|
||||||
strInput += f"""setang {client_angles[0]} {client_angles[1]} {client_angles[2]}; wait 5; {movement_input}; wait 5;"""
|
|
||||||
sql_statement = f"""DELETE FROM unloze_css_autism_bot.`bot movement input` where entry_time <= '{entry_time}'"""
|
def mysql_delete_rows():
|
||||||
cur.execute(sql_statement)
|
with closing(mysql.connector.connect(host=mysql_connection_ip, database=mysql_connection_database, user=mysql_connection_user, password=mysql_connection_pw,
|
||||||
print('Deleted ', cur.rowcount, ' rows before/during entry_time:', entry_time)
|
auth_plugin='mysql_native_password')) as cnx:
|
||||||
|
with closing(cnx.cursor()) as cur:
|
||||||
|
sql_statement = f"""SELECT hunt_or_mimic from unloze_css_autism_bot.`bot movement input` ORDER BY entry_time desc LIMIT 1"""
|
||||||
|
results = cur.execute(sql_statement, multi=True)
|
||||||
|
if results:
|
||||||
|
for result in results:
|
||||||
|
if result.with_rows:
|
||||||
|
resultfetch = result.fetchone()
|
||||||
|
break
|
||||||
|
|
||||||
|
if resultfetch:
|
||||||
|
hunt_or_mimic = resultfetch[0]
|
||||||
|
print('hunt_or_mimic delete: ', hunt_or_mimic)
|
||||||
|
if hunt_or_mimic:
|
||||||
|
sql_statement = f"""DELETE FROM unloze_css_autism_bot.`bot movement input` ORDER BY entry_time asc LIMIT 10"""
|
||||||
|
cur.execute(sql_statement)
|
||||||
|
print('Deleted ', cur.rowcount, ' rows')
|
||||||
cnx.commit()
|
cnx.commit()
|
||||||
|
|
||||||
|
def mysql_get_player_info(movement_list):
|
||||||
|
with closing(mysql.connector.connect(host=mysql_connection_ip, database=mysql_connection_database, user=mysql_connection_user, password=mysql_connection_pw,
|
||||||
|
auth_plugin='mysql_native_password')) as cnx:
|
||||||
|
with closing(cnx.cursor()) as cur:
|
||||||
|
sql_statement = f"""SELECT StuckX, StuckY, xyz_0, xyz_1, xyz_2, hunt_or_mimic from unloze_css_autism_bot.`bot movement input` bmi ORDER BY entry_time desc LIMIT 1"""
|
||||||
|
cur.execute(sql_statement)
|
||||||
|
huntfetch = cur.fetchone()
|
||||||
|
if huntfetch:
|
||||||
|
hunt_or_mimic = huntfetch[5]
|
||||||
if not hunt_or_mimic:
|
if not hunt_or_mimic:
|
||||||
|
stuckX = huntfetch[0]
|
||||||
|
stuckY = huntfetch[1]
|
||||||
|
xyz_difference = [huntfetch[2], huntfetch[3], huntfetch[4]]
|
||||||
|
strInput = ""
|
||||||
|
axis_distance = 50
|
||||||
|
if stuckX:
|
||||||
|
print('stuckX enabled')
|
||||||
|
if movement_list[0] == 0:
|
||||||
|
movement_list[0] = 1
|
||||||
|
elif movement_list[0] == 1:
|
||||||
|
movement_list[0] = 0
|
||||||
|
strInput += " +jump; wait 3; +duck; wait 5;"
|
||||||
|
if stuckY:
|
||||||
|
print('stuckY enabled')
|
||||||
|
if movement_list[1] == 0:
|
||||||
|
movement_list[1] = 1
|
||||||
|
elif movement_list[1] == 1:
|
||||||
|
movement_list[1] = 0
|
||||||
|
strInput += " +jump; wait 3; +duck; wait 5;"
|
||||||
|
print('hunt mode enabled')
|
||||||
|
if not stuckX and not stuckY:
|
||||||
|
if xyz_difference[0] > axis_distance:
|
||||||
|
movement_list[0] = 1
|
||||||
|
elif xyz_difference[0] < -axis_distance:
|
||||||
|
movement_list[0] = 0
|
||||||
|
|
||||||
|
if xyz_difference[1] < -axis_distance:
|
||||||
|
movement_list[1] = 1
|
||||||
|
elif xyz_difference[1] > axis_distance:
|
||||||
|
movement_list[1] = 0
|
||||||
|
|
||||||
if movement_list[0] == 1:
|
if movement_list[0] == 1:
|
||||||
strInput += " -back; wait 5; +forward; wait 5;"
|
strInput += " -back; wait 5; +forward; wait 5;"
|
||||||
elif movement_list[0] == 0:
|
elif movement_list[0] == 0:
|
||||||
strInput += " -forward; wait 5; +back; wait 5;"
|
strInput += " -forward; wait 5; +back; wait 5;"
|
||||||
if movement_list[1] == 1:
|
if movement_list[1] == 1:
|
||||||
strInput += " -moveleft; wait 5; +moveright; wait 5;"
|
strInput += " -moveleft; wait 5; +moveright; wait 5;"
|
||||||
elif movement_list[1] == 0:
|
elif movement_list[1] == 0:
|
||||||
strInput += " -moveright; wait 5; +moveleft; wait 5;"
|
strInput += " -moveright; wait 5; +moveleft; wait 5;"
|
||||||
sql_statement = f"""DELETE FROM unloze_css_autism_bot.`bot movement input` where entry_time <= '{entry_time}'"""
|
|
||||||
|
print('xyz_difference[0]: ', xyz_difference[0])
|
||||||
|
print('xyz_difference[1]: ', xyz_difference[1])
|
||||||
|
print('movement_list[0]: ', movement_list[0], '0 = back. 1 = forward.')
|
||||||
|
print('movement_list[1]: ', movement_list[1], '0 = moveleft. 1 = moveright')
|
||||||
|
strInput += f""" setang 0 180 0; wait 5; """
|
||||||
|
writeCfgInput(strInput)
|
||||||
|
time.sleep(0.4)
|
||||||
|
writeCfgInput("wait 5;")
|
||||||
|
|
||||||
|
else:
|
||||||
|
sql_statement = f"""SELECT * from unloze_css_autism_bot.`bot movement input` ORDER BY entry_time asc LIMIT 10"""
|
||||||
cur.execute(sql_statement)
|
cur.execute(sql_statement)
|
||||||
#print('sql_statement: ', sql_statement)
|
resultfetch = cur.fetchall()
|
||||||
print('Deleted ', cur.rowcount, ' rows before/during entry_time:', entry_time)
|
#print('resultfetch: ', resultfetch)
|
||||||
cnx.commit()
|
for result in resultfetch:
|
||||||
#print('strInput final:', strInput)
|
#print('result: ', result)
|
||||||
global chatmsg
|
movement_input = result[0]
|
||||||
strInput += f" {chatmsg}"
|
client_angles = [result[1], result[2], result[3]]
|
||||||
chatmsg = ""
|
strInput = ""
|
||||||
writeCfgInput(strInput)
|
#print('client_angles: ', client_angles)
|
||||||
time.sleep(0.10)
|
print('movement_input: ', movement_input)
|
||||||
writeCfgInput("wait 5;")
|
strInput += f"""setang {client_angles[0]} {client_angles[1]} {client_angles[2]}; wait 5; {movement_input}; wait 5; """
|
||||||
cur.close()
|
#print('strInput final:', strInput)
|
||||||
cnx.close()
|
writeCfgInput(strInput)
|
||||||
run_delay = 0.05 #0.05
|
time.sleep(0.04)
|
||||||
connectionTimer = Timer(run_delay, mysql_get_player_info, args=[movement_list])
|
writeCfgInput("wait 5;")
|
||||||
connectionTimer.daemon = True
|
|
||||||
connectionTimer.start()
|
|
||||||
|
|
||||||
def mysql_check_messages():
|
def mysql_check_messages():
|
||||||
cnx = mysql_connection_pool.get_connection()
|
with closing(mysql.connector.connect(host=mysql_connection_ip, database=mysql_connection_database, user=mysql_connection_user, password=mysql_connection_pw,
|
||||||
cur = cnx.cursor()
|
auth_plugin='mysql_native_password')) as cnx:
|
||||||
sql_statement = """SELECT responsemessage FROM unloze_css_autism_bot.chatting WHERE responsemessage != '' LIMIT 1"""
|
with closing(cnx.cursor()) as cur:
|
||||||
cur.execute(sql_statement)
|
sql_statement = """SELECT responsemessage FROM unloze_css_autism_bot.chatting WHERE responsemessage != '' LIMIT 1"""
|
||||||
result = cur.fetchall()
|
cur.execute(sql_statement)
|
||||||
if result:
|
result = cur.fetchall()
|
||||||
result = result[0][0]
|
if result:
|
||||||
str = f"""say {result}"""
|
result = result[0][0]
|
||||||
print('str: ', str)
|
str = f"""say {result}"""
|
||||||
global chatmsg
|
print('str: ', str)
|
||||||
chatmsg = str
|
global chatmsg
|
||||||
sql_statement = f"""DELETE FROM unloze_css_autism_bot.`chatting` WHERE `responsemessage` = '{result}'"""
|
chatmsg = str
|
||||||
print('sql_statement: ', sql_statement)
|
sql_statement = f"""DELETE FROM unloze_css_autism_bot.`chatting` WHERE `responsemessage` = '{result}'"""
|
||||||
cur.execute(sql_statement)
|
#print('sql_statement: ', sql_statement)
|
||||||
cnx.commit()
|
cur.execute(sql_statement)
|
||||||
cur.close()
|
cnx.commit()
|
||||||
cnx.close()
|
connectionTimer = Timer(0.9, mysql_check_messages)
|
||||||
connectionTimer = Timer(0.5, mysql_check_messages)
|
connectionTimer.daemon = True
|
||||||
connectionTimer.daemon = True
|
connectionTimer.start()
|
||||||
connectionTimer.start()
|
|
||||||
|
|
||||||
def mysql_check_if_connected():
|
def mysql_check_if_connected():
|
||||||
cnx = mysql_connection_pool.get_connection()
|
with closing(mysql.connector.connect(host=mysql_connection_ip, database=mysql_connection_database, user=mysql_connection_user, password=mysql_connection_pw,
|
||||||
cur = cnx.cursor()
|
auth_plugin='mysql_native_password')) as cnx:
|
||||||
sql_statement = """SELECT connected, playercount from unloze_css_autism_bot.`bot status`"""
|
with closing(cnx.cursor()) as cur:
|
||||||
cur.execute(sql_statement)
|
sql_statement = """SELECT connected, playercount from unloze_css_autism_bot.`bot status`"""
|
||||||
result = cur.fetchall()[0]
|
cur.execute(sql_statement)
|
||||||
#print('result: ', result, ' result[0]: ', result[0])
|
result = cur.fetchall()[0]
|
||||||
connected = result[0]
|
#print('result: ', result, ' result[0]: ', result[0])
|
||||||
playercount = result[1]
|
connected = result[0]
|
||||||
#playercount might not be updated ingame and auto leave?
|
playercount = result[1]
|
||||||
print('connected: ', connected)
|
#playercount might not be updated ingame and auto leave?
|
||||||
if connected == 0:
|
print('connected: ', connected)
|
||||||
str1 = "connect 151.80.230.149:27015;"
|
if connected == 0:
|
||||||
writeCfgInput(str1)
|
str1 = "connect 151.80.230.149:27015;"
|
||||||
time.sleep(0.2)
|
writeCfgInput(str1)
|
||||||
writeCfgInput("wait 5;")
|
time.sleep(0.2)
|
||||||
time.sleep(15.50)
|
writeCfgInput("wait 5;")
|
||||||
print('not yet connected')
|
time.sleep(15.50)
|
||||||
mysql_check_if_connected()
|
print('not yet connected')
|
||||||
obsolete = """
|
mysql_check_if_connected()
|
||||||
elif playercount > 60:
|
obsolete = """
|
||||||
str1 = "connect 151.80.230.149:27016;"
|
elif playercount > 60:
|
||||||
writeCfgInput(str1)
|
str1 = "connect 151.80.230.149:27016;"
|
||||||
time.sleep(0.5)
|
writeCfgInput(str1)
|
||||||
writeCfgInput("wait 500;")
|
time.sleep(0.5)
|
||||||
time.sleep(15.50)
|
writeCfgInput("wait 500;")
|
||||||
print('not yet connected')
|
time.sleep(15.50)
|
||||||
mysql_check_if_connected() """
|
print('not yet connected')
|
||||||
connectionTimer = Timer(60.0 * 2, mysql_check_if_connected)
|
mysql_check_if_connected() """
|
||||||
connectionTimer.daemon = True
|
connectionTimer = Timer(60.0 * 2, mysql_check_if_connected)
|
||||||
connectionTimer.start()
|
connectionTimer.daemon = True
|
||||||
cur.close()
|
connectionTimer.start()
|
||||||
cnx.close()
|
|
||||||
|
|
||||||
def mysql_reset_input():
|
|
||||||
cnx = mysql_connection_pool.get_connection()
|
|
||||||
cur = cnx.cursor()
|
|
||||||
sql_statement = f"""DELETE FROM unloze_css_autism_bot.`bot movement input`"""
|
|
||||||
cur.execute(sql_statement)
|
|
||||||
cnx.commit()
|
|
||||||
cur.close()
|
|
||||||
cnx.close()
|
|
||||||
|
|
||||||
def deadlock():
|
def deadlock():
|
||||||
try:
|
try:
|
||||||
@ -233,21 +233,35 @@ def deadlock():
|
|||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if __name__ == '__main__':
|
def mysql_reset_input():
|
||||||
atexit.register(exit_handler)
|
with closing(mysql.connector.connect(host=mysql_connection_ip, database=mysql_connection_database, user=mysql_connection_user, password=mysql_connection_pw,
|
||||||
resetCfgInputShortWait()
|
auth_plugin='mysql_native_password')) as cnx:
|
||||||
mysql_check_if_connected()
|
with closing(cnx.cursor()) as cur:
|
||||||
checkbotteam()
|
sql_statement = f"""DELETE FROM unloze_css_autism_bot.`bot movement input`"""
|
||||||
print('reached mysql _get_player_info')
|
cur.execute(sql_statement)
|
||||||
mysql_reset_input()
|
cnx.commit()
|
||||||
mysql_get_player_info([False, True])
|
|
||||||
mysql_check_messages()
|
|
||||||
print('reached deadlock')
|
|
||||||
deadlock()
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
atexit.register(exit_handler)
|
||||||
|
resetCfgInputShortWait()
|
||||||
|
mysql_check_if_connected()
|
||||||
|
checkbotteam()
|
||||||
|
print('reached mysql _get_player_info')
|
||||||
|
mysql_reset_input()
|
||||||
|
organize_player_info([False, True])
|
||||||
|
mysql_check_messages()
|
||||||
|
print('reached deadlock')
|
||||||
|
deadlock()
|
||||||
|
|
||||||
|
#/home/gameservers/.steam/debian-installation/steamapps/common/Counter-Strike Source/cstrike/cfg/autoexec.cfg:
|
||||||
#/home/nonroot/.steam/steam/steamapps/common/Counter-Strike Source/cstrike/cfg/autoexec.cfg:
|
#/home/nonroot/.steam/steam/steamapps/common/Counter-Strike Source/cstrike/cfg/autoexec.cfg:
|
||||||
#alias loop "exec looptest.cfg; wait 5; loop;"; wait 5; loop;
|
#alias loop "exec looptest.cfg; wait 5; loop;"; wait 5; loop;
|
||||||
|
|
||||||
#-condebug
|
#-condebug
|
||||||
#cd /home/nonroot/.steam/
|
#cd /home/nonroot/.steam/
|
||||||
|
#cd /home/gameservers/.steam/debian-installation/
|
||||||
#./steam.sh -applaunch 240 -textmode -textmessagedebug -novid -nosound -noipx -nojoy -noshaderapi +exec looptest.cfg
|
#./steam.sh -applaunch 240 -textmode -textmessagedebug -novid -nosound -noipx -nojoy -noshaderapi +exec looptest.cfg
|
||||||
|
|
||||||
|
#cd /home/gameservers/ze_runner_files
|
||||||
|
#./play.sh
|
||||||
|
#screen -A -d -m -S ze_runner ./play.sh
|
||||||
|
@ -14,14 +14,11 @@
|
|||||||
|
|
||||||
int present = 0;
|
int present = 0;
|
||||||
int targethuman = 0;
|
int targethuman = 0;
|
||||||
int stuckcounterX = 0;
|
int stuckcounterx = 0;
|
||||||
int stuckcounterY = 0;
|
int stuckcountery = 0;
|
||||||
Database database_connection_input;
|
|
||||||
|
|
||||||
//bot input
|
//bot input
|
||||||
int row_counter = 0;
|
int row_counter = 0;
|
||||||
int stuckX = 0;
|
|
||||||
int stuckY = 0;
|
|
||||||
char keyinput[rows_entry_cap][generic_length];
|
char keyinput[rows_entry_cap][generic_length];
|
||||||
float clientangles[rows_entry_cap][3];
|
float clientangles[rows_entry_cap][3];
|
||||||
float xyz[rows_entry_cap][3];
|
float xyz[rows_entry_cap][3];
|
||||||
@ -55,12 +52,6 @@ public void OnPluginStart()
|
|||||||
HookEvent("round_start", Event_RoundStart, EventHookMode_PostNoCopy);
|
HookEvent("round_start", Event_RoundStart, EventHookMode_PostNoCopy);
|
||||||
HookEvent("player_team", event_playerteam, EventHookMode_PostNoCopy);
|
HookEvent("player_team", event_playerteam, EventHookMode_PostNoCopy);
|
||||||
|
|
||||||
//global DB
|
|
||||||
char error_connect[generic_length];
|
|
||||||
if (SQL_CheckConfig("css_autism_bot_info"))
|
|
||||||
database_connection_input = SQL_Connect("css_autism_bot_info", true, error_connect, sizeof(error_connect));
|
|
||||||
if (database_connection_input == null)
|
|
||||||
PrintToChatAll("{green}[UNLOZE] {white}Error! Could not connect to maria-DB! %s", error_connect);
|
|
||||||
//mysql
|
//mysql
|
||||||
sql_create_table();
|
sql_create_table();
|
||||||
}
|
}
|
||||||
@ -79,20 +70,18 @@ public Action cmd_talk(int client, int args)
|
|||||||
if (SQL_CheckConfig("css_autism_bot_info"))
|
if (SQL_CheckConfig("css_autism_bot_info"))
|
||||||
database_connection = SQL_Connect("css_autism_bot_info", true, error_connect, sizeof(error_connect));
|
database_connection = SQL_Connect("css_autism_bot_info", true, error_connect, sizeof(error_connect));
|
||||||
if (database_connection == null)
|
if (database_connection == null)
|
||||||
PrintToChatAll("{green}[UNLOZE] {white}Error! Could not connect to maria-DB!");
|
return Plugin_Handled;
|
||||||
char query_start[generic_length * 2];
|
char query_start[generic_length * 2];
|
||||||
Format(query_start, sizeof(query_start), "INSERT INTO unloze_css_autism_bot.`chatting` (`chatmessage`, `responsemessage`) VALUES ('%s', '')", info);
|
int size2 = 2 * strlen(info) + 1;
|
||||||
//PrintToChatAll("query_start: %s", query_start);
|
char[] sEscapedName = new char[size2 + 1];
|
||||||
mysql_exec_prepared_statement(database_connection, query_start);
|
SQL_EscapeString(database_connection, info, sEscapedName, size2 + 1);
|
||||||
|
Format(query_start, sizeof(query_start), "INSERT INTO unloze_css_autism_bot.`chatting` (`chatmessage`, `responsemessage`) VALUES ('%s', '')", sEscapedName);
|
||||||
|
//PrintToChat(client, "sEscapedName: %s", query_start);
|
||||||
|
SQL_TQuery(database_connection, DummyCallbackSimple, query_start);
|
||||||
delete database_connection;
|
delete database_connection;
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnPluginEnd()
|
|
||||||
{
|
|
||||||
delete database_connection_input;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Action event_playerteam(Event event, const char[] name, bool dontBroadcast)
|
public Action event_playerteam(Event event, const char[] name, bool dontBroadcast)
|
||||||
{
|
{
|
||||||
int client = GetClientOfUserId(event.GetInt("userid"));
|
int client = GetClientOfUserId(event.GetInt("userid"));
|
||||||
@ -196,43 +185,21 @@ public Action recursive_pressing(Handle timer, any data)
|
|||||||
xyz[row_counter][0] = dx;
|
xyz[row_counter][0] = dx;
|
||||||
xyz[row_counter][1] = dy;
|
xyz[row_counter][1] = dy;
|
||||||
xyz[row_counter][2] = dz;
|
xyz[row_counter][2] = dz;
|
||||||
|
|
||||||
float flVel[3];
|
|
||||||
GetEntPropVector(present, Prop_Data, "m_vecAbsVelocity", flVel);
|
|
||||||
int stuckcap = 3;
|
|
||||||
float mincapvelocity = 10.0;
|
|
||||||
if (flVel[0] < mincapvelocity)
|
|
||||||
{
|
|
||||||
stuckcounterX++;
|
|
||||||
if (stuckcounterX > stuckcap)
|
|
||||||
{
|
|
||||||
stuckcounterX = 0;
|
|
||||||
stuckX = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (flVel[1] < mincapvelocity)
|
|
||||||
{
|
|
||||||
stuckcounterY++;
|
|
||||||
if (stuckcounterY > stuckcap)
|
|
||||||
{
|
|
||||||
stuckcounterY = 0;
|
|
||||||
stuckY = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
int keys = GetClientButtons(targethuman);
|
int keys = GetClientButtons(targethuman);
|
||||||
if (keys & IN_FORWARD)
|
if (keys & IN_FORWARD)
|
||||||
StrCat(keyinput[row_counter], sizeof(keyinput[]), "-back; wait 5; +forward; wait 5; ");
|
Format(keyinput[row_counter], sizeof(keyinput[]), "-back; wait 5; +forward; wait 5; ");
|
||||||
else if (keys & IN_BACK)
|
else if (keys & IN_BACK)
|
||||||
StrCat(keyinput[row_counter], sizeof(keyinput[]), "-forward; wait 5; +back; wait 5; ");
|
Format(keyinput[row_counter], sizeof(keyinput[]), "-forward; wait 5; +back; wait 5; ");
|
||||||
if (keys & IN_MOVELEFT)
|
|
||||||
StrCat(keyinput[row_counter], sizeof(keyinput[]), "-moveright; wait 5; +moveleft; wait 5; ");
|
if (keys & IN_MOVELEFT && StrContains(keyinput[row_counter], "moveleft", false) == -1)
|
||||||
else if (keys & IN_MOVERIGHT)
|
Format(keyinput[row_counter], sizeof(keyinput[]), "%s -moveright; wait 5; +moveleft; wait 5; ", keyinput[row_counter]);
|
||||||
StrCat(keyinput[row_counter], sizeof(keyinput[]), "-moveleft; wait 5; +moveright; wait 5; ");
|
else if (keys & IN_MOVERIGHT && StrContains(keyinput[row_counter], "moveright", false) == -1)
|
||||||
if (keys & IN_JUMP)
|
Format(keyinput[row_counter], sizeof(keyinput[]), "%s -moveleft; wait 5; +moveright; wait 5; ", keyinput[row_counter]);
|
||||||
StrCat(keyinput[row_counter], sizeof(keyinput[]), "+jump; wait 5; ");
|
if (keys & IN_JUMP && StrContains(keyinput[row_counter], "jump", false) == -1)
|
||||||
if (keys & IN_DUCK)
|
Format(keyinput[row_counter], sizeof(keyinput[]), "%s +jump; wait 5; ", keyinput[row_counter]);
|
||||||
StrCat(keyinput[row_counter], sizeof(keyinput[]), "+duck; wait 5; ");
|
if (keys & IN_DUCK && StrContains(keyinput[row_counter], "duck", false) == -1)
|
||||||
|
Format(keyinput[row_counter], sizeof(keyinput[]), "%s +duck; wait 5; ", keyinput[row_counter]);
|
||||||
GetClientAbsAngles(targethuman, clientangles[row_counter]);
|
GetClientAbsAngles(targethuman, clientangles[row_counter]);
|
||||||
//PrintToChatAll("targethuman: %N", targethuman);
|
//PrintToChatAll("targethuman: %N", targethuman);
|
||||||
}
|
}
|
||||||
@ -278,17 +245,17 @@ public void sql_create_table()
|
|||||||
if (SQL_CheckConfig("css_autism_bot_info"))
|
if (SQL_CheckConfig("css_autism_bot_info"))
|
||||||
database_connection = SQL_Connect("css_autism_bot_info", true, error_connect, sizeof(error_connect));
|
database_connection = SQL_Connect("css_autism_bot_info", true, error_connect, sizeof(error_connect));
|
||||||
if (database_connection == null)
|
if (database_connection == null)
|
||||||
PrintToChatAll("{green}[UNLOZE] {white}Error! Could not connect to maria-DB!");
|
return;
|
||||||
//256 not enough
|
//256 not enough
|
||||||
char query_start[generic_length * 3];
|
char query_start[generic_length * 3];
|
||||||
Format(query_start, sizeof(query_start), "CREATE TABLE IF NOT EXISTS unloze_css_autism_bot.`bot status` (`connected` BOOL DEFAULT false, `spectate` BOOL DEFAULT true, `ID` INT NOT NULL DEFAULT 1, `playercount` INT DEFAULT 0, PRIMARY KEY (`ID`))");
|
Format(query_start, sizeof(query_start), "CREATE TABLE IF NOT EXISTS unloze_css_autism_bot.`bot status` (`connected` BOOL DEFAULT false, `spectate` BOOL DEFAULT true, `ID` INT NOT NULL DEFAULT 1, `playercount` INT DEFAULT 0, PRIMARY KEY (`ID`))");
|
||||||
mysql_exec_prepared_statement(database_connection, query_start);
|
SQL_TQuery(database_connection, DummyCallbackSimple, query_start);
|
||||||
Format(query_start, sizeof(query_start), "CREATE TABLE IF NOT EXISTS unloze_css_autism_bot.`bot movement input` (`keyinput` text NOT NULL, `clientangles_0` DECIMAL(13, 8) DEFAULT 0.000, `clientangles_1` DECIMAL(13, 8) DEFAULT 0.000, `clientangles_2` DECIMAL(13, 8) DEFAULT 0.000, `xyz_0` DECIMAL(13, 8) DEFAULT 0.000, `xyz_1` DECIMAL(13, 8) DEFAULT 0.000, `xyz_2` DECIMAL(13, 8) DEFAULT 0.000, `hunt_or_mimic` BOOLEAN DEFAULT false, `stuckX` BOOLEAN DEFAULT false, `stuckY` BOOLEAN DEFAULT false, `entry_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP)");
|
Format(query_start, sizeof(query_start), "CREATE TABLE IF NOT EXISTS unloze_css_autism_bot.`bot movement input` (`keyinput` text NOT NULL, `clientangles_0` DECIMAL(13, 8) DEFAULT 0.000, `clientangles_1` DECIMAL(13, 8) DEFAULT 0.000, `clientangles_2` DECIMAL(13, 8) DEFAULT 0.000, `xyz_0` DECIMAL(13, 8) DEFAULT 0.000, `xyz_1` DECIMAL(13, 8) DEFAULT 0.000, `xyz_2` DECIMAL(13, 8) DEFAULT 0.000, `hunt_or_mimic` BOOLEAN DEFAULT false, `stuckX` BOOLEAN DEFAULT false, `stuckY` BOOLEAN DEFAULT false, `entry_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP)");
|
||||||
mysql_exec_prepared_statement(database_connection, query_start);
|
SQL_TQuery(database_connection, DummyCallbackSimple, query_start);
|
||||||
Format(query_start, sizeof(query_start), "INSERT INTO unloze_css_autism_bot.`bot status` (connected, spectate, ID) VALUES (0, 1, 1) ON DUPLICATE KEY UPDATE connected = VALUES(connected), spectate = VALUES(spectate)");
|
Format(query_start, sizeof(query_start), "INSERT INTO unloze_css_autism_bot.`bot status` (connected, spectate, ID) VALUES (0, 1, 1) ON DUPLICATE KEY UPDATE connected = VALUES(connected), spectate = VALUES(spectate)");
|
||||||
mysql_exec_prepared_statement(database_connection, query_start);
|
SQL_TQuery(database_connection, DummyCallbackSimple, query_start);
|
||||||
Format(query_start, sizeof(query_start), "CREATE TABLE IF NOT EXISTS unloze_css_autism_bot.`chatting` (`chatmessage` text NOT NULL, `responsemessage` text NOT NULL)");
|
Format(query_start, sizeof(query_start), "CREATE TABLE IF NOT EXISTS unloze_css_autism_bot.`chatting` (`chatmessage` text NOT NULL, `responsemessage` text NOT NULL)");
|
||||||
mysql_exec_prepared_statement(database_connection, query_start);
|
SQL_TQuery(database_connection, DummyCallbackSimple, query_start);
|
||||||
delete database_connection;
|
delete database_connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -299,10 +266,11 @@ public void mysql_clean_movement_input()
|
|||||||
if (SQL_CheckConfig("css_autism_bot_info"))
|
if (SQL_CheckConfig("css_autism_bot_info"))
|
||||||
database_connection = SQL_Connect("css_autism_bot_info", true, error_connect, sizeof(error_connect));
|
database_connection = SQL_Connect("css_autism_bot_info", true, error_connect, sizeof(error_connect));
|
||||||
if (database_connection == null)
|
if (database_connection == null)
|
||||||
PrintToChatAll("{green}[UNLOZE] {white}Error! Could not connect to maria-DB!");
|
return;
|
||||||
char query_start[generic_length];
|
char query_start[generic_length];
|
||||||
Format(query_start, sizeof(query_start), "delete from unloze_css_autism_bot.`bot movement input`");
|
Format(query_start, sizeof(query_start), "delete from unloze_css_autism_bot.`bot movement input`");
|
||||||
mysql_exec_prepared_statement(database_connection, query_start);
|
SQL_TQuery(database_connection, DummyCallbackSimple, query_start);
|
||||||
|
delete database_connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void mysql_update_playercount()
|
public void mysql_update_playercount()
|
||||||
@ -312,10 +280,10 @@ public void mysql_update_playercount()
|
|||||||
if (SQL_CheckConfig("css_autism_bot_info"))
|
if (SQL_CheckConfig("css_autism_bot_info"))
|
||||||
database_connection = SQL_Connect("css_autism_bot_info", true, error_connect, sizeof(error_connect));
|
database_connection = SQL_Connect("css_autism_bot_info", true, error_connect, sizeof(error_connect));
|
||||||
if (database_connection == null)
|
if (database_connection == null)
|
||||||
PrintToChatAll("{green}[UNLOZE] {white}Error! Could not connect to maria-DB!");
|
return;
|
||||||
char query_start[generic_length];
|
char query_start[generic_length];
|
||||||
Format(query_start, sizeof(query_start), "INSERT INTO unloze_css_autism_bot.`bot status` (playercount, ID) VALUES (%i, 1) ON DUPLICATE KEY UPDATE playercount = %i", MaxClients, MaxClients);
|
Format(query_start, sizeof(query_start), "INSERT INTO unloze_css_autism_bot.`bot status` (playercount, ID) VALUES (%i, 1) ON DUPLICATE KEY UPDATE playercount = %i", MaxClients, MaxClients);
|
||||||
mysql_exec_prepared_statement(database_connection, query_start);
|
SQL_TQuery(database_connection, DummyCallbackSimple, query_start);
|
||||||
delete database_connection;
|
delete database_connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -326,10 +294,11 @@ public void mysql_bot_not_spec()
|
|||||||
if (SQL_CheckConfig("css_autism_bot_info"))
|
if (SQL_CheckConfig("css_autism_bot_info"))
|
||||||
database_connection = SQL_Connect("css_autism_bot_info", true, error_connect, sizeof(error_connect));
|
database_connection = SQL_Connect("css_autism_bot_info", true, error_connect, sizeof(error_connect));
|
||||||
if (database_connection == null)
|
if (database_connection == null)
|
||||||
PrintToChatAll("{green}[UNLOZE] {white}Error! Could not connect to maria-DB!");
|
return;
|
||||||
char query_start[generic_length];
|
char query_start[generic_length];
|
||||||
Format(query_start, sizeof(query_start), "INSERT INTO unloze_css_autism_bot.`bot status` (connected, spectate, ID) VALUES (1, 0, 1) ON DUPLICATE KEY UPDATE connected = VALUES(connected), spectate = VALUES(spectate)");
|
Format(query_start, sizeof(query_start), "INSERT INTO unloze_css_autism_bot.`bot status` (connected, spectate, ID) VALUES (1, 0, 1) ON DUPLICATE KEY UPDATE connected = VALUES(connected), spectate = VALUES(spectate)");
|
||||||
mysql_exec_prepared_statement(database_connection, query_start);
|
SQL_TQuery(database_connection, DummyCallbackSimple, query_start);
|
||||||
|
delete database_connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void mysql_enable_disable_connected(int state)
|
public void mysql_enable_disable_connected(int state)
|
||||||
@ -339,72 +308,91 @@ public void mysql_enable_disable_connected(int state)
|
|||||||
if (SQL_CheckConfig("css_autism_bot_info"))
|
if (SQL_CheckConfig("css_autism_bot_info"))
|
||||||
database_connection = SQL_Connect("css_autism_bot_info", true, error_connect, sizeof(error_connect));
|
database_connection = SQL_Connect("css_autism_bot_info", true, error_connect, sizeof(error_connect));
|
||||||
if (database_connection == null)
|
if (database_connection == null)
|
||||||
PrintToChatAll("{green}[UNLOZE] {white}Error! Could not connect to maria-DB!");
|
return;
|
||||||
char query_start[generic_length];
|
char query_start[generic_length];
|
||||||
if (!state)
|
if (!state)
|
||||||
Format(query_start, sizeof(query_start), "INSERT INTO unloze_css_autism_bot.`bot status` (connected, spectate, ID) VALUES (0, 1, 1) ON DUPLICATE KEY UPDATE connected = VALUES(connected), spectate = VALUES(spectate)");
|
Format(query_start, sizeof(query_start), "INSERT INTO unloze_css_autism_bot.`bot status` (connected, spectate, ID) VALUES (0, 1, 1) ON DUPLICATE KEY UPDATE connected = VALUES(connected), spectate = VALUES(spectate)");
|
||||||
else
|
else
|
||||||
Format(query_start, sizeof(query_start), "INSERT INTO unloze_css_autism_bot.`bot status` (connected, spectate, ID) VALUES (1, 1, 1) ON DUPLICATE KEY UPDATE connected = VALUES(connected), spectate = VALUES(spectate)");
|
Format(query_start, sizeof(query_start), "INSERT INTO unloze_css_autism_bot.`bot status` (connected, spectate, ID) VALUES (1, 1, 1) ON DUPLICATE KEY UPDATE connected = VALUES(connected), spectate = VALUES(spectate)");
|
||||||
//PrintToChatAll("query_start: %s", query_start);
|
//PrintToChatAll("query_start: %s", query_start);
|
||||||
mysql_exec_prepared_statement(database_connection, query_start);
|
SQL_TQuery(database_connection, DummyCallbackSimple, query_start);
|
||||||
delete database_connection;
|
delete database_connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void mysql_send_input()
|
public void mysql_send_input()
|
||||||
{
|
{
|
||||||
|
char error_connect[generic_length];
|
||||||
|
Database database_connection;
|
||||||
|
if (SQL_CheckConfig("css_autism_bot_info"))
|
||||||
|
database_connection = SQL_Connect("css_autism_bot_info", true, error_connect, sizeof(error_connect));
|
||||||
|
if (database_connection == null)
|
||||||
|
{
|
||||||
|
PrintToChatAll("{green}[UNLOZE] {white}Error! Could not connect to maria-DB!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
char query_start[generic_length * 7];
|
char query_start[generic_length * 7];
|
||||||
int iterator = 0;
|
int iterator = 0;
|
||||||
|
float flVel[3];
|
||||||
|
int stuckX = 0;
|
||||||
|
int stuckY = 0;
|
||||||
|
GetEntPropVector(present, Prop_Data, "m_vecAbsVelocity", flVel);
|
||||||
|
float mincapvelocity = 10.0;
|
||||||
|
if (flVel[0] < mincapvelocity)
|
||||||
|
{
|
||||||
|
if (stuckcounterx > 5)
|
||||||
|
{
|
||||||
|
stuckX = 1;
|
||||||
|
stuckcounterx = -1;
|
||||||
|
}
|
||||||
|
stuckcounterx++;
|
||||||
|
}
|
||||||
|
if (flVel[1] < mincapvelocity)
|
||||||
|
{
|
||||||
|
if (stuckcountery > 5)
|
||||||
|
{
|
||||||
|
stuckY = 1;
|
||||||
|
stuckcountery = -1;
|
||||||
|
}
|
||||||
|
stuckcountery++;
|
||||||
|
}
|
||||||
|
bool testdebug = false;
|
||||||
Format(query_start, sizeof(query_start), "INSERT INTO unloze_css_autism_bot.`bot movement input` VALUES ");
|
Format(query_start, sizeof(query_start), "INSERT INTO unloze_css_autism_bot.`bot movement input` VALUES ");
|
||||||
while (iterator < row_counter)
|
while (iterator < row_counter)
|
||||||
{
|
{
|
||||||
char row[generic_length];
|
char row[generic_length];
|
||||||
Format(row, sizeof(row), " ('%s', %f, %f, %f, %f, %f, %f, %i, %i, %i, NOW()),", keyinput[iterator], clientangles[iterator][0], clientangles[iterator][1], clientangles[iterator][2], xyz[iterator][0], xyz[iterator][1], xyz[iterator][2], hunt_or_mimic, stuckX, stuckY);
|
if (xyz[iterator][0] != 0 || xyz[iterator][1] != 0 || xyz[iterator][2] != 0)
|
||||||
StrCat(query_start, sizeof(query_start), row);
|
|
||||||
Format(keyinput[iterator], sizeof(keyinput), " ");
|
|
||||||
for (int i = 0; i < 3; i++)
|
|
||||||
{
|
{
|
||||||
clientangles[iterator][i] = 0.0;
|
Format(row, sizeof(row), " ('%s', %f, %f, %f, %f, %f, %f, %i, %i, %i, NOW()),", keyinput[iterator], clientangles[iterator][0], clientangles[iterator][1], clientangles[iterator][2], xyz[iterator][0], xyz[iterator][1], xyz[iterator][2], hunt_or_mimic, stuckX, stuckY);
|
||||||
xyz[iterator][i] = 0.0;
|
StrCat(query_start, sizeof(query_start), row);
|
||||||
|
Format(keyinput[iterator], sizeof(keyinput), "");
|
||||||
|
testdebug = true;
|
||||||
|
for (int i = 0; i < 3; i++)
|
||||||
|
{
|
||||||
|
clientangles[iterator][i] = 0.0;
|
||||||
|
xyz[iterator][i] = 0.0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
iterator++;
|
iterator++;
|
||||||
}
|
}
|
||||||
row_counter = 0;
|
row_counter = 0;
|
||||||
if (stuckX)
|
|
||||||
stuckX = !stuckX;
|
|
||||||
if (stuckY)
|
|
||||||
stuckY = !stuckY;
|
|
||||||
int querylen = strlen(query_start);
|
int querylen = strlen(query_start);
|
||||||
query_start[querylen - 1] = '\0';
|
query_start[querylen - 1] = '\0';
|
||||||
|
|
||||||
//debugging
|
//debugging
|
||||||
|
//PrintToChatAll("query_start final length: %i", querylen);
|
||||||
/*
|
/*
|
||||||
PrintToChatAll("query_start final length: %i", querylen);
|
|
||||||
char g_sConfigzones[PLATFORM_MAX_PATH];
|
char g_sConfigzones[PLATFORM_MAX_PATH];
|
||||||
Handle inputfile = INVALID_HANDLE;
|
Handle inputfile = INVALID_HANDLE;
|
||||||
BuildPath(Path_SM, g_sConfigzones, sizeof(g_sConfigzones), "configs/autism_insert_debug.txt");
|
BuildPath(Path_SM, g_sConfigzones, sizeof(g_sConfigzones), "configs/autism_insert_debug.txt");
|
||||||
inputfile = OpenFile(g_sConfigzones, "w");
|
inputfile = OpenFile(g_sConfigzones, "a+");
|
||||||
if (inputfile != INVALID_HANDLE)
|
if (inputfile != INVALID_HANDLE)
|
||||||
{
|
{
|
||||||
WriteFileLine(inputfile, "%s", query_start);
|
WriteFileLine(inputfile, "%s", query_start);
|
||||||
}
|
}
|
||||||
delete inputfile;
|
delete inputfile;
|
||||||
*/
|
*/
|
||||||
|
if (testdebug)
|
||||||
//mysql_exec_prepared_statement(database_connection_input, query_start);
|
SQL_TQuery(database_connection, DummyCallbackSimple, query_start);
|
||||||
SQL_TQuery(database_connection_input, DummyCallbackSimple, query_start);
|
delete database_connection;
|
||||||
}
|
|
||||||
|
|
||||||
public void mysql_exec_prepared_statement(Database database_connection, char []query_statement)
|
|
||||||
{
|
|
||||||
char error[generic_length];
|
|
||||||
DBStatement create_statement = SQL_PrepareQuery(database_connection, query_statement, error, sizeof(error));
|
|
||||||
if (create_statement == INVALID_HANDLE)
|
|
||||||
{
|
|
||||||
CloseHandle(create_statement);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
SQL_Execute(create_statement);
|
|
||||||
CloseHandle(create_statement);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DummyCallbackSimple(Handle hOwner, Handle hChild, const char[] err, DataPack pack1)
|
public void DummyCallbackSimple(Handle hOwner, Handle hChild, const char[] err, DataPack pack1)
|
||||||
|
Loading…
Reference in New Issue
Block a user