[QL] Model indexes

mowl

Coders
Model indexes can be used to filter out models rendered in RE_AddRefEntityToScene or anywhere else.

Code:
int* modelIndex = (int*)( ( DWORD ) dllHandles.hQuakeLive + 0x657160 + 0xA8 );

Model index is in centity_t at 0xA8.
Here are some indexes I use:

Code:
#define INDEX_ROCKET 13
#define INDEX_ROCKET_AMMO 24
#define INDEX_YELLOW_HEALTH 6
#define INDEX_SHOTGUN_AMMO 19
#define INDEX_GRENADE_AMMO 21
#define INDEX_LIGHTNING_AMMO 23
#define INDEX_PLASMA_AMMO 22
#define INDEX_RAILGUN_AMMO 25
#define INDEX_QUAD 29
#define INDEX_SHOTGUN 10
#define INDEX_FLAGCTF_BLUE 36
#define INDEX_FLAGCTF_RED 35
#define INDEX_FLAGSTATION_RED 1
#define INDEX_FLAGSTATION_BLUE	 2
#define INDEX_GREEN_HEALTH 5
#define INDEX_YELLOW_ARMOR 2
#define INDEX_RED_ARMOR 3

Code:
for (int i = 0 ; i < MAX_ENTITIES ; i++ ) {
	if ( modelIndex[ i ] == INDEX_ROCKET ) {
		int x, y;

		if ( 3DTo2DCoords( items[i].origin , &x, &y ) ) {
			CG_DrawText(x, y, 0.15, "Rocket launcher");
		}
	}
}

Hint: The very first beginning of an ItemTimer is shown here :)

Kind regards,
mOwl
 

AdilAA

New member
Hello, nice posts you have, i have a question, how do i hook the function, i want to start simple with chams, but i got to hook AddRefEntityToScene, i got some code from the net, this is what i have

Code:
#include <windows.h> 
#pragma comment(lib, "Detours/detours.lib") 
#include <detours.h>
#include <d3d9.h>

hooks.RE_AddRefEntityToScene = (RE_AddRefEntityToScene) hooks.o_syscall[ 0x44 ]
hooks.UI_Argv = (UI_Argv_t) hooks.o_syscall[ 0xC ];

const char *trap_UI_Argv(int arg) {
	static char buffer[1024];
	hooks.UI_Argv( arg, buffer, sizeof( buffer ) );
	return buffer;
}
void WhatEver()
{
 if (!strcmp(get_UI_Argv(1), "chams"))
	{
		if (hooks.o_UI_Argc() == 2)
		{
			hooks.o_Cmd_WriteConsole("^3QLH: ^7Cham types: off, white, glass, quad, crystal\n");
			hooks.o_Cmd_WriteConsole("^3QLH: ^7renderplayer [on/off]\n");
			return;
		}

		#define CHAMTYPE(cham) !strcmp(get_UI_Argv(2), cham)

		if (CHAMTYPE("off"))
			media.chamType = -1;

		if (CHAMTYPE("white"))
			media.chamType = media.white;

		if (CHAMTYPE("quad"))
			media.chamType = media.quadShader;

		if (CHAMTYPE("mimiccrystal"))
			media.chamType = 41;

		if (CHAMTYPE("red"))
			media.chamType = 11;

		if (CHAMTYPE("yellow"))
			media.chamType = 12;

		if (CHAMTYPE("green"))
			media.chamType = 13;

		if (CHAMTYPE("skyblue"))
			media.chamType = 14;

		if (CHAMTYPE("darkblue"))
			media.chamType = 15;

		if (CHAMTYPE("violet"))
			media.chamType = 16;

		if (CHAMTYPE("crystal"))
			media.chamType = 100;

		if (CHAMTYPE("visiblemode"))
			media.chamType = -2;

		if (CHAMTYPE("renderplayer"))
		{
		
			if (!strcmp(get_UI_Argv(3), "on"))
				settings.renderplayer = true;
			
			if (!strcmp(get_UI_Argv(3), "off"))
				settings.renderplayer = false;

		}
	}
}

void CHooks::h_RE_AddRefEntityToScene(refEntity_t* re)
{
	if (re->frame)
	{
		// Valid frame
		if (settings.renderplayer)
			hooks.o_RE_AddRefEntityToScene(re);

		if (media.chamType != -1 && media.chamType != -2)
			re->customShader = media.chamType;

		if (settings.wallhack)
			re->renderfx |= RF_DEPTHHACK;
	}

	hooks.o_RE_AddRefEntityToScene(re);
}

but most of it is underlined in red
 

mowl

Coders
AdilAA said:
I told you before to credit code you find from the internet. That piece of code is made by me, like the addresses you posted there...
If you don't know how to hook functions, you should go back to the basics.

When looking at your code, you clearly lack the needed skills.
Read a book about C++, and don't simply copy paste and except it to work.
The code I provide is ment for people who are a little further then the basics and who can implement it in their hook.
 

mowl

Coders
i found this on some random blog site, i didnt credit because i forgot the link

mowhook.wordpress.com is/was my blog. It is inactive.
And if you copy code and you can't remember who originally wrote it, what gives you the right to release it as your own.

Edit 1
AdilAA on mowhook.wordpress.com said:
Hello, I looked at this code, it seems quite good, but how do i apply it to my Quake Live? i dont know if you put it in a hudfile cfg or what, please let me know, thanks
Pretty much says enough, I'm going to say this in a more friendly way. Most people have the feeling to call themselves coders after watching a few public source codes. That is not how it should be.
As I previously mentionned, read a book about C++. Don't start with gamehacking but learn to manage the language in the first place. After on move to reverse engineering with IDAPro or ollyDBG (I will only mention these two) and take a look how to detour. I can say this is pretty much enough said.

Edit 2
Blog closed. I don't have a rude personality, I just like to say it straight forward.
If you really want a QuakeLive hack, be patient for wLQL.
http://www.whitelight.me.uk/forums/showthread.php?tid=43&pid=366#pid366
 
Top