Ui::setShowHudComponentsThisFrameBatch

From RAGE Multiplayer Wiki
Revision as of 04:23, 25 April 2024 by Shr0x (talk | contribs) (Created page with "{{ClientsideJsFunction}} {{JSContainer| === Required Params === *'''show''' {{RageType|Boolean}} *'''components''' {{RageType|Number[]}} === Return Value === *'''void''' {{RageType|void}} ==Syntax== <pre> mp.game.hud.setShowHudComponentsThisFrameBatch(show, components); </pre> ==Example== {{ClientsideCode| <syntaxhighlight lang="javascript"> const hudComponents = { HUD_WANTED_STARS: 1, HUD_WEAPON_ICON: 2, HUD_CASH: 3, HUD_MP_CASH: 4 } //hide hud comp...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Client-Side
Function

 JavaScript



JavaScript Syntax

Required Params

  • show Boolean
  • components Number[]


Return Value

  • void void

Syntax

mp.game.hud.setShowHudComponentsThisFrameBatch(show, components);

Example

Client-Side
const hudComponents = {
    HUD_WANTED_STARS: 1,
    HUD_WEAPON_ICON: 2,
    HUD_CASH: 3,
    HUD_MP_CASH: 4
}

//hide hud components
mp.game.hud.setShowHudComponentsThisFrameBatch(false, [hudComponents.HUD_CASH, hudComponents.HUD_MP_CASH, hudComponents.HUD_WANTED_STARS, hudComponents.HUD_WEAPON_ICON]);

mp.events.add('render', () => {
    mp.game.hud.applyShowHudComponentsThisFrameBatch()
});

//Show hud components after 5 seconds
setTimeout(() => {
    mp.game.hud.setShowHudComponentsThisFrameBatch(true, [hudComponents.HUD_CASH, hudComponents.HUD_MP_CASH, hudComponents.HUD_WANTED_STARS, hudComponents.HUD_WEAPON_ICON]);
}, 5000);

//or to reset hud components that you've shown just set the array to an empty array eg:
mp.game.hud.setShowHudComponentsThisFrameBatch(true, []);


See also