Skip to content

Commit

Permalink
Happy 5th Anniversary CSGO. Added TracerEffects v1.0 just in time for…
Browse files Browse the repository at this point in the history
… sv_party_mode. You can find it in the Visuals tab, Come sling some Kisak-Snot onto your fellow players!
  • Loading branch information
LWSS committed Aug 26, 2017
1 parent 59a907e commit 481e793
Show file tree
Hide file tree
Showing 15 changed files with 356 additions and 5 deletions.
2 changes: 1 addition & 1 deletion build-debug
Expand Up @@ -2,4 +2,4 @@

cmake -DCMAKE_BUILD_TYPE="DEBUG"
make -j4
mv libFuzion.so $(cat build_id).so
mv libFuzion.so $(cat build_id)
50 changes: 50 additions & 0 deletions src/ATGUI/Tabs/visualstab.cpp
Expand Up @@ -35,6 +35,26 @@ void Visuals::RenderTab()
"vertigoblue_hdr",
"vietnam" // 21
};
const char *tracerEffectNames[] = {
"Assault Rifle", // 0
"Pistol",
"SMG",
"Rifle",
"Kisak Snot",
"Machine Gun",
"Shotgun",
"Kisak Snot Fallback",
"Kisak Snot Fallback2",
"Wire1A",
"Wire2",
"Wire1B",
"Original",
"Backup",
".50 Cal",
".50 Cal Glow",
".50 Cal Low",
".50 Cal Low Glow", // 17
};

ImGui::Columns(2, NULL, true);
{
Expand Down Expand Up @@ -188,6 +208,36 @@ void Visuals::RenderTab()
ImGui::Checkbox(XORSTR("Weapons"), &Settings::ESP::Chams::Weapon::enabled);
ImGui::Checkbox(XORSTR("No Sky"), &Settings::NoSky::enabled);
ImGui::Checkbox(XORSTR("No Smoke"), &Settings::NoSmoke::enabled);


if(ImGui::Button(XORSTR("Tracer Effect"), ImVec2(-1, 0)))
ImGui::OpenPopup(XORSTR("##TracerEffectWindow"));
ImGui::SetNextWindowSize(ImVec2(320,120), ImGuiSetCond_Always);
if( ImGui::BeginPopup(XORSTR("##TracerEffectWindow")) )
{
ImGui::PushItemWidth(-1);
if( Settings::TracerEffects::serverSide )
{
Settings::TracerEffects::frequency = 1;
Settings::TracerEffects::effect = TracerEffects_t::TASER;
}
ImGui::Combo(XORSTR("##TracerEffects"), (int*)& Settings::TracerEffects::effect, tracerEffectNames, IM_ARRAYSIZE(tracerEffectNames));
ImGui::Checkbox(XORSTR("Enable Tracers"), &Settings::TracerEffects::enabled);
ImGui::Checkbox(XORSTR("Server Sided?"), &Settings::TracerEffects::serverSide);
SetTooltip("Requires a Taser in your Inventory.\nCan only shoot one shot at a time\nOnly Works with Kisak Snot");
ImGui::Columns(2, NULL, false);
{
ImGui::SliderInt(XORSTR("##TracerFreq"),&Settings::TracerEffects::frequency, 0, 10, XORSTR("Freq: %0.f"));
}
ImGui::NextColumn();
{
if( ImGui::Button(XORSTR("Restore Tracers")) ){
TracerEffect::RestoreTracers();
}
}
ImGui::PopItemWidth();
ImGui::EndPopup();
}
}
ImGui::NextColumn();
{
Expand Down
3 changes: 1 addition & 2 deletions src/ATGUI/atgui.h
Expand Up @@ -40,10 +40,9 @@ namespace UI
void ReloadWeaponSettings();
}

/*

inline void SetTooltip(const char* text)
{
if (ImGui::IsItemHovered())
ImGui::SetTooltip("%s", text);
}
*/
3 changes: 2 additions & 1 deletion src/Fuzion.cpp
Expand Up @@ -5,7 +5,7 @@

