Audio::playPedRingtone: Difference between revisions

From RAGE Multiplayer Wiki
(yay)
No edit summary
 
Line 1: Line 1:
All found occurrences in b617d, sorted alphabetically and identical lines removed: pastebin.com/RFb4GTny<br><br>AUDIO::PLAY_PED_RINGTONE('Remote_Ring', PLAYER::PLAYER_PED_ID(), 1);<br>AUDIO::PLAY_PED_RINGTONE('Dial_and_Remote_Ring', PLAYER::PLAYER_PED_ID(), 1);<br>
{{ClientsideJsFunction}}
{{JSContainer|
 
===Required Params===
*'''ringtoneName:''' {{RageType|string}} — The name of the ringtone to be played.
*'''ped:''' {{RageType|number}} — The ID of the pedestrian (player character) who will hear the ringtone.
*'''p2:''' {{RageType|boolean}} — A boolean value indicating whether to repeat the ringtone.
 
===Return value===
*'''void''' — This function does not return a value.
 
==Syntax==
==Syntax==
<syntaxhighlight lang="javascript">mp.game.audio.playPedRingtone(ringtoneName, ped, p2);</syntaxhighlight>
=== Required Arguments ===
*'''ringtoneName:''' String
*'''ped:''' Ped handle or object
*'''p2:''' Boolean
===Return value===
*'''Undefined'''
==Example==
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
// todo
// Function to play a ringtone for the player
function playRingtoneForPlayer() {
    let ringtoneName = 'Remote_Ring'; // Ringtone name to be played
    let player = mp.players.local; // Reference to the local player
 
    // Play the ringtone for the player
    mp.game.audio.playPedRingtone(ringtoneName, player.handle, true);
 
    // Notify the player that the ringtone is playing
    mp.gui.chat.push("Playing ringtone: " + ringtoneName);
}
 
// Bind the function to a key (for example, the "E" key)
mp.keys.bind(69, false, function() { // 69 is the key code for "E"
    playRingtoneForPlayer(); // Call the function to play the ringtone
});
</syntaxhighlight>
</syntaxhighlight>
}}
===Available Ringtones===
* '''Remote_Ring'''
* '''Dial_and_Remote_Ring'''
* '''Dial_Up_Ring'''
* '''Dial_Tone_Ring'''
* '''Remote_Ring_Low'''
* '''Remote_Ring_High'''
* '''Dial_Music_Ring'''
* '''Remote_Alarm_Ring'''
* '''Remote_Alarm_Alert'''
* '''Remote_Notification_Ring'''
==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:35, 6 October 2024

Client-Side
Function

 JavaScript



JavaScript Syntax


Required Params

  • ringtoneName: string — The name of the ringtone to be played.
  • ped: number — The ID of the pedestrian (player character) who will hear the ringtone.
  • p2: boolean — A boolean value indicating whether to repeat the ringtone.

Return value

  • void — This function does not return a value.

Syntax

// Function to play a ringtone for the player
function playRingtoneForPlayer() {
    let ringtoneName = 'Remote_Ring'; // Ringtone name to be played
    let player = mp.players.local; // Reference to the local player

    // Play the ringtone for the player
    mp.game.audio.playPedRingtone(ringtoneName, player.handle, true);

    // Notify the player that the ringtone is playing
    mp.gui.chat.push("Playing ringtone: " + ringtoneName);
}

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


Available Ringtones

  • Remote_Ring
  • Dial_and_Remote_Ring
  • Dial_Up_Ring
  • Dial_Tone_Ring
  • Remote_Ring_Low
  • Remote_Ring_High
  • Dial_Music_Ring
  • Remote_Alarm_Ring
  • Remote_Alarm_Alert
  • Remote_Notification_Ring

See also