2009-04-20 02:56:26 +02:00
/*
* ============================================================================
*
2008-10-04 22:59:11 +02:00
* Zombie : Reloaded
2009-04-20 02:56:26 +02:00
*
* File : cvars . inc
* Description : Config creation and cvar control .
*
* ============================================================================
2008-10-04 22:59:11 +02:00
*/
2009-04-27 04:00:38 +02:00
/**
* @ section Locked cvar value defines .
*/
#define CVARS_AUTOTEAMBALANCE_LOCKED 0
#define CVARS_LIMITTEAMS_LOCKED 0
/**
* @ endsection
*/
2009-04-20 02:56:26 +02:00
/**
* List of cvars used by the plugin .
*/
enum CvarsList
2008-10-04 22:59:11 +02:00
{
Handle : CVAR_ENABLE ,
Handle : CVAR_CLASSES_SPAWN ,
Handle : CVAR_CLASSES_RANDOM ,
2009-04-11 01:56:22 +02:00
Handle : CVAR_CLASSES_DEFAULT_ZOMBIE ,
Handle : CVAR_CLASSES_DEFAULT_HUMAN ,
Handle : CVAR_CLASSES_DEFAULT_ADMIN ,
2009-04-19 01:10:30 +02:00
Handle : CVAR_CLASSES_FILE ,
2009-04-23 06:39:11 +02:00
Handle : CVAR_WEAPONS ,
Handle : CVAR_WEAPONS_RESTRICT ,
Handle : CVAR_WEAPONS_ZMARKET_BUYZONE ,
Handle : CVAR_HITGROUPS ,
Handle : CVAR_DAMAGE_HITGROUPS ,
Handle : CVAR_DAMAGE_BLOCK_FF ,
Handle : CVAR_DAMAGE_BLOCK_BLAST ,
2009-04-20 02:56:26 +02:00
Handle : CVAR_DAMAGE_SUICIDE_ZOMBIE ,
Handle : CVAR_DAMAGE_SUICIDE_HUMAN ,
Handle : CVAR_DAMAGE_SUICIDE_CMDS ,
2009-04-23 06:39:11 +02:00
Handle : CVAR_ROUNDEND_OVERLAY ,
Handle : CVAR_ROUNDEND_OVERLAY_ZOMBIE ,
Handle : CVAR_ROUNDEND_OVERLAY_HUMAN ,
2009-04-22 04:53:19 +02:00
Handle : CVAR_INFECT_SPAWNTIME_MIN ,
Handle : CVAR_INFECT_SPAWNTIME_MAX ,
Handle : CVAR_INFECT_CONSECUTIVE_BLOCK ,
2009-04-29 01:58:41 +02:00
Handle : CVAR_INFECT_WEAPONS_DROP ,
2009-04-22 04:53:19 +02:00
Handle : CVAR_INFECT_MZOMBIE_RATIO ,
Handle : CVAR_INFECT_MZOMBIE_RESPAWN ,
Handle : CVAR_INFECT_SOUND ,
Handle : CVAR_INFECT_ESPLASH ,
Handle : CVAR_INFECT_FIREBALL ,
Handle : CVAR_INFECT_SMOKE ,
Handle : CVAR_INFECT_SPARKS ,
Handle : CVAR_INFECT_SHAKE ,
Handle : CVAR_INFECT_SHAKE_AMP ,
Handle : CVAR_INFECT_SHAKE_FREQUENCY ,
Handle : CVAR_INFECT_SHAKE_DURATION ,
Handle : CVAR_ACCOUNT_CASHFILL ,
Handle : CVAR_ACCOUNT_CASHFILL_VALUE ,
2009-04-24 05:02:19 +02:00
Handle : CVAR_VEFFECTS_LIGHTSTYLE ,
Handle : CVAR_VEFFECTS_LIGHTSTYLE_VALUE ,
Handle : CVAR_VEFFECTS_SKY ,
Handle : CVAR_VEFFECTS_SKY_PATH ,
2009-04-27 04:00:38 +02:00
Handle : CVAR_VEFFECTS_FOG ,
Handle : CVAR_VEFFECTS_FOG_OVERRIDE ,
Handle : CVAR_VEFFECTS_FOG_PCOLOR ,
Handle : CVAR_VEFFECTS_FOG_SCOLOR ,
Handle : CVAR_VEFFECTS_FOG_DENSITY ,
Handle : CVAR_VEFFECTS_FOG_STARTDIST ,
Handle : CVAR_VEFFECTS_FOG_ENDDIST ,
Handle : CVAR_VEFFECTS_FOG_FARZ ,
2009-04-24 05:02:19 +02:00
Handle : CVAR_SEFFECTS_MOAN ,
Handle : CVAR_SEFFECTS_GROAN ,
Handle : CVAR_SEFFECTS_DEATH ,
2009-04-20 02:56:26 +02:00
Handle : CVAR_AMBIENTSOUNDS ,
Handle : CVAR_AMBIENTSOUNDS_FILE ,
Handle : CVAR_AMBIENTSOUNDS_LENGTH ,
Handle : CVAR_AMBIENTSOUNDS_VOLUME ,
Handle : CVAR_ANTISTICK ,
Handle : CVAR_ANTISTICK_INTERVAL ,
Handle : CVAR_SPAWNPROTECT ,
Handle : CVAR_SPAWNPROTECT_TIME ,
Handle : CVAR_RESPAWN ,
Handle : CVAR_RESPAWN_DELAY ,
Handle : CVAR_RESPAWN_ZOMBIE ,
Handle : CVAR_RESPAWN_ZOMBIE_WORLD ,
2009-04-29 01:58:41 +02:00
Handle : CVAR_ZSPAWN ,
2009-04-20 02:56:26 +02:00
Handle : CVAR_ZHP ,
Handle : CVAR_ZHP_DEFAULT ,
// To be modulized/recoded.
2009-04-07 19:16:15 +02:00
Handle : CVAR_OVERLAY_REDISPLAY ,
2008-10-04 22:59:11 +02:00
Handle : CVAR_ZVISION_ALLOW_DISABLE ,
2009-04-15 23:40:45 +02:00
Handle : CVAR_MENU_AUTOCLOSE ,
2008-10-04 22:59:11 +02:00
Handle : CVAR_ZTELE ,
2008-12-20 20:46:05 +01:00
Handle : CVAR_ZTELE_STARTUP_DELAY ,
Handle : CVAR_ZTELE_COOLDOWN ,
Handle : CVAR_ZTELE_HUMAN_DELAY ,
Handle : CVAR_ZTELE_HUMAN_LIMIT ,
Handle : CVAR_ZTELE_ZOMBIE_DELAY ,
Handle : CVAR_ZTELE_ZOMBIE_LIMIT ,
2009-01-13 23:24:10 +01:00
Handle : CVAR_ZTELE_RESET_BUFFERS ,
2009-01-19 22:45:58 +01:00
Handle : CVAR_ANTICAMP ,
Handle : CVAR_ANTICAMP_UPDATE_INTERVAL ,
2008-10-04 22:59:11 +02:00
}
2009-04-20 02:56:26 +02:00
/**
* Array to store cvar data in .
*/
new g_hCvarsList [ CvarsList ];
2008-10-04 22:59:11 +02:00
2009-04-27 04:00:38 +02:00
/**
* @ section Global cvar handles .
*/
new Handle : g_hAutoTeamBalance = INVALID_HANDLE ;
new Handle : g_hLimitTeams = INVALID_HANDLE ;
new Handle : g_hRestartGame = INVALID_HANDLE ;
/**
* @ endsection
*/
2009-04-20 02:56:26 +02:00
/**
* Cvars module init function .
2009-04-27 04:00:38 +02:00
*/
2009-04-20 02:56:26 +02:00
CvarsInit ()
2009-04-27 04:00:38 +02:00
{
// Retrieve handles of CS:S cvars.
g_hAutoTeamBalance = FindConVar ( " mp_autoteambalance " );
g_hLimitTeams = FindConVar ( " mp_limitteams " );
g_hRestartGame = FindConVar ( " mp_restartgame " );
// Create zombiereloaded cvars.
CvarsCreate ();
// Hook cvars.
CvarsHook ();
}
/**
* Create all cvars for plugin .
*/
CvarsCreate ()
2008-10-04 22:59:11 +02:00
{
2009-04-20 02:56:26 +02:00
// Cvar naming guidelines:
// 1. Prefix: "zr_"
// 2. Module name next. "zr_modulename_"
// 3. (If applys) Submodule name next. "zr_modulename_submodulename_" Ex "zr_weapons_restrict_"
// 4. Name last part to be defaulted to "1" (if boolean cvar) Ex "zr_damage_suicide_zombie",
// because it will be defaulted to "1". "zr_damage_suicide_zombie_disable" = bad. Because we want
// to try to default everything to "1" and let hosts disable what they don't want.
//
// Cvar description guidelines
// Assume cvar is enabled.
// Ex. "zr_roundend_overlay" "1" "Display round win overlays to all clients."
// Explain (additional) options in brackets.
// Ex. "zr_classes_default_zombie" "" "Default zombie class. ['""' = Class config defaults. 'random' = Give client random class on connect.]"
// Any thing else?
2008-10-04 22:59:11 +02:00
2009-04-20 02:56:26 +02:00
// ===========================
2009-04-29 01:58:41 +02:00
// General (Core)
// ===========================
2009-04-20 02:56:26 +02:00
g_hCvarsList [ CVAR_ENABLE ] = CreateConVar ( " zr_enable " , " 1 " , " " );
// ===========================
2009-04-29 01:58:41 +02:00
// Log (core)
// ===========================
2009-04-27 04:00:38 +02:00
// Cvars created in log.inc, because of compilation problems when creating them here.
2009-04-20 02:56:26 +02:00
// ===========================
2009-04-29 01:58:41 +02:00
// Translations (core)
// ===========================
// (None)
// ===========================
// Tools (core)
// ===========================
2009-04-20 02:56:26 +02:00
// (None)
// ===========================
2009-04-29 01:58:41 +02:00
// Models (core)
// ===========================
// TODO: config file path.
2009-04-20 02:56:26 +02:00
// ===========================
// Classes (core)
// ===========================
2009-04-29 01:58:41 +02:00
g_hCvarsList [ CVAR_CLASSES_SPAWN ] = CreateConVar ( " zr_classes_spawn " , " 0 " , " " );
2009-04-20 02:56:26 +02:00
// Old Desc: Classmenu is re-displayed every spawn (0: Disable)
2009-04-29 01:58:41 +02:00
g_hCvarsList [ CVAR_CLASSES_RANDOM ] = CreateConVar ( " zr_classes_random " , " 0 " , " " );
2009-04-20 02:56:26 +02:00
// Old Desc: A random class is assigned to each player every round. Overrides zr_classes_spawn and default classes. (0: Disable)
2009-04-29 01:58:41 +02:00
g_hCvarsList [ CVAR_CLASSES_DEFAULT_ZOMBIE ] = CreateConVar ( " zr_classes_default_zombie " , " random " , " " );
2009-04-20 02:56:26 +02:00
// Old Desc: Default zombie class selected for all players when they connect. Use \"random\" to select a random class, or blank to use class config defaults.
2009-04-29 01:58:41 +02:00
g_hCvarsList [ CVAR_CLASSES_DEFAULT_HUMAN ] = CreateConVar ( " zr_classes_default_human " , " random " , " " );
2009-04-20 02:56:26 +02:00
// Old Desc:
2009-04-29 01:58:41 +02:00
g_hCvarsList [ CVAR_CLASSES_DEFAULT_ADMIN ] = CreateConVar ( " zr_classes_default_admin " , " random " , " " );
2009-04-20 02:56:26 +02:00
// Old Desc: Default admin-only class selected for admins when they connect. Use \"random\" to select a random class, or blank to use class config defaults.
2009-04-29 01:58:41 +02:00
g_hCvarsList [ CVAR_CLASSES_FILE ] = CreateConVar ( " zr_classes_file " , " configs/zr/playerclasses.txt " , " " );
2009-04-20 02:56:26 +02:00
// Old Desc: Class data file to read from, in Valves key/values format. The path is relative to the \"sourcemod\" folder.
// ===========================
2009-04-23 06:39:11 +02:00
// Weapons (core)
2009-04-20 02:56:26 +02:00
// ===========================
2009-04-23 06:39:11 +02:00
// General
g_hCvarsList [ CVAR_WEAPONS ] = CreateConVar ( " zr_weapons " , " 1 " , " " );
// Note make config file cvar.
// Note this disables restrict submodule.
// Restrict
g_hCvarsList [ CVAR_WEAPONS_RESTRICT ] = CreateConVar ( " zr_weapons_restrict " , " 1 " , " " );
// Note make config file cvar.
// Market Handler
2009-04-29 01:58:41 +02:00
g_hCvarsList [ CVAR_WEAPONS_ZMARKET_BUYZONE ] = CreateConVar ( " zr_weapons_zmarket_buyzone " , " 1 " , " " );
2009-04-23 06:39:11 +02:00
// Old Desc: Must be in buyzone to access !zmarket, if Market is installed (0: Can be used anywhere)
// ===========================
// Hitgroups (core)
// ===========================
g_hCvarsList [ CVAR_HITGROUPS ] = CreateConVar ( " zr_hitgroups " , " 1 " , " " );
// Note make config file cvar.
// ===========================
2009-04-29 01:58:41 +02:00
// Round End (core)
// ===========================
g_hCvarsList [ CVAR_ROUNDEND_OVERLAY ] = CreateConVar ( " zr_roundend_overlay " , " 1 " , " " );
2009-04-23 06:39:11 +02:00
// Old Desc: Shows an overlay to all clients when a team wins. (0: Disable)
2009-04-29 01:58:41 +02:00
g_hCvarsList [ CVAR_ROUNDEND_OVERLAY_HUMAN ] = CreateConVar ( " zr_roundend_overlays_human " , " overlays/zr/humans_win " );
2009-04-23 06:39:11 +02:00
// Old Desc: overlays/zr/humans_win", "Path to \"humans win\" overlay
2009-04-29 01:58:41 +02:00
g_hCvarsList [ CVAR_ROUNDEND_OVERLAY_ZOMBIE ] = CreateConVar ( " zr_roundend_overlays_zombie " , " overlays/zr/zombies_win " , " " );
2009-04-23 06:39:11 +02:00
// Old Desc: Path to \"zombies win\" overlay
2009-04-20 02:56:26 +02:00
2009-04-22 04:53:19 +02:00
// ===========================
// Infect (core)
// ===========================
2009-04-29 01:58:41 +02:00
g_hCvarsList [ CVAR_INFECT_MZOMBIE_RATIO ] = CreateConVar ( " zr_infect_mzombie_ratio " , " 5 " , " " );
g_hCvarsList [ CVAR_INFECT_MZOMBIE_RESPAWN ] = CreateConVar ( " zr_infect_mzombie_respawn " , " 0 " , " " );
g_hCvarsList [ CVAR_INFECT_SPAWNTIME_MIN ] = CreateConVar ( " zr_infect_spawntime_min " , " 30.0 " , " " );
g_hCvarsList [ CVAR_INFECT_SPAWNTIME_MAX ] = CreateConVar ( " zr_infect_spawntime_max " , " 50.0 " , " " );
2009-04-22 04:53:19 +02:00
g_hCvarsList [ CVAR_INFECT_CONSECUTIVE_BLOCK ] = CreateConVar ( " zr_infect_consecutive_block " , " 1 " , " " );
2009-04-29 01:58:41 +02:00
g_hCvarsList [ CVAR_INFECT_WEAPONS_DROP ] = CreateConVar ( " zr_infect_weapons_drop " , " 1 " , " " );
2009-04-22 04:53:19 +02:00
// Effects
2009-04-29 01:58:41 +02:00
g_hCvarsList [ CVAR_INFECT_FIREBALL ] = CreateConVar ( " zr_infect_fireball " , " 1 " , " " );
g_hCvarsList [ CVAR_INFECT_SMOKE ] = CreateConVar ( " zr_infect_smoke " , " 1 " , " " );
g_hCvarsList [ CVAR_INFECT_SPARKS ] = CreateConVar ( " zr_infect_sparks " , " 1 " , " " );
g_hCvarsList [ CVAR_INFECT_SOUND ] = CreateConVar ( " zr_infect_sound " , " npc/fast_zombie/fz_scream1.wav " , " " );
g_hCvarsList [ CVAR_INFECT_ESPLASH ] = CreateConVar ( " zr_infect_esplash " , " 1 " , " " );
g_hCvarsList [ CVAR_INFECT_SHAKE ] = CreateConVar ( " zr_infect_shake " , " 1 " , " " );
g_hCvarsList [ CVAR_INFECT_SHAKE_AMP ] = CreateConVar ( " zr_infect_shake_amp " , " 15.0 " , " " );
g_hCvarsList [ CVAR_INFECT_SHAKE_FREQUENCY ] = CreateConVar ( " zr_infect_shake_frequency " , " 1.0 " , " " );
g_hCvarsList [ CVAR_INFECT_SHAKE_DURATION ] = CreateConVar ( " zr_infect_shake_duration " , " 5.0 " , " " );
2009-04-22 04:53:19 +02:00
2009-04-20 02:56:26 +02:00
// ===========================
2009-04-23 06:39:11 +02:00
// Damage (core)
2009-04-20 02:56:26 +02:00
// ===========================
2009-04-18 01:44:41 +02:00
2009-04-23 06:39:11 +02:00
// Hitgroup Damage
2009-04-20 02:56:26 +02:00
2009-04-29 01:58:41 +02:00
g_hCvarsList [ CVAR_DAMAGE_HITGROUPS ] = CreateConVar ( " zr_damage_hitgroups " , " 1 " , " " );
2009-04-20 02:56:26 +02:00
2009-04-23 06:39:11 +02:00
// Block Damage Types
2009-04-20 02:56:26 +02:00
2009-04-29 01:58:41 +02:00
g_hCvarsList [ CVAR_DAMAGE_BLOCK_FF ] = CreateConVar ( " zr_damage_block_ff " , " 1 " , " " );
2009-04-23 06:39:11 +02:00
// note overrides mp_friendlyfire
2009-04-29 01:58:41 +02:00
g_hCvarsList [ CVAR_DAMAGE_BLOCK_BLAST ] = CreateConVar ( " zr_damage_block_blast " , " 1 " , " " );
2009-04-22 04:53:19 +02:00
2009-04-23 06:39:11 +02:00
// Suicide Intercept
2009-04-20 02:56:26 +02:00
2009-04-23 06:39:11 +02:00
g_hCvarsList [ CVAR_DAMAGE_SUICIDE_ZOMBIE ] = CreateConVar ( " zr_damage_suicide_zombie " , " 1 " , " " );
// Old Desc: Intercept human suicide attempts.
g_hCvarsList [ CVAR_DAMAGE_SUICIDE_HUMAN ] = CreateConVar ( " zr_damage_suicide_human " , " 1 " , " " );
// Old Desc: Intercept zombie suicide attempts.
g_hCvarsList [ CVAR_DAMAGE_SUICIDE_CMDS ] = CreateConVar ( " zr_damage_suicide_cmds " , " kill, spectate, jointeam " , " " );
// Old Desc: List of suicide commands to intercept. (Delimited by \", \"
2009-04-20 02:56:26 +02:00
2009-04-22 04:53:19 +02:00
// ===========================
// Account (module)
// ===========================
g_hCvarsList [ CVAR_ACCOUNT_CASHFILL ] = CreateConVar ( " zr_account_cashfill " , " 1 " , " " );
// Old Desc: Enable the mod to set the players cash to zr_cashamount (0: Disabled)
g_hCvarsList [ CVAR_ACCOUNT_CASHFILL_VALUE ] = CreateConVar ( " zr_account_cashfill_value " , " 12000 " , " " );
// Old Desc: How much money players will have when they spawn when zr_cashfill is 1
2009-04-24 05:02:19 +02:00
// ===========================
// Visual Effects (module)
// ===========================
2009-04-27 04:00:38 +02:00
// Lightstyle
g_hCvarsList [ CVAR_VEFFECTS_LIGHTSTYLE ] = CreateConVar ( " zr_veffects_lightstyle " , " 0 " , " " );
2009-04-24 05:02:19 +02:00
g_hCvarsList [ CVAR_VEFFECTS_LIGHTSTYLE_VALUE ] = CreateConVar ( " zr_veffects_lightstyle_value " , " a " , " " );
2009-04-27 04:00:38 +02:00
// Sky
2009-04-24 05:02:19 +02:00
g_hCvarsList [ CVAR_VEFFECTS_SKY ] = CreateConVar ( " zr_veffects_sky " , " 1 " , " " );
2009-04-27 04:00:38 +02:00
g_hCvarsList [ CVAR_VEFFECTS_SKY_PATH ] = CreateConVar ( " zr_veffects_sky_path " , " sky_fake_white.vmt " , " " );
// Fog
g_hCvarsList [ CVAR_VEFFECTS_FOG ] = CreateConVar ( " zr_veffects_fog " , " 0 " , " " );
// NOTE DISABLE. SOURCEMOD DOESNT SUPPORT THIS YET.
g_hCvarsList [ CVAR_VEFFECTS_FOG_OVERRIDE ] = CreateConVar ( " zr_veffects_fog_override " , " 0 " , " " );
// NOTE DISABLE. SOURCEMOD DOESNT SUPPORT THIS YET.
g_hCvarsList [ CVAR_VEFFECTS_FOG_PCOLOR ] = CreateConVar ( " zr_veffects_fog_pcolor " , " 255 255 255 " , " " );
g_hCvarsList [ CVAR_VEFFECTS_FOG_SCOLOR ] = CreateConVar ( " zr_veffects_fog_scolor " , " 255 255 255 " , " " );
g_hCvarsList [ CVAR_VEFFECTS_FOG_DENSITY ] = CreateConVar ( " zr_veffects_fog_density " , " 0.8 " , " " );
g_hCvarsList [ CVAR_VEFFECTS_FOG_STARTDIST ] = CreateConVar ( " zr_veffects_fog_startdist " , " 0 " , " " );
g_hCvarsList [ CVAR_VEFFECTS_FOG_ENDDIST ] = CreateConVar ( " zr_veffects_fog_enddist " , " 400 " , " " );
g_hCvarsList [ CVAR_VEFFECTS_FOG_FARZ ] = CreateConVar ( " zr_veffects_fog_farz " , " 2000 " , " " );
2009-04-24 05:02:19 +02:00
2009-04-20 02:56:26 +02:00
// ===========================
2009-04-29 01:58:41 +02:00
// Sound Effects (module)
// ===========================
// Zombie Sounds
g_hCvarsList [ CVAR_SEFFECTS_MOAN ] = CreateConVar ( " zr_seffects_moan " , " 30 " , " " );
2009-04-20 02:56:26 +02:00
// Old Desc: How often, in seconds, a zombie moans (0: Disable)
2009-04-29 01:58:41 +02:00
g_hCvarsList [ CVAR_SEFFECTS_GROAN ] = CreateConVar ( " zr_seffects_groan " , " 5 " , " " );
2009-04-20 02:56:26 +02:00
// Old Desc: Chance factor a zombie will groan when shot (Lower: More often, 0: Disable)
2009-04-29 01:58:41 +02:00
g_hCvarsList [ CVAR_SEFFECTS_DEATH ] = CreateConVar ( " zr_seffects_death " , " 1 " , " " );
2009-04-20 02:56:26 +02:00
// Old Desc: Zombie will emit a death sound when killed (0: Disable)
// Ambient Sounds
2009-04-29 01:58:41 +02:00
g_hCvarsList [ CVAR_AMBIENTSOUNDS ] = CreateConVar ( " zr_ambientsounds " , " 1 " , " " );
2009-04-20 02:56:26 +02:00
// Old Desc: Enable creepy ambience to be played throughout the game (0: Disable)
2009-04-29 01:58:41 +02:00
g_hCvarsList [ CVAR_AMBIENTSOUNDS_FILE ] = CreateConVar ( " zr_ambientsounds_file " , " ambient/zr/zr_ambience.mp3 " , " " );
2009-04-20 02:56:26 +02:00
// Old Desc: Path to ambient sound file that will be played throughout the game, when zr_ambience is 1
2009-04-29 01:58:41 +02:00
g_hCvarsList [ CVAR_AMBIENTSOUNDS_LENGTH ] = CreateConVar ( " zr_ambientsounds_length " , " 60.0 " , " " );
2009-04-20 02:56:26 +02:00
// Old Desc: The length, in seconds, of the ambient sound file
2009-04-29 01:58:41 +02:00
g_hCvarsList [ CVAR_AMBIENTSOUNDS_VOLUME ] = CreateConVar ( " zr_ambientsounds_volume " , " 1.0 " , " " );
2009-04-20 02:56:26 +02:00
// Old Desc: Volume of ambient sounds when zr_ambience is 1 (0.0: Unhearable, 1.0: Max volume)
// ===========================
2009-04-29 01:58:41 +02:00
// Antistick (module)
// ===========================
g_hCvarsList [ CVAR_ANTISTICK ] = CreateConVar ( " zr_antistick " , " 1 " , " " );
2009-04-20 02:56:26 +02:00
// Old Desc: Enable the anti-stick module, which will automatically unstick players stuck within each other. (0:Disable)
2009-04-29 01:58:41 +02:00
g_hCvarsList [ CVAR_ANTISTICK_INTERVAL ] = CreateConVar ( " zr_antistick_interval " , " 0.5 " , " " );
2009-04-20 02:56:26 +02:00
// Old Desc: How often, in seconds, the anti-stick module checks each player for being stuck. (1.0: Default)
// ===========================
2009-04-29 01:58:41 +02:00
// Knockback (module)
// ===========================
// (None)
2009-04-20 02:56:26 +02:00
// ===========================
2009-04-29 01:58:41 +02:00
// Spawn Protect (module)
// ===========================
g_hCvarsList [ CVAR_SPAWNPROTECT ] = CreateConVar ( " zr_spawnprotect " , " 1 " , " " );
g_hCvarsList [ CVAR_SPAWNPROTECT_TIME ] = CreateConVar ( " zr_spawnprotect_time " , " 10 " , " " );
// ===========================
// Respawn (module)
// ===========================
g_hCvarsList [ CVAR_RESPAWN ] = CreateConVar ( " zr_respawn " , " 0 " , " " );
2009-04-20 02:56:26 +02:00
// Old Desc: When player is killed, player will respawn
2009-04-29 01:58:41 +02:00
g_hCvarsList [ CVAR_RESPAWN_DELAY ] = CreateConVar ( " zr_respawn_delay " , " 1 " , " " );
2009-04-20 02:56:26 +02:00
// Old Desc: How long to wait after death to respawn, in seconds
2009-04-29 01:58:41 +02:00
g_hCvarsList [ CVAR_RESPAWN_ZOMBIE ] = CreateConVar ( " zr_respawn_zombie " , " 1 " , " " );
2009-04-20 02:56:26 +02:00
// Old Desc: Respawn player as zombie (0: Respawn as human)
2009-04-29 01:58:41 +02:00
g_hCvarsList [ CVAR_RESPAWN_ZOMBIE_WORLD ] = CreateConVar ( " zr_respawn_zombie_world " , " 1 " , " " );
2009-04-20 02:56:26 +02:00
// Old Desc: Respawn zombies as zombies if they were killed by the world, like elevators, doors and lasers. (0: Disable)
// ===========================
2009-04-29 01:58:41 +02:00
// Napalm (module)
// ===========================
// (None)
// ===========================
// ZSpawn (module)
// ===========================
g_hCvarsList [ CVAR_ZSPAWN ] = CreateConVar ( " zr_zspawn " , " 1 " , " " );
// Old Desc: Allow players to spawn if they just joined the game (0: Disable)
// ===========================
// ZHP (module)
// ===========================
g_hCvarsList [ CVAR_ZHP ] = CreateConVar ( " zr_zhp " , " 1 " , " " );
2009-04-20 02:56:26 +02:00
// Old Desc: Allows clients to enable/disable zombie health display (1: On, 0: Off)
2009-04-29 01:58:41 +02:00
g_hCvarsList [ CVAR_ZHP_DEFAULT ] = CreateConVar ( " zr_zhp_default " , " 1 " , " " );
2009-04-20 02:56:26 +02:00
// Old Desc: The default value of zombie health display to new clients (1: On, 0: Off)
// TO BE MODULIZED/RECODED.
2009-04-29 01:58:41 +02:00
g_hCvarsList [ CVAR_OVERLAY_REDISPLAY ] = CreateConVar ( " zr_overlay_redisplay " , " 3 " , " " );
2009-04-20 02:56:26 +02:00
// Old Desc: Frequency, in seconds, to display overlay on the client's screen (Never go below 0.1, 0.2 seems safe)
2009-04-29 01:58:41 +02:00
g_hCvarsList [ CVAR_ZVISION_ALLOW_DISABLE ] = CreateConVar ( " zr_zvision_allow_disable " , " 1 " , " " );
2009-04-20 02:56:26 +02:00
// Old Desc: Allow users to disable ZVision with their nightvision key (0: Disable)
2009-04-29 01:58:41 +02:00
g_hCvarsList [ CVAR_MENU_AUTOCLOSE ] = CreateConVar ( " zr_menu_autoclose " , " 0 " , " " );
2009-04-20 02:56:26 +02:00
// Old Desc: Automatically close menus on selection. If disabled the menu will remain open.
2009-04-29 01:58:41 +02:00
g_hCvarsList [ CVAR_ZTELE ] = CreateConVar ( " zr_tele " , " 1 " , " " );
2009-04-20 02:56:26 +02:00
// Old Desc: Allow players to use the teleporter to get to spawn. (0: Disable)
2009-04-29 01:58:41 +02:00
g_hCvarsList [ CVAR_ZTELE_STARTUP_DELAY ] = CreateConVar ( " zr_tele_startup_delay " , " 30 " , " " );
2009-04-20 02:56:26 +02:00
// Old Desc: Number of seconds to wait before the teleporter is enabled (0: Always enabled)
2009-04-29 01:58:41 +02:00
g_hCvarsList [ CVAR_ZTELE_COOLDOWN ] = CreateConVar ( " zr_tele_cooldown " , " 20 " , " " );
2009-04-20 02:56:26 +02:00
// Old Desc: Number of seconds to wait before the teleporter can be used again, after a teleport. (0: Disable)
2009-04-29 01:58:41 +02:00
g_hCvarsList [ CVAR_ZTELE_HUMAN_DELAY ] = CreateConVar ( " zr_tele_human_delay " , " 10 " , " " );
2009-04-20 02:56:26 +02:00
// Old Desc: Teleport delay for humans. (0: No delay)
2009-04-29 01:58:41 +02:00
g_hCvarsList [ CVAR_ZTELE_HUMAN_LIMIT ] = CreateConVar ( " zr_tele_human_limit " , " 3 " , " " );
2009-04-20 02:56:26 +02:00
// Old Desc: Maximum number of teleports humans can do. (0: Humans can't use the teleporter. -1: Unlimited)
2009-04-29 01:58:41 +02:00
g_hCvarsList [ CVAR_ZTELE_ZOMBIE_DELAY ] = CreateConVar ( " zr_tele_zombie_delay " , " 0 " , " " );
2009-04-20 02:56:26 +02:00
// Old Desc: Teleport delay for zombies. (0: No delay)
2009-04-29 01:58:41 +02:00
g_hCvarsList [ CVAR_ZTELE_ZOMBIE_LIMIT ] = CreateConVar ( " zr_tele_zombie_limit " , " 8 " , " " );
2009-04-20 02:56:26 +02:00
// Old Desc: Maximum number of teleports zombies can do. (0: Zombies can't use the teleporter. -1: Unlimited)
2009-04-29 01:58:41 +02:00
g_hCvarsList [ CVAR_ZTELE_RESET_BUFFERS ] = CreateConVar ( " zr_tele_reset_buffers " , " 1 " , " " );
2009-04-20 02:56:26 +02:00
// Old Desc: Reset custom saved teleport locations on each round start. (0: Disable)
2009-04-29 01:58:41 +02:00
g_hCvarsList [ CVAR_ANTICAMP ] = CreateConVar ( " zr_anticamp " , " 1 " , " " );
2009-04-20 02:56:26 +02:00
// Old Desc: Enables or disables hurt volumes for preventing unfair camping. (0: Disable)
2009-04-29 01:58:41 +02:00
g_hCvarsList [ CVAR_ANTICAMP_UPDATE_INTERVAL ] = CreateConVar ( " zr_anticamp_update_interval " , " 1 " , " " );
2009-04-20 02:56:26 +02:00
// Old Desc: How often to update player locations (in seconds).
2009-04-27 04:00:38 +02:00
// Auto-generate config file if it doesn't exist, then execute.
2008-10-04 22:59:11 +02:00
AutoExecConfig ( true , " zombiereloaded " , " sourcemod/zombiereloaded " );
}
2009-04-27 04:00:38 +02:00
/**
* Hook cvar changes .
*
* @ param unhook If true , cvars will be unhooked , false to hook cvars .
*/
CvarsHook ( bool : unhook = false )
{
// If unhook is true, then continue.
if ( unhook )
{
// Unhook all cvars.
UnhookConVarChange ( g_hAutoTeamBalance , CvarsHookLocked );
UnhookConVarChange ( g_hLimitTeams , CvarsHookLocked );
UnhookConVarChange ( g_hRestartGame , CvarsHookRestartGame );
// Stop after unhooking cvars.
return ;
}
// Set locked cvars to their locked value.
SetConVarInt ( g_hAutoTeamBalance , CVARS_AUTOTEAMBALANCE_LOCKED );
SetConVarInt ( g_hLimitTeams , CVARS_LIMITTEAMS_LOCKED );
2008-10-04 22:59:11 +02:00
2009-04-27 04:00:38 +02:00
// Hook cvar to prevent it from changing.
HookConVarChange ( g_hAutoTeamBalance , CvarsHookLocked );
//HookConVarChange(hLimitTeams, CvarsHookLocked);
HookConVarChange ( g_hRestartGame , CvarsHookRestartGame );
2009-04-20 02:56:26 +02:00
2009-04-27 04:00:38 +02:00
// Anticamp shtuff. (needs to be moved to anticamp if these hooks are necessary)
2009-04-20 02:56:26 +02:00
HookConVarChange ( g_hCvarsList [ CVAR_ANTICAMP ], AnticampHook );
HookConVarChange ( g_hCvarsList [ CVAR_ANTICAMP_UPDATE_INTERVAL ], UpdateIntervalHook );
2008-10-04 22:59:11 +02:00
}
2009-04-27 04:00:38 +02:00
/**
* Cvar hook callback ( mp_autoteambalance , mp_limitteams )
* Prevents changes to cvar .
*
* @ param convar The cvar handle .
* @ param oldvalue The value before the attempted change .
* @ param newvalue The new value .
*/
public CvarsHookLocked ( Handle : cvar , const String : oldvalue [], const String : newvalue [])
2008-10-04 22:59:11 +02:00
{
2009-04-27 04:00:38 +02:00
// If cvar is mp_autoteambalance, then continue.
if ( cvar == g_hAutoTeamBalance )
2008-10-04 22:59:11 +02:00
{
2009-04-27 04:00:38 +02:00
// Revert to locked value.
SetConVarInt ( g_hAutoTeamBalance , CVARS_AUTOTEAMBALANCE_LOCKED );
2008-10-04 22:59:11 +02:00
2009-04-27 04:00:38 +02:00
// If log flag check fails, then don't log.
if ( LogCheckFlag ( LOG_CORE_EVENTS , LOG_MODULE_CORE ))
{
LogMessageFormatted ( - 1 , " Cvars " , " Cvar Locked " , " Cvar \" mp_autoteambalance \" was reverted back to \" CVARS_AUTOTEAMBALANCE_LOCKED \" . " , LOG_FORMAT_TYPE_FULL );
}
2008-10-04 22:59:11 +02:00
}
2009-04-27 04:00:38 +02:00
// If cvar is mp_limitteams, then continue.
else if ( cvar == g_hLimitTeams )
2008-10-04 22:59:11 +02:00
{
2009-04-27 04:00:38 +02:00
// Revert to locked value.
SetConVarInt ( g_hLimitTeams , CVARS_LIMITTEAMS_LOCKED );
// If log flag check fails, then don't log.
if ( LogCheckFlag ( LOG_CORE_EVENTS , LOG_MODULE_CORE ))
{
LogMessageFormatted ( - 1 , " Cvars " , " Cvar Locked " , " Cvar \" mp_limitteams \" was reverted back to \" CVARS_LIMITTEAMS_LOCKED \" . " , LOG_FORMAT_TYPE_FULL );
}
2008-10-04 22:59:11 +02:00
}
}
2009-04-27 04:00:38 +02:00
/**
* Cvar hook callback ( mp_restartgame )
* Stops restart and just ends the round .
*
* @ param convar The cvar handle .
* @ param oldvalue The value before the attempted change .
* @ param newvalue The new value .
*/
public CvarsHookRestartGame ( Handle : cvar , const String : oldvalue [], const String : newvalue [])
2008-10-04 22:59:11 +02:00
{
2009-04-27 04:00:38 +02:00
// Prevent round restart.
SetConVarInt ( cvar , 0 );
// If value was invalid or 0, then stop.
new Float : delay = StringToFloat ( newvalue );
if ( delay <= 0 )
{
return ;
}
// Terminate the round with restart time as delay.
2009-04-29 01:58:41 +02:00
RoundEndTerminateRound ( delay );
2009-04-27 04:00:38 +02:00
// If log flag check fails, then don't log.
if ( LogCheckFlag ( LOG_CORE_EVENTS , LOG_MODULE_CORE ))
{
LogMessageFormatted ( - 1 , " Cvars " , " Restart Game " , " \" mp_restartgame \" was caught and blocked, commencing round. " , LOG_FORMAT_TYPE_FULL );
}
2009-02-13 22:57:02 +01:00
}