Back to Coding

Advanced Mechanic Job Script

Prompt

Create a comprehensive and advanced mechanic job script for the FiveM ESX framework that encompasses the following key features: - **Vehicle Repair and Part Replacement:** Enable mechanics to repair and replace specific vehicle parts, including engine, battery, tires, and brakes. Implement detailed physical interactions such as removing and swapping wheels with different types. - **Breakdown Risk System:** Develop a mileage-based system tracking vehicle usage, triggering random breakdown risks (battery failure, engine trouble, tire blowouts) when vehicles approach or exceed approximately 100,000 km. Use timers and mileage tracking to realistically simulate wear and tear. - **Tire Management:** Permit mechanics to remove tires physically with appropriate animations and install various tire or wheel types, affecting vehicle performance in game accordingly. - **Realistic Animations:** Integrate suitable mechanic animations throughout interactions, such as tool usage, removing parts, inspecting vehicles, and replacing components, using FiveM’s animation capabilities. - **Boss Features:** Include comprehensive boss management functionalities like recruitment and firing of staff, payroll management, and access to business-related menus, fully integrated with ESX and ox_lib. - **Integration with ox_target, ox_lib, and ox_inventory:** Use ox_target for precise, contextual player interactions; ox_lib for utility and UI features; and ox_inventory to manage all inventory-related tasks, such as part storage, tool usage, and stock control. - **High Interaction Depth:** Design an immersive, feature-rich job experience with dynamic player roles, detailed UI/UX where applicable, and seamless interaction flow. # Steps 1. Define vehicle parts with detailed states (working, damaged, broken). 2. Implement vehicle mileage tracking and trigger random breakdown events based on use. 3. Develop repair and replacement mechanics with physical part representation, e.g., tire removal. 4. Create and integrate animations for every mechanic action. 5. Build boss menus enabling staff recruitment/firing and financial management using ESX and ox_lib. 6. Utilize ox_target to enable contextual targeting and interaction prompts. 7. Link all inventory actions for parts and tools to ox_inventory. 8. Conduct thorough testing for realism, performance, and balanced gameplay. # Output Format Deliver a complete, modular, and well-documented FiveM ESX Lua job script along with all necessary resource files (client-side scripts, server-side scripts, animations, configuration files) organized and ready for deployment. Include extensive inline comments explaining critical functionality, clear instructions on installation and configuration, and usage guides for integrating ox_target, ox_lib, and ox_inventory. If external dependencies, assets, or use of third-party libraries are required, specify versions and how to acquire/install them clearly. # Notes - Emphasize performance optimization and modularity to enable future extension and maintenance. - Confirm compatibility with the latest stable releases of ESX, ox_target, ox_lib, and ox_inventory. - Implement safeguards against edge cases, such as attempts to repair already functional parts or replace missing components. - Ensure animations are smooth, non-invasive, and synchronized for all nearby players. # Response Formats Respond with a structured, well-commented Lua script and related resource files arranged for immediate use or straightforward adaptation within a FiveM ESX server environment.

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.