From 572ced8387b8defafea6820dced3e23b245b2eda Mon Sep 17 00:00:00 2001 From: jenz Date: Sat, 15 Aug 2026 12:36:00 +0200 Subject: [PATCH] had forgotten these two files --- .../translations/zombiereloaded.phrases.txt | 1229 +++++++++++++++++ src/zr/soundeffects/volumecontrol.inc | 408 ++++++ 2 files changed, 1637 insertions(+) create mode 100644 cstrike/addons/sourcemod/translations/zombiereloaded.phrases.txt create mode 100644 src/zr/soundeffects/volumecontrol.inc diff --git a/cstrike/addons/sourcemod/translations/zombiereloaded.phrases.txt b/cstrike/addons/sourcemod/translations/zombiereloaded.phrases.txt new file mode 100644 index 0000000..b61afb0 --- /dev/null +++ b/cstrike/addons/sourcemod/translations/zombiereloaded.phrases.txt @@ -0,0 +1,1229 @@ +"Phrases" +{ + // =========================== + // General (base) + // =========================== + + "General round objective" + { + "en" "The game is @greenHumans vs. Zombies@default, the goal for zombies is to infect all humans by knifing them." + } + + "General zmenu reminder" + { + "#format" "{1:s},{2:s}" + "en" "For help on Zombie:Reloaded commands, type \"{1}{2}\" in chat." + } + + // =========================== + // Generic (base) + // =========================== + + // General + + "Literal text" + { + "#format" "{1:s}" + "en" "{1}" + } + // Set string to "{1}" for all languages. + + "Feature is disabled" + { + "en" "This feature is currently disabled by the server host." + } + + "Not enough money" + { + "en" "You do not have enough money to buy this item." + } + + "Must be player" + { + "en" "This feature is reserved for players only." + } + + "Must be admin" + { + "en" "This feature is reserved for admins only." + } + + "No access to command" + { + "en" "You do not have access to this command." + } + + "Must be alive" + { + "en" "This feature requires that you are alive." + } + + "Must be dead" + { + "en" "This feature requires that you are dead." + } + + "Must be on team" + { + "en" "This feature requires that you are on a team." + } + + "Must be zombie" + { + "en" "This feature requires that you are a zombie." + } + + "Must be human" + { + "en" "This feature requires that you are a human." + } + + "Must be in buyzone" + { + "en" "This feature requires that you are in a buyzone." + } + + "Increase by" + { + "#format" "{1:s}" + "en" "Increase by {1}" + } + + "Decrease by" + { + "#format" "{1:s}" + "en" "Decrease by {1}" + } + + "Current Value" + { + "en" "Current value:" + } + + "Zombie" + { + "en" "Zombie" + } + + "Human" + { + "en" "Human" + } + + // Menu + + "Menu empty" + { + "en" "(Empty)" + } + + // =========================== + // Config (core) + // =========================== + + // Commands + + "Config command reload syntax" + { + "en" "Syntax: zr_reloadconfig [file alias2] ... - Reloads a config file." + } + + "Config command reload related commands" + { + "en" "Related command(s): zr_config_reloadall" + } + + "Config command reload syntax aliases" + { + "#format" "{1:s},{2:s},{3:s},{4:s},{5:s}" + "en" "File Aliases:\n* \"{1}\"\n* \"{2}\"\n* \"{3}\"\n* \"{4}\"\n* \"{5}\"" + } + + "Config command reload invalid" + { + "#format" "{1:s}" + "en" "Invalid file alias: \"{1}\"" + } + + "Config command reload not loaded" + { + "#format" "{1:s}" + "en" "Config file \"{1}\" failed to load. (Either disabled or invalid file content.)" + } + + "Config command reload all stats begin" + { + "en" "Reloading all Zombie:Reloaded config files...\n------------------------------------------------" + } + + "Config command reload all stats successful" + { + "#format" "{1:s}" + "en" "\"{1}\" - Successful." + } + + "Config command reload all stats failed" + { + "#format" "{1:s}" + "en" "\"{1}\" - Failed. (Either disabled or invalid file content.)" + } + + // =========================== + // Log (core) + // =========================== + + "Log Generic Flag" + { + // Max length: 19 characters. + "en" "Generic Flag:" + } + + "Log Value" + { + // Max length: 7 characters: + "en" "Value:" + } + + "Log Module" + { + // Max length: 23 characters: + "en" "Module:" + } + + "Log Status" + { + "en" "Filter Status:" + } + + "Log Module Filtering" + { + "en" "Module Filtering:" + } + + "Log Module Short Name" + { + "en" "Short Name:" + } + + // =========================== + // Classes + // =========================== + + // General + + "Classes admin mode enabled" + { + "en" "Admin mode is enabled!" + } + + "Classes random assignment" + { + "#format" "{1:s}" + "en" "You have randomly been assigned to the @green\"{1}\"@default class." + } + + // Center Text/HUD + + "Classes overlay toggle" + { + "#format" "{1:s}" + "en" "Class overlay toggle commands: {1}" + } + + // Menu + + "Classes menu title" + { + "en" "Class Selection:" + } + + "Classes menu active" + { + "#format" "{1:s}" + "en" "Active: {1}" + } + + "Classes menu next" + { + "#format" "{1:s}" + "en" "Next spawn: {1}" + } + + "Classes menu select zombie" + { + "en" "Select Zombie Class" + } + + "Classes menu select human" + { + "en" "Select Human Class" + } + + "Classes menu select admin" + { + "en" "Select Admin Mode Class" + } + + "Classes menu admin mode toggle" + { + "en" "Toggle Admin Mode" + } + + "Classes Menu Team Select Title" + { + "en" "Select Team:" + } + + "Classes Menu Zombies" + { + "en" "Zombies" + } + + "Classes Menu Humans" + { + "en" "Humans" + } + + "Classes Menu Multiplier Select Title" + { + "en" "Select Multiplier:" + } + + "Classes Menu Adjust Value" + { + "en" "Adjust Value:" + } + + // Attributes + + "Classes Attrib Napalm Time" + { + "en" "Napalm Time" + } + + "Classes Attrib Health" + { + "en" "Health" + } + + "Classes Attrib Regen Interval" + { + "en" "Health Regeneration Interval" + } + + "Classes Attrib Regen Amount" + { + "en" "Health Regeneration Amount" + } + + "Classes Attrib Infect Gain" + { + "en" "Infection Health Gain" + } + + "Classes Attrib Speed" + { + "en" "Running Speed" + } + + "Classes Attrib Knockback" + { + "en" "Knock Back" + } + + "Classes Attrib Jump Height" + { + "en" "Jump Height" + } + + "Classes Attrib Jump Distance" + { + "en" "Jump Distance" + } + + "Classes Selection Not Allowed" + { + "en" "Changing classes is not allowed." + } + + // =========================== + // Immunity + // =========================== + + "Immunity Shield Not Available" + { + "en" "You don't have a shield." + } + + "Immunity Shield Cooldown" + { + "#format" "{1:d}" + "en" "{1} seconds until shield is available." + } + + "Immunity Shield Time Left" + { + "#format" "{1:d}" + "en" "Shield time left: {1}" + } + + // =========================== + // Overlays (core) + // =========================== + + "Overlays not supported" + { + "#format" "{1:d},{2:d}" + "en" "Blocking Overlay - DX{1} Detected (DX{2} Required)" + } + + // =========================== + // Infect (core) + // =========================== + + // General + + "Infect infected" + { + "en" "You have been infected! Go pass it on to as many other players as you can." + } + + "Infect human" + { + "en" "The merciful gods (known as admins) have resurrected your soul, find some cover!" + } + + "Infect disconnect" + { + "en" "The last zombie has left the game, and has passed the infection on to you." + } + + "Mother zombie infect cycle reset" + { + "en" "The mother zombie infection cycle has been reset." + } + + // Center Text + + "Infect countdown" + { + "#format" "{1:d}" + "en" "First infection in {1} seconds." + } + + // Menu + + "Infect menu clients title" + { + "en" "Zombie Management\nToggle Infection:\n[] = Infected" + } + + // Commands + + "Infect command infect syntax" + { + "en" "Infect a client. Usage: zr_infect [respawn - 1/0]" + } + + "Infect command human syntax" + { + "en" "Turn a client into a human. Usage: zr_human [respawn - 1/0] [protect - 1/0]" + } + + "Infect command infect successful" + { + "#format" "{1:s}" + "en" "Successfully infected @green{1}@default." + } + + "Infect command infect successful public" + { + "#format" "{1:s},{2:s}" + "en" "@lgreen{1}@default has infected @green{2}@default." + } + + "Infect command infect mother successful" + { + "#format" "{1:s}" + "en" "Successfully infected @green{1}@default as the mother zombie." + } + + "Infect command infect mother successful public" + { + "#format" "{1:s},{2:s}" + "en" "@lgreen{1}@default has infected @green{2}@default as the mother zombie." + } + + "Infect command infect unsuccessful" + { + "#format" "{1:s}" + "en" "Could not infect @green{1}@default." + } + + "Infect command human successful" + { + "#format" "{1:s}" + "en" "Successfully brought back @green{1}@default to life." + } + + "Infect command human successful public" + { + "#format" "{1:s},{2:s}" + "en" "@lgreen{1}@default has brought back @green{2}@default to life." + } + + "Infect command human unsuccessful" + { + "#format" "{1:s}" + "en" "Could not bring back @green{1}@default to life." + } + + // =========================== + // Damage (core) + // =========================== + + "Damage suicide intercept" + { + "en" "Suicide attempt intercepted." + } + + // =========================== + // Menu (core) + // =========================== + + // General + + "Menu main title" + { + "#format" "{1:s},{2:s}" + "en" "ZR Commands:\nPrefix command with \"{1}\" or \"{2}\" (quiet) when typing in chat." + } + + "Menu main zadmin" + { + "en" "ZAdmin - Open admin menu" + } + + "Menu main zclass" + { + "en" "ZClass - Configure class settings" + } + + "Menu main zcookies" + { + "en" "ZCookies - Toggle personal ZR settings here" + } + + "Menu main zspawn" + { + "en" "ZSpawn - Join late? Spawn with this" + } + + "Menu main ztele" + { + "en" "ZTele - Stuck? Teleport back to spawn" + } + + "Menu main zhp" + { + "en" "ZHP - Shows real HP as zombie" + } + + "Menu main zmarket" + { + "en" "ZMarket - Customize loadouts here" + } + + // =========================== + // Weapons (core) + // =========================== + + // General + + "Zombie cant use weapon" + { + "en" "Zombies can't use weapons!" + } + + // Restrict + + "Restrict weapon" + { + "#format" "{1:s}" + "en" "Weapon @green\"{1}\"@default has been restricted." + } + + "Unrestrict weapon" + { + "#format" "{1:s}" + "en" "Weapon @green\"{1}\"@default has been unrestricted." + } + + "Restrict weapon stopped" + { + "#format" "{1:s}" + "en" "Weapon @green\"{1}\"@default is already restricted." + } + + "Unrestrict weapon stopped" + { + "#format" "{1:s}" + "en" "Weapon @green\"{1}\"@default has no restrictions set." + } + + "Restrict weapon type" + { + "#format" "{1:s}" + "en" "Weapons of type @green\"{1}\"@default have been restricted." + } + + "Unrestrict weapon type" + { + "#format" "{1:s}" + "en" "Weapons of type @green\"{1}\"@default have been unrestricted." + } + + "Restrict weapon type stopped" + { + "#format" "{1:s}" + "en" "Weapons of type @green\"{1}\"@default are all already restricted." + } + + "Unrestrict weapon type stopped" + { + "#format" "{1:s}" + "en" "Weapons of type @green\"{1}\"@default have no restrictions set." + } + + "Restrict weapon untoggleable" + { + "#format" "{1:s}" + "en" "Weapon @green\"{1}\"@default may not have its restrictions toggled." + } + + "Weapon invalid" + { + "#format" "{1:s}" + "en" "Weapon @green\"{1}\"@default is an invalid weapon (type) name." + } + + "Weapon is restricted" + { + "#format" "{1:s}" + "en" "Weapon @green{1}@default is restricted." + } + + // ZMarket + + "Weapons zmarket buyzone" + { + "en" "You must be in a buyzone to use ZMarket." + } + + "Weapons zmarket purchase" + { + "#format" "{1:s}" + "en" "You have purchased weapon @green{1}.@default Select item again to buy ammo if you are low." + } + + "Weapons zmarket purchase max" + { + "#format" "{1:s},{2:d}" + "en" "Weapon @green{1}@default has a purchase limit of @green{2}@default. Wait until you respawn to try again." + } + + "Weapons zmarket grenade max" + { + "#format" "{1:d}" + "en" "You may only carry {1} grenade(s) of this type." + } + + "Weapons zmarket not enough money" + { + "en" "You have insufficient funds." + } + + "Weapons zmarket updated loadout" + { + "en" "You are not able to purchase a weapon at this time, but your loadout has been updated with this weapon." + } + + "Weapons zmarket get current loadout" + { + "en" "Updated current loadout, use rebuy option to purchase these weapons again." + } + + // Commands + + "Weapons command restrict syntax" + { + "en" "Restricts a weapon or a weapon type. Usage: zr_restrict [weapon2|weapontype2] ..." + } + + "Weapons command unrestrict syntax" + { + "en" "Unrestricts a weapon or a weapon type. Usage: zr_unrestrict [weapon2|weapontype2] ..." + } + + // Menu (Restrict) + + "Weapons menu restrict main title" + { + "en" "Weapons Management" + } + + "Weapons menu restrict main restrict" + { + "en" "Weapon Restrictions" + } + + "Weapons menu restrict main market" + { + "en" "ZMarket" + } + + "Weapons menu restrict types title" + { + "en" "Weapon Restrictions\nSelect Weapon Type:" + } + + "Weapons menu restrict types weapon type title" + { + "#format" "{1:s}" + "en" "Weapon Restrictions\nWeapon Type: {1}\n[] = Restricted" + } + + "Weapons menu restrict types restrict all" + { + "#format" "{1:s}" + "en" "Restrict weapon type {1}" + } + + "Weapons menu restrict types unrestrict all" + { + "#format" "{1:s}" + "en" "Unrestrict weapon type {1}" + } + + "Weapons menu restrict zmarket title" + { + "en" "ZMarket\nSelect Setting:" + } + + "Weapons menu restrict zmarket buyzone" + { + "#format" "{1:s}" + "en" "Buyzone Only - {1}" + } + + // Menu (ZMarket) + + "Weapons menu zmarket main title" + { + "en" "ZMarket\nSelect an Option:" + } + + "Weapons menu zmarket main get loadout" + { + "en" "Save Current Setup" + } + + "Weapons menu zmarket main edit loadout" + { + "en" "Edit Saved Setup" + } + + "Weapons menu zmarket main rebuy" + { + "en" "Buy Saved Setup" + } + + "Weapons menu zmarket main weapons list" + { + "en" "Buy Weapons" + } + + "Weapons menu zmarket loadout title" + { + "en" "ZMarket\nMy Current Setup:\nSelect weapon slot to modify.\nNote: Rebuy refers to these weapons.\nYou will spawn with these weapons." + } + + "Weapons menu zmarket loadout primary" + { + "#format" "{1:s}" + "en" "Primary: {1}" + } + + "Weapons menu zmarket loadout secondary" + { + "#format" "{1:s}" + "en" "Secondary: {1}" + } + + "Weapons menu zmarket loadout default" + { + "#format" "{1:s}" + "en" "Default ({1})" + } + + "Weapons menu zmarket loadout weapons title" + { + "en" "ZMarket\nSelect Weapon Loadout:" + } + + "Weapons menu zmarket types title" + { + "en" "ZMarket\nSelect Weapon Type:" + } + + "Weapons menu zmarket types weapon type title" + { + "#format" "{1:s}" + "en" "ZMarket\nWeapon Type: {1}\n[] = Restricted" + } + + "Weapons menu zmarket types weapon info" + { + "#format" "{1:s},{2:d},{3:d}" + "en" "{1} (${2})\nPurchases Left: {3}" + } + + "Weapons menu zmarket types weapon ammo" + { + "en" "Ammo" + } + + // =========================== + // Hitgroups (core) + // =========================== + + // Menu + + "Hitgroups menu hitgroups title" + { + "en" "Hitgroup Management\nCommands: zr_hitgroup(_enable_all/_headshots_only)\nSelect a Hitgroup to Toggle:" + } + + "Hitgroups menu hitgroups enable all" + { + "en" "Enable All Hitgroups" + } + + "Hitgroups menu hitgroups headshots only" + { + "en" "Headshots Only" + } + + // Commands + + "Hitgroups command syntax" + { + "en" "Toggles or sets if a zombie's hitgroup can be damaged. Usage: zr_hitgroup [1/0]" + } + + "Hitgroups command related commands" + { + "en" "Related command(s): zr_hitgroup_enable_all, zr_hitgroup_headshots_only" + } + + "Hitgroups command syntax names" + { + "en" "Hitgroup Names:" + } + + "Hitgroups command successful on" + { + "#format" "{1:s}" + "en" "Damage for hitgroup \"{1}\" has been toggled on." + } + + "Hitgroups command successful off" + { + "#format" "{1:s}" + "en" "Damage for hitgroup \"{1}\" has been toggled off." + } + + "Hitgroups command invalid hitgroup" + { + "#format" "{1:s}" + "en" "\"{1}\" is not a valid hitgroup alias. Type zr_hitgroup to view all aliases." + } + + "Hitgroups command enable all successful" + { + "en" "All zombie hitgroups have been enabled for damage." + } + + "Hitgroups command headshots only successful" + { + "en" "Zombies may now only be damaged by headshots." + } + + // =========================== + // ZAdmin (core) + // =========================== + + "ZAdmin main title" + { + "en" "ZAdmin\nSelect Category:" + } + + "ZAdmin main class multipliers" + { + "en" "Class Multipliers" + } + + "ZAdmin main weapons" + { + "en" "Weapon Management" + } + + "ZAdmin main hitgroups" + { + "en" "Hitgroup Management" + } + + "ZAdmin main zombie" + { + "en" "Zombie Management" + } + + "ZAdmin main force zspawn" + { + "en" "Force ZSpawn" + } + + "ZAdmin main force ztele" + { + "en" "Force ZTele" + } + + // =========================== + // AntiStick (module) + // =========================== + + // Commands + + "AntiStick command set width syntax" + { + "en" "Sets the width of a model's hull. (See zr_antistick_list_models) Usage: zr_antistick_set_width " + } + + "AntiStick command list models list" + { + "en" "Player name: Model: Hull width:\n-------------------------------------------------------------------------------------------------------------" + } + + "AntiStick command list models name" + { + "#format" "{1:-35s},{2:-51s},{3:-.2f}" + "en" "{1} {2} {3}" + } + + "AntiStick command set width successful" + { + "#format" "{1:s},{2:f}" + "en" "Model hull width for model \"{1}\" has been changed to \"{2}.\"" + } + + "AntiStick command set width invalid model" + { + "#format" "{1:s}" + "en" "Invalid model/player specified: \"{1}\"" + } + + "AntiStick command set width invalid width" + { + "#format" "{1:f}" + "en" "Invalid model hull width specified: \"{1}\"" + } + + // =========================== + // Spawn Protect (module) + // =========================== + + // General + + "Spawn protection begin" + { + "#format" "{1:d}" + "en" "Zombies are present, you have {1} seconds to find a safe place before you lose immunity." + } + + "Spawn protection end" + { + "en" "You are now susceptible to zombie infection." + } + + // HUD + + "Spawn Protect" + { + "#format" "{1:d}" + "en" "Zombie protection ends in: {1} seconds." + } + + // =========================== + // ZCookies (module) + // =========================== + + "ZCookies Menu main title" + { + "en" "ZCookies\nSelect a Cookie:" + } + + "ZCookies menu main auto-rebuy" + { + "#format" "{1:s}" + "en" "ZMarket Auto-Rebuy: {1}" + } + + "ZCookies menu main zhp" + { + "#format" "{1:s}" + "en" "ZHP Display: {1}" + } + + "ZCookies menu main overlay" + { + "#format" "{1:s}" + "en" "Human/Zombie Class Overlay: {1}" + } + + "ZCookies zmarket loadout" + { + "en" "ZMarket Loadout" + } + + // =========================== + // ZSpawn (module) + // =========================== + + // General + + "ZSpawn double spawn" + { + "en" "ZSpawn can only be used if you joined late during a round in progress." + } + + "ZSpawn timelimit" + { + "#format" "{1:d}" + "en" "The timelimit ({1} seconds), to use ZSpawn, has already expired." + } + + // Menu + + "ZSpawn clients title" + { + "en" "Force ZSpawn (zr_zspawn_force)\nSelect a Player:" + } + + // Commands + + "ZSpawn command force syntax" + { + "en" "Force ZSpawn on a client. Usage: zr_zspawn_force ['0' = Spawn as human | '1' = Spawn as zombie]" + + } + + "ZSpawn command force successful" + { + "#format" "{1:s}" + "en" "Successfully spawned @lgreen{1}@default." + } + + "ZSpawn command force successful public" + { + "#format" "{1:s},{2:s},{3:s}" + "en" "@lgreen{1}@default has spawned @green{2}@default as @lgreen{3}@default." + } + + "ZSpawn command force unsuccessful" + { + "#format" "{1:s}" + "en" "Could not zspawn @lgreen{1}@default." + } + + // =========================== + // ZTele (module) + // =========================== + + // General + + "ZTele restricted human" + { + "en" "ZTele is restricted for humans at this time." + } + + "ZTele max" + { + "#format" "{1:d}" + "en" "You have reached your max of {1} teleport(s) per round." + } + + "ZTele in progress" + { + "en" "You are currently pending teleportation." + } + + "ZTele autocancel text" + { + "#format" "{1:d}" + "en" "Teleport has been cancelled. (Restrictive boundary is {1} ft.)" + } + + // Center Text + + "ZTele countdown" + { + "#format" "{1:d}" + "en" "Teleporting back to spawn in: {1} seconds." + } + + "ZTele autocancel centertext" + { + "en" "Teleport has been cancelled." + } + + "ZTele countdown end" + { + "#format" "{1:d},{2:d}" + "en" "Teleported back to spawn. (Count: {1}/{2})" + } + + // Menu + + "ZTele clients title" + { + "en" "Force ZTele (zr_ztele_force)\nSelect a Player:" + } + + // Commands + + "ZTele command force syntax" + { + "en" "Force ZTele on a client. Usage: zr_ztele_force " + + } + + "ZTele command force successful" + { + "#format" "{1:s}" + "en" "Successfully teleported @lgreen{1}@default." + } + + "ZTele command force unsuccessful" + { + "#format" "{1:s}" + "en" "Could not teleport @lgreen{1}@default." + } + + // =========================== + // ZHP (module) + // =========================== + + // General + + "ZHP enable" + { + "en" "HP display enabled, your real HP will be displayed after infection." + } + + "ZHP disable" + { + "en" "HP display disabled." + } + + // HUD + + "Display HP" + { + "#format" "{1:d}" + "en" "HP: {1}" + } + + // =========================== + // ZVolume (module) + // =========================== + + "Volume_Menu_Title" + { + "en" "[ZR] Volume Control Menu\nCommand: !zvolume" + } + + "Zombie Voice" + { + "en" "Zombie Voice" + } + + "Ambient" + { + "en" "Ambient" + } + + "ZombieVoice_Usage" + { + "en" "Usage: zr_zombie_volume <0 - 100>" + } + + "ZombieVoice_Title_Menu" + { + "#format" "{1:d}" + "en" "[ZR] Zombie Voice Volume (Current: {1:d}%)" + } + + "ZombieVoice_CommandUsage" + { + "en" "Command: !zombie_volume <1-100>" + } + + "Set_ZombieVoice_Volume" + { + "#format" "{1:d}" + "en" "Set Zombie Voice Volume to {lightgreen}{1:d}%." + } + + "Ambient_Usage" + { + "en" "Usage: zr_ambient_volume <0 - 100>" + } + + "Ambient_Title_Menu" + { + "#format" "{1:d}" + "en" "[ZR] Ambient Volume (Current: {1:d}%)" + } + + "Ambient_CommandUsage" + { + "en" "Command: !ambient_volume <1-100>" + } + + "Set_Ambient_Volume" + { + "#format" "{1:d}" + "en" "Set Ambient Volume to {lightgreen}{1:d}%." + } + + // =========================== + // Volumetric features (module) + // =========================== + + "Vol Anticamp Message" + { + "en" "This area is restricted, please move." + } + + "Vol Slay" + { + "#format" "{1:s},{2:d}" + "en" "Slayed player \"{1}\" for camping in a restricted area (ID: {2})." + } + + "Vol Ignite" + { + "#format" "{1:s},{2:d}" + "en" "Ignited player \"{1}\" for camping in a restricted area (ID: {2})." + } +} diff --git a/src/zr/soundeffects/volumecontrol.inc b/src/zr/soundeffects/volumecontrol.inc new file mode 100644 index 0000000..807ca93 --- /dev/null +++ b/src/zr/soundeffects/volumecontrol.inc @@ -0,0 +1,408 @@ +/* + * ============================================================================ + * + * Zombie:Reloaded + * + * File: volumecontrol.inc + * Type: Core + * Description: Basic volume control for player to change. + * + * Copyright (C) 2009-2013 Greyscale, Richard Helgeby + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * ============================================================================ + */ + +/** + * Cookie names for client volume settings. + */ +#define ZVOLUME_COOKIE_ZSOUND "zr_zombie_volume" +#define ZVOLUME_COOKIE_AMBIENT "zr_ambient_volume" + +/** + * Cookie handles for client volume settings. + */ +new Handle:g_hZSoundVolumeCookie = INVALID_HANDLE; +new Handle:g_hAmbientVolumeCookie = INVALID_HANDLE; + +/** + * Per-client volume, as a fraction (0.0 - 1.0), applied on top of sounds + * emitted through SEffectsEmitSoundFromClient() and SEffectsEmitAmbientSound(). + */ +new Float:zfZSoundVolume[MAXPLAYERS + 1]; +new Float:zfAmbientVolume[MAXPLAYERS + 1]; + +/** + * Create commands specific to ZVolume. + */ +ZVolumeOnCommandsCreate() +{ + RegConsoleCmd("sm_zvol", Command_ZVolume, "Brings up the zvolume menu"); + RegConsoleCmd("sm_zvolume", Command_ZVolume, "Brings up the zvolume menu"); + RegConsoleCmd("sm_zsound", Command_ZSound, "Brings up the zsound menu"); + RegConsoleCmd("sm_zombie_volume", Command_ZSound, "Brings up the zsound menu"); + RegConsoleCmd("sm_zambient", Command_ZAmbient, "Brings up the ambient menu"); + RegConsoleCmd("sm_ambient_volume", Command_ZAmbient, "Brings up the ambient menu"); +} + +/** + * Create ZVolume-related cookies here. + */ +ZVolumeOnCookiesCreate() +{ + if (g_hZSoundVolumeCookie == INVALID_HANDLE) + { + g_hZSoundVolumeCookie = RegClientCookie(ZVOLUME_COOKIE_ZSOUND, "Control Zombie Sound.", CookieAccess_Protected); + } + + if (g_hAmbientVolumeCookie == INVALID_HANDLE) + { + g_hAmbientVolumeCookie = RegClientCookie(ZVOLUME_COOKIE_AMBIENT, "Control Ambient Sound.", CookieAccess_Protected); + } +} + +/** + * Called once a client's saved cookies have been loaded from the database. + * + * @param client The client index. + */ +ZVolumeOnCookiesCached(client) +{ + decl String:sValue[8]; + + sValue[0] = '\0'; + GetClientCookie(client, g_hZSoundVolumeCookie, sValue, sizeof(sValue)); + if (!sValue[0]) + { + new Float:seffectsvolume = GetConVarFloat(g_hCvarsList[CVAR_SEFFECTS_VOLUME]); + IntToString(RoundToNearest(seffectsvolume * 100.0), sValue, sizeof(sValue)); + } + SetZombieVoiceVolume(client, StringToInt(sValue)); + + sValue[0] = '\0'; + GetClientCookie(client, g_hAmbientVolumeCookie, sValue, sizeof(sValue)); + if (!sValue[0]) + { + new Float:ambientvolume = GetConVarFloat(g_hCvarsList[CVAR_AMBIENTSOUNDS_VOLUME]); + IntToString(RoundToNearest(ambientvolume * 100.0), sValue, sizeof(sValue)); + } + SetAmbientVolume(client, StringToInt(sValue)); +} + +/** + * Returns the client's personal zombie-voice volume, as a fraction (0.0 - 1.0). + * + * @param client The client index. + */ +Float:ZVolume_GetZSoundVolume(client) +{ + return zfZSoundVolume[client]; +} + +/** + * Returns the client's personal ambient-sound volume, as a fraction (0.0 - 1.0). + * + * @param client The client index. + */ +Float:ZVolume_GetAmbientVolume(client) +{ + return zfAmbientVolume[client]; +} + +/** + * Command callback (sm_zvol, sm_zvolume) + * Opens the volume control menu. + */ +public Action:Command_ZVolume(client, args) +{ + if (IsClientInGame(client)) + { + VolumeControlMenu(client); + return Plugin_Handled; + } + return Plugin_Handled; +} + +VolumeControlMenu(client) +{ + new Handle:menu = CreateMenu(VolumeControlMenuHandler); + + decl String:sMenuTitle[128]; + Format(sMenuTitle, sizeof(sMenuTitle), "%t", "Volume_Menu_Title"); + SetMenuTitle(menu, sMenuTitle); + + decl String:sItem[64]; + + Format(sItem, sizeof(sItem), "%t", "Zombie Voice"); + AddMenuItem(menu, "1", sItem); + + Format(sItem, sizeof(sItem), "%t", "Ambient"); + AddMenuItem(menu, "2", sItem); + + SetMenuExitBackButton(menu, true); + DisplayMenu(menu, client, MENU_TIME_FOREVER); +} + +public VolumeControlMenuHandler(Handle:menu, MenuAction:action, param1, param2) +{ + switch (action) + { + case MenuAction_Select: + { + decl String:info[32]; + GetMenuItem(menu, param2, info, sizeof(info)); + if (StrEqual(info, "1", false)) + { + ZombieVoiceVolumeMenu(param1); + } + else if (StrEqual(info, "2")) + { + AmbientVolumeMenu(param1); + } + } + case MenuAction_Cancel: + { + if (param2 == MenuCancel_ExitBack) + { + ZMenuMain(param1); + } + } + case MenuAction_End: + { + CloseHandle(menu); + } + } + return 0; +} + +// Zombie Voice Section +/** + * Command callback (sm_zsound, sm_zombie_volume) + */ +public Action:Command_ZSound(client, args) +{ + if (args == 0) + { + ZombieVoiceVolumeMenu(client); + return Plugin_Handled; + } + + decl String:sArg[32]; + GetCmdArg(1, sArg, sizeof(sArg)); + new iVolume = StringToInt(sArg); + + if (iVolume < 0 || iVolume > 100) + { + TranslationReplyToCommand(client, "ZombieVoice_Usage"); + return Plugin_Handled; + } + else if (0 <= iVolume <= 100) + { + SetZombieVoiceVolume(client, iVolume); + return Plugin_Handled; + } + return Plugin_Handled; +} + +ZombieVoiceVolumeMenu(client) +{ + new Handle:menu = CreateMenu(ZombieVoiceVolumeMenuHandler); + + decl String:sMenuTitle[128]; + Format(sMenuTitle, sizeof(sMenuTitle), "%t\n%t", "ZombieVoice_Title_Menu", RoundToNearest(zfZSoundVolume[client] * 100), "ZombieVoice_CommandUsage"); + SetMenuTitle(menu, sMenuTitle); + + AddMenuItem(menu, "1", "100%"); + AddMenuItem(menu, "2", "80%"); + AddMenuItem(menu, "3", "60%"); + AddMenuItem(menu, "4", "40%"); + AddMenuItem(menu, "5", "20%"); + + SetMenuExitBackButton(menu, true); + DisplayMenu(menu, client, MENU_TIME_FOREVER); +} + +public ZombieVoiceVolumeMenuHandler(Handle:menu, MenuAction:action, param1, param2) +{ + switch (action) + { + case MenuAction_Select: + { + decl String:info[32]; + GetMenuItem(menu, param2, info, sizeof(info)); + if (StrEqual(info, "1", false)) + { + SetZombieVoiceVolume(param1, 100); + ZombieVoiceVolumeMenu(param1); + } + else if (StrEqual(info, "2")) + { + SetZombieVoiceVolume(param1, 80); + ZombieVoiceVolumeMenu(param1); + } + else if (StrEqual(info, "3")) + { + SetZombieVoiceVolume(param1, 60); + ZombieVoiceVolumeMenu(param1); + } + else if (StrEqual(info, "4")) + { + SetZombieVoiceVolume(param1, 40); + ZombieVoiceVolumeMenu(param1); + } + else if (StrEqual(info, "5")) + { + SetZombieVoiceVolume(param1, 20); + ZombieVoiceVolumeMenu(param1); + } + } + case MenuAction_Cancel: + { + if (param2 == MenuCancel_ExitBack) + { + VolumeControlMenu(param1); + } + } + case MenuAction_End: + { + CloseHandle(menu); + } + } + return 0; +} + +SetZombieVoiceVolume(client, volume) +{ + zfZSoundVolume[client] = volume * 0.01; + + decl String:sValue[8]; + IntToString(volume, sValue, sizeof(sValue)); + SetClientCookie(client, g_hZSoundVolumeCookie, sValue); + + if (IsClientInGame(client)) + { + TranslationPrintToChat(client, "Set_ZombieVoice_Volume", volume); + } +} + +// Ambient Section +/** + * Command callback (sm_zambient, sm_ambient_volume) + */ +public Action:Command_ZAmbient(client, args) +{ + if (args == 0) + { + AmbientVolumeMenu(client); + return Plugin_Handled; + } + + decl String:sArg[32]; + GetCmdArg(1, sArg, sizeof(sArg)); + new iVolume = StringToInt(sArg); + + if (iVolume < 0 || iVolume > 100) + { + TranslationReplyToCommand(client, "Ambient_Usage"); + return Plugin_Handled; + } + else if (0 <= iVolume <= 100) + { + SetAmbientVolume(client, iVolume); + return Plugin_Handled; + } + return Plugin_Handled; +} + +AmbientVolumeMenu(client) +{ + new Handle:menu = CreateMenu(AmbientVolumeMenuHandler); + + decl String:sMenuTitle[128]; + Format(sMenuTitle, sizeof(sMenuTitle), "%t\n%t", "Ambient_Title_Menu", RoundToNearest(zfAmbientVolume[client] * 100), "Ambient_CommandUsage"); + SetMenuTitle(menu, sMenuTitle); + + AddMenuItem(menu, "1", "100%"); + AddMenuItem(menu, "2", "80%"); + AddMenuItem(menu, "3", "60%"); + AddMenuItem(menu, "4", "40%"); + AddMenuItem(menu, "5", "20%"); + + SetMenuExitBackButton(menu, true); + DisplayMenu(menu, client, MENU_TIME_FOREVER); +} + +public AmbientVolumeMenuHandler(Handle:menu, MenuAction:action, param1, param2) +{ + switch (action) + { + case MenuAction_Select: + { + decl String:info[32]; + GetMenuItem(menu, param2, info, sizeof(info)); + if (StrEqual(info, "1", false)) + { + SetAmbientVolume(param1, 100); + AmbientVolumeMenu(param1); + } + else if (StrEqual(info, "2")) + { + SetAmbientVolume(param1, 80); + AmbientVolumeMenu(param1); + } + else if (StrEqual(info, "3")) + { + SetAmbientVolume(param1, 60); + AmbientVolumeMenu(param1); + } + else if (StrEqual(info, "4")) + { + SetAmbientVolume(param1, 40); + AmbientVolumeMenu(param1); + } + else if (StrEqual(info, "5")) + { + SetAmbientVolume(param1, 20); + AmbientVolumeMenu(param1); + } + } + case MenuAction_Cancel: + { + if (param2 == MenuCancel_ExitBack) + { + VolumeControlMenu(param1); + } + } + case MenuAction_End: + { + CloseHandle(menu); + } + } + return 0; +} + +SetAmbientVolume(client, volume) +{ + zfAmbientVolume[client] = volume * 0.01; + + decl String:sValue[8]; + IntToString(volume, sValue, sizeof(sValue)); + SetClientCookie(client, g_hAmbientVolumeCookie, sValue); + + if (IsClientInGame(client)) + { + TranslationPrintToChat(client, "Set_Ambient_Volume", volume); + } +}