Merge pull request #408 from BenCat07/master

Fix menu float slider crash & Lagexploit fixes
This commit is contained in:
BenCat07 2018-05-01 09:50:14 +02:00 committed by GitHub
commit 695d75215b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 26 deletions

View File

@ -28,6 +28,10 @@ CatVar razorback(CV_SWITCH, "se_antirazorback", "0", "Anti-Razorback",
"Stab through razorbacks"); "Stab through razorbacks");
CatVar stickyspam(CV_SWITCH, "se_stickyspam", "0", "Sticky spam", CatVar stickyspam(CV_SWITCH, "se_stickyspam", "0", "Sticky spam",
"Allows Spam of stickies simply by holding Mouse1."); "Allows Spam of stickies simply by holding Mouse1.");
CatVar infinitecharge(CV_SWITCH, "se_infinite_charge", "0",
"Infinite sticky charge",
"Infinitely charge stickies, (can be used for sniping "
"and or b1g dmg using the quickiebomb launcher)");
CatVar cloak(CV_SWITCH, "se_cloak", "0", "Instant decloak/cloak", ""); CatVar cloak(CV_SWITCH, "se_cloak", "0", "Instant decloak/cloak", "");
CatVar cap(CV_SWITCH, "se_cap", "0", "Auto instant cap", ""); CatVar cap(CV_SWITCH, "se_cap", "0", "Auto instant cap", "");
CatVar cart(CV_SWITCH, "se_cart", "0", "Farm cart points", CatVar cart(CV_SWITCH, "se_cart", "0", "Farm cart points",
@ -376,6 +380,12 @@ void CreateMove()
} }
} }
} }
if (g_pLocalPlayer->bAttackLastTick && infinitecharge &&
g_pLocalPlayer->weapon()->m_iClassID ==
(CL_CLASS(CTFPipebombLauncher)) &&
(g_pUserCmd->buttons & IN_ATTACK) &&
CE_BYTE(LOCAL_W, netvar.m_flChargeLevel))
amount = (int) value;
if (instant_weapon_switch && not HasCondition<TFCond_Cloaked>(LOCAL_E)) if (instant_weapon_switch && not HasCondition<TFCond_Cloaked>(LOCAL_E))
{ {
if (lastwep != g_pLocalPlayer->weapon()->m_iClassID) if (lastwep != g_pLocalPlayer->weapon()->m_iClassID)
@ -416,7 +426,8 @@ void CreateMove()
// m1 since a while) // m1 since a while)
// and you are holding m1 run the Doom code // and you are holding m1 run the Doom code
if (doom && servertime - nextattack > 0.0f && if (doom && servertime - nextattack > 0.0f &&
g_pUserCmd->buttons & IN_ATTACK) (g_pUserCmd->buttons & IN_ATTACK ||
g_pUserCmd->buttons & IN_ATTACK2))
{ {
// Incase i ever goes below 0.1 recalculate it (or if it's just // Incase i ever goes below 0.1 recalculate it (or if it's just
// inited) // inited)
@ -426,24 +437,10 @@ void CreateMove()
amount = i * 66; amount = i * 66;
// Don't attack if the clip is empty so you also instantly reload // Don't attack if the clip is empty so you also instantly reload
if (!CE_BYTE(g_pLocalPlayer->weapon(), netvar.m_iClip1)) if (!CE_BYTE(g_pLocalPlayer->weapon(), netvar.m_iClip1))
{
g_pUserCmd->buttons &= ~IN_ATTACK; g_pUserCmd->buttons &= ~IN_ATTACK;
}
// If doom is active and nextattack2 is positive (not reloading/holding
// m2 since a while)
// and you are holding m2 run the Doom code
if (doom && servertime - nextattack2 > 0.0f &&
g_pUserCmd->buttons & IN_ATTACK2)
{
// Incase i2 ever goes below 0.1 recalculate it (or if it's just
// inited)
if (i2 < 0.1f)
i2 = servertime - nextattack2;
// Set lagexploit amount (i * 66 = i seconds of lag)
amount = i2 * 66;
// if primary ammo is empty don't hold m2, not a byte check since
// many weapons may not have a secondary clip
if (CE_INT(g_pLocalPlayer->weapon(), netvar.m_iClip2) == 0)
g_pUserCmd->buttons &= ~IN_ATTACK2; g_pUserCmd->buttons &= ~IN_ATTACK2;
}
} }
// if anti-razorback is active and you can stab through the shieled // if anti-razorback is active and you can stab through the shieled
if (razorback && servertime - nextattack > 3.0f && if (razorback && servertime - nextattack > 3.0f &&
@ -550,17 +547,12 @@ void CreateMove()
void Draw() void Draw()
{ {
#if ENABLE_VISUALS #if ENABLE_VISUALS
if (doom && (servertime - nextattack > 0.0f || servertime - nextattack2)) if (doom && (servertime - nextattack > 0.0f))
{ {
auto amount = servertime - nextattack; auto amount = servertime - nextattack;
auto amount2 = servertime - nextattack2;
if (amount > 0.0f) if (amount > 0.0f)
AddCenterString(format("Fireable Primary amount: ", (int) amount), AddCenterString(format("Fireable amount: ", (int) amount),
colors::orange); colors::orange);
if (amount2 > 0.0f)
AddCenterString(
format("Fireable Secondary amount: ", (int) amount2),
colors::orange);
} }
if (razorback) if (razorback)
{ {

View File

@ -909,7 +909,7 @@ void ConVar::InternalSetFloatValue(float fNewValue)
if (!(m_nFlags & FCVAR_NEVER_AS_STRING)) if (!(m_nFlags & FCVAR_NEVER_AS_STRING))
{ {
char tempVal[32]; char tempVal[32];
Q_snprintf(tempVal, sizeof(tempVal), "%f", m_fValue); snprintf(tempVal, sizeof(tempVal), "%f", m_fValue);
ChangeStringValue(tempVal, flOldValue); ChangeStringValue(tempVal, flOldValue);
} }
else else