All pastes #917772 Raw Edit

nghost

public text v1 · immutable
#917772 ·published 2008-02-25 17:42 UTC
rendered paste body
typedef void (*xcommand_t)( );
typedef struct sCommand
{
    sCommand * pNext;
    const char * szName;
    
    DWORD dwUnknown[2];

    xcommand_t function;

    //Better be safe than sorry, since the structure might be bigger
    DWORD dwIMightNotBeNeeded[10];
} tCommand;
int (*orig_Cmd_AddCommand)( const char * name, xcommand_t function );
int Cmd_AddCommand( const char * name, xcommand_t function )
{
	BOOL bSuccess = FALSE;
	tCommand *pCommand = NULL; //*

	bSuccess = Cmd_AddCommand( name, function );

	_asm mov esi, name
	_asm mov eax, 4F99F0h
	_asm call eax ;Cmd_AddCommand
	_asm mov bSuccess, eax

	if( bSuccess )
	{
		pCommand = new tCommand; 

		pCommand->pNext = *(tCommand**)0x14108BC;
		pCommand->szName = name;
		pCommand->function = function;
				
		*(tCommand**)0x14108BC = pCommand; //add the new command to the list

		return (int)pCommand; //Typecast
	}

	return NULL;
}

VOID AimOn_f( )
{
	if ( !Mom_Aim->value )
		Mom_Aim->value = 1;
}
VOID AimOff_f( )
{
	Mom_Aim->value = 0;
}

tCommand cmdTable[] =
{
	{ NULL,		"+aim",		0,	&AimOn_f,	0	},    //error C2440: 'initializing' : cannot convert from 'void (__cdecl *)(void)' to 'DWORD'
	{ NULL,		"-aim",		0,	&AimOff_f,	0	},    //error C2440: 'initializing' : cannot convert from 'void (__cdecl *)(void)' to 'DWORD'
	{ NULL,		NULL,		0,	NULL,		0	}
};