plunkettscott / interact-sound

A resource providing the ability to play sounds using the FiveM NUI environment.
https://plunkettscott.gitbooks.io/scott-s-script-documentation/content/scripts/interactsound.html
MIT License
63 stars 129 forks source link

question #12

Closed LASTMAN770 closed 4 years ago

LASTMAN770 commented 4 years ago

please help me over here

so if i want the sound to play if the player is close to a center area

what should i change here

RegisterNetEvent('InteractSound_CL:PlayWithinDistance') AddEventHandler('InteractSound_CL:PlayWithinDistance', function(playerNetId, maxDistance, soundFile, soundVolume) local lCoords = GetEntityCoords(GetPlayerPed(-1)) local eCoords = GetEntityCoords(GetPlayerPed(GetPlayerFromServerId(playerNetId))) local distIs = Vdist(lCoords.x, lCoords.y, lCoords.z, eCoords.x, eCoords.y, eCoords.z) if(distIs <= maxDistance) then SendNUIMessage({ transactionType = 'playSound', transactionFile = ENTER.ogg, transactionVolume = 1.0 }) end end)

lets say the audio should start playing when a player is close to this cords

1311.6092529297,625.64227294922,80.577026367188 where do i put it and from where can i change the max distance ?

sorry i'm still learning