Garry's Mod

Garry's Mod

Not enough ratings
Hook Sounds
   
Award
Favorite
Favorited
Unfavorite
Content Type: Addon
Addon Type: Tool
Addon Tags: Fun
File Size
Posted
Updated
1.253 KB
12 Jul, 2024 @ 7:11am
12 Jul, 2024 @ 7:46am
2 Change Notes ( view )

Subscribe to download
Hook Sounds

Description
An addon that allows for sounds to be played when events (i.e. hooks, such as EntityTakeDamage) are triggered.

To add a hook sound entry, modify GarrysMod/garrysmod/data/hook_sounds.json. If this file does not exist, it can be created manually. In the future there may be an in-game UI for editing sound entries, but for now the file must be edited manually.

The hook_sounds.json format is as follows:
{ "shared": [ // Entries shared between client and server. Sound entry objects go here, separated by commas. ], "client": [ // Clientside only entries. Sound entry objects go here, separated by commas. ], "server": [ // Serverside only entries. Sound entry objects go here, separated by commas. ] }

The format for individual sound entry objects is as follows:
{ "hook": "<Insert event name here>", "sound": "<Insert sound path relative to sounds folder here>" }

Event names included in Garry's Mod can be found at the Garry's Mod Wiki[wiki.facepunch.com]. For the hook "GM:DoPlayerDeath", called serverside when a player dies, the event name is "DoPlayerDeath". Some addons may also add their own events.

There are also some special cases in which sounds are played differently. If the first input value of an event is an Entity (Or any other type that is an entity, such as a Player) then the sound will be played at that entity's position instead of everywhere. Other addons are able to add their own cases by hooking into the OnHookSound event, which runs whenever a hook sound is played, and passes the sound name as well as all of the input values of the triggering hook.
1 Comments
noewaeda 21 Jul, 2024 @ 4:17pm 
definitely using this