Audio::stopPedRingtone: Difference between revisions

From RAGE Multiplayer Wiki
(Created page with " {{ClientsideJsFunction}} {{JSContainer| ===Required Params=== *'''ped:''' {{RageType|number}} ===Return value=== *''' {{RageType|void}} ''' ==Syntax== <syntaxhighlight lang="javascript"> mp.game.audio.stopPedRingtone(ped) </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|


===Required Params===
===Required Params===
*'''ped:''' {{RageType|number}}
*'''ped:''' {{RageType|number}} — The ID of the pedestrian (player character) whose ringtone will be stopped.


===Return value===
===Return value===
*''' {{RageType|void}} '''
*'''void''' — This function does not return a value.


==Syntax==
==Syntax==
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
mp.game.audio.stopPedRingtone(ped)
// Function to stop the ringtone for the player
</syntaxhighlight>
function stopRingtoneForPlayer() {
    let player = mp.players.local; // Reference to the local player
 
    // Stop the ringtone for the player
    mp.game.audio.stopPedRingtone(player.handle);
 
    // Notify the player that the ringtone has been stopped
    mp.gui.chat.push("Stopped ringtone.");
}


==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
    stopRingtoneForPlayer(); // Call the function to stop the ringtone
});
</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:40, 6 October 2024

Client-Side
Function

 JavaScript



JavaScript Syntax


Required Params

  • ped: number — The ID of the pedestrian (player character) whose ringtone will be stopped.

Return value

  • void — This function does not return a value.

Syntax

// Function to stop the ringtone for the player
function stopRingtoneForPlayer() {
    let player = mp.players.local; // Reference to the local player

    // Stop the ringtone for the player
    mp.game.audio.stopPedRingtone(player.handle);

    // Notify the player that the ringtone has been stopped
    mp.gui.chat.push("Stopped ringtone.");
}

// Bind the function to a key (the "E" key)
mp.keys.bind(69, false, function() { // 69 is the key code for "E"
    stopRingtoneForPlayer(); // Call the function to stop the ringtone
});


See also