void cheat_handle_emo ( struct vehicle_info *vehicle_info, struct actor_info *actor_info, float time_diff ) { traceLastFunc( "cheat_handle_emo()" ); struct vehicle_info *vtemp; if ( !isBadPtr_GTA_pPed(actor_info) ) { if ( KEY_PRESSED(set.key_self_destruct) ) actor_info->hitpoints = 0.0f; } else if ( !isBadPtr_GTA_pVehicle(vehicle_info) ) { actor_info = actor_info_get(ACTOR_SELF, 0); if ( actor_info->state == ACTOR_STATE_DRIVING && actor_info->vehicle->passengers[0] == actor_info ) { if ( KEY_PRESSED(set.key_self_destruct) ) { for ( vtemp = vehicle_info; vtemp != NULL; vtemp = vtemp->trailer ) { if(vtemp == NULL) return; vtemp->hitpoints = 1.0f; cheat_vehicle_tires_set( vtemp, 1 ); if ( !set.trailer_support ) break; } } } } }
void cheat_handle_exit_vehicle ( struct vehicle_info *vehicle_info, struct actor_info *actor_info ) { if (!isBadPtr_GTA_pVehicle(vehicle_info)) { if (vehicle_info != cheat_state->_generic.pVehicleExit_Last) { if (!isBadPtr_GTA_pVehicle(cheat_state->_generic.pVehicleExit_Last)) { cheat_state->_generic.pVehicleExit_Last->m_nVehicleFlags.bCanBeDamaged = true; } cheat_state->_generic.pVehicleExit_Last = vehicle_info; } } if (!isBadPtr_GTA_pPed(actor_info)) { if (!isBadPtr_GTA_pVehicle(cheat_state->_generic.pVehicleExit_Last)) { cheat_state->_generic.pVehicleExit_Last->m_nVehicleFlags.bCanBeDamaged = true; cheat_state->_generic.pVehicleExit_Last = NULL; } } }
void cheat_handle_stick ( struct vehicle_info *vehicle_info, struct actor_info *actor_info, float time_diff ) { traceLastFunc( "cheat_handle_stick()" ); struct object_base *base_stick, *base_self; struct actor_info *actor_stick; struct vehicle_info *vehicle_stick; float *speed_stick, *speed_self; float *spin_stick, *spin_self; static int id = -1; int i; if ( KEY_PRESSED(set.key_stick) ) { if ( vehicle_info != NULL ) cheat_state->vehicle.stick ^= 1; else cheat_state->actor.stick ^= 1; id = actor_find( id - 1, 1, ACTOR_ALIVE | ACTOR_NOT_SAME_VEHICLE ); } if ( KEY_PRESSED(set.key_stick_nearest) ) { if ( vehicle_info != NULL ) cheat_state->vehicle.stick ^= 1; else cheat_state->actor.stick ^= 1; id = actor_find_nearest( ACTOR_ALIVE | ACTOR_NOT_SAME_VEHICLE ); } if ( (vehicle_info != NULL && cheat_state->vehicle.stick) || (actor_info != NULL && cheat_state->actor.stick) ) { // remove any bad vehicle or actor stuffs if ( isBadPtr_GTA_pVehicle(vehicle_info) ) vehicle_info = NULL; if ( isBadPtr_GTA_pPed(actor_info) ) actor_info = NULL; /* check if actor has disappeared.. and if it has, switch to teh nearest */ if ( id != -1 && actor_info_get(id, ACTOR_ALIVE) == NULL ) id = actor_find_nearest( ACTOR_ALIVE | ACTOR_NOT_SAME_VEHICLE ); if ( KEY_PRESSED(set.key_stick_prev) ) id = actor_find( id, -1, ACTOR_ALIVE | ACTOR_NOT_SAME_VEHICLE ); if ( KEY_PRESSED(set.key_stick_next) ) id = actor_find( id, 1, ACTOR_ALIVE | ACTOR_NOT_SAME_VEHICLE ); /* no actors to stick to */ if ( id == -1 ) { cheat_state_text( "No players found; stick disabled." ); cheat_state->vehicle.stick = 0; cheat_state->actor.stick = 0; return; } /* get actor struct for the actor we're sticking to */ actor_stick = actor_info_get( id, ACTOR_ALIVE | ACTOR_NOT_SAME_VEHICLE ); if ( actor_stick == NULL ) return; /* is this actor in a vehicle? */ vehicle_stick = actor_vehicle_get( actor_stick ); base_stick = vehicle_stick ? &vehicle_stick->base : &actor_stick->base; base_self = vehicle_info ? &vehicle_info->base : &actor_info->base; speed_stick = vehicle_stick ? vehicle_stick->speed : actor_stick->speed; speed_self = vehicle_info ? vehicle_info->speed : actor_info->speed; spin_stick = vehicle_stick ? vehicle_stick->spin : actor_stick->spin; spin_self = vehicle_info ? vehicle_info->spin : actor_info->spin; /* allow warping to work + always warp towards whatever we're sticking to... but only when we're in a vehicle */ if ( KEY_PRESSED(set.key_warp_mod) && vehicle_info != NULL ) { float out[4]; /* multiply the matrix of whatever we're sticking to with the user supplied vector */ matrix_vect4_mult( base_stick->matrix, set.stick_vect, out ); /* multiply the result with the negative warp-speed value, and put it in the speed vector (negative because we want to warp towards teh target, not away from it */ vect3_mult( out, -set.warp_speed, speed_self ); } if ( !KEY_DOWN(set.key_warp_mod) ) { float d[4] = { 0.0f, 0.0f, 0.0f, 0.0f }; float accel_mult = 1.0f; float out[4]; /* handle stick movement keys */ if ( KEY_DOWN(set.key_stick_forward) ) d[1] += 1.0f; if ( KEY_DOWN(set.key_stick_backward) ) d[1] -= 1.0f; if ( KEY_DOWN(set.key_stick_left) ) d[0] -= 1.0f; if ( KEY_DOWN(set.key_stick_right) ) d[0] += 1.0f; if ( KEY_DOWN(set.key_stick_up) ) d[2] += 1.0f; if ( KEY_DOWN(set.key_stick_down) ) d[2] -= 1.0f; if ( KEY_DOWN(set.key_stick_in) ) d[3] -= 1.0f; if ( KEY_DOWN(set.key_stick_out) ) d[3] += 1.0f; if ( !near_zero(set.stick_accel_time) ) { static uint32_t time_start; if ( !vect4_near_zero(d) ) time_start = ( time_start == 0 ) ? time_get() : time_start; else time_start = 0; /* no keys pressed */ /* acceleration */ if ( time_start != 0 ) { float t = TIME_TO_FLOAT( time_get() - time_start ); if ( t < set.stick_accel_time ) accel_mult *= t / set.stick_accel_time; } } /* calculate new vector + dist */ if ( !vect3_near_zero(d) && !vect3_near_zero(set.stick_vect) ) { for ( i = 0; i < 3; i++ ) { d[i] = set.stick_vect[i] * set.stick_vect_dist + d[i] * time_diff * 8.0f * accel_mult; } set.stick_vect_dist = vect3_length( d ); vect3_normalize( d, set.stick_vect ); } /* move towards/away from the center */ if ( !near_zero(d[3]) ) set.stick_vect_dist += d[3] * time_diff * 40.0f * accel_mult; /* Teleport vehicle detachables */ if ( vehicle_info != NULL ) vehicle_detachables_teleport( vehicle_info, &base_self->matrix[4 * 3], &base_stick->matrix[4 * 3] ); matrix_copy( base_stick->matrix, base_self->matrix ); vect3_copy( speed_stick, speed_self ); vect3_copy( spin_stick, spin_self ); /*base_self->interior_id = base_stick->interior_id; gta_interior_id_set(base_stick->interior_id);*/ /* multiply the matrix of the target with the user supplied vector */ matrix_vect4_mult( base_stick->matrix, set.stick_vect, out ); /* multiply the result with the user supplied vector distance */ vect3_mult( out, set.stick_vect_dist, out ); /* and add it to our position */ vect3_vect3_add( &base_self->matrix[4 * 3], out, &base_self->matrix[4 * 3] ); if ( vehicle_info != NULL ) { /* Teleport detachables again :p */ vehicle_detachables_teleport( vehicle_info, &base_stick->matrix[4 * 3], &base_self->matrix[4 * 3] ); vehicle_prevent_below_height( vehicle_info, set.stick_min_height ); } else if ( actor_info != NULL ) { // new pedFlags actor_info->pedFlags.bIsStanding = true; actor_info->pedFlags.bWasStanding = true; actor_info->pedFlags.bStayInSamePlace = true; } } } }
void cheat_lockstatus() { if (!cheat_state->_generic.lockstatus) return; if (gta_menu_active()) return; if (cheat_state->_generic.cheat_panic_enabled) return; if (!pGameInterface || !pGameInterface->GetPools()) return; if (!pPedSelf) return; const vehicle_entry *vehicle; char buf[256]; int v; float w, h; D3DXVECTOR3 poss, screenposs; CVector2D screenPosition; CVector ourPosition, iterPosition, ourPosMinusIter; // get our position if (!isBadPtr_GTA_pVehicle(pPedSelf->GetVehicle())) { ourPosition = *(pPedSelf->GetVehicle()->GetPosition()); } else { ourPosition = pPedSelf->GetInterface()->Placeable.matrix->vPos; } // setup iterator CVehicleSA *iterVehicle = NULL; CPoolsSA *pPools = reinterpret_cast <CPoolsSA *> (pGameInterface->GetPools()); CPoolsSA::vehiclePool_t::mapType::iterator iter = pPools->m_vehiclePool.map.begin(); // iterate while (iter.pos < iter.end) { // map iterator CVehicleSA pointer to our CVehicleSA pointer iterVehicle = iter.pos->second; // advance to next CVehicleSA for next pass iter.pos++; // move past null pointers if (isBadPtr_GTA_pVehicle(iterVehicle)) continue; //if ( isBadPtr_GTA_pVehicle(iterVehicle->GetVehicleInterface()) ) // continue; // check if it's farther than set.vehicle_tags_dist iterPosition = iterVehicle->GetInterface()->Placeable.matrix->vPos; ourPosMinusIter = ourPosition - iterPosition; if (ourPosMinusIter.Length() > set.vehicle_tags_dist) continue; // check if it's our vehicle if (iterVehicle == pPedSelf->GetVehicle()) continue; // check if it's near zero if (iterVehicle->GetPosition()->IsNearZero()) continue; // CVector to D3DXVECTOR3, function to be converted to CVector later poss.x = iterPosition.fX; poss.y = iterPosition.fY; poss.z = iterPosition.fZ; // yup CalcScreenCoors(&poss, &screenposs); // check if the vehicle is culled or not if (screenposs.z < 1.f) continue; // D3DXVECTOR3 to CVector2D screenPosition.fX = screenposs.x; screenPosition.fY = screenposs.y; // get the vehicle model's name vehicle = gta_vehicle_get_by_id(iterVehicle->GetModelIndex()); // get SAMP's vehicle id if (g_Vehicles != NULL) v = translateGTASAMP_vehiclePool.iSAMPID[getVehicleGTAIDFromInterface((DWORD *)iterVehicle->GetVehicleInterface())]; else v = (int)iterVehicle->GetArrayID(); ///////////////// // render time // h = pD3DFont->DrawHeight(); _snprintf_s(buf, sizeof(buf)-1, "%s", iterVehicle->AreDoorsLocked() ? "Закрыта" : "Открыта"); w = pD3DFont->DrawLength(buf); // different color if car is being driven DWORD color_veh; if (iterVehicle->AreDoorsLocked()) color_veh = D3DCOLOR_XRGB(255, 0, 0); // blueish 100, 150, 235 else color_veh = D3DCOLOR_XRGB(0, 255, 0); // render vehicle name pD3DFont->PrintShadow(screenPosition.fX, screenPosition.fY, color_veh, buf); } return; }