Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*********************************************
- This is a very simple wallhack based on pat0's code. The difference here is the VMT hookens,
- which is written in the code below.
- This is also known to crash on level change :(
- *********************************************/
- ConVar metalslave_esp_enable("metalslave_esp_enable",0,0,"Displays information about other players");
- ConVar metalslave_wallhack_enable("metalslave_wallhack_enable","1",0,"Set to 1 to see various models through walls");
- UINT32 OrigFindMaterial = NULL;
- #define FINDMATERIAL_ORANGEBAWKS 70
- UINT32 thisptr;
- IMaterial * __stdcall FindMaterialOB( char const* pMaterialName, const char *pTextureGroupName, bool complain, const char *pComplainPrefix ) {
- __asm {
- mov thisptr, ecx
- };
- // fetch the real material
- IMaterial* realmat = NULL;
- int iComplain = (complain) ? 1 : 0;
- __asm {
- mov ecx, thisptr
- push pComplainPrefix
- push iComplain
- push pTextureGroupName
- push pMaterialName
- call OrigFindMaterial
- mov realmat, eax
- };
- if (metalslave_wallhack_enable.GetInt() ) {
- if (realmat) {
- if (
- strstr(pMaterialName,"models\\player") ||
- strstr(pMaterialName,"models\\items") ||
- strstr(pMaterialName,"models\\flag") ||
- strstr(pMaterialName,"models\\buildables") ||
- strstr(pMaterialName,"models\\weapons") ||
- strstr(pMaterialName,"particle") ||
- strstr(pMaterialName,"Particles")
- ) {
- Msg("*** Material %s haxed. (Texture group %s)\n",pMaterialName,pTextureGroupName);
- realmat->SetMaterialVarFlag( MATERIAL_VAR_IGNOREZ, true );
- realmat->SetMaterialVarFlag( MATERIAL_VAR_ZNEARER, true );
- realmat->AlphaModulate(255.0f);
- }
- //if (strstr(pTextureGroupName, "World")) {
- // realmat->SetMaterialVarFlag( MATERIAL_VAR_ALPHATEST, true );
- //}
- } else {
- Msg("Mat %s not found\n", pMaterialName);
- }
- }
- return realmat;
- }
- void DoMatSysHooks() {
- UINT32* matsystem_vtable_ptr;
- if (!materials) {
- Msg("Material system not hooked up yet!\n");
- return;
- }
- memcpy(&matsystem_vtable_ptr, (void*)((UINT32*)materialSystem), 4);
- OrigFindMaterial = matsystem_vtable_ptr[ FINDMATERIAL_ORANGEBAWKS ];
- UINT32* hookzed_vtable = new UINT32[700];
- UINT32 hookzed_vtable_ptr = (UINT32)hookzed_vtable;
- memcpy(hookzed_vtable,matsystem_vtable_ptr,700);
- *((UINT32*)materialSystem) = hookzed_vtable_ptr;
- // yawn
- hookzed_vtable[ FINDMATERIAL_ORANGEBAWKS ] = (UINT32)FindMaterialOB;
- }
Add Comment
Please, Sign In to add comment