Play Custom Sounds - London Studios - FiveMods
Goodbye, old look! Hello, new look!
We would like to inform you that FiveMods implemented exciting updates and improvements to enhance your experience on the new released rework.
Visit us here: www.fivemods.net.
This website is only accessible with limited features. Restricted features: Upload, Login, Partner program



Play Custom Sounds - London Studios

Downloads: 453 | Uploaded: 14. Apr 2021

(0)
Free download ScriptsSounds LondonStudios Custom Play OGG WAV MP3

Description

PlayCustomSounds is a standalone FiveM Resource allowing you to play external sounds in your FiveM server from other resources and scripts. Four main functions:

1. Play sounds to all players

2. Play sounds to a specified player

3. Play sounds to a specified player and all players in a certain radius, including a reduction in volume the further away you are.

4. Play sounds to a set 3D coordinate, and all players in a radius, including a volume reduction the further away you are.

This resource works by the triggering of ServerEvents from external scripts, the possibilities are endless, you may choose to play a sound upon a player entering a vehicle, or even play sounds in a certain area of the map such as a custom fire alarm or sound. This is similar to a Lua plugin for external sounds, however this version has more functionality.

Please use the documentation below on how to install and use this in your resources. You may call these external ServerEvents from any FiveM supported language. Any bugs or feedback is greatly appreciated in the thread and we will support any queries with installations or those requiring assistance.

# 1. Installation

Any external resources triggering ServerEvents handled by this resource (<b>playCustomSounds</b>) will require the server to have this installed. The installation comes with a FiveM-Ready “fxmanifest.lua” file. This should be placed in the server resources file, and ensure you start “playcustomsounds” in server.cfg.

IMPORTANT: The resource name must remain lowercase, this is due to an interaction with the FiveM NUI function requiring this for DNS purposes.

2. Installing custom sounds

All custom sounds must be in the “.ogg” format. Online converters can be used to format files this way. Place all custom sounds in the <b>“html/sounds/”</b> folder in the <b>"playcustomsounds"</b> resource folder.

3. Triggering Custom Sounds

After the PlayCustomSounds resource is on the server, you will have the ability to <b>TriggerServerEvents</b> from any other resource, including ones you create.

These are all Server Events, and triggered from a Client resource file.

(examples, client.lua or Client.net.dll)

NOTES:

- The specified volume must be at a maximum of 1.0 and must be as a float value.

- The specified sound file to play must not include .ogg, this is automatically added!

- The dynamic volume (further away you are), is automatic but requires a base volume.

- The distance (or radius) is a float value, it is worth testing this out in-game

Play sound to all players - “Server:SoundToAll”

Play a sound to all players on the server

Format:

```

TriggerServerEvent(“Server:SoundToAll”, soundFile, soundVolume);

```

soundFile = String, soundVolume = Float

Example:

```

TriggerServerEvent(“Server:SoundToAll”, “example”, 1.0f);

```

This would play the “example.ogg” sound at Volume 1.0 to all players.

