Back to Coding

Advanced Mechanic Job

Prompt

Create a comprehensive and advanced mechanic job script for the FiveM ESX framework, incorporating the following detailed features: 1. **Vehicle Repair and Part Replacement:** Allow mechanics to repair and physically replace specific vehicle parts such as engine, battery, tires, brakes, etc., including detailed mechanics like removing and swapping wheels with various types. 2. **Breakdown Risk System:** Implement a mileage-based breakdown risk mechanism where vehicles approaching or surpassing 100,000 km incur random breakdown events like battery failure, engine trouble, or tire blowouts, using timers or mileage tracking to simulate realistic wear and tear. 3. **Tire Management:** Enable mechanics to remove tires physically using proper animations and install different tire or wheel types, affecting vehicle performance realistically. 4. **Realistic Animations:** Integrate realistic and context-appropriate mechanic animations throughout all interactions, including using tools, removing parts, replacing components, and inspecting vehicles, synchronized suitably for all nearby players. 5. **Boss Features:** Provide comprehensive boss-level management functionalities such as recruiting and firing mechanics, managing payroll, and accessing other business-related menus. 6. **Integration with ox_target, ox_lib, and ox_inventory:** Fully leverage ox_target for targeted interaction prompts, ox_lib for utilities, and ox_inventory for comprehensive inventory management including parts, tools, and stock control. 7. **High Interaction Depth:** Design the job to be immersive and feature-rich, supporting dynamic player roles and interactions with detailed UI/UX where applicable. # Steps to Implement - Define vehicle parts and their states: working, damaged, and broken. - Implement mileage tracking and a system to trigger randomized breakdowns based on vehicle usage. - Develop repair and part replacement mechanics with physical representations such as tire removal. - Script mechanic animations using suitable FiveM animation libraries, ensuring synchronization. - Construct boss menus for staff management and financial controls using ESX and ox_lib. - Use ox_target for precise contextual targeting and interaction prompts. - Integrate ox_inventory for managing inventory actions including parts, tools, and stock. - Conduct thorough testing for realism, performance, and game balance. # Output Format Provide the complete, well-documented Lua job script along with all necessary supporting resource files (client scripts, server scripts, animation files, configuration files). Organize files clearly, ready for deployment within a FiveM ESX server environment. Include comprehensive comments explaining critical code sections, installation steps, configuration guidelines, and usage instructions for integrating ox_target, ox_lib, and ox_inventory. Specify any external dependencies or assets required and their sources. # Notes - Prioritize modular, efficient code design to facilitate future updates and extensions. - Ensure compatibility with the latest stable versions of ESX, ox_target, ox_lib, and ox_inventory. - Build in safeguards against edge cases, such as attempting to repair already functional parts or replace parts not present. - Make animations seamless and synchronized for all players in proximity. # Response Format Output a structured, fully-commented Lua script and supporting files, ready for direct use or customization on a FiveM ESX server. Do not include explanations outside of code comments.

Related Coding Prompts

Write Code

As a seasoned programmer, your task is to write code in [programming language] to [perform action]. The code should be efficient, well-structured, and optimized for performance. Make sure to follow best practices and industry standards while implementing the necessary algorithms and logic to achieve the desired functionality. Test the code thoroughly to ensure it functions as intended and meets all requirements. Additionally, document the code properly for future reference and maintenance.

Debug Code

Act as a seasoned programmer with over 20 years of commercial experience. Analyze the provided [piece of code] that is causing a specific [error]. Your task involves diagnosing the root cause of the error, understanding the context and functionality intended by the code, and proposing a solution to fix the issue. Your analysis should include a step-by-step walkthrough of the code, identification of any bugs or logical mistakes, and a detailed explanation of how to resolve them. Additionally, suggest any improvements or optimizations to enhance the performance, readability, or maintainability of the code based on your extensive experience. Ensure that your solution adheres to best practices in software development and is compatible with the current development environment where the code is being executed.

Do Code Review

As a seasoned programmer with over 20 years of commercial experience, your task is to perform a comprehensive code review on the provided [piece of code]. Your review should meticulously evaluate the code's efficiency, readability, and maintainability. You are expected to identify any potential bugs, security vulnerabilities, or performance issues and suggest specific improvements or optimizations. Additionally, assess the code's adherence to industry standards and best practices. Your feedback should be constructive and detailed, offering clear explanations and recommendations for changes. Where applicable, provide examples or references to support your suggestions. Your goal is to ensure that the code not only functions as intended but also meets high standards of quality and can be easily managed and scaled in the future. This review is an opportunity to mentor and guide less experienced developers, so your insights should be both educational and actionable.