diff --git a/attach-user b/attach-user new file mode 100755 index 00000000..7d999c17 --- /dev/null +++ b/attach-user @@ -0,0 +1,46 @@ +#!/usr/bin/env bash + +user=$USER + +if [ "$#" == 1 ]; then + user=$1 +fi + +proc="0" + +for pid in $(pidof hl2_linux) +do + if sudo -H -u $user kill -0 $pid + then + proc=$pid + break + fi +done + + +if [ "$proc" == "0" ] +then + echo "TF2 for $user is not running" + continue +fi + +echo Attaching to "$proc" + +FILENAME=$(realpath "bin/libcathook.so") + +echo loading "$FILENAME" to "$proc" + +sudo killall -19 steam +sudo killall -19 steamwebhelper + +sudo gdb -n -q -batch \ + -ex "attach $proc" \ + -ex "set \$dlopen = (void*(*)(char*, int)) dlopen" \ + -ex "call \$dlopen(\"$FILENAME\", 1)" \ + -ex "call dlerror()" \ + -ex 'print (char *) $2' \ + -ex "detach" \ + -ex "quit" + +sudo killall -18 steamwebhelper +sudo killall -18 steam \ No newline at end of file diff --git a/src/headshake.cpp b/src/headshake.cpp new file mode 100644 index 00000000..8c8f28cb --- /dev/null +++ b/src/headshake.cpp @@ -0,0 +1,12 @@ +/* + * headshake.cpp + * + * Created on: Aug 2, 2017 + * Author: nullifiedcat + */ + +#include + +const std::vector headshake_pitch_deltas = { + -0.2, 0.8, -1.7, 0.8, -0.8, 0.19, -0.99, 1.9 +}; diff --git a/src/headshake.hpp b/src/headshake.hpp new file mode 100644 index 00000000..6b61018d --- /dev/null +++ b/src/headshake.hpp @@ -0,0 +1,12 @@ +/* + * headshake.hpp + * + * Created on: Aug 2, 2017 + * Author: nullifiedcat + */ + +#pragma once + + + + diff --git a/src/helpers.cpp b/src/helpers.cpp index bbd92ff3..e9434758 100644 --- a/src/helpers.cpp +++ b/src/helpers.cpp @@ -156,6 +156,7 @@ powerup_type GetPowerupOnPlayer(CachedEntity* player) { // A function to tell if a player is using a specific weapon bool HasWeapon(CachedEntity* ent, int wantedId) { + if (CE_BAD(ent)) return false; // Create a var to store the handle int *hWeapons; // Grab the handle and store it into the var @@ -172,6 +173,7 @@ bool HasWeapon(CachedEntity* ent, int wantedId) { } bool HasDarwins(CachedEntity* ent) { + if (CE_BAD(ent)) return false; // Check if player is sniper if (CE_INT(ent, netvar.iClass) != tf_sniper) return false; // Check if player is using darwins, 231 is the id for darwins danger sheild