Ui::setHeadDisplayWanted: Difference between revisions

From RAGE Multiplayer Wiki
No edit summary
No edit summary
 
Line 1: Line 1:
displays wanted star above head
{{ClientsideJsFunction}}
==Syntax==
{{JSContainer|
<syntaxhighlight lang="javascript">mp.game.ui.setHeadDisplayWanted(headDisplayId, wantedlvl);</syntaxhighlight>
 
=== Required Arguments ===
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.
*'''headDisplayId:''' int
 
*'''wantedlvl:''' int
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.
===Return value===
 
*'''Undefined'''
=== Required Params ===
==Example==
* '''headDisplayId:''' {{RageType|int}} – The display ID representing the player or entity whose wanted level should be displayed.
* '''wantedlvl:''' {{RageType|int}} – The wanted level to display (0–5), with 0 hiding the icon.
 
=== Return Value ===
* '''Undefined''' – This function does not return a value.
 
== Syntax ==
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
// todo
mp.game.ui.setHeadDisplayWanted(headDisplayId, wantedlvl);
</syntaxhighlight>
</syntaxhighlight>
==See also==
 
== Example ==
<syntaxhighlight lang="javascript">
// 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.`);
</syntaxhighlight>
}}
== See Also ==
{{Ui_s_function_c}}
{{Ui_s_function_c}}
[[Category:Clientside API]]
[[Category:Clientside API]]
[[Category:UI API]]
[[Category:UI API]]
[[Category:TODO: Example]]
[[Category:TODO: Example]]

Latest revision as of 09:31, 2 November 2024

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