Audio::isMobilePhoneCallOngoing

From RAGE Multiplayer Wiki
Revision as of 20:43, 6 October 2024 by Caballero (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Client-Side
Function

 JavaScript



JavaScript Syntax


Return value

  • boolean — Returns `true` if a mobile phone call is currently ongoing, otherwise returns `false`.

Syntax

// Function to check if a mobile phone call is ongoing
function checkMobilePhoneCall() {
    // Check if a mobile phone call is ongoing
    let isCallOngoing = mp.game.audio.isMobilePhoneCallOngoing();

    // Notify the player about the call status
    if (isCallOngoing) {
        mp.gui.chat.push("You are currently on a phone call.");
    } else {
        mp.gui.chat.push("You are not on a phone call.");
    }
}

// Bind the function to a key (the "E" key)
mp.keys.bind(69, false, function() { // 69 is the key code for "E"
    checkMobilePhoneCall(); // Call the function to check the phone call status
});


See also