示例#1
0
void cheat_handle_checkpoint ( void )
{
	if ( KEY_PRESSED(set.key_checkpoint_1) || KEY_PRESSED(set.key_checkpoint_2) )
	{
		int					n = KEY_PRESSED( set.key_checkpoint_1 ) ? 0 : 1;
		struct checkpoint	*cp = gta_checkpoint_info_get( n );
		float				pos[3];

		if ( cp != NULL )
		{
			struct vehicle_info *vehicle_info = vehicle_info_get( VEHICLE_SELF, 0 );

			vect3_copy( cp->position, pos );
			pos[2] += 1.0f;
			cheat_teleport( pos, 0 );		/* XXX interior id? */

			if ( vehicle_info != NULL )
				vehicle_prevent_below_height( vehicle_info, set.checkpoint_min_height );
		}
		else
		{
			cheat_state_text( "Checkpoint does not exist." );
		}
	}
}
示例#2
0
void cheat_cpmaster()
{
	if (cheat_state->_generic.cpm)
	{
		float checkPos[3] = { 0, 0, 0 };
		float playerPos[3] = { pPedSelf->GetPosition()->fX, pPedSelf->GetPosition()->fY, pPedSelf->GetPosition()->fZ };
		static int iTime = 0;
		if ((int)GetTickCount() - iTime > set.coord_time)
		{
			if (g_SAMPMisc->iRaceCheckpointEnabled)
			{
				vect3_copy(g_SAMPMisc->vecRaceCheckpointPos, checkPos);
				checkPos[2] += set.cpm_offset;
				float lenX = checkPos[0] - playerPos[0];
				float lenY = checkPos[1] - playerPos[1];
				float lenXY = sqrt(pow(lenX, 2) + pow(lenY, 2));
				float sinA = lenX / lenXY, cosA = lenY / lenXY;
				if (vect3_dist(checkPos, playerPos) > set.coord_dist)
				{
					playerPos[0] += sinA * set.coord_dist;
					playerPos[1] += cosA * set.coord_dist;
					playerPos[2] = checkPos[2] - 40.0f;
				}
				else
					vect3_copy(checkPos, playerPos);
				cheat_teleport(playerPos, 0);
			}
			iTime = GetTickCount();
		}
		struct vehicle_info *info = vehicle_info_get(-1, 0x01);
		if (info != NULL)
			vehicleUnflip(info);
	}
}
示例#3
0
void cheat_takecarbyid()
{
	if (cheat_state->_generic.getauto)
	{
		for (int i = 0; i < SAMP_MAX_VEHICLES; i++)
		{
			if (g_Vehicles->iIsListed[i] == NULL)
				continue;
			if (g_Vehicles->pSAMP_Vehicle[i] == NULL)
				continue;
			if (g_Vehicles->pSAMP_Vehicle[i]->pGTA_Vehicle == NULL)
				continue;

			int car_id = (int)(((DWORD)g_Vehicles->pGTA_Vehicle[i]) - (DWORD)pool_vehicle->start) / 2584;
			struct vehicle_info *vinfo = vehicle_info_get(car_id, 0);

			int iSAMPVehicleID = getSAMPVehicleIDFromGTAVehicle(vinfo);
			if (iSAMPVehicleID == g_Players->pLocalPlayer->sCurrentVehicleID) continue;

			if (!g_Vehicles->pSAMP_Vehicle[i]->iIsLocked)
			{
				if (g_Vehicles->pGTA_Vehicle[i]->base.model_alt_id == set.find_id)
				{
					g_RakClient->SendEnterPlayerVehicle(i, 0);
					GTAfunc_PutActorInCar(vinfo);
					cheat_state->_generic.getauto = 0;
					break;
				}
			}
		}
	}
}
示例#4
0
void cheat_coordmaster()
{
	if (!cheat_state->_generic.coordmaster)
		return;

	if(vehicle_info *info = vehicle_info_get(-1, 1))
		vehicleUnflip(info);

	static DWORD dwCount = 0;

	if (GetTickCount() < dwCount)
		return;

	float fPosition[3] = {
		pPedSelf->GetPosition()->fX,
		pPedSelf->GetPosition()->fY,
		pPedSelf->GetPosition()->fZ
	};

	float fDist = vect3_dist(fPosition, set.coord_target);

	if (fDist > set.coord_dist)
	{
		float fDistXY = vect2_dist(fPosition, set.coord_target);
		float fDistSin = (set.coord_target[0] - fPosition[0]) / fDistXY;
		float fDistCos = (set.coord_target[1] - fPosition[1]) / fDistXY;

		fPosition[0] += fDistSin * set.coord_dist;
		fPosition[1] += fDistCos * set.coord_dist;
		if (set.coord_height != fPosition[2])
		{
			if (set.coord_height - fPosition[2] > set.coord_dist * 0.5f)
			{
				float fK = set.coord_height > fPosition[2] ? 0.5f : -0.5f;
				fPosition[2] += set.coord_dist * fK;
			}
			else
				fPosition[2] = set.coord_height;
		}
		else if (fDistXY < set.coord_dist)
		{
			float fK = set.coord_target[2] > fPosition[2] ? 0.5f : -0.5f;
			fPosition[2] += set.coord_dist * fK;
		}
	}
	else
	{
		vect3_copy(set.coord_target, fPosition);
		Log("[RAKBOT] Вы достигли места назначения!");
		cheat_state->_generic.coordmaster = 0;
	}

	cheat_teleport(fPosition, gta_interior_id_get());

	GTAfunc_LockActor(cheat_state->_generic.coordmaster ? 1 : 0);
	dwCount = GetTickCount() + set.coord_time;
}
示例#5
0
void cheat_teleport_nearest_car ( void )
{
	int					id = vehicle_find_nearest( VEHICLE_ALIVE | VEHICLE_EMPTY );
	struct vehicle_info *info = vehicle_info_get( id, VEHICLE_ALIVE | VEHICLE_EMPTY );

	if ( id == -1 || info == NULL )
		return;

	cheat_teleport( &info->base.matrix[4 * 3], info->base.interior_id );
}
示例#6
0
void cheat_colpuls()
{
	if (cheat_state->_generic.carcolpuls && cheat_state->state == CHEAT_STATE_VEHICLE)
	{
		struct vehicle_info *vinfo = vehicle_info_get(-1, 0x01);
		if (vinfo == NULL)
			return;
		vehicle_setColor0(vinfo, rand() % 255);
		vehicle_setColor1(vinfo, rand() % 255);
	}
}
示例#7
0
void cheat_handle_unlock ( void )
{
	struct vehicle_info *info;
	int					i;

	if ( cheat_state->_generic.vehicles_unlock )
	{
		for ( i = 0; i < pool_vehicle->size; i++ )
		{
			info = vehicle_info_get( i, 0 );
			if ( info != NULL )
				info->door_status = 1;			/* unlocked */
		}
	}
}
示例#8
0
void cheat_teleport ( const float pos[3], int interior_id )
{
	if ( cheat_state->state == CHEAT_STATE_ACTOR
		|| GTAfunc_RemoveActorFromCarAndPutAt_requestingTeleport )
	{
		GTAfunc_RemoveActorFromCarAndPutAt_requestingTeleport = false;
		cheat_actor_teleport( actor_info_get(ACTOR_SELF, 0), pos, interior_id );
	}
	else if ( cheat_state->state == CHEAT_STATE_VEHICLE ) //&& !set.teleport_slow )
		cheat_vehicle_teleport( vehicle_info_get(VEHICLE_SELF, 0), pos, interior_id );
	/*else if ( cheat_state->state == CHEAT_STATE_VEHICLE && set.teleport_slow )
	{
		vect3_copy(pos, cheat_state->vehicle.tele_coords);
		cheat_state->vehicle.tele_on = 1;
	}*/
}
示例#9
0
static void cheat_main_vehicle ( double time_diff )
{
	traceLastFunc( "cheat_main_vehicle()" );

	struct vehicle_info *info = vehicle_info_get( VEHICLE_SELF, 0 );
	if ( info == NULL )
		return;

	cheat_handle_antiHijack( NULL, info, time_diff );

	// copy vehicle coords to cheat_state storage
	vect3_copy( &info->base.matrix[4 * 3], cheat_state->vehicle.coords );

	// the following functions can be found in cheat_generic.cpp
	cheat_handle_unfreeze( info, NULL, time_diff );
	cheat_handle_teleport( info, NULL, time_diff );
	cheat_handle_stick( info, NULL, time_diff );
	cheat_handle_freeze_vehicles( info, NULL );
	cheat_handle_hp( info, NULL, time_diff );
	cheat_handle_emo( info, NULL, time_diff );

	// the following functions can be found in cheat_vehicle.cpp
	cheat_handle_vehicle_protection( info, time_diff );
	cheat_handle_vehicle_unflip( info, time_diff );
	cheat_handle_vehicle_nitro( info, time_diff );
	cheat_handle_vehicle_air_brake( info, time_diff );
	cheat_handle_vehicle_warp( info, time_diff );
	cheat_handle_vehicle_quick_turn( info, time_diff );
	cheat_handle_vehicle_brake( info, time_diff );
	cheat_handle_vehicle_hop( info, time_diff );
	cheat_handle_vehicle_engine( info, time_diff );
	cheat_handle_vehicle_brakedance( info, time_diff );
	cheat_handle_vehicle_blinking_carlights( info, time_diff );
	cheat_handle_vehicle_fly( info, time_diff );
	cheat_handle_vehicle_keepTrailer( info, time_diff );
	cheat_handle_vehicle_repair_car( info, time_diff );
	cheat_handle_vehicle_spiderWheels( info, time_diff );
	//cheat_handle_vehicle_slowTeleport( info, time_diff );
#ifdef __CHEAT_VEHRECORDING_H__
	cheat_handle_vehicle_recording( info, time_diff );
#endif

	// these NEED to stay last, because they can remove the player from the vehicle
	cheat_handle_vehicle_fast_exit( info, time_diff );
	cheat_handle_exit_vehicle ( info, NULL );
}
示例#10
0
void cheat_handle_freeze_vehicles ( struct vehicle_info *vehicle_info, struct actor_info *actor_info )
{
	traceLastFunc( "cheat_handle_freeze_vehicles()" );

	static struct freeze_info	*freeze;
	struct vehicle_info			*info;
	float						*pos;
	int							i;

	if ( KEY_PRESSED(set.key_vehicles_freeze) )
	{
		cheat_state->_generic.vehicles_freeze ^= 1;
		if ( !cheat_state->_generic.vehicles_freeze && freeze != NULL )
			memset( freeze, 0, pool_vehicle->size * sizeof(struct freeze_info) );
	}

	if ( vehicle_info != NULL )
		pos = &vehicle_info->base.matrix[4 * 3];
	else if ( actor_info != NULL )
		pos = &actor_info->base.matrix[4 * 3];
	else
		return;

	if ( freeze == NULL )	/* XXX free on exit */
	{
		freeze = (struct freeze_info *)malloc( pool_vehicle->size * sizeof(struct freeze_info) );
		if ( freeze == NULL )
			return;
		memset( freeze, 0, pool_vehicle->size * sizeof(struct freeze_info) );
	}

	if ( cheat_state->_generic.vehicles_freeze )
	{
		for ( i = 0; i < pool_vehicle->size; i++ )
		{
			if ( (info = vehicle_info_get(i, VEHICLE_ALIVE)) == NULL || info == vehicle_info )
			{
				if ( info == vehicle_info && freeze[i].set )
					cheat_vehicle_air_brake_set( 1 );	/* entered a frozen vehicle */
				freeze[i].set = 0;
				continue;
			}

			if ( freeze[i].set )
			{
				matrix_copy( freeze[i].matrix, info->base.matrix );
				vect3_mult( info->speed, 0.0f, info->speed );
				vect3_mult( info->spin, 0.0f, info->spin );
			}

			if ( vehicle_contains_trailer(vehicle_info, info) )
			{
				freeze[i].set = 0;
				continue;
			}

			if ( vect3_dist(pos, &info->base.matrix[4 * 3]) >= 80.0f )
			{
				freeze[i].set = 0;
				continue;
			}

			if ( freeze[i].set )
			{
				continue;
			}

			matrix_copy( info->base.matrix, freeze[i].matrix );
			freeze[i].set = 1;
		}
	}
}
示例#11
0
void cheat_hook ( HWND wnd )
{
	traceLastFunc( "cheat_hook()" );

	// get the time
	static uint64_t time_last;
	__time_current = __time_get();
	g_timeDiff = TIME_TO_DOUBLE(time_get() - time_last);

	// for looping
	int i;

	// install keyhook
	keyhook_maybe_install( wnd );

	// setup menu
	menu_maybe_init();
	traceLastFunc( "cheat_hook()" );

	/* initialize state */
	if ( cheat_state == NULL )
	{
		// set default cheat_state variables
		cheat_state = &__cheat_state;
		cheat_state->_generic.spoof_weapon = -1;
		cheat_state->_generic.money = set.money_enabled;
		cheat_state->_generic.weapon = set.weapon_enabled;
		cheat_state->_generic.vehicles_unlock = false;
		cheat_state->_generic.vehicles_warp_invert = true;
		cheat_state->actor.invulnerable = true;
		cheat_state->vehicle.invulnerable = true;
		cheat_state->vehicle.hp_tire_support = true;
		cheat_state->vehicle.hp_minimum_on = 1;
		cheat_state->vehicle.hp_regen_on = 1;
		cheat_state->actor.hp_regen_on = 1;
		cheat_state->vehicle.brkdance = 0;
		cheat_state->game_speed = 1.0f;
		cheat_state->vehicle.is_engine_on = 1;
		cheat_state->_generic.interior_patch_enabled = 0;

		// refreshes any cheat_state stuff set from the INI
		ini_load_setSettings();

		/* install patches from the .ini file */
		for ( i = 0; i < INI_PATCHES_MAX; i++ )
		{
			if ( set.patch[i].name != NULL && set.patch[i].ini_auto )
				patcher_install( &set.patch[i] );
		}

		if ( g_dwSAMP_Addr != NULL )
		{
			for ( i = 0; i < INI_SAMPPATCHES_MAX; i++ )
			{
				if ( set.sampPatch[i].name != NULL && set.sampPatch[i].ini_auto )
					patcher_install( &set.sampPatch[i] );
			}
		}
	}	/* end initialize state */

	// set cheat state to "off"
	cheat_state->state = CHEAT_STATE_NONE;

	/* setup & refresh actor pool */
	pool_actor = *(struct pool **)ACTOR_POOL_POINTER;
	if ( pool_actor == NULL || pool_actor->start == NULL || pool_actor->size <= 0 )
		return;

	/* setup & refresh vehicle pool */
	pool_vehicle = *(struct pool **)VEHICLE_POOL_POINTER;
	if ( pool_vehicle == NULL || pool_vehicle->start == NULL || pool_vehicle->size <= 0 )
		return;

	//////////////////////////////////////////
	// looks like we have pools so continue //
	struct actor_info	*actor_info;
	struct vehicle_info *vehicle_info;
	actor_info = actor_info_get( ACTOR_SELF, ACTOR_ALIVE );
	vehicle_info = vehicle_info_get( VEHICLE_SELF, 0 );

	/* no vehicle, and no actor. exit. */
	if ( vehicle_info == NULL && actor_info == NULL )
	{
		if ( cheat_state->actor.air_brake
		 ||	 cheat_state->actor.stick
		 ||	 cheat_state->vehicle.air_brake
		 ||	 cheat_state->vehicle.stick )
		{
			cheat_state->actor.air_brake = 0;
			cheat_vehicle_air_brake_set( 0 );
			cheat_state->actor.stick = 0;
			cheat_state->vehicle.stick = 0;
			cheat_state_text( "Air brake / stick disabled" );
		}
	}
	else
	{
		if ( vehicle_info == NULL )
		{
			if ( cheat_state->vehicle.air_brake || cheat_state->vehicle.stick )
			{
				cheat_vehicle_air_brake_set( 0 );
				cheat_state->vehicle.stick = 0;
				cheat_state_text( "Air brake / stick disabled" );
			}

			cheat_state->state = CHEAT_STATE_ACTOR;

			// reset infinite NOS toggle state
			if ( cheat_state->vehicle.infNOS_toggle_on )
			{
				cheat_state->vehicle.infNOS_toggle_on = false;
				patcher_remove( &patch_vehicle_inf_NOS );
			}
		}
		else
		{
			if ( cheat_state->actor.air_brake || cheat_state->actor.stick )
			{
				cheat_state->actor.air_brake = 0;
				cheat_state->actor.stick = 0;
				cheat_state_text( "Air brake / stick disabled" );
			}

			cheat_state->state = CHEAT_STATE_VEHICLE;
		}

		// post GTA initialization initizalization routines
		if ( m_InitStages == 0 )
		{
			// setup CGame & friends
			pGameInterface = new CGameSA();
			pPools = pGameInterface->GetPools();

			//pGameInterface->Initialize(); // all this does so far is disable modshops and pay&sprays
			// this seems to fix SAMP's load hang bug
			//pGameInterface->StartGame();

			// we have to add ourself to the pool first so that we are always the 1st ref
			// NEW --> use the global external: pPedSelf
			pPedSelf = pGameInterface->GetPools()->AddPed( (DWORD *)actor_info );
			pPedSelfSA = pPedSelf->GetPedInterface();

			// install all startup hooks
			cheat_hookers_installhooks();

			// increment stage
			m_InitStages++;
		}
		else if ( m_InitStages == 1 )
		{
			// load all the weapon models
			loadAllWeaponModels();

			// get funky
			//pGameInterface->GetAudio()->PlayBeatTrack(2);

			// increment stage
			m_InitStages++;
		}
	}

	if ( cheat_state->state != CHEAT_STATE_NONE )
	{
		// keep this updated, cos something is switching it now
		pPedSelf = pPools->GetPedFromRef( CPOOLS_PED_SELF_REF );
		pPedSelfSA = pPedSelf->GetPedInterface();
	}

	static bool chat_set_once = false;
	if ( !chat_set_once && set.d3dtext_chat )
	{
		if ( g_Chat != NULL && g_Chat->iChatWindowMode )
		{
			//Log("Disabling SA:MP chat text.");
			g_Chat->iChatWindowMode = 0;
			chat_set_once = true;
		}
	}

	// sets kill text to s0beit mode if enabled from INI
	static bool kill_set_once = false;
	if ( !kill_set_once && set.d3dtext_kill )
	{
		if ( g_DeathList != NULL && g_DeathList->iEnabled )
		{
			g_DeathList->iEnabled = 0;
			kill_set_once = true;
		}
	}

	// more random than random
	if ( rand() % 5000 == 0 )
		srand( rand() + time_get() );

	// OMGWTFBBQ?!?
	if ( cheat_panic() )
	{
		cheat_state->state = CHEAT_STATE_NONE;
		goto out;
	}

	// menus are good
	menu_run();

	// install volatile patches from the .ini file
	for ( i = 0; i < INI_PATCHES_MAX; i++ )
	{
		if ( set.patch[i].name != NULL && set.patch[i].has_volatile && set.patch[i].installed )
			patcher_install( &set.patch[i] );
	}

	// generic stuff - these want to run even though we're dead
	cheat_handle_debug( wnd );
	cheat_handle_misc();
	cheat_handle_spoof_weapon();
	cheat_handle_weapon();
	gta_game_speed_set( cheat_state->game_speed );
	cheat_main_display_debug_stuff(g_timeDiff);

	if ( cheat_state->state != CHEAT_STATE_NONE )
	{
		// generic stuff
		cheat_handle_weapon_disable();
		cheat_handle_money();

		//////////////////////////////////////////////////////////////////
		// this should be removed after reworking weapon cheat function //
		//if ( set.restore_weapons_after_death )
		//	* (uint8_t *)0x5E6320 = 0xC3;

		cheat_handle_unlock();
		cheat_handle_checkpoint();

		// do stuff :p
		if ( cheat_state->state == CHEAT_STATE_VEHICLE )
		{
			cheat_main_vehicle( g_timeDiff );
		}
		else if ( cheat_state->state == CHEAT_STATE_ACTOR )
		{
			cheat_main_actor( g_timeDiff );
		}

		if ( KEY_PRESSED(set.key_disable_Wall_Collisions) )
		{
			cheat_state->_generic.nocols_walls_enabled ^= 1;
			if ( cheat_state->_generic.nocols_walls_enabled )
				patcher_install( &patch_NoColsWalls );
			else
				patcher_remove( &patch_NoColsWalls );
		}

		for ( i = 0; i < INI_PATCHES_MAX; i++ )
		{
			if ( set.patch[i].name != NULL && KEY_PRESSED(set.patch[i].ini_hotkey) )
			{
				if ( set.patch[i].installed || set.patch[i].failed )
					patcher_remove( &set.patch[i] );
				else
					patcher_install( &set.patch[i] );
			}
		}

		for ( i = 0; i < INI_SAMPPATCHES_MAX; i++ )
		{
			if ( set.sampPatch[i].name != NULL && KEY_PRESSED(set.sampPatch[i].ini_hotkey) )
			{
				if ( set.sampPatch[i].installed || set.sampPatch[i].failed )
					patcher_remove( &set.sampPatch[i] );
				else
					patcher_install( &set.sampPatch[i] );
			}
		}

		if ( KEY_PRESSED(set.key_vehicle_jumper) )
		{
			int iVehicleID = vehicle_find_nearest( VEHICLE_ALIVE + VEHICLE_NOTBURNING );
			vehicleJumper( iVehicleID );
		}

		if ( KEY_PRESSED(set.key_vehicle_occupied_jumper) )
		{
			int iVehicleID = vehicle_find_nearest( VEHICLE_ALIVE + VEHICLE_NOTBURNING + VEHICLE_OCCUPIED );
			vehicleJumper( iVehicleID );
		}
	}	// cheat_state->state != CHEAT_STATE_NONE

	// hack some SA:MP, shall we?
	if ( g_SAMP && g_renderSAMP_initSAMPstructs )
		sampMainCheat();

out: ;
	if (gta_menu_active()) {
		keyhook_clear_states();
		*(BYTE *)0xB7CB49 = 0; // game not paused even if we are in the menu.
	}
	else
		keyhook_run();
	time_last = time_get();
}
示例#12
0
void cheat_autodriver()
{
	static bool action = true;
	static DWORD dwTime = 0;
	if (cheat_state->_generic.autodriver == 1)
	{
		if (GetTickCount() - 2500 > dwTime && action == false)
		{
			float cpos[3] = { pPedSelf->GetPosition()->fX, pPedSelf->GetPosition()->fY, pPedSelf->GetPosition()->fZ };
			g_RakClient->SendFakeOnfootSyncData(cpos, actor_info_get(-1, 0)->hitpoints, actor_info_get(-1, 0)->speed);
			dwTime = GetTickCount();
			action = true;
		}
		else if (GetTickCount() - 250 > dwTime && action == true)
		{
			float cpos[3] = { pPedSelf->GetPosition()->fX, pPedSelf->GetPosition()->fY, pPedSelf->GetPosition()->fZ };
			g_RakClient->SendEnterPlayerVehicle(g_Players->pLocalPlayer->sCurrentVehicleID, 0);
			g_RakClient->SendFakeDriverSyncData(g_Players->pLocalPlayer->sCurrentVehicleID, cpos, vehicle_info_get(-1, 0)->hitpoints, vehicle_info_get(-1, 0)->speed);
			dwTime = GetTickCount();
			action = false;
		}
	}
	return;
}