0

im trying to add i think you call a random string picker heres what i have added it too

#include "stdafx.h"

refimport_t *		ri					= (refimport_t *)	NULL;
refexport_t *		re					= (refexport_t *)	NULL;
refimport_t *		o_ri				= (refimport_t *)	NULL;
refexport_t *		o_re				= (refexport_t *)	0x0068A1E8;

cg_t *				cg					= (cg_t *)			0x01379000;
centity_t *			cg_entities			= (centity_t *)		0x0146DA00;
clientInfo_t *		clientinfo			= (clientInfo_t *)	0x0145A914;
float *				viewangles			= (float *)			0x008E4824;
short *				delta_angles		= (short *)			0x0096B6D8;
int *				ping				= (int *)			0x0096B67C;
int *				keycatchers			= (int *)			0x0096B654;


const t_va						va						= (t_va)					0x0044A990;
const t_Com_Milliseconds		Com_Milliseconds		= (t_Com_Milliseconds)		0x00467F30;
const t_Con_Close				Con_Close				= (t_Con_Close)				0x004073B0;
const t_DrawStringExt			DrawStringExt			= (t_DrawStringExt)			0x005322C0;
const t_CG_Trace				CG_Trace				= (t_CG_Trace)				0x004D8170;
const t_CM_BoxTrace				CM_BoxTrace				= (t_CM_BoxTrace)			0x0041D120;
const t_CG_ClipMoveToEntities	CG_ClipMoveToEntities	= (t_CG_ClipMoveToEntities)	0x004DE2A0;
const t_CG_PointContents		CG_PointContents		= (t_CG_PointContents)		0x004DE730;

t_CG_FireRecoil					o_CG_FireRecoil			= (t_CG_FireRecoil)			NULL;
t_CG_Obituary					o_CG_Obituary			= (t_CG_Obituary)			NULL;
t_CG_Player						o_CG_Player				= (t_CG_Player)				NULL;
//t_CG_ResetPlayerEntity			o_CG_ResetPlayerEntity	= (t_CG_ResetPlayerEntity)	NULL;

const xcommand_t				StartAttack				= (xcommand_t)				0x00407180;
const xcommand_t				StopAttack				= (xcommand_t)				0x004071A0;
const xcommand_t				ToggleCrouch			= (xcommand_t)				0x00408040;
const xcommand_t				ToggleProne				= (xcommand_t)				0x00408070;

float	fZoomFactor		= 1.0f;

