Coding
814 prompts available
Advanced 3D Door Placer
Create an advanced 3D door placement system script featuring full 3D placement capabilities and a clean, high-end UI similar to those found on professional servers. The script must incorporate the same robust save system used in the user's existing repair bench script to ensure consistency and reliability. Requirements: - Implement precise 3D placement allowing doors to be positioned and oriented in all three spatial dimensions with intuitive controls. - Design a polished, user-friendly UI that matches or exceeds the quality seen in high-end game servers, emphasizing clarity, responsiveness, and ease of use. - Integrate the same save/load mechanics from the repair bench script to persist door placements reliably between sessions. - Ensure the script is modular, well-commented, and optimized for performance. Steps: 1. Analyze the repair bench script's save system to understand data structures and methods used. 2. Develop the 3D placement mechanics allowing snap-to-grid and freeform placement. 3. Create the UI components, including preview windows, confirmation dialogs, and placement controls. 4. Implement saving and loading of placed doors using the inherited save system. 5. Test across various scenarios to ensure robustness and usability. Output Format: Provide the complete script code in a well-structured, properly indented format. Include comprehensive comments explaining key parts of the code. Additionally, a brief usage guide summarizing how to use the door placer and save/load functionality should be included as comments at the top of the script.
Add Scroll and Submit Button
You are provided with a React component named `LocationSelecting` that manages commodity location placements with dynamic bins and quantities, using Material-UI components, Redux state, Formik form handling, and animation with Lottie. Your task is to enhance this component by: 1. Adding a **Submit** button fixed at the bottom of the component, which triggers form submission logic (e.g., calling `formik.handleSubmit`) or a handler passed as props. 2. Modifying the input section (the area where the location rows and quantity inputs are displayed) to have a fixed height with vertical scrolling enabled so that when content overflows, the user can scroll without the entire component growing beyond this height. ### Requirements: - The Submit button must be visually distinct and remain fixed at the bottom, regardless of the scroll position within the input section. - The input section containing the mapped locations must have a fixed height (e.g., around 300-400px) with overflow-y set to scroll. - The scrolling area should be styled so it integrates well with the overall UI (using MUI `Box` or equivalent) and should not interfere with the top header or submit button. - Assume `formik` instance passed via props is used to handle form state and submission. - Preserve all existing logic and styling. ### Steps: 1. Wrap the locations mapping section inside a container with fixed height and `overflowY: 'auto'`. 2. Add a Box or Grid container below the scrollable section containing a full-width Submit button that calls `formik.handleSubmit` or another provided submit handler. 3. Ensure the layout uses flex or stack styles so that scroll area and submit button coexist without layout breakage. ### Output Format Return the full updated React component source code for `LocationSelecting` including these enhancements, keeping all existing imports and logic intact, only adding the fixed height scroll for the input section and the fixed bottom submit button. ### Example snippet to add scroll: ```jsx <Box sx={{ maxHeight: 350, overflowY: 'auto', mt: 2 }}> {/* Map over locations here */} </Box> ``` ### Example snippet for submit button fixed at bottom: ```jsx <Box sx={{ position: 'sticky', bottom: 0, backgroundColor: 'white', p: 1, borderTop: '1px solid #ccc' }}> <Button variant="contained" fullWidth onClick={formik.handleSubmit}> Submit </Button> </Box> ``` Incorporate these patterns into the component and ensure seamless user experience. ---
Add Second Player in Unreal
To add a second player in Unreal Engine who uses a different pawn class and shares the same camera as player one without splitting the screen, follow these steps: 1. **Create a New Pawn Class**: Design a second pawn class for the second player character. Ensure that it has appropriate movement functionality for a platformer game. 2. **Configure Input Settings**: In your project settings under Engine > Input, add new input mappings for the second player. For example, if player one uses keyboard keys like "WASD", you could map player two to another set of keys like "Arrow keys". 3. **Modify the Game Mode**: In your custom GameMode class, override the `PostLogin` function. This function will allow you to spawn the second player with its own pawn class while ensuring both players share the same camera. - Example in C++: ```cpp void AYourGameMode::PostLogin(APlayerController* NewPlayer) { Super::PostLogin(NewPlayer); // Spawn the second player pawn for the second player controller AMySecondPawn* NewPawn = GetWorld()->SpawnActor<AMySecondPawn>(... NewPlayer->Possess(NewPawn); } ``` 4. **Set Up a Single Camera**: Ensure that player one’s camera remains active for both players. In Unreal, cameras are usually controlled by the player controller. - In `PostLogin`, you can set the camera view using `PlayerController->SetViewTargetWithBlend(...)` targeting player one’s camera. This will ensure that both players see through the same camera. - Here’s an example of how you might do this: ```cpp APlayerController* Player1Controller = ... // Reference to Player 1 Controller NewPlayer->SetViewTargetWithBlend(Player1Controller->GetPawn()); ``` 5. **Test Your Setup**: Launch your game and test that both players can control their respective characters using the assigned keys, while both view through the same camera perspective. Remember, you may need to adjust collision settings, player inputs, and physics to prevent any unwanted interactions between the two characters or gameplay mechanics that are specific to shared camera views.
Add Session Range to MQL5 Indicator
You are provided with an existing MQL5 code for a range breakout indicator. Your task is to modify this indicator to incorporate session-based trading functionality, specifically for sessions such as the US session. The modifications must adhere to the following requirements: - Add logic to detect and mark the first candle of the specified trading session (e.g., US session) within the current indicator. - Mark the high and low range of this first session candle exactly as the current indicator does, maintaining the same style and plotting behavior. - Do not modify or alter any existing plotting functions or the visual aspects of the indicator; only add the session detection and range identification logic. - The overall behavior and output of the indicator apart from the added session-based functionality should remain unchanged. # Steps 1. Identify the timeframe and timing parameters corresponding to the desired session (e.g., US session hours). 2. Implement detection of the first candle within this session on each trading day. 3. Capture and mark the high and low of this first session candle, replicating the existing plotting method for range breakout. 4. Ensure the new code integrates smoothly without changing existing indicator plots or calculations. # Output Format Provide the MQL5 code of the modified indicator with the added session functionality included as comments for clarity. Do not remove or alter existing code except where necessary to add the session logic. Preserve original code comments and structure as much as possible. # Notes - The solution must work for multiple sessions if extended, but implementing the US session is sufficient here. - Ensure the code handles session start times accurately according to the chart timezone. - Maintain performance efficiency and avoid redundant calculations.
Add Settings and Leave Buttons
You are tasked with adding two buttons labeled "Settings" and "Leave" to the in-game menu for Garry's Mod (gmod). - The "Settings" button should open the regular gmod settings menu when clicked. - The "Leave" button should disconnect the player from the current game server. Please provide detailed script code in Lua to implement these two buttons in the menu, including any necessary hooks or function calls to ensure they work correctly within the gmod environment. # Steps 1. Identify the correct menu panel where buttons can be added. 2. Create and add the "Settings" button. 3. Link the "Settings" button to open the default gmod settings menu. 4. Create and add the "Leave" button. 5. Link the "Leave" button to disconnect the player from the current server. 6. Ensure proper handling for UI updates and player disconnection. # Output Format Provide the complete Lua code snippet that can be integrated into the gmod menu's Lua files to implement the described functionality. Include comments explaining key parts of the code for clarity. # Notes Make sure to use appropriate gmod API functions such as RunConsoleCommand for disconnecting and whatever function or method is standard to open the gmod settings menu. The buttons should be added in a standard way so they blend with the existing menu style.
Add Simple Lowercase Comments
// constructor to initialize the ticketpool with max capacity and transaction writer // use synchronized for thread safety // if current size is greater than max capacity put the current thread into waiting list // add ticket into list // notify waiting threads // constructor to initialize the customer object with ticket pool, retrieval rate, total tickets, name, and id // method to define the behavior of the customer thread // loop through the total tickets the customer wants to buy // attempt to release a ticket from the pool and log the transaction details // reference to the ticket pool operation interface // add comments for each important part of the code using this simple lowercase style // example: // constructor to initialize the main data structures // method to handle concurrency and synchronization // ensure thread safety by waiting when pool is full // notify all waiting threads after adding a ticket // customer thread loops to attempt ticket purchase // log transaction details after successful ticket release // apply the same style to all the main functional blocks in the code you wrote // avoid complex language and keep comments brief but clear please comment the existing code accordingly using the style described above.
Add start script advice
You are given a package manifest partially shown as a JSON object, which resembles the structure of a package-lock.json file, including metadata about packages and dependencies. Your task is to advise where to include the scripts configuration snippet: ```json "scripts": { "start": "electron ." } ``` This script is typically included in the package.json file to define convenient command aliases for npm. Provide a clear explanation specifying that the "scripts" section should be added as a top-level property within the package.json file (not in package-lock.json), alongside other metadata such as "name" and "version". Be explicit and concise in your response. # Output Format Provide your explanation in clear, plain English without any JSON formatting or code blocks. The output should be a short, direct answer explaining where the "scripts" object with the start command should be placed in the project files. # Notes - The presented JSON with "packages" and detailed module versions is a package-lock.json structure. - The "scripts" key belongs in package.json, not package-lock.json. - The "start": "electron ." script should be part of the scripts section in package.json. # Examples If the existing package.json is: { "name": "attendanceapp", "version": "1.0.0" } You would add: { "name": "attendanceapp", "version": "1.0.0", "scripts": { "start": "electron ." } } This allows running `npm start` to launch Electron. Your response should clearly state this placement and reasoning.
Add Startup Buttons
Create a starting page for an app that features two buttons displayed in all capital letters: 1. Button labeled "STUDENT" — when clicked, it navigates the user to the app's home page. 2. Button labeled "TEACHER" — when clicked, it navigates the user to a new page dedicated to teachers. Ensure the buttons are clearly visible and appropriately spaced on the starting page. Use consistent styling and capitalization for both buttons. # Steps - Design the starting page layout with two buttons. - Label the first button as "STUDENT" and configure its action to navigate to the home page. - Label the second button as "TEACHER" and configure its action to navigate to a new teacher page. - All button labels must be in uppercase. # Output Format Provide the complete code snippet or implementation details needed to realize the described starting page with the two buttons and their navigation functionality.
Add Sticker Function
Create a function that automatically adds a sticker to a sticker pack based on a received sticker file ID and hash. The function should retrieve and use all necessary metadata such as pack name and short name. Ensure that the proper validations and error handling are in place. ### Steps: 1. **Receive Sticker Information:** Accept inputs for the sticker's file ID and hash as parameters. 2. **Get Pack Details:** Automatically fetch the sticker pack name and short name from a predefined source or API. 3. **Add Sticker:** Use the received file ID and hash to add the sticker to the sticker pack. 4. **Error Handling:** Implement error handling for cases where the sticker cannot be added or metadata cannot be retrieved. ### Output Format: - Return a success message along with the ID of the added sticker, or an error message if it fails. ### Examples: - Example 1: Input: {"file_id": "12345", "hash": "abcd1234"} → Output: "Sticker added successfully to pack 'Cute Stickers' with ID: 67890." - Example 2: Input: {"file_id": "54321", "hash": "xyz9876"} → Output: "Error adding sticker: Invalid hash." ### Notes: - Ensure the function checks if the pack exists before trying to add the sticker. - Include logging for successful and failed operations for better tracking.
Add Submit Button Instructions
You are a helpful software development assistant. Your task is to guide the user on how to add a "submit" button to their UI that, when clicked, navigates to the URL path "/submit". To provide an accurate and helpful answer, first ask for or consider the following details if context is missing: - The technology stack or framework used in the UI (e.g., React, Angular, Vue, plain HTML, etc.) - The structure or code snippets of the current UI components, if available Then, explain step-by-step how to add the button linked to the "/submit" path: 1. How to add the button element in the UI code. 2. How to implement navigation upon clicking the button, using routing or standard anchor linking based on the framework. 3. Any necessary import or module setup for routing if applicable. Emphasize best practices for UI/UX and code clarity. # Output Format Provide a clear, concise, and actionable explanation with code examples relevant to the mentioned or assumed technology. Use markdown formatting for code blocks and structured text. If uncertain about the tech stack, mention common approaches for different frameworks. # Notes - If you do not have details about the user's codebase, suggest asking for more information. - Focus on actionable steps and code samples to make the implementation straightforward.
Advanced Admin Jail Script
Create an advanced, optimized admin jail script compatible with qb-core, esx, qbx_core, and standalone frameworks. The script must include: - A sophisticated user interface (UI) for admins to manage jails effectively. - The primary command `adminjail` which triggers the jail functionality. - Compatibility across the specified frameworks ensuring smooth integration. - Efficient and optimized code for minimal performance impact. # Steps 1. Design a modular architecture that supports multiple frameworks (qb-core, esx, qbx_core, standalone). 2. Develop a responsive and user-friendly UI enabling admins to jail and unjail players, set jail time, and view jailed players. 3. Implement the `adminjail` command with flexible options (e.g., specify player, jail duration, reason). 4. Write optimized code that minimizes server load and ensures quick execution. 5. Test the script extensively in each supported framework environment. # Output Format Provide the complete source code files for the admin jail script, including UI files and server/client scripts, with detailed comments explaining each part. Include instructions for installation and usage in each framework. # Notes - Ensure the UI is polished and provides clear feedback for admin actions. - Maintain strict security to prevent abuse or unauthorized jail commands. - Include fallback handling to maintain functionality across all frameworks.
Add Tabs to GUI
You are tasked with enhancing an existing script by integrating new tabs into the main GUI window's user interface. The user previously requested adding certain tabs and has now asked you to implement these additions properly into the GUI. Instructions: - Review the existing script to identify the new tabs that were mentioned but not yet added to the main GUI interface. - Examine how the "loop dash" tab is implemented and imported into the GUI as an example. - Using the example as a model, correctly add all the requested new tabs to the main GUI as distinct tabs. - Ensure the integrations follow the same coding style, naming conventions, and structure as the existing tabs. - Use the example file provided for UI elements to guide implementation details. - Maintain clarity, consistency, and functionality within the GUI. Steps: 1. Identify all the new tabs specified in the previous user instruction. 2. Analyze the existing "loop dash" tab implementation and how it integrates into the main GUI. 3. Implement the new tabs following the same method. 4. Test to confirm the new tabs appear correctly in the GUI's tab bar. Output Format: - Provide the updated script or relevant code snippets that show the correctly integrated new tabs within the main GUI. - Include comments where appropriate to describe the changes. Notes: - If any ambiguity arises concerning the tabs to add, explain your assumptions. - Strive for neat, maintainable code that fits seamlessly with the existing application. Your final response should contain the code modifications clearly demonstrating the addition of all requested tabs to the main GUI window as tabs, modeled on the "loop dash" example.