static EventListener* eventListener = nullptr;
// The Below Line is Set by the Build script. Keep this on Line 8.
char buildID[] = "cCklz64KjWlMk3QUBxqBYwF6HxZyFm4t"; // Line Set by build script
char buildID[] = "yLX2Hsqq4cAgpZWxWB9anCycDHdQVLWx"; // Line Set by build script
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
bool preload = false;
bool isShuttingDown = false;
Expand Down Expand Up @@ -242,6 +242,7 @@ void __attribute__((destructor)) Shutdown()
AntiAim::LuaCleanup();
Aimbot::XDOCleanup();
NoSmoke::Cleanup();
TracerEffect::RestoreTracers();

clientVMT->ReleaseVMT();
panelVMT->ReleaseVMT();
Expand Down
1 change: 1 addition & 0 deletions src/Hacks/hacks.h
Expand Up @@ -34,6 +34,7 @@
#include "snipercrosshair.h"
#include "spammer.h"
#include "thirdperson.h"
#include "tracereffect.h"
#include "triggerbot.h"
#include "autoknife.h"
#include "valvedscheck.h"
Expand Down
217 changes: 217 additions & 0 deletions src/Hacks/tracereffect.cpp
@@ -0,0 +1,217 @@
#include "tracereffect.h"

bool Settings::TracerEffects::enabled = false;
bool Settings::TracerEffects::serverSide = false;
TracerEffects_t Settings::TracerEffects::effect = TracerEffects_t::TASER;
int Settings::TracerEffects::frequency = 1;

struct tracerRecord
{
tracerRecord(void* addr, char *weapName, char *effName, int freq)
{
address = addr;
strncpy(weaponName, weapName, 32);
strncpy(effectName, effName, 32);
frequency = freq;
}
void* address;
char weaponName[32];
char effectName[32];
int frequency;
};

static bool wait = false;
static long waitUntil = 0; // Epoch in ms
static std::string lastGun;
/* Used for Restoring the Original Tracer Effect */
static std::vector<tracerRecord> tracerRecords;


static const char *tracerEffectNames[] = {
"weapon_tracers_assrifle", // 0
"weapon_tracers_pistol",
"weapon_tracers_smg",
"weapon_tracers_rifle",
"weapon_tracers_taser",
"weapon_tracers_mach",
"weapon_tracers_shot",
"weapon_tracers_taser_fallback",
"weapon_tracers_taser_fallback2",
"weapon_tracers_taser_wire1a",
"weapon_tracers_taser_wire2",
"weapon_tracers_taser_wire1b",
"weapon_tracers_original",
"weapon_tracers_backup",
"weapon_tracers_50cal",
"weapon_tracers_50cal_glow",
"weapon_tracers_50cal_low",
"weapon_tracers_50cal_low_glow", // 17
};

const std::map<std::string, short> drawTimes = {
{"weapon_cz75a", 1880},
{"weapon_mp9", 1330},
{"weapon_awp", 1900},
{"weapon_aug", 1285},
{"weapon_m249", 1180},
{"weapon_m4a1", 1170},
{"weapon_m4a1_silencer", 1170},
{"weapon_galilar", 1175},
{"weapon_bizon", 1150},
{"weapon_glock", 1150},
{"weapon_negev", 1130},
{"weapon_sawedoff", 1120},
{"weapon_elite", 1100},
{"weapon_ump45", 1085},
{"weapon_nova", 1070},
{"weapon_scar20", 1050},
{"weapon_g3sg1", 1050},
{"weapon_famas", 1050},
{"weapon_mp7", 1055},
{"weapon_fiveseven", 1050},
{"weapon_ak47", 1050},
{"weapon_mac10", 1030},
{"weapon_usp_silencer", 1030},
{"weapon_deagle", 1030},
{"weapon_ssg08", 1150},
{"weapon_xm1014", 1020},
{"weapon_hkp2000", 1020},
{"weapon_p250", 1050},
{"weapon_tec9", 1050},
{"weapon_sg556", 1025},
{"weapon_mag7", 1025},
};

void TracerEffect::RestoreTracers( )
{
if( tracerRecords.size() <= 0 )
return;
for( unsigned int i = 0; i < tracerRecords.size(); i++ )
{
CCSWeaponInfo *swag = (CCSWeaponInfo*)tracerRecords[i].address;
*swag->GetTracerFrequency() = tracerRecords[i].frequency;
strncpy(swag->GetTracerEffect(), tracerRecords[i].effectName, strlen(tracerRecords[i].effectName));
}
tracerRecords.clear();
}
void TracerEffect::CreateMove(CUserCmd* cmd) {
if ( !Settings::TracerEffects::enabled )
{
RestoreTracers();
return;
}

C_BasePlayer *localplayer = ( C_BasePlayer * )entityList->GetClientEntity( engine->GetLocalPlayer( ) );
if ( !engine->IsInGame( ) || !localplayer || !localplayer->GetAlive( ) )
return;
C_BaseCombatWeapon *localWeapon = ( C_BaseCombatWeapon * )entityList->GetClientEntityFromHandle( localplayer->GetActiveWeapon( ) );
if ( !localWeapon || localWeapon->GetInReload() )
return;

if ( localWeapon->GetNextPrimaryAttack() > globalVars->curtime )
return;
if ( !( cmd->buttons & IN_ATTACK ) )
{
/* On One-taps, it doesn't get to the taser part, so we need to switch back to the gun here */
if ( strcmp(localWeapon->GetCSWpnData()->GetConsoleName(), "weapon_taser") == 0 && Settings::TracerEffects::serverSide )
engine->ExecuteClientCmd("lastinv");
return;
}

if( wait )
{
if( Util::GetEpochTime() <= waitUntil )
{
cmd->buttons = cmd->buttons & ~IN_ATTACK;
return;
}

wait = false;
}

if( localWeapon->GetCSWpnData()->GetWeaponType() == CSWeaponType::WEAPONTYPE_MACHINEGUN ||
localWeapon->GetCSWpnData()->GetWeaponType() == CSWeaponType::WEAPONTYPE_PISTOL ||
localWeapon->GetCSWpnData()->GetWeaponType() == CSWeaponType::WEAPONTYPE_RIFLE ||
localWeapon->GetCSWpnData()->GetWeaponType() == CSWeaponType::WEAPONTYPE_SUBMACHINEGUN ||
localWeapon->GetCSWpnData()->GetWeaponType() == CSWeaponType::WEAPONTYPE_SHOTGUN ||
localWeapon->GetCSWpnData()->GetWeaponType() == CSWeaponType::WEAPONTYPE_SNIPER_RIFLE )
{
if( strcmp(lastGun.c_str(), localWeapon->GetCSWpnData()->GetConsoleName()) != 0 )
{
RestoreTracers();
}
/* Search for record by weaponName, add to tracerRecords struct if not already there. */
auto pred = [&](const tracerRecord & record) {
return (strcmp(record.weaponName, localWeapon->GetCSWpnData()->GetConsoleName()) == 0);
};
if( std::find_if(std::begin(tracerRecords), std::end(tracerRecords), pred) == std::end(tracerRecords) )
{
/* Add new weapon */
tracerRecords.push_back(tracerRecord((void*)localWeapon->GetCSWpnData(),
localWeapon->GetCSWpnData()->GetConsoleName(),
localWeapon->GetCSWpnData()->GetTracerEffect(),
*localWeapon->GetCSWpnData()->GetTracerFrequency()));
}

/* The Server-sided glitch normally doesn't show on the localClient. We ignore the user settings to show the taser glitch accurately */
if( Settings::TracerEffects::serverSide )
{
*localWeapon->GetCSWpnData()->GetTracerFrequency() = 1;
if( strlen(localWeapon->GetCSWpnData()->GetTracerEffect()) > strlen(tracerEffectNames[(int)TracerEffects_t::TASER]) )
{
strncpy(localWeapon->GetCSWpnData()->GetTracerEffect(),
tracerEffectNames[(int)TracerEffects_t::TASER],
strlen(localWeapon->GetCSWpnData()->GetTracerEffect()));
}
else
{ /* This could lead to some bad juju later, since we are making the string bigger */
strncpy(localWeapon->GetCSWpnData()->GetTracerEffect(),
tracerEffectNames[(int)TracerEffects_t::TASER],
strlen(tracerEffectNames[(int)TracerEffects_t::TASER]));
}
/* Gun is out, we need to Swap to taser and then quickly Fire to trigger the glitch
* The Glitch is that the server will use the tracer effect of your currently selected weapon
* Instead of the one you took the shot with */
lastGun = localWeapon->GetCSWpnData()->GetConsoleName();
engine->ClientCmd_Unrestricted("use weapon_taser;"); // needs to be unrestricted
cmd->buttons = cmd->buttons | IN_ATTACK;
wait = true;
waitUntil = Util::GetEpochTime() + 125;
}
else /* Just do some Client-Sided Effects for Fun based on the Settings */
{
*localWeapon->GetCSWpnData()->GetTracerFrequency() = Settings::TracerEffects::frequency;
if( strlen(localWeapon->GetCSWpnData()->GetTracerEffect()) > strlen(tracerEffectNames[(int)Settings::TracerEffects::effect]) )
{
strncpy(localWeapon->GetCSWpnData()->GetTracerEffect(),
tracerEffectNames[(int)Settings::TracerEffects::effect],
strlen(localWeapon->GetCSWpnData()->GetTracerEffect()));
}
else
{
strncpy(localWeapon->GetCSWpnData()->GetTracerEffect(),
tracerEffectNames[(int)Settings::TracerEffects::effect],
strlen(tracerEffectNames[(int)Settings::TracerEffects::effect]));
}
}
}
else if ( strcmp(localWeapon->GetCSWpnData()->GetConsoleName(), "weapon_taser") == 0 )
{
if( !Settings::TracerEffects::serverSide )
return;
/* Taser is out, we need to switch back to the gun and wait for it to be cocked */
if( drawTimes.find(lastGun) == drawTimes.end() )
{
cvar->ConsoleDPrintf("(TracerEffect::CreateMove): Warning: Gun \"%s\" not found in drawTimes map\n", localWeapon->GetCSWpnData()->GetConsoleName());
}
else
{
wait = true;
waitUntil = Util::GetEpochTime() + drawTimes.at(lastGun);
}

engine->ExecuteClientCmd("lastinv");
cmd->buttons = cmd->buttons & ~IN_ATTACK;

}
}
13 changes: 13 additions & 0 deletions src/Hacks/tracereffect.h
@@ -0,0 +1,13 @@
#pragma once

