Skip to content

Voice

This page documents hooks in the voice category.


GetPlayerDeathSound(client, isFemale)View Source

Purpose

Allows plugins or modules to override the death sound selected for a player.

Category

Voice

Realm

Server

Parameters

Player client The player whose death sound is being resolved.

boolean isFemale Whether the player should use the female sound set.

Returns

string|nil Return a sound path or sound object to override the death sound. Returning nil allows the default behavior to continue.

Example Usage

  hook.Add("GetPlayerDeathSound", "liaExampleGetPlayerDeathSound", function(client, isFemale)
      if client:isStaffOnDuty() then
          return "vo/npc/male01/pain07.wav"
      end
  end)

GetPlayerPainSound(client, paintype, isFemale)View Source

Purpose

Allows plugins or modules to override the pain sound selected for a player.

Category

Voice

Realm

Server

Parameters

Player client The player whose pain sound is being resolved.

string paintype The pain context being resolved, such as `hurt` or `drown`.

boolean isFemale Whether the player should use the female sound set.

Returns

string|nil Return a sound path or sound object to override the pain sound. Returning nil allows the default behavior to continue.

Example Usage

  hook.Add("GetPlayerPainSound", "liaExampleGetPlayerPainSound", function(client, paintype, isFemale)
      if paintype == "drown" then
          return "player/pl_drown1.wav"
      end
  end)

ModifyVoiceIndicatorText(client, voiceText, voiceType)View Source

Purpose

Allows plugins or modules to replace the text shown on the local voice indicator.

Category

Voice

Realm

Client

Parameters

Player client The local speaking player.

string voiceText The text that will be drawn on the voice indicator.

string voiceType The current voice range mode.

Returns

string|nil Return a replacement string to override the indicator text. Returning nil allows the default text to be used.

Example Usage

  hook.Add("ModifyVoiceIndicatorText", "liaExampleModifyVoiceIndicatorText", function(client, voiceText, voiceType)
      if voiceType == "yelling" then
          return voiceText .. " [Broadcast]"
      end
  end)

OnDeathSoundPlayed(client, deathSound)View Source

Purpose

Runs after a death sound has been emitted for a player.

Category

Voice

Realm

Server

Parameters

Player client The player who emitted the death sound.

string deathSound The sound that was played.

Example Usage

  hook.Add("OnDeathSoundPlayed", "liaExampleOnDeathSoundPlayed", function(client, deathSound)
      lia.log.add(client, "deathSoundPlayed", deathSound)
  end)

OnPainSoundPlayed(entity, painSound)View Source

Purpose

Runs after a pain sound has been emitted for a player.

Category

Voice

Realm

Server

Parameters

Player entity The player who emitted the pain sound.

string painSound The sound that was played.

Example Usage

  hook.Add("OnPainSoundPlayed", "liaExampleOnPainSoundPlayed", function(entity, painSound)
      lia.log.add(entity, "painSoundPlayed", painSound)
  end)

OverrideVoiceHearingStatus(listener, speaker, canHear)View Source

Purpose

Allows plugins or modules to override cached voice hearing checks for a listener and speaker pair.

Category

Voice

Realm

Server

Parameters

Player listener The player whose hearing result is being computed.

Player speaker The speaking player being checked.

boolean canHear The current range-based hearing result.

Returns

boolean|nil Return true or false to override whether the listener can hear the speaker. Returning nil allows the default behavior to continue.

Example Usage

  hook.Add("OverrideVoiceHearingStatus", "liaExampleOverrideVoiceHearingStatus", function(listener, speaker, canHear)
      if listener:isStaffOnDuty() then
          return true
      end
  end)

ShouldPlayDeathSound(client, deathSound)View Source

Purpose

Allows plugins or modules to block player death sound selection or the final death sound playback.

Category

Voice

Realm

Server

Parameters

Player client The player whose death sound is being processed.

string deathSound optional The resolved sound that is about to be emitted. This is nil during the earlier selection check in `GetPlayerDeathSound`.

Returns

boolean|nil Return false to stop the death sound flow at the current stage. Returning nil allows the default behavior to continue.

Example Usage

  hook.Add("ShouldPlayDeathSound", "liaExampleShouldPlayDeathSound", function(client, deathSound)
      if client:isStaffOnDuty() then
          return false
      end
  end)

ShouldPlayPainSound(client, painContextOrSound)View Source

Purpose

Allows plugins or modules to block player pain sound selection or the final pain sound playback.

Category

Voice

Realm

Server

Parameters

Player client The player whose pain sound is being processed.

string painContextOrSound Either the requested pain context such as `hurt` or `drown`, or the resolved sound path that is about to be emitted.

Returns

boolean|nil Return false to stop the pain sound flow at the current stage. Returning nil allows the default behavior to continue.

Example Usage

  hook.Add("ShouldPlayPainSound", "liaExampleShouldPlayPainSound", function(client, painContextOrSound)
      if painContextOrSound == "drown" then
          return false
      end
  end)