Ui::setHeadDisplayWanted

From RAGE Multiplayer Wiki

Client-Side
Function

 JavaScript



JavaScript Syntax


The `setHeadDisplayWanted` function displays a wanted star icon above a specified player's head, indicating their wanted level. This function is useful for displaying visual cues above a player's head to signify their wanted status in roleplay or law enforcement scenarios.

The wanted level can range from 0 (no stars) to 5 (maximum wanted level), and it provides other players with a clear visual indicator of someone’s wanted status, enhancing the realism and interaction possibilities within gameplay.

Required Params

  • headDisplayId: int – The display ID representing the player or entity whose wanted level should be displayed.
  • wantedlvl: int – The wanted level to display (0–5), with 0 hiding the icon.

Return Value

  • Undefined – This function does not return a value.

Syntax

mp.game.ui.setHeadDisplayWanted(headDisplayId, wantedlvl);

Example

// Example usage of setHeadDisplayWanted

const headDisplayId = player.handle; // Get the display ID for the current player
const wantedLevel = 3;               // Set desired wanted level (e.g., 3 stars)

// Display 3 wanted stars above the player's head
mp.game.ui.setHeadDisplayWanted(headDisplayId, wantedLevel);

// Confirm the action in chat
mp.gui.chat.push(`Wanted level set to ${wantedLevel} for player.`);


See Also