ev_radialmenu

EV Radial Menu System

The EV Radial Menu System provides an intuitive and dynamic interface for players to perform job-specific actions, interact with vehicles, or access custom functionalities. This guide explains how to configure, customize, and extend the radial menu system.


System Features

Core Features

  • Job-Based Menus: Dynamically displays options based on the player's job.

  • Vehicle-Specific Interactions: Contextual menus for specific vehicles or scenarios.

  • Customizable: Easily extend or modify menus using modular definitions.

  • User-Friendly: Smooth integration with roleplay frameworks and intuitive keybinds.

Dynamic Updates

  • Automatically adjusts menus based on:

    • Player job roles.

    • Vehicle entry/exit.

    • Specific in-game events.


Configuration

The configuration file (config.lua) defines the structure of the radial menu. It includes:

  • Menu Items: Base-level options displayed in the radial menu.

  • Job Interactions: Job-specific submenus.

  • Localization: Language support for prompts and notifications.

Example Configuration

Adding a New Menu

Step 1: Create a Menu File

Create a new Lua file in the menus folder (e.g., menus/myNewMenu.lua) and define your menu:

Step 2: Register the Menu

Include the new menu in the appropriate Config.JobInteractions entry in config.lua:

Step 3: Define Events

In your client script (client/main.lua), register the events linked to the menu:


Client-Side Details

Dynamic Updates

Vehicle-Based Menus

The system adjusts the menu based on the player's vehicle:

Job-Based Menus

Menus adjust based on the player's job:

Call setupSubItems() before opening the radial menu to ensure it updates correctly.


Keybind Configuration

The default keybind to open the radial menu is defined in config.lua:

To change the keybind:

  1. Modify Config.Keybind in config.lua.

  2. Update the RegisterKeyMapping in client/main.lua:


Example: Adding a "Toggle Light" Menu Item

Scenario: Add a "Toggle Light" menu item for mechanics.

  1. Define the Menu Item:

  1. Register the Event:

  1. Add to the Menu:


Example Scenarios

Scenario 1: Police Interaction

  1. A player with the "police" job opens the radial menu.

  2. Job-specific options (e.g., "Call Backup") appear.

  3. The player selects an action, triggering the appropriate event.

Scenario 2: Vehicle-Specific Menu

  1. A player enters a specific vehicle (e.g., "rearmount").

  2. Contextual options (e.g., "Set Ladder") are dynamically added to the menu.

  3. Upon exiting the vehicle, the options are removed.


Notes

  • Custom Logic: Add or modify menu items in Config.MenuItems or the relevant menus file.

  • Localization: Use Config.Locales for language-specific prompts.

  • Event Handling: Ensure all menu options are linked to client or server events.

Last updated