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_pickchecker() { if (cheat_state->_generic.pickchecker) { for (int i = 0; i < SAMP_MAX_PICKUPS; i++) { if (g_SAMP->pPools->pPickup->pickup[i].iModelID == set.model_pickup) { struct actor_info *self = actor_info_get(ACTOR_SELF, 0); float pPos[3] = { 0.0f, 0.0f, 0.0f }; vect3_copy(g_SAMP->pPools->pPickup->pickup[i].fPosition, pPos); if (vect3_near_zero(pPos)) continue; if (cheat_state->state == CHEAT_STATE_VEHICLE) GTAfunc_RemoveActorFromCarAndPutAt(pPos); else { cheat_actor_teleport(self, pPos, 0); cheat_state->_generic.coordmaster = 0; cheat_state->_generic.pickchecker = 0; if (cheat_state->_generic.buyhouse) { say("/buyhouse"); } GTAfunc_LockActor(0); break; } } } } }
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_handle_unfreeze ( struct vehicle_info *vehicle_info, struct actor_info *actor_info, float time_diff ) { traceLastFunc( "cheat_handle_unfreeze()" ); if ( KEY_PRESSED(set.key_anti_freeze) ) { GTAfunc_TogglePlayerControllable(0); GTAfunc_LockActor(0); pGameInterface->GetCamera()->RestoreWithJumpCut(); // stop all animations if ( actor_info != NULL && !actor_info->pedFlags.bInVehicle ) GTAfunc_DisembarkInstantly(); } }
void cheat_handle_quickwarp(struct vehicle_info *vehicle_info, struct actor_info *actor_info) { if (KEYCOMBO_PRESSED(set.key_quickwarp)) { CCam *pCam = pGame->GetCamera()->GetCam(pGame->GetCamera()->GetActiveCam()); CVector camsrc(*pCam->GetSource()), src, target, tppos; CColPoint *pCollision = nullptr; CEntitySAInterface *pEntity = nullptr; if (pCam->GetMode() == MODE_AIMWEAPON || pCam->GetMode() == MODE_AIMWEAPON_ATTACHED || pCam->GetMode() == MODE_AIMWEAPON_FROMCAR) { // calculate target position by aim vector pGame->GetCamera()->Find3rdPersonCamTargetVector(700.0f, &camsrc, &src, &target); } else { // else by camera vector target = camsrc + *pCam->GetFront() * 700.0f; } // ignore self vehicle if (vehicle_info != nullptr) { *(::vehicle_info **)VAR_IgnoredEntity = vehicle_info; } if (GTAfunc_ProcessLineOfSight(&camsrc, &target, &pCollision, &pEntity, true, true, false, true, true, false, false, false)) { tppos = *pCollision->GetPosition(); tppos -= (*pCollision->GetNormal()) * 0.5f; if (pCollision->GetNormal()->fZ >= 0.5f || pPedSelf->GetAreaCode() != 0) { tppos.fZ += 1.0f; tppos.fZ = pGameInterface->GetWorld()->FindGroundZFor3DPosition(&tppos); } else { tppos.fZ = pGameInterface->GetWorld()->FindGroundZForPosition(tppos.fX, tppos.fY); } if (vehicle_info != nullptr) { // check for collision CVehicle *vehSelf = pPedSelf->GetVehicle(); if (vehSelf) { pCollision->Destroy(); // check for collision CVector vecVehicleGravity; vehSelf->GetGravity(&vecVehicleGravity); CVector vecVehicleAbove = (-vecVehicleGravity * 5.0f) + tppos; CVector vecVehicleBelow = (vecVehicleGravity * 5.0f) + tppos; bool bCollision = GTAfunc_ProcessLineOfSight(&vecVehicleAbove, &vecVehicleBelow, &pCollision, &pEntity, true, false, false, true, true, false, false, false); // not checking for vehicle collisions if (bCollision && pCollision) { // set vehicle to same Up position has surface normal CMatrix matVehicleSelf; vehSelf->GetMatrix(&matVehicleSelf); CVector vecCollisionNormal = *pCollision->GetNormal(); // get "down" from vehicle model CVector rotationAxis = matVehicleSelf.vUp; // normalize our vectors vecCollisionNormal.Normalize(); rotationAxis.Normalize(); // axis and rotation for gravity float theta = acos(rotationAxis.DotProduct(&vecCollisionNormal)); if (!near_zero(theta)) { rotationAxis.CrossProduct(&vecCollisionNormal); rotationAxis.Normalize(); rotationAxis.ZeroNearZero(); matVehicleSelf = matVehicleSelf.Rotate(&rotationAxis, -theta); } // set the new matrix vehSelf->SetMatrix(&matVehicleSelf); // set pos floats for actual teleporting tppos.fX = pCollision->GetPosition()->fX; tppos.fY = pCollision->GetPosition()->fY; tppos.fZ = pCollision->GetPosition()->fZ + 1.0f; // should be enough to stay above the ground properly } else { tppos.fZ += 0.5f; } cheat_vehicle_teleport(vehicle_info, &tppos.fX, gta_interior_id_get(), true); } } else if (actor_info != nullptr) { tppos.fZ += 1.0f; cheat_actor_teleport(actor_info, &tppos.fX, gta_interior_id_get()); } GTAfunc_TogglePlayerControllable(0); GTAfunc_LockActor(0); } if (pCollision != nullptr) { pCollision->Destroy(); } } }