Audio::isPedRingtonePlaying
JavaScript
Required Params
- ped: number — The ID of the pedestrian (player character) to check if the ringtone is playing.
Return value
- boolean — Returns true if the ringtone is currently playing for the specified pedestrian, otherwise returns false.
Syntax
// Function to check if a ringtone is playing for the player
function checkRingtoneStatus() {
let player = mp.players.local; // Reference to the local player
// Check if a ringtone is playing for the player
let isPlaying = mp.game.audio.isPedRingtonePlaying(player.handle);
// Notify the player about the ringtone status
if (isPlaying) {
mp.gui.chat.push("A ringtone is currently playing.");
} else {
mp.gui.chat.push("No ringtone is currently playing.");
}
}
// Bind the function to a key (for example, the "E" key)
mp.keys.bind(69, false, function() { // 69 is the key code for "E"
checkRingtoneStatus(); // Call the function to check ringtone status
});