- Optional Dependencies
- https://umod.org/plugins/human-npc
Sound Library Api allows you to store & play recorded sounds for players, attach them to npcs, trigger them via in-game events
Use Sound Library API Encoder which allows you to convert any audio file to our own format (after converting the file, rename it and move it to /data/SoundLibraryApi):
Sound Library Encoder
Configuration:
Use Sound Library API Encoder which allows you to convert any audio file to our own format (after converting the file, rename it and move it to /data/SoundLibraryApi):
Sound Library Encoder
Configuration:
Code:
{
"Scheduled message interval (seconds)": 900.0,
"Speaker Distance (The higher the number, the further away is the speaker resulting in a quieter voice)": 5.0,
"Audio events": {
"ScheduledMessage": {
"Enable audio event": true,
"Global audio event (set false in order to be heard only by the player that triggered the audio event)": true,
"Audio files": [
"placeholder1",
"placeholder2"
]
},
"Welcome": {
"Enable audio event": true,
"Global audio event (set false in order to be heard only by the player that triggered the audio event)": false,
"Audio files": [
"placeholder1",
"placeholder2"
]
},
"PatrolHelicopter": {
"Enable audio event": true,
"Global audio event (set false in order to be heard only by the player that triggered the audio event)": true,
"Audio files": [
"placeholder1",
"placeholder2"
]
},
"Airdrop": {
"Enable audio event": true,
"Global audio event (set false in order to be heard only by the player that triggered the audio event)": true,
"Audio files": [
"placeholder1",
"placeholder2"
]
},
"CargoShip": {
"Enable audio event": true,
"Global audio event (set false in order to be heard only by the player that triggered the audio event)": true,
"Audio files": [
"placeholder1",
"placeholder2"
]
},
"Chinook": {
"Enable audio event": true,
"Global audio event (set false in order to be heard only by the player that triggered the audio event)": true,
"Audio files": [
"placeholder1",
"placeholder2"
]
},
"CrateHack": {
"Enable audio event": true,
"Global audio event (set false in order to be heard only by the player that triggered the audio event)": false,
"Audio files": [
"placeholder1",
"placeholder2"
]
},
"MissionStarted": {
"Enable audio event": true,
"Global audio event (set false in order to be heard only by the player that triggered the audio event)": false,
"Audio files": [
"placeholder1",
"placeholder2"
]
},
"MissionFinished": {
"Enable audio event": true,
"Global audio event (set false in order to be heard only by the player that triggered the audio event)": false,
"Audio files": [
"placeholder1",
"placeholder2"
]
},
"MissionFailed": {
"Enable audio event": true,
"Global audio event (set false in order to be heard only by the player that triggered the audio event)": false,
"Audio files": [
"placeholder1",
"placeholder2"
]
}
}
}
[CENTER]Language:[/CENTER]
[code]{
"NoPermission": "<color=#e3e3e3>You do not have permission to use this command</color>",
"AlreadyRecording": "<color=#e3e3e3>You're already recording. Please save or cancel your previous recording before starting a new one.</color>",
"InvalidAddSyntax": "<color=#e3e3e3>Invalid Syntax. Ex: <color=#de8732>/sl add soundname</color></color>",
"AddAlreadyExists": "<color=#e3e3e3>This sound already exists. </color><color=#e3e3e3>Please add <color=#de8732>overwrite</color> to your arguments to allow overwriting an existing sound.</color><color=#e3e3e3>Ex: <color=#de8732>sl add {{0}} overwrite</color></color>",
"AddRecording": "<color=#e3e3e3>You can now start recording.\n</color><color=#e3e3e3>The recording will automatically start once your start sending audio.\n</color><color=#e3e3e3>Once you have completed you can use <color=#de8732>/sl save</color> or <color=#de8732>/sl cancel</color>.\n</color><color=#e3e3e3>You can listen to your recording using <color=#de8732>/sl play</color>\n</color><color=#e3e3e3>If you want to rerecord your recording use <color=#de8732>/sl reset</color></color>",
"NotRecording": "<color=#e3e3e3>You're not currently recording.</color>",
"RecordingSaved": "<color=#e3e3e3>We have saved your recording as '{0}'</color>",
"CanceledRecording": "<color=#e3e3e3>We have canceled your recording</color>",
"ResetRecording": "<color=#e3e3e3>Your recording has been reset.</color>",
"PlayInvalidSyntax": "<color=#e3e3e3>Invalid Syntax. Ex: <color=#de8732>/sl play soundname</color> - to play the sound with the given name.</color>",
"NoSoundFileFound": "<color=#e3e3e3>No sound file found with name '{0}'</color>",
"HelpText": "<color=#e3e3e3>Allows players to record sound that can be played back to a player\n<color=#de8732>/sl add soundname</color> - to start the creation of a new sound.\n<color=#de8732>/sl npc add hookActionType fileName</color> - to add one or more filenames to a human npc (hook action types are: <color=#de8732>OnUseNPC/OnEnterNPC/OnLeaveNPC/OnHitNPC</color>)\n<color=#de8732>/sl npc remove hookActionType fileName</color> - to remove a filename from a human npc (hook action types are: <color=#de8732>OnUseNPC/OnEnterNPC/OnLeaveNPC/OnHitNPC</color>)\n<color=#de8732>/sl save</color> - to save your recorded sound.\n<color=#de8732>/sl reset</color> - to clear your current recording.\n<color=#de8732>/sl cancel</color> - to cancel your recording and not save.\n<color=#de8732>/sl play</color> - to player your current recording back to you.\n<color=#de8732>/sl</color> - to view this help text again.</color>",
"AudioMessagesHelpText": "<color=#e3e3e3><color=#66B2FF>/audio send playerName audioName</color> - Sends an audio message to a player</color>\n<color=#e3e3e3><color=#66B2FF>/audio sendall audioName</color> - Sends an audio message to everyone on the server\n<color=#e3e3e3><color=#66B2FF>/audio sendlooped playerName audioName 2 (loop times amount)</color> - Sends a looped audio message to a player\n<color=#e3e3e3><color=#66B2FF>/audio sendalllooped audioName 2 (loop times amount)</color> - Sends a looped audio message to everyone on the server\n<color=#e3e3e3><color=#66B2FF>/audio files</color> - Shows a list of all audio files on the server\n<color=#e3e3e3><color=#66B2FF>/sl</color> - Shows the help page for the Sound Library API\n<color=#e3e3e3><color=#66B2FF>/audio help</color> - Shows these help messages",
"PlayingText": "<color=#e3e3e3>Playing the file with the name of <color=#de8732>{0}</color></color>",
"PlayingAudioMessageText": "<color=#e3e3e3>Playing the file with the name of <color=#66B2FF>{0}</color></color>",
"InvalidTarget": "<color=#e3e3e3>Invalid target, try using his steamid/name</color>",
"NullFileName": "<color=#e3e3e3>This file name is null, use /audio files</color>",
"AvailableFileNames": "<color=#e3e3e3>Available files:\n<color=#66B2FF>{0}</color></color>",
"FileNameNotFound": "<color=#e3e3e3><color=#66B2FF>{0}</color> does not exist, use <color=#66B2FF>/audio files</color></color>",
"NpcNotFound": "<color=#e3e3e3>Couldn't find any human npc, make sure you have created one using <color=#de8732>/npc_add</color> and you are looking at it!</color>",
"InvalidHookActionType": "<color=#e3e3e3><color=#de8732>{0}</color> is invalid, list of hook action types:<color=#de8732>\nOnUseNPC\nOnEnterNPC\nOnLeaveNPC\nOnHitNPC</color></color>",
"NpcSoundAdded": "<color=#e3e3e3><color=#de8732>{0}</color> was added and will play when <color=#66B2FF>{1}</color> is triggered</color>",
"NpcSoundRemoved": "<color=#e3e3e3><color=#de8732>{0}</color> was removed from this NPC!</color>",
"FileNameAlreadyAdded": "<color=#e3e3e3><color=#de8732>{0}</color> was already added to this NPC!</color>"
}
Human NPC Integration example:
Code:
{
"Npc Data": {
"303133854": {
"Action type of the npc & Filenames that are played": {
"OnUseNPC": [
"testing",
"testing"
]
}
},
"986905907": {
"Action type of the npc & Filenames that are played": {
"OnEnterNPC": [
"testing"
]
}
},
"1543143931": {
"Action type of the npc & Filenames that are played": {
"OnHitNPC": [
"messagesound"
]
}
},
"1205925446": {
"Action type of the npc & Filenames that are played": {
"OnUseNPC": [
"testing",
"pop"
],
"OnHitNPC": [
"testing"
]
}
},
"45461627": {
"Action type of the npc & Filenames that are played": {
"OnUseNPC": [
"messagesound"
],
"OnHitNPC": [
"messagesound"
]
}
},
"942954162": {
"Action type of the npc & Filenames that are played": {
"OnHitNPC": [
"waveeffect",
"messagesound"
],
"OnEnterNPC": [
"messagesound"
]
}
}
}
}
Recording & Playing Audio Files Video:
Permissions:
soundlibraryapi.use - In order to use /sl
soundlibraryapi.audio - In order to use /audio
Console Command:
audio.message