Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

My thoughts for moveElement #2859

Open
1 task done
F2BShady opened this issue Dec 30, 2022 · 1 comment
Open
1 task done

My thoughts for moveElement #2859

F2BShady opened this issue Dec 30, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@F2BShady
Copy link
Contributor

F2BShady commented Dec 30, 2022

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

  • I have read and understood the Security Policy and this issue is not about a cheat or security vulnerability.
@F2BShady F2BShady added the enhancement New feature or request label Dec 30, 2022
@F2BShady
Copy link
Contributor Author

F2BShady commented Jan 23, 2023

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
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant