Open F2BShady opened 1 year ago
void moveElement(int arr[], int size, int currentIndex, int newIndex) {
if (currentIndex < 0 || currentIndex >= size || newIndex < 0 || newIndex >= size) {
// Handle invalid indices
std::cout << "Invalid indices provided." << std::endl;
return;
}
int temp = arr[currentIndex];
if (currentIndex < newIndex) {
// Shift elements to the right
for (int i = currentIndex; i < newIndex; i++) {
arr[i] = arr[i + 1];
}
} else if (currentIndex > newIndex) {
// Shift elements to the left
for (int i = currentIndex; i > newIndex; i--) {
arr[i] = arr[i - 1];
}
}
arr[newIndex] = temp;
}
how you could use the function:
int main() {
int arr[] = {1, 2, 3, 4, 5};
int size = sizeof(arr) / sizeof(arr[0]);
moveElement(arr, size, 2, 4);
for (int i = 0; i < size; i++) {
std::cout << arr[i] << " ";
}
// Output: 1 2 4 5 3
}
Is your feature request related to a problem? Please describe.
moveObjects
=bool moveObject ( object theObject, int time, float targetx, float targety, float targetz, [ float moverx, float movery, float moverz, string strEasingType, float fEasingPeriod, float fEasingAmplitude, float fEasingOvershoot ] )
It would be nice to also move players and vehicles if you change it to
moveElement
if we move the player with "moveElement" with this it will ignore the collisions and reach the target,this works for objects but I think it would be much better for other element types (for support vehicles and players)
Describe the solution you'd like
As a solution, change the moveObject function to moveElement "Get vehicle and player support"
Describe alternatives you've considered
No response
Additional context
No response
Security Policy