custom spam/killsay files automatically reload. fix imgui int for some
catvars
This commit is contained in:
parent
30bba4ceb4
commit
9d13e787b6
@ -31,6 +31,7 @@ void CatVar_Integer(CatVar& var) {
|
|||||||
int value = var;
|
int value = var;
|
||||||
ImGui::PushItemWidth(120.0f);
|
ImGui::PushItemWidth(120.0f);
|
||||||
int step = var.restricted ? (var.max - var.min) / 50 : 1;
|
int step = var.restricted ? (var.max - var.min) / 50 : 1;
|
||||||
|
if (step == 0) step = 1;
|
||||||
if (ImGui::InputInt(label, &value, step, step * 20)) {
|
if (ImGui::InputInt(label, &value, step, step * 20)) {
|
||||||
var = value;
|
var = value;
|
||||||
}
|
}
|
||||||
|
@ -272,6 +272,7 @@ void hack::Initialize() {
|
|||||||
hacks::shared::anticheat::Init();
|
hacks::shared::anticheat::Init();
|
||||||
hacks::tf2::healarrow::Init();
|
hacks::tf2::healarrow::Init();
|
||||||
InitSpinner();
|
InitSpinner();
|
||||||
|
hacks::shared::spam::Init();
|
||||||
logging::Info("Initialized Fidget Spinner");
|
logging::Info("Initialized Fidget Spinner");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -82,6 +82,9 @@ void Reload() {
|
|||||||
|
|
||||||
void Init() {
|
void Init() {
|
||||||
g_IEventManager2->AddListener(&getListener(), (const char*)"player_death", false);
|
g_IEventManager2->AddListener(&getListener(), (const char*)"player_death", false);
|
||||||
|
filename.InstallChangeCallback([](IConVar* var, const char* pszOV, float flOV) {
|
||||||
|
file.TryLoad(std::string(filename.GetString()));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Shutdown() {
|
void Shutdown() {
|
||||||
|
@ -137,6 +137,12 @@ int QueryPlayer(Query query) {
|
|||||||
return index_result;
|
return index_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Init() {
|
||||||
|
filename.InstallChangeCallback([](IConVar* var, const char* pszOV, float flOV) {
|
||||||
|
file.TryLoad(std::string(filename.GetString()));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
bool SubstituteQueries(std::string& input) {
|
bool SubstituteQueries(std::string& input) {
|
||||||
size_t index = input.find("%query:");
|
size_t index = input.find("%query:");
|
||||||
while (index != std::string::npos) {
|
while (index != std::string::npos) {
|
||||||
|
@ -25,6 +25,7 @@ extern CatVar enabled;
|
|||||||
extern CatVar filename;
|
extern CatVar filename;
|
||||||
extern CatCommand reload;
|
extern CatCommand reload;
|
||||||
|
|
||||||
|
void Init();
|
||||||
void CreateMove();
|
void CreateMove();
|
||||||
void Reset();
|
void Reset();
|
||||||
void Reload();
|
void Reload();
|
||||||
|
@ -18,6 +18,21 @@
|
|||||||
TextFile::TextFile()
|
TextFile::TextFile()
|
||||||
: lines {} {}
|
: lines {} {}
|
||||||
|
|
||||||
|
bool TextFile::TryLoad(std::string name) {
|
||||||
|
if (name.length() == 0) return false;
|
||||||
|
std::string filename = format("cathook/", name);
|
||||||
|
std::ifstream file(filename, std::ios::in);
|
||||||
|
if (!file) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
lines.clear();
|
||||||
|
for (std::string line; std::getline(file, line);) {
|
||||||
|
if (*line.rbegin() == '\r') line.erase(line.length() - 1, 1);
|
||||||
|
lines.push_back(line);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void TextFile::Load(std::string name) {
|
void TextFile::Load(std::string name) {
|
||||||
std::string filename = format("cathook/", name);
|
std::string filename = format("cathook/", name);
|
||||||
std::ifstream file(filename, std::ios::in);
|
std::ifstream file(filename, std::ios::in);
|
||||||
@ -27,6 +42,7 @@ void TextFile::Load(std::string name) {
|
|||||||
}
|
}
|
||||||
lines.clear();
|
lines.clear();
|
||||||
for (std::string line; std::getline(file, line);) {
|
for (std::string line; std::getline(file, line);) {
|
||||||
|
if (*line.rbegin() == '\r') line.erase(line.length() - 1, 1);
|
||||||
lines.push_back(line);
|
lines.push_back(line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ class TextFile {
|
|||||||
public:
|
public:
|
||||||
TextFile();
|
TextFile();
|
||||||
void Load(std::string filename);
|
void Load(std::string filename);
|
||||||
|
bool TryLoad(std::string filename);
|
||||||
size_t LineCount() const;
|
size_t LineCount() const;
|
||||||
const std::string& Line(size_t id) const;
|
const std::string& Line(size_t id) const;
|
||||||
public:
|
public:
|
||||||
|
Reference in New Issue
Block a user