#include "../interfaces.h"
#include "../settings.h"
#include <map>
#include <string>
#include <vector>
namespace TracerEffect
{
void RestoreTracers();
//Hooks
void CreateMove(CUserCmd* cmd);
}
1 change: 1 addition & 0 deletions src/Hooks/CreateMove.cpp
Expand Up @@ -34,6 +34,7 @@ bool Hooks::CreateMove(void* thisptr, float flInputSampleTime, CUserCmd* cmd)
ESP::CreateMove(cmd);
Walkbot::CreateMove(cmd);
PredictionSystem::EndPrediction();
TracerEffect::CreateMove(cmd);

EdgeJump::PostPredictionCreateMove(cmd);

Expand Down
17 changes: 17 additions & 0 deletions src/SDK/IClientEntity.h
Expand Up @@ -536,6 +536,10 @@ class FileWeaponInfo_t
class CCSWeaponInfo : public FileWeaponInfo_t
{
public:
char* GetConsoleName()
{
return *(char**)((uintptr_t)this + 0x8);
}
CSWeaponType GetWeaponType()
{
return *(CSWeaponType*)((uintptr_t)this + 0x140);
Expand Down Expand Up @@ -568,6 +572,14 @@ class CCSWeaponInfo : public FileWeaponInfo_t
{
return *(int*)((uintptr_t)this + 0x240);
}
char* GetTracerEffect()
{
return *(char**)((uintptr_t)this + 0x278);
}
int* GetTracerFrequency()
{
return (int*)((uintptr_t)this + 0x280);
}
};

class C_BaseCombatWeapon: public C_BaseAttributableItem
Expand Down Expand Up @@ -598,6 +610,11 @@ class C_BaseCombatWeapon: public C_BaseAttributableItem
return *(float*)((uintptr_t)this + offsets.DT_WeaponCSBase.m_fAccuracyPenalty);
}

bool GetReloadVisuallyComplete()
{
return *(bool*)((uintptr_t)this + offsets.DT_WeaponCSBase.m_bReloadVisuallyComplete);
}

CCSWeaponInfo* GetCSWpnData()
{
typedef CCSWeaponInfo* (* oGetCSWpnData)(void*);
Expand Down

3 comments on commit 481e793

@LWSS
Copy link
Owner Author

@LWSS LWSS commented on 481e793 Aug 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

snot

snot2

Images of Snot mid-flight from my other pc

Someone get kisak a tissue!

@DankPaster
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AimTux is dead they said, No more updates they said, DETXED THEY SAID.

@gslandtreter
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I lol'd

Please sign in to comment.