Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Citizen.CreateThread(function()
- while true do
- Citizen.Wait(100)
- local veh = GetVehiclePedIsIn(GetPlayerPed(-1))
- local height = GetEntityHeightAboveGround(veh)
- if GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "POLMAV" then
- if (height > 75) then
- local lCoords = GetEntityCoords(veh)
- TriggerServerEvent('Server:NPAS', lCoords, height)
- else
- TriggerServerEvent('Server:NPASstop')
- end
- end
- end
- end)
- RegisterNetEvent('Client:NPAS')
- AddEventHandler('Client:NPAS', function(lCoords, height)
- local nCoords = GetEntityCoords(GetPlayerPed(-1))
- local hDist = GetDistanceBetweenCoords(lCoords.x, lCoords.y, lCoords.z, nCoords.x, nCoords.y, nCoords.z, false)
- local soundVolume = 0.35
- if (hDist > 0.8) then
- if (height < 150) then
- vDist = 1-((150-height)/75)
- elseif (height > 150) and (height < 330) then
- vDist = ((330-height)/180)
- end
- local hVol = 1-(hDist/500)
- soundVolume = soundVolume*vDist*hVol
- SendNUIMessage({
- transactionType = 'npas',
- transactionVolume = soundVolume
- })
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement