Audio::stopPedRingtone

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

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