void cmd_tele_loc ( char *param ) { if ( strlen(param) == 0 ) { addMessageToChatWindow( "USAGE: /m0d_tele_loc <location name>" ); addMessageToChatWindow( "Use /m0d_tele_locations to show the location names." ); addMessageToChatWindow( "The more specific you are on location name the better the result." ); return; } for ( int i = 0; i < STATIC_TELEPORT_MAX; i++ ) { if ( strlen(set.static_teleport_name[i]) == 0 || vect3_near_zero(set.static_teleport[i].pos) ) continue; if ( !findstrinstr(set.static_teleport_name[i], param) ) continue; cheat_state_text( "Teleported to: %s.", set.static_teleport_name[i] ); cheat_teleport( set.static_teleport[i].pos, set.static_teleport[i].interior_id ); return; } addMessageToChatWindow( "USAGE: /m0d_tele_loc <location name>" ); addMessageToChatWindow( "Use /m0d_tele_locations to show the location names." ); addMessageToChatWindow( "The more specific you are on location name the better the result." ); }
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." ); } } }
void cheat_stealcar() { if (cheat_state->_generic.stealcar) { static int time = 0; if (GetTickCount() - time > 500) { struct vehicle_info *info = getGTAVehicleFromSAMPVehicleID(set.stcar); if (g_Vehicles->pSAMP_Vehicle[set.stcar]->iIsLocked) { float cPos[3] = { 0.0f, 0.0f, 0.0f }; vect3_copy(&info->base.matrix[12], cPos); cPos[2] -= 1.8f; GTAfunc_LockActor(1); if (cheat_state->state == CHEAT_STATE_VEHICLE) GTAfunc_RemoveActorFromCarAndPutAt(cPos); else cheat_teleport(cPos, gta_interior_id_get()); } else { g_RakClient->SendEnterPlayerVehicle(set.stcar, 0); GTAfunc_PutActorInCar(info); info->m_nVehicleFlags.bEngineOn = 1; cheat_state->_generic.stealcar = 0; GTAfunc_TogglePlayerControllable(0); GTAfunc_LockActor(0); pGameInterface->GetCamera()->RestoreWithJumpCut(); } time = GetTickCount(); } } }
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); } }
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; }
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 ); }
void cheat_farm() { if (cheat_state->_generic.farm) { static DWORD time = 0; if (g_SAMPMisc->iCheckpointEnabled && vect3_dist(g_SAMPMisc->fCheckpointPos, &actor_info_get(-1, 0x01)->base.matrix[12]) > g_SAMPMisc->fCheckpointSize[0]) { float spd[3] = { 0, 0, 0 }; for (int i = 0; i <= 32; i++) { float x = *(float *)(0xC7DD58 + 48 + 160 * i); float y = *(float *)(0xC7DD58 + 52 + 160 * i); float z = *(float *)(0xC7DD58 + 56 + 160 * i); if ((x > 2695 && x < 2696 && y > -1705 && y < -1704) || (x > 1099 && x < 1100 && y > 1601 && y < 1602) || (x == 0 && y == 0) || *(WORD *)(0xC7DD58 + 80 + 160 * i) != 1) continue; else { float pos[3] = { x, y, z + 1.0f }; cheat_teleport(pos, 0); break; } } } else if (!g_SAMPMisc->iCheckpointEnabled && GetTickCount() - time > 1000) { float curPos[3] = { pPedSelf->GetPosition()->fX, pPedSelf->GetPosition()->fY, pPedSelf->GetPosition()->fZ }; int iPic = getPickup(curPos, 50, 19197); g_RakClient->SendFakeOnfootSyncData(g_SAMP->pPools->pPickup->pickup[iPic].fPosition, actor_info_get(-1, 0)->hitpoints, actor_info_get(-1, 0)->speed); RakNet::BitStream bs; bs.Write(iPic); g_RakClient->RPC(RPC_PickedUpPickup, &bs, HIGH_PRIORITY, RELIABLE_ORDERED, 0, 0); time = GetTickCount(); } } }
void cheat_handle_teleport ( struct vehicle_info *vehicle_info, struct actor_info *actor_info, float time_diff ) { traceLastFunc( "cheat_handle_teleport()" ); struct object_base *base = ( vehicle_info != NULL ) ? &vehicle_info->base : &actor_info->base; int i; // Set teleport coordinates for ( i = 0; i < TELEPORT_MAX; i++ ) { if ( set.key_teleport_set[i] == 0 ) continue; if ( KEY_PRESSED(set.key_teleport_set[i]) ) { cheat_state->teleport[i].set = 1; matrix_copy( base->matrix, cheat_state->teleport[i].matrix ); cheat_state->teleport[i].interior_id = gta_interior_id_get(); cheat_state_text( "Teleport coordinates set." ); } } // Teleport to stored coordinates for ( i = 0; i < TELEPORT_MAX; i++ ) { if ( set.key_teleport[i] == 0 ) continue; if ( KEY_PRESSED(set.key_teleport[i]) ) { if ( cheat_state->teleport[i].set ) { cheat_teleport_history_save(); cheat_teleport( &cheat_state->teleport[i].matrix[4 * 3], cheat_state->teleport[i].interior_id ); // when teleports are stored in-game, we have a copy of the matrix to preserve rotation, etc.. matrix_copy( cheat_state->teleport[i].matrix, base->matrix ); } else if ( !vect3_near_zero(set.teleport[i].pos) ) { cheat_teleport_history_save(); cheat_teleport( set.teleport[i].pos, set.teleport[i].interior_id ); } else { cheat_state_text( "Teleport coordinates not set." ); break; } break; } } if ( KEY_PRESSED(set.key_teleport_hist) ) { struct cheat_state_teleport *teleport = NULL; cheat_state->teleport_hist_count--; if ( cheat_state->teleport_hist_count < 0 ) cheat_state->teleport_hist_count = 0; else teleport = &cheat_state->teleport_hist[cheat_state->teleport_hist_count]; if ( teleport != NULL && teleport->set ) { cheat_teleport( &teleport->matrix[4 * 3], teleport->interior_id ); matrix_copy( teleport->matrix, base->matrix ); teleport->set = 0; } else { cheat_state_text( "Teleport history list is empty." ); } } }