Skip to main content

Audio::stopPedRingtone

Client-side function

JavaScript​

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
});