centity_t * drawingPlayer = NULL;
void RE_EndFrame( )
{
	if( cg->snap )
	{
		pBot->DrawESP( ( toi( dv_nameesp->value ) == 1 ), 
					   ( toi( dv_distanceesp->value ) == 1 ), 
					   ( toi( dv_lineesp->value ) == 1 ),
					   ( toi( dv_boxesp->value ) == 1 ) );

		if( toi( dv_radar->value ) == 1 )
		{
			pBot->DrawRadar( 
				tovec( dv_radar_rect->value )[0],
				tovec( dv_radar_rect->value )[1], 
				tovec( dv_radar_rect->value )[2],
				tovec( dv_radar_rect->value )[3],
				tof( dv_radar_range->value ), 
				tovec( dv_radar_prim->value ), 
				tovec( dv_radar_sec->value ), 
				tovec( dv_radar_ally->value ),
				tovec( dv_radar_enemy->value )
			);
		}

		if( clientinfo[ cg->clientNum ].team < TEAM_SPECTATOR && cg->clientNum == cg->snap->ps.clientNum )
		{
			if( toi( dv_aimbot->value ) == 1 )
			{
				int iAimKeyCode = Dvar_GetKeyCode( dv_aim_key );
				if( iAimKeyCode == 0 || ( iAimKeyCode && ( GetAsyncKeyState( iAimKeyCode ) & 0x8000 ) ) )
				{
					if( pBot->Aim( ) )
					{
						if( toi( dv_autoshoot->value ) == 1 )
							pBot->Autoshoot( clientinfo[ cg->clientNum ].curWeapon, true );
						if( toi( dv_autosight->value ) == 1 )
							pBot->Autosight( true );
					}
					else
					{
						if( toi( dv_autoshoot->value ) == 1 )
							pBot->Autoshoot( clientinfo[ cg->clientNum ].curWeapon, false );
						if( toi( dv_autosight->value ) == 1 )
							pBot->Autosight( false );
					}
				}
			}
			else if( toi( dv_aimbot->value ) == 2 )
			{
				int iHAKeyCode = Dvar_GetKeyCode( dv_ha_key );
				if( iHAKeyCode == 0 || ( iHAKeyCode && ( GetAsyncKeyState( iHAKeyCode ) & 0x8000 ) ) )
				{
					int iAimed = pBot->HumanAim( tof( dv_ha_fov_x->value ),
												 tof( dv_ha_fov_y->value ),
												 tof( dv_ha_div->value ),
												 tof( dv_ha_freq->value ),
												 tof( dv_ha_amp->value ) );

					if( iAimed == 2 )
					{
						if( toi( dv_autoshoot->value ) == 1 )
							pBot->Autoshoot( clientinfo[ cg->clientNum ].curWeapon, true );
					}
					else if( iAimed == 1 )
					{
						if( toi( dv_autosight->value ) == 1 )
							pBot->Autosight( true );
					}
					else if( iAimed == 0 )
					{
						if( toi( dv_autoshoot->value ) == 1 )
							pBot->Autoshoot( clientinfo[ cg->clientNum ].curWeapon, false );
						if( toi( dv_autosight->value ) == 1 )
							pBot->Autosight( false );
					}
				}
			}
			else
			{
				clientInfo_t * ci = AimingAtClient( );
					
				if( ci && ci->team < TEAM_SPECTATOR && ( ci->team == TEAM_FREE || ci->team != clientinfo[ cg->clientNum ].team ) )
				{
					pBot->DrawTargetInfo( ci );
					
					if( toi( dv_autoshoot->value ) == 1 )
						pBot->Autoshoot( clientinfo[ cg->clientNum ].curWeapon, true );
					if( toi( dv_autosight->value ) == 1 )
						pBot->Autosight( true );
				}
				else
				{
					if( toi( dv_autoshoot->value ) == 1 )
						pBot->Autoshoot( 0, false );
					if( toi( dv_autosight->value ) == 1 )
						pBot->Autosight( false );
				}
			}
		}

		pBot->ClearTargets( );
	}

	re->EndFrame( );
}

void RE_RenderScene( refdef_t * fd )
{
	centity_t *		cent;
	clientInfo_t *	ci;
	UINT			i;

	ScreenW = (float)fd->width;
	ScreenH = (float)fd->height;

	fd->fov_x *= fZoomFactor;
	fd->fov_y *= fZoomFactor;

	for( i = 0; i < MAX_CLIENTS; i++ )
	{
		cent = &cg_entities[ i ];
		ci = &clientinfo[ cent->currentState.clientNum ];

		if(	cent->currentValid == qtrue &&
			cent->currentState.eType == ET_PLAYER && 
			!( cent->currentState.eFlags & 1 ) &&
			//!pBot->InvalidPlayer( cent->currentState.number ) &&
			ci->infoValid == qtrue &&
			ci->team < TEAM_SPECTATOR && 
			ci->clientNum != cg->snap->ps.clientNum  )
		{
			pBot->AddTarget( cent, tof( dv_prediction->value ), toi( dv_aim_priority->value ) );
		}
	}
	
	re->RenderScene( fd );
}

int RE_AddRefEntityToScene( refEntity_t * ent, shaderInfo_t * si, centity_t * cent )
{
				
	ent->renderfx |= RF_DEPTHHACK | RF_NOSHADOW;


	int iRet = re->AddRefEntityToScene( ent, si, cent );

	return iRet;
}

void RE_BeginRegistration( gfxconfig_t * gfxConfig )
{
	re->BeginRegistration( gfxConfig );

	ProcessDvars( );
	ProcessCommands( );

	/* Register Shaders */
	sWhite			= re->RegisterShader( "white",				3, 7 );
	sBlack			= re->RegisterShader( "black",				3, 7 );

	/* Register Fonts */
	consoleFont		= re->RegisterFont( "fonts/consoleFont",	3 );
	normalFont		= re->RegisterFont( "fonts/normalFont",		3 );
	smallFont		= re->RegisterFont( "fonts/smallFont",		3 );
	bigFont			= re->RegisterFont( "fonts/bigFont",		3 );
	extraBigFont	= re->RegisterFont( "fonts/extraBigFont",	3 );
	boldFont		= re->RegisterFont( "fonts/boldFont",		3 );

	pBot			= new CBot( 2 );
}

