26 lines
1.3 KiB
Lua
26 lines
1.3 KiB
Lua
|
RegisterNetEvent('InteractSound_SV:PlayOnOne', function(clientNetId, soundFile, soundVolume)
|
||
|
TriggerClientEvent('InteractSound_CL:PlayOnOne', clientNetId, soundFile, soundVolume)
|
||
|
end)
|
||
|
|
||
|
RegisterNetEvent('InteractSound_SV:PlayOnSource', function(soundFile, soundVolume)
|
||
|
TriggerClientEvent('InteractSound_CL:PlayOnOne', source, soundFile, soundVolume)
|
||
|
end)
|
||
|
|
||
|
RegisterNetEvent('InteractSound_SV:PlayOnAll', function(soundFile, soundVolume)
|
||
|
TriggerClientEvent('InteractSound_CL:PlayOnAll', -1, soundFile, soundVolume)
|
||
|
end)
|
||
|
|
||
|
RegisterNetEvent('InteractSound_SV:PlayWithinDistance', function(maxDistance, soundFile, soundVolume)
|
||
|
TriggerClientEvent('InteractSound_CL:PlayWithinDistanceOS', -1, GetEntityCoords(GetPlayerPed(source)), maxDistance, soundFile, soundVolume)
|
||
|
end)
|
||
|
|
||
|
RegisterNetEvent('InteractSound_SV:PlayWithinDistance', function(maxDistance, soundFile, soundVolume)
|
||
|
local src = source
|
||
|
local DistanceLimit = 300
|
||
|
if maxDistance < DistanceLimit then
|
||
|
TriggerClientEvent('InteractSound_CL:PlayWithinDistance', -1, GetEntityCoords(GetPlayerPed(src)), maxDistance, soundFile, soundVolume)
|
||
|
else
|
||
|
print(('[interact-sound] [^3WARNING^7] %s attempted to trigger InteractSound_SV:PlayWithinDistance over the distance limit ' .. DistanceLimit):format(GetPlayerName(src)))
|
||
|
end
|
||
|
end)
|