Merge pull request #336 from BenCat07/patch-2

Fix lagexploit on zoom + add instant weapon switch
This commit is contained in:
nullifiedcat 2018-01-24 20:46:32 +03:00 committed by GitHub
commit f7ca64f38b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,6 +18,8 @@ CatVar toggle(CV_SWITCH, "se_toggle", "0", "Toggle sequence exploit");
CatVar shoot(CV_SWITCH, "se_shoot", "0",
"Allows instant revving up or shooting two shots at once");
CatVar cloak(CV_SWITCH, "se_cloak", "0", "Instant decloak/cloak");
CatVar instant_weapon_switch(CV_SWITCH, "se_switch", "0",
"Instant weapon switch");
CatVar key(CV_KEY, "se_key", "0", "Sequence exploit key");
CatVar master_switch(CV_SWITCH, "se_master", "1", "Enable sequence exploit",
"Master switch for the sequence exploit\nDisabling this "
@ -107,7 +109,8 @@ void CreateMove()
// TODO: Alternative to - LOCAL_E->m_iAmmo <
// LOCAL_E->m_iMaxAmmo That is pseudocode but checking each
// weapon for ammo + engie for metal would be ideal
if ((e->m_ItemType == ITEM_AMMO_SMALL ||
if (CE_INT(g_pLocalPlayer->weapon(), netvar.m_iAmmo) < 5 &&
(e->m_ItemType == ITEM_AMMO_SMALL ||
e->m_ItemType == ITEM_AMMO_MEDIUM ||
e->m_ItemType == ITEM_AMMO_LARGE))
{
@ -133,6 +136,13 @@ void CreateMove()
(g_pUserCmd->buttons & IN_ATTACK2));
if (!LOCAL_E->m_bAlivePlayer)
return;
if (instant_weapon_switch && not HasCondition<TFCond_Cloaked>(LOCAL_E))
{
static int lastweapon = 0;
if (lastweapon != g_pUserCmd->weaponselect)
amount = 1 * 90;
lastweapon = g_pUserCmd->weaponselect;
}
if (cloak && shoot)
{
if (g_pLocalPlayer->weapon()->m_iClassID == CL_CLASS(CTFKnife))
@ -158,12 +168,24 @@ void CreateMove()
{
if (shoot)
{
if (CanShoot() && bIsHolding && !bWasHolding)
amount = 1 * 90;
else if (bWasHolding && !bIsHolding)
amount = 1 * 90;
bWasHolding = (g_pUserCmd->buttons & IN_ATTACK) ||
(g_pUserCmd->buttons & IN_ATTACK2);
if (not g_pLocalPlayer->holding_sniper_rifle)
{
if (CanShoot() && bIsHolding && !bWasHolding)
amount = 1 * 90;
else if (bWasHolding && !bIsHolding)
amount = 1 * 90;
bWasHolding = (g_pUserCmd->buttons & IN_ATTACK) ||
(g_pUserCmd->buttons & IN_ATTACK2);
}
else
{
bIsHolding = (g_pUserCmd->buttons & IN_ATTACK);
if (CanShoot() && bIsHolding && !bWasHolding)
amount = 1 * 90;
else if (bWasHolding && !bIsHolding)
amount = 1 * 90;
bWasHolding = (g_pUserCmd->buttons & IN_ATTACK);
}
}
}
else if (!shoot)