Audio::isMobilePhoneCallOngoing: Difference between revisions

From RAGE Multiplayer Wiki
(Created page with " {{ClientsideJsFunction}} {{JSContainer| ===Return value=== *''' {{RageType|boolean}} ''' ==Syntax== <syntaxhighlight lang="javascript"> mp.game.audio.isMobilePhoneCallOngoing() </syntaxhighlight> ==Example== <syntaxhighlight lang="javascript"> //todo </syntaxhighlight> }} ==See also== {{Audio_s_function_c}} Category:Clientside API Category:TODO: Example")
 
No edit summary
 
Line 1: Line 1:
{{ClientsideJsFunction}}
{{ClientsideJsFunction}}
{{JSContainer|
{{JSContainer|


===Return value===
===Return value===
*''' {{RageType|boolean}} '''
*'''boolean''' — Returns `true` if a mobile phone call is currently ongoing, otherwise returns `false`.


==Syntax==
==Syntax==
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
mp.game.audio.isMobilePhoneCallOngoing()
// Function to check if a mobile phone call is ongoing
</syntaxhighlight>
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.");
    }
}


==Example==
// Bind the function to a key (the "E" key)
<syntaxhighlight lang="javascript">
mp.keys.bind(69, false, function() { // 69 is the key code for "E"
//todo
    checkMobilePhoneCall(); // Call the function to check the phone call status
});
</syntaxhighlight>
</syntaxhighlight>
}}
}}
==See also==
==See also==
{{Audio_s_function_c}}
{{Audio_functions_c}}
[[Category:Clientside API]]
[[Category:Clientside API]]
[[Category:TODO: Example]]
[[Category:TODO: Example]]

Latest revision as of 20:43, 6 October 2024

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