Audio::playPedRingtone

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

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