Sound¶
Client-seitige Soundwiedergabe über NUI. Unterstützt positionsbasierte, Entity-gebundene, Spieler- und Frontend-Sounds.
Übersicht¶
Das Sound-Modul leitet Anfragen an die HUD-NUI weiter, die mithilfe der Web Audio API räumliche Sounds abspielt. Alle Funktionen sind nur clientseitig verfügbar.
API¶
-- Sound an Position
cv.playSound(soundName, soundSet, x, y, z, range)
-- x/y/z optional → nutzt Spielerposition wenn nil
-- range: Hörweite in Metern (Standard: 50.0)
-- Sound auf Entity (Ped oder Fahrzeug)
cv.playSoundOnEntity(soundName, soundSet, entityHandle)
-- Sound vom Spieler aus
cv.playSoundFromPlayer(soundName, soundSet, range)
-- range: Standard 50.0
-- Frontend-Sound (kein räumlicher Kontext)
cv.playFrontendSound(soundName, soundSet)
Beispiele¶
-- Sirene an aktueller Position
cv.playSoundFromPlayer('SIRENE_1', 'DLC_HEIST_BIOLAB_PROP_SOUNDS')
-- Explosion-Sound an Zielposition
local coords = GetEntityCoords(someVehicle)
cv.playSound('EXP_TAG_BARREL', 'WEB_RACEPACK', coords.x, coords.y, coords.z, 100.0)
-- Sound auf Fahrzeug heften
cv.playSoundOnEntity('CAR_HORN', 'HUD_MINI_GAME_SOUNDSET', GetVehiclePedIsIn(PlayerPedId(), false))
-- UI-Bestätigungs-Sound
cv.playFrontendSound('SELECT', 'HUD_FREEMODE_SOUNDSET')
Sound Sets (Beispiele)¶
FiveM-/GTA-V-Audio-Bibliotheken — vollständige Liste in den GTA-Natives:
| Sound Set | Beschreibung |
|---|---|
HUD_FREEMODE_SOUNDSET |
HUD-UI-Sounds (SELECT, BACK, …) |
HUD_MINI_GAME_SOUNDSET |
Minigame-Sounds |
DLC_HEIST_BIOLAB_PROP_SOUNDS |
Heist-Props (Sirenen, …) |
WEB_RACEPACK |
Renn-Sounds |
GTAO_FM_Events_Soundset |
Freeroam-Events |