(Note: The f after 1.0 is used in C# programming to declare a float.)

Play sound to client - “Server:SoundToClient”

Play a sound to a specified client based on NetworkID. (Not other players nearby)

Format:

```

TriggerServerEvent(“Server:SoundToClient”, networkId, soundFile, soundVolume);

```

networkId = Specified Player, soundFile = String, soundVolume = Float

Example:

TriggerServerEvent(“Server:SoundToClient”, networkId, “example”, 1.0f);

This would play the “example.ogg” sound at Volume 1.0 to the player with “networkId”.

(Note: The f after 1.0 is used in C programming to declare a float.)

Play sound to player and radius - “Server:SoundToRadius”

Play a sound to the specified player based on NetworkID and all players in a specified radius to the player, reducing the volume based on distance from the player.

Format:

```

TriggerServerEvent(“Server:SoundToRadius”, networkId, soundRadius, soundFile, soundVolume”);

```

networkId = Specified Player, soundRadius = Float, soundFile = String, soundVolume = Float

Example:

```

TriggerServerEvent(“Server:SoundToRadius”, networkId, 20.0f, “example”, 1.0f);

```

(Note: The f after 1.0 is used in C# programming to declare a float.)

This would play the “example.ogg” sound at Volume 1.0 to the player with “networkId” and all players in a 20.0 float radius, reducing the volume based on distance.

Play sound to coords and radius - “Server:SoundToCoords”

Play a sound to the specified coordinates (3D) and all players in a specified radius, reducing the volume based on distance from the coordinates.

Format:

```

TriggerServerEvent(“Server:SoundToCoords”, positionX, positionY, positionZ, soundRadius, soundFile, soundVolume);

```

positionX, positionY, positionZ = Floats, soundRadius = Float, soundFile = String, soundVolume = Float.

Example:

```

TriggerServerEvent(“Server:SoundToCoords”, positionX, positionY, positionZ, 20.0f, “example”, 1.0f);

```

(Note: The f after 1.0 is used in C# programming to declare a float.)

This would play the “example.ogg” sound at the specified coordinates at volume 1.0 and all players in a 20.0 float radius, reducing the volume based on distance.

One way these coordinates can be declared prior is through the use of Vector3, a FiveM Native Function, you can then enter positionX, positionY and positionZ as parameters.

Licence Information

© 2020 - London Studios

This plugin may be freely distributed however the source code should not be modified or changed without obtained permission from London Studios.

Credit must be given when redistributing or using as part of external resources.

Other mods from this creator

https://storage.fivemods.net/uploads/1/hfgU5Qz73v4H/img/43PF51glKwR0JyUG7jzx1.png-Image (display)
What3Words (W3W)

This free resource is a great addition to any roleplay server, allowing the use of What3Words inside FiveM. Instead of coordinates...

https://storage.fivemods.net/uploads/1/RjqgtpiQW9s5/img/BD1w4WkJHc0VXNFRUfIi7.png-Image (display)
CustodyAlarm - London Studios

CustodyAlarm is a **FiveM** resource allowing you to activate custody alarms at custody stations. The locations can be fully custo...

https://storage.fivemods.net/uploads/1/Ao7Z5ycabErB/img/yznZMkJAD1ibmLx6Fov97.png-Image (display)
SearchHandler - London Studios

This plugin is designed to enhance the player search experience for your FiveM server, a simple resource allowing players to set t...

https://storage.fivemods.net/uploads/1/TrMyFQzUvuxl/img/SiCcQDEKF6bR2nm4GaLH7.png-Image (display)
SmartSounds - London Studios

**SmartSounds** is a FiveM resource allowing you to play custom sounds in-game to players nearby, featuring an easy to configure "...

https://storage.fivemods.net/uploads/1/MBs68Q5qnelP/img/o465cFg9S1VLOWHyfnrv7.png-Image (display)
SmartTester - London Studios

SmartObservations is a FiveM resource enhancing the roadside testing experience. The resource includes a customisable **Bre...

https://storage.fivemods.net/uploads/1/NPZY4tzcDQiF/img/S6IvZeG9wTgkLoUa2s1N7.png-Image (display)
SmartObservations - London Studios

SmartObservations is a FiveM resource which enhances the experience of taking and working with **medical observations** (eg, Heart...

https://storage.fivemods.net/uploads/1/nCafPcDXOjt6/img/yD8vji1NRwLB9Ugzkhe0l.jpg-Image (display)
Police Handbook

This modification implements a British Police Handbook into FiveM (Server Side). The command /handbook is used to display a list o...

https://storage.fivemods.net/uploads/1/NGDOafM6lpZb/img/wHlxLkV2UgGsbA5fzDCZ7.png-Image (display)
Vehicle Objects - London Studios

**Vehicle Objects** is a FiveM resource allowing you to add objects such as learner plates, pass plates and parking tickets...

https://storage.fivemods.net/uploads/1/TPtNIqSeybZp/img/s7Ta0Dm3JANoHG5yFP6K1.png-Image (display)
ActivateAlarm - LondonStudios

A FiveM resource used to activate a custom alarm sound in an area. This uses another resource called PlayCustomSounds, a standalon...