void RE_Shutdown( )
{
	delete pBot;

	re->Shutdown( );
}

__declspec( naked ) void h_CG_FireRecoil( )
{
	__asm
	{
		push dv_norecoil
		call _Dvar_GetInt //stdcall

		test eax, eax
		jz fire_recoil

		retn

fire_recoil:
		jmp dword ptr [o_CG_FireRecoil]
	}
}
DWORD WINAPI playSound(LPVOID iValue) //PlaySond function
{
    PlaySound(NULL, NULL, SND_ASYNC);
    PlaySound((char*)iValue, NULL, SND_APPLICATION | SND_FILENAME | SND_ASYNC);
    return 0;
}
void h_CG_Obituary( )
{
	entityState_t *	ent			= NULL;
	__asm mov ent, eax

	int				iTarget		= ent->otherEntityNum;
	int				iAttacker	= ent->otherEntityNum2;
	int				iMod		= ent->eventParm;
	clientInfo_t *	ciTarget	= NULL;
	clientInfo_t *	ciAttacker	= NULL;

	if( iTarget >= 0 && iTarget < MAX_CLIENTS )
	{
		ciTarget = &clientinfo[ iTarget ];

		// entity is dead
		cg_entities[ iTarget ].currentState.eFlags &= 1;
		//pBot->SetInvalidPlayer( iTarget );
		
		if( iAttacker >= 0 && iAttacker < MAX_CLIENTS )
			ciAttacker = &clientinfo[ iAttacker ];
		else
			iAttacker = ENTITYNUM_WORLD;

		if( ciAttacker && ciAttacker->clientNum == cg->clientNum )
		{
			if( ciTarget->clientNum == cg->clientNum )
				pBot->Stats.Suicides++;
		}
			else
			{
				if( ( iMod & 0xFFFFFF7F ) == 7 )
				{
					pBot->Stats.TotalKills	++;
					pBot->Stats.Bashes		++;
				}
				else if( ( iMod & 0xFFFFFF7F ) == 8 )
				{
					pBot->Stats.TotalKills	++;
					pBot->Stats.Headshots	++;
				}
				int val = GenerateRandomValue(0,2);
					if(toi ( dv_killsounds->value ) )
                switch(val)
                {
                     case 0:
                                CreateThread(NULL, 0, playSound, headhunter, 0, 0);
                     case 1:
                                CreateThread(NULL, 0, playSound, hshot, 0, 0);
					 case 2:
                                CreateThread(NULL, 0, playSound, hshot, 0, 0);
                }
				else
				{
					pBot->Stats.TotalKills	++;
				}
			}
		}
		else if( ciTarget->clientNum == cg->clientNum )
			pBot->Stats.Deaths++;
	__asm mov eax, ent
	o_CG_Obituary( );
}

void h_CG_Player( )
{
	__asm mov drawingPlayer, eax

	o_CG_Player( );

	__asm xor eax, eax
	__asm mov drawingPlayer, eax
}

this is what i have added in to it to pick randomly

int val = GenerateRandomValue(0,2);
					if(toi ( dv_killsounds->value ) )
                switch(val)
                {
                     case 0:
                                CreateThread(NULL, 0, playSound, headhunter, 0, 0);
                     case 1:
                                CreateThread(NULL, 0, playSound, hshot, 0, 0);
		     case 2:
                                CreateThread(NULL, 0, playSound, hshot, 0, 0);
                }

it i get a error when i try to compile ''C3861: 'GenerateRandomValue': identifier not found''
i cant seem to figure this one out

help
im more of a vb.net guy

Edited by B1GGS: n/a

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by tetron
0

caveat: This code is doing lots of things that look messy. Especially for the error that you are unfamiliar.

Your error means that you need the .h file or at the top with somting like

int GenerateRandomValue(int v1, int v2);

You will also need the definition of the function at someplace too.

Your error basically means that you are using a function that has not been defined. Becuase it is a compiler error rather than
a linker error this means that the computer does not know the signature of the function.


it i get a error when i try to compile ''C3861: 'GenerateRandomValue': identifier not found''
i cant seem to figure this one out

help
im more of a vb.net guy

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.