Reorganized cvars.inc, organized all cvars into module groups (to be updated later), removed unused cvars, made classes and weapons core modules (event forwarding priority), updated spawn protect cvars, added cvars to disable weapons, restrict, and hitgroups

This commit is contained in:
Greyscale 2009-04-20 02:56:26 +02:00
parent 8ac1361a70
commit 41153af5f4
30 changed files with 533 additions and 297 deletions

View File

@ -26,6 +26,9 @@
// Cvars (core)
#include "zr/cvars"
// Log (TODO)
// #include "zr/log"
// Translations (core)
#include "zr/translation"
@ -35,37 +38,31 @@
// Models (core)
#include "zr/models"
// Round end (core)
// Class System (core)
#include "zr/playerclasses/playerclasses"
// Round End (core)
#include "zr/roundend"
// Damage (core)
#include "zr/damage"
// Class system (module)
#include "zr/playerclasses/playerclasses"
#include "zr/anticamp"
#include "zr/teleport"
#include "zr/zombie"
#include "zr/menu"
#include "zr/sayhooks"
// Weapons (module)
// Weapons (core)
#include "zr/weapons/weapons"
// Sound effects (module)
// Hitgroups (core)
#include "zr/hitgroups"
// Sound Effects (module)
#include "zr/soundeffects/soundeffects"
// Antistick (module)
#include "zr/antistick"
// Hitgroups (module)
#include "zr/hitgroups"
// Knockback (module)
#include "zr/knockback"
// Spawn protect (module)
// Spawn Protect (module)
#include "zr/spawnprotect"
// Respawn (module)
@ -77,6 +74,11 @@
// ZHP (module)
#include "zr/zhp"
#include "zr/anticamp"
#include "zr/teleport"
#include "zr/zombie"
#include "zr/menu"
#include "zr/sayhooks"
#include "zr/zadmin"
#include "zr/commands"
#include "zr/event"
@ -109,10 +111,13 @@ public OnPluginStart()
// ======================================================================
// Cvars
CvarsInit();
CvarsHook();
// TODO: Be modulized/recoded.
HookEvents();
HookChatCmds();
CreateCvars();
HookCvars();
CreateCommands();
HookCommands();
FindOffsets();
@ -163,11 +168,11 @@ public OnMapStart()
LoadDownloadData();
// Forward event to modules.
RoundEndOnMapStart();
ClassLoad();
RoundEndOnMapStart();
WeaponsLoad();
SEffectsOnMapStart();
HitgroupsLoad();
SEffectsOnMapStart();
Anticamp_Startup();
}
@ -208,9 +213,9 @@ public OnClientPutInServer(client)
bMotherInfectImmune[client] = false;
// Forward event to modules.
ClassClientInit(client);
RoundEndClientInit(client);
DamageClientInit(client);
ClassClientInit(client);
SEffectsClientInit(client);
WeaponsClientInit(client);
SpawnProtectClientInit(client);
@ -228,8 +233,8 @@ public OnClientDisconnect(client)
PlayerLeft(client);
// Forward event to modules.
DamageOnClientDisconnect(client);
ClassOnClientDisconnect(client);
DamageOnClientDisconnect(client);
WeaponsOnClientDisconnect(client);
ZTeleResetClient(client);
@ -265,8 +270,8 @@ MapChangeCleanup()
{
TerminateRound(3.0, Game_Commencing);
UnhookCvars();
UnhookEvents();
CvarsHook();
CvarsUnhook();
// TODO: Disable all modules! Teleport, ambience, overlays, antistick, etc.

View File

@ -31,7 +31,7 @@ new Handle:hUpdateTimer;
Anticamp_Startup(bool:no_reset = false)
{
new Float:interval = GetConVarFloat(gCvars[CVAR_ANTICAMP_UPDATE_INTERVAL]);
new Float:interval = GetConVarFloat(g_hCvarsList[CVAR_ANTICAMP_UPDATE_INTERVAL]);
// Create timer for updating player locations.
if (hUpdateTimer != INVALID_HANDLE)
@ -342,7 +342,7 @@ HurtPlayersInVolume(volume_index)
new client_health;
decl String:client_name[64];
decl String:buffer[192];
new anticamp_echo = GetConVarBool(gCvars[CVAR_ANTICAMP_ECHO]);
new anticamp_echo = GetConVarBool(g_hCvarsList[CVAR_ANTICAMP_ECHO]);
// x = client index.
for (new x = 1; x <= MaxClients; x++)

View File

@ -40,10 +40,10 @@ AntiStickRestart()
KillTimer(tAntiStick);
}
new bool:antistick = GetConVarBool(gCvars[CVAR_ANTISTICK]);
new bool:antistick = GetConVarBool(g_hCvarsList[CVAR_ANTISTICK]);
if (antistick)
{
new Float:interval = GetConVarFloat(gCvars[CVAR_ANTISTICK_INTERVAL]);
new Float:interval = GetConVarFloat(g_hCvarsList[CVAR_ANTISTICK_INTERVAL]);
tAntiStick = CreateTimer(interval, AntiStickTimer, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
}
}

View File

@ -37,7 +37,7 @@ CreateCommands()
public Action:Command_Infect(client, argc)
{
new bool:enabled = GetConVarBool(gCvars[CVAR_ENABLE]);
new bool:enabled = GetConVarBool(g_hCvarsList[CVAR_ENABLE]);
if (argc < 1 || !enabled)
{
return Plugin_Handled;
@ -84,7 +84,7 @@ public Action:Command_Infect(client, argc)
public Action:Command_Respawn(client, argc)
{
new bool:enabled = GetConVarBool(gCvars[CVAR_ENABLE]);
new bool:enabled = GetConVarBool(g_hCvarsList[CVAR_ENABLE]);
if (argc < 1 || !enabled)
{
return Plugin_Handled;
@ -136,17 +136,38 @@ public Action:Command_Respawn(client, argc)
}
/**
* Command callback for client command "zr_restrict"
* Command callback (zr_restrict)
* Restricts a weapon or group
*
* @param client The client index.
* @param argc Argument count.
*/
public Action:Command_Restrict(client, argc)
{
// Disabled.
// If plugin is disabled then stop
new bool:enabled = GetConVarBool(gCvars[CVAR_ENABLE]);
/**new bool:enabled = GetConVarBool(g_hCvarsList[CVAR_ENABLE]);
if (argc < 1 || !enabled)
{
return Plugin_Handled;
}*/
// If weapons module is disabled, then stop.
new bool:weapons = GetConVarBool(g_hCvarsList[CVAR_WEAPONS]);
if (!weapons)
{
// Tell client command is disabled.
ZR_ReplyToCommand(client, "Feature is disabled");
return Plugin_Handled;
}
// If restrict module is disabled, then stop.
new bool:restrict = GetConVarBool(g_hCvarsList[CVAR_WEAPONS_RESTRICT]);
if (!restrict)
{
// Tell client command is disabled.
ZR_ReplyToCommand(client, "Feature is disabled");
return Plugin_Handled;
}
// arg1 = weapon being restricted
@ -165,17 +186,38 @@ public Action:Command_Restrict(client, argc)
}
/**
* Command callback for client command "zr_unrestrict"
* Command callback (zr_unrestrict)
* Unrestricts a weapon or group
*
* @param client The client index.
* @param argc Argument count.
*/
public Action:Command_Unrestrict(client, argc)
{
// Disabled.
// If plugin is disabled then stop
new bool:enabled = GetConVarBool(gCvars[CVAR_ENABLE]);
/**new bool:enabled = GetConVarBool(g_hCvarsList[CVAR_ENABLE]);
if (argc < 1 || !enabled)
{
return Plugin_Handled;
}*/
// If weapons module is disabled, then stop.
new bool:weapons = GetConVarBool(g_hCvarsList[CVAR_WEAPONS]);
if (!weapons)
{
// Tell client command is disabled.
ZR_ReplyToCommand(client, "Feature is disabled");
return Plugin_Handled;
}
// If restrict module is disabled, then stop.
new bool:restrict = GetConVarBool(g_hCvarsList[CVAR_WEAPONS_RESTRICT]);
if (!restrict)
{
// Tell client command is disabled.
ZR_ReplyToCommand(client, "Feature is disabled");
return Plugin_Handled;
}
// arg1 = weapon being restricted

View File

@ -1,49 +1,55 @@
/**
* ====================
/*
* ============================================================================
*
* Zombie:Reloaded
* File: cvars.inc
* Author: Greyscale
* ====================
*
* File: cvars.inc
* Description: Config creation and cvar control.
*
* ============================================================================
*/
enum ZRSettings
/**
* List of cvars used by the plugin.
*/
enum CvarsList
{
Handle:CVAR_ENABLE,
Handle:CVAR_LOG,
Handle:CVAR_ALLOW_PLAYER_TEAM,
Handle:CVAR_AMBIENTSOUNDS,
Handle:CVAR_AMBIENTSOUNDS_FILE,
Handle:CVAR_AMBIENTSOUNDS_LENGTH,
Handle:CVAR_AMBIENTSOUNDS_VOLUME,
Handle:CVAR_SOUNDEFFECTS_MOAN,
Handle:CVAR_SOUNDEFFECTS_GROAN,
Handle:CVAR_SOUNDEFFECTS_DEATH,
Handle:CVAR_NAPALM_IGNITEGRENADE,
Handle:CVAR_CLASSES,
Handle:CVAR_ROUNDEND_OVERLAY,
Handle:CVAR_ROUNDEND_OVERLAY_ZOMBIE,
Handle:CVAR_ROUNDEND_OVERLAY_HUMAN,
Handle:CVAR_CLASSES_SPAWN,
Handle:CVAR_CLASSES_RANDOM,
Handle:CVAR_CLASSES_DEFAULT_ZOMBIE,
Handle:CVAR_CLASSES_DEFAULT_HUMAN,
Handle:CVAR_CLASSES_DEFAULT_ADMIN,
Handle:CVAR_CLASSES_FILE,
Handle:CVAR_ZOMBIE_HEALTH,
Handle:CVAR_ZOMBIE_SPEED,
Handle:CVAR_ZOMBIE_JUMP_DISTANCE,
Handle:CVAR_ZOMBIE_JUMP_HEIGHT,
Handle:CVAR_ZOMBIE_NVGS,
Handle:CVAR_ZOMBIE_FOV,
Handle:CVAR_ZOMBIE_REGEN,
Handle:CVAR_ZOMBIE_REGEN_HEALTH,
Handle:CVAR_ZOMBIE_REGEN_INTERVAL,
Handle:CVAR_ZOMBIE_NAPALM,
Handle:CVAR_ZOMBIE_NAPALM_TIME,
Handle:CVAR_ZOMBIE_NOFALLDAMAGE,
Handle:CVAR_ZOMBIE_KILL_BONUS,
Handle:CVAR_ZOMBIE_INFECT_HEALTH,
Handle:CVAR_ZOMBIE_ZVISION,
Handle:CVAR_ZOMBIE_ALPHA_SPAWN,
Handle:CVAR_ZOMBIE_ALPHA_DAMAGED,
Handle:CVAR_ZOMBIE_ALPHA_DAMAGE,
Handle:CVAR_DAMAGE_SUICIDE_ZOMBIE,
Handle:CVAR_DAMAGE_SUICIDE_HUMAN,
Handle:CVAR_DAMAGE_SUICIDE_CMDS,
Handle:CVAR_WEAPONS,
Handle:CVAR_WEAPONS_RESTRICT,
Handle:CVAR_HITGROUPS,
Handle:CVAR_SOUNDEFFECTS_MOAN,
Handle:CVAR_SOUNDEFFECTS_GROAN,
Handle:CVAR_SOUNDEFFECTS_DEATH,
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,
Handle:CVAR_ZHP,
Handle:CVAR_ZHP_DEFAULT,
// To be modulized/recoded.
Handle:CVAR_OVERLAY_REDISPLAY,
Handle:CVAR_ZVISION_ALLOW_DISABLE,
Handle:CVAR_MENU_AUTOCLOSE,
@ -52,22 +58,10 @@ enum ZRSettings
Handle:CVAR_DARK_SKY,
Handle:CVAR_MOTHER_ZOMBIE_RATIO,
Handle:CVAR_MOTHER_ZOMBIE_RESPAWN,
Handle:CVAR_RESPAWN,
Handle:CVAR_RESPAWN_ZOMBIE,
Handle:CVAR_RESPAWN_DELAY,
Handle:CVAR_SUICIDE_ZOMBIE,
Handle:CVAR_SUICIDE_HUMAN,
Handle:CVAR_SUICIDE_CMDS,
Handle:CVAR_SUICIDE_WORLD_DAMAGE,
Handle:CVAR_SPAWN_MIN,
Handle:CVAR_SPAWN_MAX,
Handle:CVAR_ANTISTICK,
Handle:CVAR_ANTISTICK_INTERVAL,
Handle:CVAR_PROTECT,
Handle:CVAR_CONSECUTIVE_INFECT,
Handle:CVAR_ROUNDEND_OVERLAY,
Handle:CVAR_ROUNDEND_OVERLAY_ZOMBIE,
Handle:CVAR_ROUNDEND_OVERLAY_HUMAN,
Handle:CVAR_ZMARKET_BUYZONE,
Handle:CVAR_ZSPAWN,
Handle:CVAR_ZTELE,
@ -78,8 +72,6 @@ enum ZRSettings
Handle:CVAR_ZTELE_ZOMBIE_DELAY,
Handle:CVAR_ZTELE_ZOMBIE_LIMIT,
Handle:CVAR_ZTELE_RESET_BUFFERS,
Handle:CVAR_ZHP,
Handle:CVAR_ZHP_DEFAULT,
Handle:CVAR_CASHFILL,
Handle:CVAR_CASHAMOUNT,
Handle:CVAR_INFECT_FIREBALL,
@ -93,119 +85,292 @@ enum ZRSettings
Handle:CVAR_INFECT_SHAKE_DURATION,
Handle:CVAR_ANTICAMP,
Handle:CVAR_ANTICAMP_UPDATE_INTERVAL,
Handle:CVAR_ANTICAMP_ECHO
Handle:CVAR_ANTICAMP_ECHO,
}
new gCvars[ZRSettings];
/**
* Array to store cvar data in.
*/
new g_hCvarsList[CvarsList];
CreateCvars()
/**
* Cvars module init function.
*/
CvarsInit()
{
gCvars[CVAR_ENABLE] = CreateConVar("zr_enable", "1", "Enable zombie gameplay (0: Disable)");
gCvars[CVAR_LOG] = CreateConVar("zr_log", "331", "Logging flags. Log messages to sourcemod logs, server console or client console. Use zr_log_flags to see a list of flags. (0: Disable)");
gCvars[CVAR_AMBIENTSOUNDS] = CreateConVar("zr_ambientsounds", "1", "Enable creepy ambience to be played throughout the game (0: Disable)");
gCvars[CVAR_AMBIENTSOUNDS_FILE] = CreateConVar("zr_ambientsounds_file", "ambient/zr/zr_ambience.mp3", "Path to ambient sound file that will be played throughout the game, when zr_ambience is 1");
gCvars[CVAR_AMBIENTSOUNDS_LENGTH] = CreateConVar("zr_ambientsounds_length", "60.0", "The length, in seconds, of the ambient sound file");
gCvars[CVAR_AMBIENTSOUNDS_VOLUME] = CreateConVar("zr_ambientsounds_volume", "1.0", "Volume of ambient sounds when zr_ambience is 1 (0.0: Unhearable, 1.0: Max volume)");
gCvars[CVAR_SOUNDEFFECTS_MOAN] = CreateConVar("zr_soundeffects_moan", "50", "How often, in seconds, a zombie moans (0: Disable)");
gCvars[CVAR_SOUNDEFFECTS_GROAN] = CreateConVar("zr_soundeffects_groan", "5", "Chance factor a zombie will groan when shot (Lower: More often, 0: Disable)");
gCvars[CVAR_SOUNDEFFECTS_DEATH] = CreateConVar("zr_soundeffects_death", "1", "Zombie will emit a death sound when killed (0: Disable)");
gCvars[CVAR_NAPALM_IGNITEGRENADE] = CreateConVar("zr_napalm_ignitegrenade", "1", "Ignites all thrown grenades. (0: Disable)");
gCvars[CVAR_CLASSES] = CreateConVar("zr_classes", "1", "Enable zombie classes");
gCvars[CVAR_CLASSES_SPAWN] = CreateConVar("zr_classes_spawn", "0", "Classmenu is re-displayed every spawn (0: Disable)");
gCvars[CVAR_CLASSES_RANDOM] = CreateConVar("zr_classes_random", "0", "A random class is assigned to each player every round. Overrides zr_classes_spawn and default classes. (0: Disable)");
gCvars[CVAR_CLASSES_DEFAULT_ZOMBIE] = CreateConVar("zr_classes_default_zombie", "random", "Default zombie class selected for all players when they connect. Use \"random\" to select a random class, or blank to use class config defaults.");
gCvars[CVAR_CLASSES_DEFAULT_HUMAN] = CreateConVar("zr_classes_default_human", "random", "Default human class selected for all players when they connect. Use \"random\" to select a random class, or blank to use class config defaults.");
gCvars[CVAR_CLASSES_DEFAULT_ADMIN] = CreateConVar("zr_classes_default_admin", "random", "Default admin-only class selected for admins when they connect. Use \"random\" to select a random class, or blank to use class config defaults.");
gCvars[CVAR_CLASSES_FILE] = CreateConVar("zr_classes_file", "configs/zr/playerclasses.txt", "Class data file to read from, in Valves key/values format. The path is relative to the \"sourcemod\" folder.");
gCvars[CVAR_ZOMBIE_HEALTH] = CreateConVar("zr_zombie_health", "5000", "The default health of a zombie");
gCvars[CVAR_ZOMBIE_SPEED] = CreateConVar("zr_zombie_speed", "350", "How fast zombies travel (300: Default speed, 600: Double speed)");
gCvars[CVAR_ZOMBIE_JUMP_DISTANCE] = CreateConVar("zr_zombie_jump_distance", "0.1", "How far the zombie jumps, (0: Regular jump distance)");
gCvars[CVAR_ZOMBIE_JUMP_HEIGHT] = CreateConVar("zr_zombie_jump_height", "10.0", "How high a zombie jumps (0: Regular jump height)");
gCvars[CVAR_ZOMBIE_NVGS] = CreateConVar("zr_zombie_nvgs", "-1", "Zombies will be equipped with nightvision. Also used to override class nvgs if non-negative. (-1: No override, uses class setting, 0: No nvgs, 1: Nvgs on)");
gCvars[CVAR_ZOMBIE_FOV] = CreateConVar("zr_zombie_fov", "110", "The field of vision of zombies (90: Default vision)");
gCvars[CVAR_ZOMBIE_REGEN] = CreateConVar("zr_zombie_regen", "0", "Zombies will regenerate health");
gCvars[CVAR_ZOMBIE_REGEN_HEALTH] = CreateConVar("zr_zombie_regen_health", "1", "How much health is regenerated when zr_zombie_regen is 1");
gCvars[CVAR_ZOMBIE_REGEN_INTERVAL] = CreateConVar("zr_zombie_regen_interval", "5", "How often, in seconds, a zombie regenerates health when zr_zombie_regen is 1");
gCvars[CVAR_ZOMBIE_NAPALM] = CreateConVar("zr_zombie_napalm", "1", "Turns grenades into napalm grenades that light zombies on fire (0: Disable)");
gCvars[CVAR_ZOMBIE_NAPALM_TIME] = CreateConVar("zr_zombie_napalm_time", "20", "How long the zombie burns when zr_napalm is 1");
gCvars[CVAR_ZOMBIE_NOFALLDAMAGE] = CreateConVar("zr_zombie_nofalldamage", "0", "Zombies wont be hurt from falling (0: Disable)");
gCvars[CVAR_ZOMBIE_KILL_BONUS] = CreateConVar("zr_zombie_kill_bonus", "2", "How many additional kills are rewarded to the killer of the zombie");
gCvars[CVAR_ZOMBIE_INFECT_HEALTH] = CreateConVar("zr_zombie_infect_health", "100", "How much health a zombie gains when infecting a human (0: Disable)");
gCvars[CVAR_ZOMBIE_ZVISION] = CreateConVar("zr_zombie_zvision", "overlays/zr/zvision", "Overlay to be shown on all zombies' screen on infection (Leave empty to disable)");
gCvars[CVAR_ZOMBIE_ALPHA_SPAWN] = CreateConVar("zr_zombie_alpha_spawn", "255", "Initial transparency (0: Invisible. 255: Fully visible)");
gCvars[CVAR_ZOMBIE_ALPHA_DAMAGED] = CreateConVar("zr_zombie_alpha_damaged", "255", "Transparency when damaged (0: Invisible. 255: Fully visible)");
gCvars[CVAR_ZOMBIE_ALPHA_DAMAGE] = CreateConVar("zr_zombie_alpha_damage", "0", "How much damage to do before changing transparency.");
gCvars[CVAR_OVERLAY_REDISPLAY] = CreateConVar("zr_overlay_redisplay", "3", "Frequency, in seconds, to display overlay on the client's screen (Never go below 0.1, 0.2 seems safe)");
gCvars[CVAR_ZVISION_ALLOW_DISABLE] = CreateConVar("zr_zvision_allow_disable", "1", "Allow users to disable ZVision with their nightvision key (0: Disable)");
gCvars[CVAR_MENU_AUTOCLOSE] = CreateConVar("zr_menu_autoclose", "0", "Automatically close menus on selection. If disabled the menu will remain open.");
gCvars[CVAR_DARK] = CreateConVar("zr_dark", "0", "Default value for darkening maps, most dislike this feature (0: Disable)");
gCvars[CVAR_DARK_LEVEL] = CreateConVar("zr_dark_level", "a", "The darkness of the map, a being the darkest, z being extremely bright when zr_dark is 1 (n: Default)");
gCvars[CVAR_DARK_SKY] = CreateConVar("zr_dark_sky", "sky_borealis01", "The sky the map will have when zr_dark is 1");
gCvars[CVAR_MOTHER_ZOMBIE_RATIO] = CreateConVar("zr_mother_zombie_ratio", "5", "For every 'x' number of humans, there will be 1 zombie (0: Always only 1 mother zombie)");
gCvars[CVAR_MOTHER_ZOMBIE_RESPAWN] = CreateConVar("zr_mother_zombie_respawn", "0", "First zombie(s) will be teleported back to spawn when infected (0: Disable)");
gCvars[CVAR_RESPAWN] = CreateConVar("zr_respawn", "0", "When player is killed, player will respawn");
gCvars[CVAR_RESPAWN_ZOMBIE] = CreateConVar("zr_respawn_zombie", "1", "Respawn player as zombie (0: Respawn as human)");
gCvars[CVAR_RESPAWN_DELAY] = CreateConVar("zr_respawn_delay", "1", "How long to wait after death to respawn, in seconds");
gCvars[CVAR_SUICIDE_ZOMBIE] = CreateConVar("zr_suicide_zombie", "1", "Intercept human suicide attempts.");
gCvars[CVAR_SUICIDE_HUMAN] = CreateConVar("zr_suicide_human", "1", "Intercept zombie suicide attempts.");
gCvars[CVAR_SUICIDE_CMDS] = CreateConVar("zr_suicide_cmds", "kill, spectate, jointeam", "List of suicide commands to intercept. (Delimited by \", \"");
/** Note: CVAR_SUICIDE_WORLD_DAMAGE should be renamed as it is not part of the suicide intercept function*/
gCvars[CVAR_SUICIDE_WORLD_DAMAGE] = CreateConVar("zr_suicide_world_damage", "1", "Respawn zombies as zombies if they were killed by the world, like elevators, doors and lasers. (0: Disable)");
gCvars[CVAR_SPAWN_MIN] = CreateConVar("zr_spawn_min", "30", "Minimum time a player is picked to be zombie after the round starts, in seconds");
gCvars[CVAR_SPAWN_MAX] = CreateConVar("zr_spawn_max", "50", "Maximum time a player is picked to be zombie after the round starts, in seconds");
gCvars[CVAR_ANTISTICK] = CreateConVar("zr_antistick", "1", "Enable the anti-stick module, which will automatically unstick players stuck within each other. (0:Disable)");
gCvars[CVAR_ANTISTICK_INTERVAL] = CreateConVar("zr_antistick_interval", "1.0", "How often, in seconds, the anti-stick module checks each player for being stuck. (1.0: Default)");
gCvars[CVAR_PROTECT] = CreateConVar("zr_protect", "10", "Players that join late will be protected for this long, in seconds (0: Disable)");
gCvars[CVAR_CONSECUTIVE_INFECT] = CreateConVar("zr_consecutive_infect", "0", "Allow player to be randomly chosen twice in a row to be a mother zombie (0: Disable)");
gCvars[CVAR_ROUNDEND_OVERLAY] = CreateConVar("zr_roundend_overlay", "1", "Shows an overlay to all clients when a team wins. (0: Disable)");
gCvars[CVAR_ROUNDEND_OVERLAY_HUMAN] = CreateConVar("zr_roundend_overlays_human", "overlays/zr/humans_win", "Path to \"humans win\" overlay");
gCvars[CVAR_ROUNDEND_OVERLAY_ZOMBIE] = CreateConVar("zr_roundend_overlays_zombie", "overlays/zr/zombies_win", "Path to \"zombies win\" overlay");
gCvars[CVAR_ZMARKET_BUYZONE] = CreateConVar("zr_zmarket_buyzone", "1", "Must be in buyzone to access !zmarket, if Market is installed (0: Can be used anywhere)");
gCvars[CVAR_ZSPAWN] = CreateConVar("zr_zspawn", "1", "Allow players to spawn if they just joined the game (0: Disable)");
gCvars[CVAR_ZTELE] = CreateConVar("zr_tele", "1", "Allow players to use the teleporter to get to spawn. (0: Disable)");
gCvars[CVAR_ZTELE_STARTUP_DELAY] = CreateConVar("zr_tele_startup_delay", "30", "Number of seconds to wait before the teleporter is enabled (0: Always enabled)");
gCvars[CVAR_ZTELE_COOLDOWN] = CreateConVar("zr_tele_cooldown", "20", "Number of seconds to wait before the teleporter can be used again, after a teleport. (0: Disable)");
gCvars[CVAR_ZTELE_HUMAN_DELAY] = CreateConVar("zr_tele_human_delay", "10", "Teleport delay for humans. (0: No delay)");
gCvars[CVAR_ZTELE_HUMAN_LIMIT] = CreateConVar("zr_tele_human_limit", "3", "Maximum number of teleports humans can do. (0: Humans can't use the teleporter. -1: Unlimited)");
gCvars[CVAR_ZTELE_ZOMBIE_DELAY] = CreateConVar("zr_tele_zombie_delay", "0", "Teleport delay for zombies. (0: No delay)");
gCvars[CVAR_ZTELE_ZOMBIE_LIMIT] = CreateConVar("zr_tele_zombie_limit", "8", "Maximum number of teleports zombies can do. (0: Zombies can't use the teleporter. -1: Unlimited)");
gCvars[CVAR_ZTELE_RESET_BUFFERS] = CreateConVar("zr_tele_reset_buffers", "1", "Reset custom saved teleport locations on each round start. (0: Disable)");
gCvars[CVAR_ZHP] = CreateConVar("zr_zhp", "1", "Allows clients to enable/disable zombie health display (1: On, 0: Off)");
gCvars[CVAR_ZHP_DEFAULT] = CreateConVar("zr_zhp_default", "1", "The default value of zombie health display to new clients (1: On, 0: Off)");
gCvars[CVAR_CASHFILL] = CreateConVar("zr_cashfill", "1", "Enable the mod to set the players cash to zr_cashamount (0: Disabled)");
gCvars[CVAR_CASHAMOUNT] = CreateConVar("zr_cashamount", "12000", "How much money players will have when they spawn when zr_cashfill is 1");
gCvars[CVAR_INFECT_FIREBALL] = CreateConVar("zr_infect_fireball", "1", "A fireball is created when a player is infected (0: Disable)");
gCvars[CVAR_INFECT_SMOKE] = CreateConVar("zr_infect_smoke", "1", "A puff of smoke is created when a player is infected (0: Disable)");
gCvars[CVAR_INFECT_SPARKS] = CreateConVar("zr_infect_sparks", "1", "Sparks are emitted when a player is infected (0: Disable)");
gCvars[CVAR_INFECT_SOUND] = CreateConVar("zr_infect_sound", "npc/fast_zombie/fz_scream1.wav", "Sound played from from player on infection (Leave blank to disable)");
gCvars[CVAR_INFECT_ESPLASH] = CreateConVar("zr_infect_esplash", "1", "An energy splash is emitted when player is infected (0: Disable)");
gCvars[CVAR_INFECT_SHAKE] = CreateConVar("zr_infect_shake", "1", "Player's screen is shaken on infection (0: Disable)");
gCvars[CVAR_INFECT_SHAKE_AMP] = CreateConVar("zr_infect_shake_amp", "15.0", "Amplitude of the shake, when zr_infect_shake is 1");
gCvars[CVAR_INFECT_SHAKE_FREQUENCY] = CreateConVar("zr_infect_shake_frequency", "1.0", "Frequency of the shake, when zr_infect_shake is 1");
gCvars[CVAR_INFECT_SHAKE_DURATION] = CreateConVar("zr_infect_shake_duration", "5.0", "Duration of the shake, when zr_infect_shake is 1");
gCvars[CVAR_ANTICAMP] = CreateConVar("zr_anticamp", "1", "Enables or disables hurt volumes for preventing unfair camping. (0: Disable)");
gCvars[CVAR_ANTICAMP_UPDATE_INTERVAL] = CreateConVar("zr_anticamp_update_interval", "1", "How often to update player locations (in seconds).");
gCvars[CVAR_ANTICAMP_ECHO] = CreateConVar("zr_anticamp_echo", "1", "Log kills done by anticamp to admin chat.");
// 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?
// ===========================
// General (Core)
// ===========================
g_hCvarsList[CVAR_ENABLE] = CreateConVar("zr_enable", "1", "");
// ===========================
// Log (core)
// ===========================
g_hCvarsList[CVAR_LOG] = CreateConVar("zr_log", "331", "");
// Old Desc: Logging flags. Log messages to sourcemod logs, server console or client console. Use zr_log_flags to see a list of flags. (0: Disable)
// ===========================
// Translations (core)
// ===========================
// (None)
// ===========================
// Round End (core)
// ===========================
g_hCvarsList[CVAR_ROUNDEND_OVERLAY] = CreateConVar("zr_roundend_overlay", "1", "");
// Old Desc: Shows an overlay to all clients when a team wins. (0: Disable)
g_hCvarsList[CVAR_ROUNDEND_OVERLAY_HUMAN] = CreateConVar("zr_roundend_overlays_human", "");
// Old Desc: overlays/zr/humans_win", "Path to \"humans win\" overlay
g_hCvarsList[CVAR_ROUNDEND_OVERLAY_ZOMBIE] = CreateConVar("zr_roundend_overlays_zombie", "overlays/zr/zombies_win", "");
// Old Desc: Path to \"zombies win\" overlay
// ===========================
// Offsets (core)
// ===========================
// (None)
// ===========================
// Models (core)
// ===========================
// TODO: config file path.
// ===========================
// Classes (core)
// ===========================
g_hCvarsList[CVAR_CLASSES_SPAWN] = CreateConVar("zr_classes_spawn", "0", "");
// Old Desc: Classmenu is re-displayed every spawn (0: Disable)
g_hCvarsList[CVAR_CLASSES_RANDOM] = CreateConVar("zr_classes_random", "0", "");
// Old Desc: A random class is assigned to each player every round. Overrides zr_classes_spawn and default classes. (0: Disable)
g_hCvarsList[CVAR_CLASSES_DEFAULT_ZOMBIE] = CreateConVar("zr_classes_default_zombie", "random", "");
// 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.
g_hCvarsList[CVAR_CLASSES_DEFAULT_HUMAN] = CreateConVar("zr_classes_default_human", "random", "");
// Old Desc:
g_hCvarsList[CVAR_CLASSES_DEFAULT_ADMIN] = CreateConVar("zr_classes_default_admin", "random", "");
// 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.
g_hCvarsList[CVAR_CLASSES_FILE] = CreateConVar("zr_classes_file", "configs/zr/playerclasses.txt", "");
// Old Desc: Class data file to read from, in Valves key/values format. The path is relative to the \"sourcemod\" folder.
// ===========================
// Damage (core)
// ===========================
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 \", \"
// ===========================
// Weapons (core)
// ===========================
// 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.
// ===========================
// Hitgroups (core)
// ===========================
g_hCvarsList[CVAR_HITGROUPS] = CreateConVar("zr_hitgroups", "1", "");
// Note make config file cvar.
// ===========================
// Sound Effects (module)
// ===========================
// Zombie Sounds
g_hCvarsList[CVAR_SOUNDEFFECTS_MOAN] = CreateConVar("zr_soundeffects_moan", "30", "");
// Old Desc: How often, in seconds, a zombie moans (0: Disable)
g_hCvarsList[CVAR_SOUNDEFFECTS_GROAN] = CreateConVar("zr_soundeffects_groan", "5", "");
// Old Desc: Chance factor a zombie will groan when shot (Lower: More often, 0: Disable)
g_hCvarsList[CVAR_SOUNDEFFECTS_DEATH] = CreateConVar("zr_soundeffects_death", "1", "");
// Old Desc: Zombie will emit a death sound when killed (0: Disable)
// Ambient Sounds
g_hCvarsList[CVAR_AMBIENTSOUNDS] = CreateConVar("zr_ambientsounds", "1", "");
// Old Desc: Enable creepy ambience to be played throughout the game (0: Disable)
g_hCvarsList[CVAR_AMBIENTSOUNDS_FILE] = CreateConVar("zr_ambientsounds_file", "ambient/zr/zr_ambience.mp3", "");
// Old Desc: Path to ambient sound file that will be played throughout the game, when zr_ambience is 1
g_hCvarsList[CVAR_AMBIENTSOUNDS_LENGTH] = CreateConVar("zr_ambientsounds_length", "60.0", "");
// Old Desc: The length, in seconds, of the ambient sound file
g_hCvarsList[CVAR_AMBIENTSOUNDS_VOLUME] = CreateConVar("zr_ambientsounds_volume", "1.0", "");
// Old Desc: Volume of ambient sounds when zr_ambience is 1 (0.0: Unhearable, 1.0: Max volume)
// ===========================
// Antistick (module)
// ===========================
g_hCvarsList[CVAR_ANTISTICK] = CreateConVar("zr_antistick", "1", "");
// Old Desc: Enable the anti-stick module, which will automatically unstick players stuck within each other. (0:Disable)
g_hCvarsList[CVAR_ANTISTICK_INTERVAL] = CreateConVar("zr_antistick_interval", "0.5", "");
// Old Desc: How often, in seconds, the anti-stick module checks each player for being stuck. (1.0: Default)
// ===========================
// Knockback (module)
// ===========================
// (None)
// ===========================
// 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", "");
// Old Desc: When player is killed, player will respawn
g_hCvarsList[CVAR_RESPAWN_DELAY] = CreateConVar("zr_respawn_delay", "1", "");
// Old Desc: How long to wait after death to respawn, in seconds
g_hCvarsList[CVAR_RESPAWN_ZOMBIE] = CreateConVar("zr_respawn_zombie", "1", "");
// Old Desc: Respawn player as zombie (0: Respawn as human)
g_hCvarsList[CVAR_RESPAWN_ZOMBIE_WORLD] = CreateConVar("zr_respawn_zombie_world", "1", "");
// Old Desc: Respawn zombies as zombies if they were killed by the world, like elevators, doors and lasers. (0: Disable)
// ===========================
// Napalm (module)
// ===========================
// (None)
// ===========================
// ZHP (module)
// ===========================
g_hCvarsList[CVAR_ZHP] = CreateConVar("zr_zhp", "1", "");
// Old Desc: Allows clients to enable/disable zombie health display (1: On, 0: Off)
g_hCvarsList[CVAR_ZHP_DEFAULT] = CreateConVar("zr_zhp_default", "1", "");
// Old Desc: The default value of zombie health display to new clients (1: On, 0: Off)
// TO BE MODULIZED/RECODED.
g_hCvarsList[CVAR_OVERLAY_REDISPLAY] = CreateConVar("zr_overlay_redisplay", "3", "");
// Old Desc: Frequency, in seconds, to display overlay on the client's screen (Never go below 0.1, 0.2 seems safe)
g_hCvarsList[CVAR_ZVISION_ALLOW_DISABLE] = CreateConVar("zr_zvision_allow_disable", "1", "");
// Old Desc: Allow users to disable ZVision with their nightvision key (0: Disable)
g_hCvarsList[CVAR_MENU_AUTOCLOSE] = CreateConVar("zr_menu_autoclose", "0", "");
// Old Desc: Automatically close menus on selection. If disabled the menu will remain open.
g_hCvarsList[CVAR_DARK] = CreateConVar("zr_dark", "0", "");
// Old Desc: Default value for darkening maps, most dislike this feature (0: Disable)
g_hCvarsList[CVAR_DARK_LEVEL] = CreateConVar("zr_dark_level", "a", "");
// Old Desc: The darkness of the map, a being the darkest, z being extremely bright when zr_dark is 1 (n: Default)
g_hCvarsList[CVAR_DARK_SKY] = CreateConVar("zr_dark_sky", "sky_borealis01", "");
// Old Desc: The sky the map will have when zr_dark is 1
g_hCvarsList[CVAR_MOTHER_ZOMBIE_RATIO] = CreateConVar("zr_mother_zombie_ratio", "5", "");
// Old Desc: For every 'x' number of humans, there will be 1 zombie (0: Always only 1 mother zombie)
g_hCvarsList[CVAR_MOTHER_ZOMBIE_RESPAWN] = CreateConVar("zr_mother_zombie_respawn", "0", "");
// Old Desc: First zombie(s) will be teleported back to spawn when infected (0: Disable)
g_hCvarsList[CVAR_SPAWN_MIN] = CreateConVar("zr_spawn_min", "30", "");
// Old Desc: Minimum time a player is picked to be zombie after the round starts, in seconds
g_hCvarsList[CVAR_SPAWN_MAX] = CreateConVar("zr_spawn_max", "50", "");
// Old Desc: Maximum time a player is picked to be zombie after the round starts, in seconds
g_hCvarsList[CVAR_CONSECUTIVE_INFECT] = CreateConVar("zr_consecutive_infect", "0", "");
// Old Desc: Allow player to be randomly chosen twice in a row to be a mother zombie (0: Disable)
g_hCvarsList[CVAR_ZMARKET_BUYZONE] = CreateConVar("zr_zmarket_buyzone", "1", "");
// Old Desc: Must be in buyzone to access !zmarket, if Market is installed (0: Can be used anywhere)
g_hCvarsList[CVAR_ZSPAWN] = CreateConVar("zr_zspawn", "1", "");
// Old Desc: Allow players to spawn if they just joined the game (0: Disable)
g_hCvarsList[CVAR_ZTELE] = CreateConVar("zr_tele", "1", "");
// Old Desc: Allow players to use the teleporter to get to spawn. (0: Disable)
g_hCvarsList[CVAR_ZTELE_STARTUP_DELAY] = CreateConVar("zr_tele_startup_delay", "30", "");
// Old Desc: Number of seconds to wait before the teleporter is enabled (0: Always enabled)
g_hCvarsList[CVAR_ZTELE_COOLDOWN] = CreateConVar("zr_tele_cooldown", "20", "");
// Old Desc: Number of seconds to wait before the teleporter can be used again, after a teleport. (0: Disable)
g_hCvarsList[CVAR_ZTELE_HUMAN_DELAY] = CreateConVar("zr_tele_human_delay", "10", "");
// Old Desc: Teleport delay for humans. (0: No delay)
g_hCvarsList[CVAR_ZTELE_HUMAN_LIMIT] = CreateConVar("zr_tele_human_limit", "3", "");
// Old Desc: Maximum number of teleports humans can do. (0: Humans can't use the teleporter. -1: Unlimited)
g_hCvarsList[CVAR_ZTELE_ZOMBIE_DELAY] = CreateConVar("zr_tele_zombie_delay", "0", "");
// Old Desc: Teleport delay for zombies. (0: No delay)
g_hCvarsList[CVAR_ZTELE_ZOMBIE_LIMIT] = CreateConVar("zr_tele_zombie_limit", "8", "");
// Old Desc: Maximum number of teleports zombies can do. (0: Zombies can't use the teleporter. -1: Unlimited)
g_hCvarsList[CVAR_ZTELE_RESET_BUFFERS] = CreateConVar("zr_tele_reset_buffers", "1", "");
// Old Desc: Reset custom saved teleport locations on each round start. (0: Disable)
g_hCvarsList[CVAR_CASHFILL] = CreateConVar("zr_cashfill", "1", "");
// Old Desc: Enable the mod to set the players cash to zr_cashamount (0: Disabled)
g_hCvarsList[CVAR_CASHAMOUNT] = CreateConVar("zr_cashamount", "12000", "");
// Old Desc: How much money players will have when they spawn when zr_cashfill is 1
g_hCvarsList[CVAR_INFECT_FIREBALL] = CreateConVar("zr_infect_fireball", "1", "");
// Old Desc: A fireball is created when a player is infected (0: Disable)
g_hCvarsList[CVAR_INFECT_SMOKE] = CreateConVar("zr_infect_smoke", "1", "");
// Old Desc: A puff of smoke is created when a player is infected (0: Disable)
g_hCvarsList[CVAR_INFECT_SPARKS] = CreateConVar("zr_infect_sparks", "1", "");
// Old Desc: Sparks are emitted when a player is infected (0: Disable)
g_hCvarsList[CVAR_INFECT_SOUND] = CreateConVar("zr_infect_sound", "");
// Old Desc: npc/fast_zombie/fz_scream1.wav", "Sound played from from player on infection (Leave blank to disable)
g_hCvarsList[CVAR_INFECT_ESPLASH] = CreateConVar("zr_infect_esplash", "1", "");
// Old Desc: An energy splash is emitted when player is infected (0: Disable)
g_hCvarsList[CVAR_INFECT_SHAKE] = CreateConVar("zr_infect_shake", "1", "");
// Old Desc: Player's screen is shaken on infection (0: Disable)
g_hCvarsList[CVAR_INFECT_SHAKE_AMP] = CreateConVar("zr_infect_shake_amp", "15.0", "");
// Old Desc: Amplitude of the shake, when zr_infect_shake is 1
g_hCvarsList[CVAR_INFECT_SHAKE_FREQUENCY] = CreateConVar("zr_infect_shake_frequency", "1.0", "");
// Old Desc: Frequency of the shake, when zr_infect_shake is 1
g_hCvarsList[CVAR_INFECT_SHAKE_DURATION] = CreateConVar("zr_infect_shake_duration", "5.0", "");
// Old Desc: Duration of the shake, when zr_infect_shake is 1
g_hCvarsList[CVAR_ANTICAMP] = CreateConVar("zr_anticamp", "1", "");
// Old Desc: Enables or disables hurt volumes for preventing unfair camping. (0: Disable)
g_hCvarsList[CVAR_ANTICAMP_UPDATE_INTERVAL] = CreateConVar("zr_anticamp_update_interval", "1", "");
// Old Desc: How often to update player locations (in seconds).
g_hCvarsList[CVAR_ANTICAMP_ECHO] = CreateConVar("zr_anticamp_echo", "1", "");
// Old Desc: Log kills done by anticamp to admin chat.
// TODO: Recode.
//HookConVarChange(gCvars[CVAR_ENABLE], EnableHook);
HookConVarChange(gCvars[CVAR_ANTICAMP], AnticampHook);
HookConVarChange(gCvars[CVAR_ANTICAMP_UPDATE_INTERVAL], UpdateIntervalHook);
//HookConVarChange(g_hCvarsList[CVAR_ENABLE], EnableHook);
AutoExecConfig(true, "zombiereloaded", "sourcemod/zombiereloaded");
}
HookCvars()
CvarsHook()
{
SetConVarBool(FindConVar("mp_autoteambalance"), false);
SetConVarInt(FindConVar("mp_limitteams"), 0);
HookConVarChange(FindConVar("mp_autoteambalance"), AutoTeamBalanceHook);
HookConVarChange(FindConVar("mp_limitteams"), LimitTeamsHook);
HookConVarChange(g_hCvarsList[CVAR_ANTICAMP], AnticampHook);
HookConVarChange(g_hCvarsList[CVAR_ANTICAMP_UPDATE_INTERVAL], UpdateIntervalHook);
}
UnhookCvars()
CvarsUnhook()
{
UnhookConVarChange(FindConVar("mp_autoteambalance"), AutoTeamBalanceHook);
UnhookConVarChange(FindConVar("mp_limitteams"), LimitTeamsHook);
@ -240,7 +405,7 @@ public LimitTeamsHook(Handle:convar, const String:oldValue[], const String:newVa
LogHasFlag(flag)
{
if (GetConVarInt(gCvars[CVAR_LOG]) & flag)
if (GetConVarInt(g_hCvarsList[CVAR_LOG]) & flag)
{
return 1;
}

View File

@ -50,7 +50,7 @@ DamageInit()
{
// Create command callbacks (intercepts) for listed suicide commands.
decl String:suicidecmds[64];
GetConVarString(gCvars[CVAR_SUICIDE_CMDS], suicidecmds, sizeof(suicidecmds));
GetConVarString(g_hCvarsList[CVAR_DAMAGE_SUICIDE_CMDS], suicidecmds, sizeof(suicidecmds));
// Create array to store cmds
new String:arrayCmds[DAMAGE_SUICIDE_MAX_CMDS][DAMAGE_SUICIDE_MAX_LENGTH];
@ -105,7 +105,7 @@ DamageOnClientDisconnect(client)
public DamageTraceAttack(client, inflictor, attacker, damage, hitbox, hitgroup)
{
// Disabled
// new bool:enabled = GetConVarBool(gCvars[CVAR_ENABLE]);
// new bool:enabled = GetConVarBool(g_hCvarsList[CVAR_ENABLE]);
// If attacker isn't valid, then stop.
if (!ZRIsValidClient(attacker))
@ -144,7 +144,7 @@ public DamageOnTakeDamage(client, inflictor, attacker, damage, damagetype, ammot
{
// Disabled.
/**
new bool:enabled = GetConVarBool(gCvars[CVAR_ENABLE]);
new bool:enabled = GetConVarBool(g_hCvarsList[CVAR_ENABLE]);
if (!enabled)
{
return Hacks_Continue;
@ -250,7 +250,7 @@ public Action:DamageSuicideIntercept(client, argc)
{
// Disabled.
/**
new bool:enabled = GetConVarBool(gCvars[CVAR_ENABLE]);
new bool:enabled = GetConVarBool(g_hCvarsList[CVAR_ENABLE]);
if (!enabled)
{
return Plugin_Continue;
@ -278,8 +278,8 @@ public Action:DamageSuicideIntercept(client, argc)
new bool:clientzombie = IsPlayerZombie(client);
// Get cvar values for suicide interception.
new bool:suicidezombie = GetConVarBool(gCvars[CVAR_SUICIDE_ZOMBIE]);
new bool:suicidehuman = GetConVarBool(gCvars[CVAR_SUICIDE_HUMAN]);
new bool:suicidezombie = GetConVarBool(g_hCvarsList[CVAR_DAMAGE_SUICIDE_ZOMBIE]);
new bool:suicidehuman = GetConVarBool(g_hCvarsList[CVAR_DAMAGE_SUICIDE_HUMAN]);
// Determine whether to block suicide based off of the client's zombie flag and cvar values.
new bool:blocksuicide = clientzombie ? suicidezombie : suicidehuman;

View File

@ -71,8 +71,8 @@ public Action:RoundFreezeEnd(Handle:event, const String:name[], bool:dontBroadca
KillTimer(tInfect);
}
new Float:min = GetConVarFloat(gCvars[CVAR_SPAWN_MIN]);
new Float:max = GetConVarFloat(gCvars[CVAR_SPAWN_MAX]);
new Float:min = GetConVarFloat(g_hCvarsList[CVAR_SPAWN_MIN]);
new Float:max = GetConVarFloat(g_hCvarsList[CVAR_SPAWN_MAX]);
new Float:randlen = GetRandomFloat(min, max);
tInfect = CreateTimer(randlen, MotherZombie, _, TIMER_FLAG_NO_MAPCHANGE);
@ -144,10 +144,10 @@ public Action:PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
// Check if client is on a team.
if (ZRIsClientOnTeam(index))
{
new bool:cashfill = GetConVarBool(gCvars[CVAR_CASHFILL]);
new bool:cashfill = GetConVarBool(g_hCvarsList[CVAR_CASHFILL]);
if (cashfill)
{
new cash = GetConVarInt(gCvars[CVAR_CASHAMOUNT]);
new cash = GetConVarInt(g_hCvarsList[CVAR_CASHAMOUNT]);
SetPlayerMoney(index, cash);
}

View File

@ -52,6 +52,13 @@ HitgroupsLoad()
// Clear hitgroup data
HitgroupsClearData();
// If module is disabled, then stop.
new bool:hitgroups = GetConVarBool(g_hCvarsList[CVAR_HITGROUPS]);
if (!hitgroups)
{
return;
}
decl String:path[PLATFORM_MAX_PATH];
BuildPath(Path_SM, path, sizeof(path), "configs/zr/hitgroups.txt");

View File

@ -53,12 +53,11 @@ NapalmOnClientHurt(client, const String:weapon[])
*/
NapalmOnWeaponFire(const String:weapon[])
{
// If ignite grenade is disabled, then stop.
new bool:ignitegrenade = GetConVarBool(gCvars[CVAR_NAPALM_IGNITEGRENADE]);
if (!ignitegrenade)
// If human class can't throw napalm grenades, then stop. (TODO)
/*if ()
{
return;
}
}*/
// If weapon isn't a grenade, then stop.
if (!StrEqual(weapon, "hegrenade", false))

View File

@ -139,9 +139,9 @@ bool:ClassApplyOverlay(client, classindex, cachetype = ZR_CLASS_CACHE_PLAYER)
}
// If client doesn't meet minimum requirement, then print unsupported text.
if (dxLevel[client] < ROUNDEND_MIN_DXLEVEL)
if (dxLevel[client] < GENERAL_MIN_DXLEVEL)
{
ZR_PrintCenterText(client, "DX90 not supported", dxLevel[client], ROUNDEND_MIN_DXLEVEL);
ZR_PrintCenterText(client, "DX90 not supported", dxLevel[client], GENERAL_MIN_DXLEVEL);
return false;
}

View File

@ -37,8 +37,8 @@ ClassOnClientDisconnect(client)
ClassOnClientSpawn(client)
{
new bool:randomclass = GetConVarBool(gCvars[CVAR_CLASSES_RANDOM]);
new bool:showmenu = GetConVarBool(gCvars[CVAR_CLASSES_SPAWN]);
new bool:randomclass = GetConVarBool(g_hCvarsList[CVAR_CLASSES_RANDOM]);
new bool:showmenu = GetConVarBool(g_hCvarsList[CVAR_CLASSES_SPAWN]);
decl String:steamid[16];
decl String:classname[64];

View File

@ -228,7 +228,7 @@ public ClassMenuSelectHandle(Handle:menu, MenuAction:action, client, slot)
decl String:classname[64];
new classindex;
new teamid;
new bool:autoclose = GetConVarBool(gCvars[CVAR_MENU_AUTOCLOSE]);
new bool:autoclose = GetConVarBool(g_hCvarsList[CVAR_MENU_AUTOCLOSE]);
switch (action)
{

View File

@ -66,7 +66,7 @@ ClassOverlayStart(client)
ClientCommand(client, "r_screenoverlay \"%s\"", ActiveOverlay[client]);
bClientOverlayOn[client] = true;
new Float:redisplay = GetConVarFloat(gCvars[CVAR_OVERLAY_REDISPLAY]);
new Float:redisplay = GetConVarFloat(g_hCvarsList[CVAR_OVERLAY_REDISPLAY]);
tOverlay[client] = CreateTimer(redisplay, ClassOverlayTimer, client, TIMER_REPEAT);
}

View File

@ -637,15 +637,15 @@ ClassGetDefaultSpawnClass(teamid, cachetype = ZR_CLASS_CACHE_MODIFIED)
{
case ZR_CLASS_TEAM_ZOMBIES:
{
GetConVarString(gCvars[CVAR_CLASSES_DEFAULT_ZOMBIE], classname, sizeof(classname));
GetConVarString(g_hCvarsList[CVAR_CLASSES_DEFAULT_ZOMBIE], classname, sizeof(classname));
}
case ZR_CLASS_TEAM_HUMANS:
{
GetConVarString(gCvars[CVAR_CLASSES_DEFAULT_HUMAN], classname, sizeof(classname));
GetConVarString(g_hCvarsList[CVAR_CLASSES_DEFAULT_HUMAN], classname, sizeof(classname));
}
case ZR_CLASS_TEAM_ADMINS:
{
GetConVarString(gCvars[CVAR_CLASSES_DEFAULT_ADMIN], classname, sizeof(classname));
GetConVarString(g_hCvarsList[CVAR_CLASSES_DEFAULT_ADMIN], classname, sizeof(classname));
}
default:
{

View File

@ -259,7 +259,7 @@ ClassLoad()
kvClassData = CreateKeyValues("classes");
decl String:classfile[256];
GetConVarString(gCvars[CVAR_CLASSES_FILE], classfile, sizeof(classfile));
GetConVarString(g_hCvarsList[CVAR_CLASSES_FILE], classfile, sizeof(classfile));
// Try to load the class configuration file.
decl String:path[PLATFORM_MAX_PATH];

View File

@ -75,14 +75,14 @@ RespawnOnClientDeath(client, attacker, const String:weapon[])
}
// If respawn is disabled, stop here.
new bool:respawn = GetConVarBool(gCvars[CVAR_RESPAWN]);
new bool:respawn = GetConVarBool(g_hCvarsList[CVAR_RESPAWN]);
if (!respawn)
{
return;
}
// Start respawn timer.
new Float:delay = GetConVarFloat(gCvars[CVAR_RESPAWN_DELAY]);
new Float:delay = GetConVarFloat(g_hCvarsList[CVAR_RESPAWN_DELAY]);
tRespawn[client] = CreateTimer(delay, RespawnTimer, client, TIMER_FLAG_NO_MAPCHANGE);
}
@ -95,7 +95,7 @@ RespawnOnClientDeath(client, attacker, const String:weapon[])
RespawnKilledByWorld(client)
{
// Return true if both the cvar is enabled and the player was killed by world.
return (GetConVarBool(gCvars[CVAR_SUICIDE_WORLD_DAMAGE]) && pKilledByWorld[client]);
return (GetConVarBool(g_hCvarsList[CVAR_RESPAWN_ZOMBIE_WORLD]) && pKilledByWorld[client]);
}
/**
@ -121,7 +121,7 @@ RespawnSpawnClient(client)
}
// Get respawn team.
new bool:respawn_zombie = GetConVarBool(gCvars[CVAR_RESPAWN_ZOMBIE]);
new bool:respawn_zombie = GetConVarBool(g_hCvarsList[CVAR_RESPAWN_ZOMBIE]);
// Get suicide respawn cvar
if (respawn_zombie)
@ -130,7 +130,7 @@ RespawnSpawnClient(client)
return;
}
if (GetConVarBool(gCvars[CVAR_SUICIDE_WORLD_DAMAGE]) && pKilledByWorld[client])
if (GetConVarBool(g_hCvarsList[CVAR_RESPAWN_ZOMBIE_WORLD]) && pKilledByWorld[client])
{
InfectPlayer(client);
pKilledByWorld[client] = false;

View File

@ -42,11 +42,6 @@
*/
#define ROUNDEND_DELAY_SHORT 3.0
/**
* Minimum dx level required to see overlays.
*/
#define ROUNDEND_MIN_DXLEVEL 90
/**
* Possible round end outcomes.
*/
@ -401,14 +396,14 @@ RoundEndDisplayClientOverlay(client, const String:overlay[])
}
// If dxLevel is above or equal to minimum requirement, then display overlay.
if (dxLevel[client] >= ROUNDEND_MIN_DXLEVEL)
if (dxLevel[client] >= GENERAL_MIN_DXLEVEL)
{
ClientCommand(client, "r_screenoverlay \"%s\"", overlay);
}
// If client doesn't meet minimum requirement, then print unsupported text.
else
{
ZR_PrintCenterText(client, "DX90 not supported", dxLevel[client], ROUNDEND_MIN_DXLEVEL);
ZR_PrintCenterText(client, "DX90 not supported", dxLevel[client], GENERAL_MIN_DXLEVEL);
}
}
@ -421,7 +416,7 @@ RoundEndDisplayClientOverlay(client, const String:overlay[])
RoundEndOverlayStart(Float:time, RoundEndOutcome:outcome)
{
// If round end overlays are disabled, then stop.
new bool:overlay = GetConVarBool(gCvars[CVAR_ROUNDEND_OVERLAY]);
new bool:overlay = GetConVarBool(g_hCvarsList[CVAR_ROUNDEND_OVERLAY]);
if (!overlay)
{
return;
@ -434,12 +429,12 @@ RoundEndOverlayStart(Float:time, RoundEndOutcome:outcome)
// Show "zombies win" overlay.
case ZombiesWin:
{
GetConVarString(gCvars[CVAR_ROUNDEND_OVERLAY_ZOMBIE], overlaypath, sizeof(overlaypath));
GetConVarString(g_hCvarsList[CVAR_ROUNDEND_OVERLAY_ZOMBIE], overlaypath, sizeof(overlaypath));
}
// Show "humans win" overlay.
case HumansWin:
{
GetConVarString(gCvars[CVAR_ROUNDEND_OVERLAY_HUMAN], overlaypath, sizeof(overlaypath));
GetConVarString(g_hCvarsList[CVAR_ROUNDEND_OVERLAY_HUMAN], overlaypath, sizeof(overlaypath));
}
// Show no overlay.
default:

View File

@ -14,7 +14,7 @@ HookChatCmds()
public Action:SayCommand(client, argc)
{
new bool:enabled = GetConVarBool(gCvars[CVAR_ENABLE]);
new bool:enabled = GetConVarBool(g_hCvarsList[CVAR_ENABLE]);
if (!client || !enabled)
{
return Plugin_Continue;
@ -81,7 +81,7 @@ public Action:SayCommand(client, argc)
ZSpawn(client)
{
new bool:spawn = GetConVarBool(gCvars[CVAR_ZSPAWN]);
new bool:spawn = GetConVarBool(g_hCvarsList[CVAR_ZSPAWN]);
if (!spawn)
{
ZR_PrintToChat(client, "Feature is disabled");

View File

@ -50,7 +50,7 @@ AmbientSoundsClientInit(client)
bool:AmbientSoundsValidateConfig()
{
// If ambience is disabled, then stop.
new bool:ambience = GetConVarBool(gCvars[CVAR_AMBIENTSOUNDS]);
new bool:ambience = GetConVarBool(g_hCvarsList[CVAR_AMBIENTSOUNDS]);
if (!ambience)
{
return false;
@ -64,7 +64,7 @@ bool:AmbientSoundsValidateConfig()
// Get ambient sound file.
decl String:sound[SOUND_MAX_PATH];
GetConVarString(gCvars[CVAR_AMBIENTSOUNDS_FILE], sound, sizeof(sound));
GetConVarString(g_hCvarsList[CVAR_AMBIENTSOUNDS_FILE], sound, sizeof(sound));
Format(sound, sizeof(sound), "sound/%s", sound);
// If file doesn't exist, then log error and stop.
@ -76,7 +76,7 @@ bool:AmbientSoundsValidateConfig()
}
// If volume is muted or invalid, then log error and stop.
new Float:ambientvolume = GetConVarFloat(gCvars[CVAR_AMBIENTSOUNDS_VOLUME]);
new Float:ambientvolume = GetConVarFloat(g_hCvarsList[CVAR_AMBIENTSOUNDS_VOLUME]);
if (ambientvolume <= 0.0)
{
// Log invalid ambient sound volume error.
@ -85,7 +85,7 @@ bool:AmbientSoundsValidateConfig()
}
// If length is invalid, then log error and stop.
new Float:ambientlength = GetConVarFloat(gCvars[CVAR_AMBIENTSOUNDS_LENGTH]);
new Float:ambientlength = GetConVarFloat(g_hCvarsList[CVAR_AMBIENTSOUNDS_LENGTH]);
if (ambientlength <= 0.0)
{
// Log invalid ambient sound length error.
@ -138,10 +138,10 @@ AmbientSoundsOnClientSpawn(client)
// Get ambient sound file.
decl String:sound[SOUND_MAX_PATH];
GetConVarString(gCvars[CVAR_AMBIENTSOUNDS_FILE], sound, sizeof(sound));
GetConVarString(g_hCvarsList[CVAR_AMBIENTSOUNDS_FILE], sound, sizeof(sound));
// Get ambient sound volume.
new Float:ambientvolume = GetConVarFloat(gCvars[CVAR_AMBIENTSOUNDS_VOLUME]);
new Float:ambientvolume = GetConVarFloat(g_hCvarsList[CVAR_AMBIENTSOUNDS_VOLUME]);
// Emit ambient sound.
SEffectsEmitAmbientSound(sound, ambientvolume, client);
@ -177,7 +177,7 @@ AmbientSoundsRestart()
}
// Get ambient sound length.
new Float:ambientlength = GetConVarFloat(gCvars[CVAR_AMBIENTSOUNDS_LENGTH]);
new Float:ambientlength = GetConVarFloat(g_hCvarsList[CVAR_AMBIENTSOUNDS_LENGTH]);
// Start ambient sounds timer.
tAmbientSounds = CreateTimer(ambientlength, AmbientSoundsTimer, _, TIMER_FLAG_NO_MAPCHANGE);
@ -198,16 +198,16 @@ public Action:AmbientSoundsTimer(Handle:timer)
// Get ambient sound file.
decl String:sound[SOUND_MAX_PATH];
GetConVarString(gCvars[CVAR_AMBIENTSOUNDS_FILE], sound, sizeof(sound));
GetConVarString(g_hCvarsList[CVAR_AMBIENTSOUNDS_FILE], sound, sizeof(sound));
// Get ambient sound volume.
new Float:ambientvolume = GetConVarFloat(gCvars[CVAR_AMBIENTSOUNDS_VOLUME]);
new Float:ambientvolume = GetConVarFloat(g_hCvarsList[CVAR_AMBIENTSOUNDS_VOLUME]);
// Emit ambient sound.
SEffectsEmitAmbientSound(sound, ambientvolume);
// Get ambient sound length.
new Float:ambientlength = GetConVarFloat(gCvars[CVAR_AMBIENTSOUNDS_LENGTH]);
new Float:ambientlength = GetConVarFloat(g_hCvarsList[CVAR_AMBIENTSOUNDS_LENGTH]);
// Start new timer with sound length as delay.
tAmbientSounds = CreateTimer(ambientlength, AmbientSoundsTimer, _, TIMER_FLAG_NO_MAPCHANGE);

View File

@ -105,7 +105,7 @@ ZombieSoundsOnClientDeath(client)
}
// If death sound cvar is disabled, then stop.
new bool:death = GetConVarBool(gCvars[CVAR_SOUNDEFFECTS_DEATH]);
new bool:death = GetConVarBool(g_hCvarsList[CVAR_SOUNDEFFECTS_DEATH]);
if (!death)
{
return;
@ -132,7 +132,7 @@ ZombieSoundsOnClientHurt(client)
}
// Get groan factor, if 0, then stop.
new groan = GetConVarInt(gCvars[CVAR_SOUNDEFFECTS_GROAN]);
new groan = GetConVarInt(g_hCvarsList[CVAR_SOUNDEFFECTS_GROAN]);
if (!groan)
{
return;
@ -157,7 +157,7 @@ ZombieSoundsOnClientHurt(client)
ZombieSoundsOnClientInfected(client)
{
// If interval is set to 0, then stop.
new Float:interval = GetConVarFloat(gCvars[CVAR_SOUNDEFFECTS_MOAN]);
new Float:interval = GetConVarFloat(g_hCvarsList[CVAR_SOUNDEFFECTS_MOAN]);
if (!interval)
{
return;

View File

@ -67,16 +67,16 @@ SpawnProtectOnClientSpawn(client)
return;
}
// If protect cvar is invalid or 0, then stop.
new protect = GetConVarInt(gCvars[CVAR_PROTECT]);
if (protect <= 0)
// If protect cvar is disabled, then stop.
new bool:protect = GetConVarBool(g_hCvarsList[CVAR_SPAWNPROTECT]);
if (!protect)
{
return;
}
// If player respawns as human, and either cvar zr_suicide_world_damage or the client
// wasn't killed by world is false, then continue on to protect client.
new bool:respawn_zombie = GetConVarBool(gCvars[CVAR_RESPAWN_ZOMBIE]);
new bool:respawn_zombie = GetConVarBool(g_hCvarsList[CVAR_RESPAWN_ZOMBIE]);
if (!respawn_zombie && !RespawnKilledByWorld(client))
{
// Set spawn protect flag on client.
@ -87,11 +87,12 @@ SpawnProtectOnClientSpawn(client)
SetPlayerAlpha(client, 0);
SetPlayerSpeed(client, 600.0);
// Set time left to zr_protect's value.
pSpawnProtectTime[client] = protect;
// Set time left to zr_protect_time's value.
new protect_time = GetConVarInt(g_hCvarsList[CVAR_SPAWNPROTECT_TIME]);
pSpawnProtectTime[client] = protect_time;
// Tell client they are being protected.
ZR_PrintToChat(client, "Spawn protection begin", protect);
ZR_PrintToChat(client, "Spawn protection begin", protect_time);
// Send time left in a hud message.
ZR_HudHint(client, "Spawn Protect", pSpawnProtectTime[client]);

View File

@ -13,7 +13,7 @@ ZTeleEnable()
{
KillTimer(ztele_startup_timer);
}
new Float:startup_delay = GetConVarFloat(gCvars[CVAR_ZTELE_STARTUP_DELAY]);
new Float:startup_delay = GetConVarFloat(g_hCvarsList[CVAR_ZTELE_STARTUP_DELAY]);
if (startup_delay > 0)
{
ztele_startup_timer = CreateTimer(startup_delay, Event_TeleporterStartup);
@ -336,7 +336,7 @@ public Action:Command_TeleportAbort(client, argc)
bool:ZTele(client)
{
// Check if the teleporter is disabled.
new bool:tele = GetConVarBool(gCvars[CVAR_ZTELE]);
new bool:tele = GetConVarBool(g_hCvarsList[CVAR_ZTELE]);
if (!tele)
{
ZR_PrintToChat(client, "Feature is disabled");
@ -375,7 +375,7 @@ bool:ZTele(client)
// Check limits.
if (IsPlayerHuman(client))
{
new human_limit = GetConVarInt(gCvars[CVAR_ZTELE_HUMAN_LIMIT]);
new human_limit = GetConVarInt(g_hCvarsList[CVAR_ZTELE_HUMAN_LIMIT]);
new bool:tele_humans;
if (human_limit == 0)
{
@ -400,7 +400,7 @@ bool:ZTele(client)
}
else
{
new zombie_limit = GetConVarInt(gCvars[CVAR_ZTELE_ZOMBIE_LIMIT]);
new zombie_limit = GetConVarInt(g_hCvarsList[CVAR_ZTELE_ZOMBIE_LIMIT]);
new bool:tele_zombies;
if (zombie_limit == 0)
{
@ -439,8 +439,8 @@ TeleportClient(client, bool:no_delay = false, bool:free_tele = false, bool:no_co
if (IsPlayerHuman(client))
{
new human_delay = GetConVarInt(gCvars[CVAR_ZTELE_HUMAN_DELAY]);
new human_limit = GetConVarInt(gCvars[CVAR_ZTELE_HUMAN_LIMIT]);
new human_delay = GetConVarInt(g_hCvarsList[CVAR_ZTELE_HUMAN_DELAY]);
new human_limit = GetConVarInt(g_hCvarsList[CVAR_ZTELE_HUMAN_LIMIT]);
if (human_delay > 0)
{
ztele_countdown[client] = human_delay;
@ -461,8 +461,8 @@ TeleportClient(client, bool:no_delay = false, bool:free_tele = false, bool:no_co
}
else
{
new zombie_delay = GetConVarInt(gCvars[CVAR_ZTELE_ZOMBIE_DELAY]);
new zombie_limit = GetConVarInt(gCvars[CVAR_ZTELE_ZOMBIE_LIMIT]);
new zombie_delay = GetConVarInt(g_hCvarsList[CVAR_ZTELE_ZOMBIE_DELAY]);
new zombie_limit = GetConVarInt(g_hCvarsList[CVAR_ZTELE_ZOMBIE_LIMIT]);
if (zombie_delay > 0)
{
ztele_countdown[client] = zombie_delay;
@ -490,7 +490,7 @@ TeleportClient(client, bool:no_delay = false, bool:free_tele = false, bool:no_co
TeleportEntity(client, spawnLoc[client], NULL_VECTOR, empty_vector);
// Create cooldown timer if enabled.
new cooldown = GetConVarInt(gCvars[CVAR_ZTELE_COOLDOWN]);
new cooldown = GetConVarInt(g_hCvarsList[CVAR_ZTELE_COOLDOWN]);
if (!no_cooldown && cooldown)
{
ztele_countdown[client] = cooldown;

View File

@ -30,7 +30,7 @@ bool:ZMarketSend(client)
}
// Check buyzone cvar to see if client has to be in a buyzone to use.
new bool:buyzone = GetConVarBool(gCvars[CVAR_ZMARKET_BUYZONE]);
new bool:buyzone = GetConVarBool(g_hCvarsList[CVAR_ZMARKET_BUYZONE]);
if (!IsClientInBuyZone(client) && buyzone)
{
// Tell client they must be in a buyzone.
@ -106,7 +106,7 @@ public bool:Market_OnWeaponSelected(client, String:weaponid[])
}
// Check if buyzone cvar is enabled, and if the client is in a buyzone.
new bool:buyzone = GetConVarBool(gCvars[CVAR_ZMARKET_BUYZONE]);
new bool:buyzone = GetConVarBool(g_hCvarsList[CVAR_ZMARKET_BUYZONE]);
if (!IsClientInBuyZone(client) && buyzone)
{
ZR_PrintCenterText(client, "Market out of buyzone");

View File

@ -422,7 +422,7 @@ WeaponsMenuMarket(client)
decl String:togglebuyzone[64];
decl String:curSetting[8];
ZRBoolToConfigSetting(GetConVarBool(gCvars[CVAR_ZMARKET_BUYZONE]), curSetting, sizeof(curSetting));
ZRBoolToConfigSetting(GetConVarBool(g_hCvarsList[CVAR_ZMARKET_BUYZONE]), curSetting, sizeof(curSetting));
Format(togglebuyzone, sizeof(togglebuyzone), "%t", "Weapons menu market toggle buyzone", curSetting);
@ -451,13 +451,13 @@ public WeaponsMenuMarketHandle(Handle:menu_weapons_market, MenuAction:action, cl
{
case 0:
{
if (GetConVarBool(gCvars[CVAR_ZMARKET_BUYZONE]))
if (GetConVarBool(g_hCvarsList[CVAR_ZMARKET_BUYZONE]))
{
SetConVarBool(gCvars[CVAR_ZMARKET_BUYZONE], false);
SetConVarBool(g_hCvarsList[CVAR_ZMARKET_BUYZONE], false);
}
else
{
SetConVarBool(gCvars[CVAR_ZMARKET_BUYZONE], true);
SetConVarBool(g_hCvarsList[CVAR_ZMARKET_BUYZONE], true);
}
}
}

View File

@ -67,6 +67,16 @@ RestrictClearData()
*/
RestrictOnMapStart()
{
// Clear weapon restrict data.
RestrictClearData();
// If module is disabled, then stop.
new bool:restrict = GetConVarBool(g_hCvarsList[CVAR_WEAPONS_RESTRICT]);
if (!restrict)
{
return;
}
// Restrict default restrictions. (set in weapons.txt)
RestrictDefaultRestrictions();
@ -78,7 +88,7 @@ RestrictOnMapStart()
{
if (LogFlagCheck(LOG_CORE_EVENTS, LOG_MODULE_WEAPONS))
{
ZR_LogMessageFormatted(-1, "Weapons", "Config Validation", "Missing file weapongroups.txt.", LOG_FORMAT_TYPE_FULL);
ZR_LogMessageFormatted(-1, "Weapons", "Config Validation", "Missing file weapongroups.txt.", LOG_FORMAT_TYPE_ERROR);
}
return;
@ -208,7 +218,7 @@ RestrictOnClientDisconnect(client)
public Action:RestrictBuyHook(client, argc)
{
// If plugin is disabled then stop.
new bool:enabled = GetConVarBool(gCvars[CVAR_ENABLE]);
new bool:enabled = GetConVarBool(g_hCvarsList[CVAR_ENABLE]);
if (!enabled)
{
// Allow command.
@ -835,7 +845,7 @@ RestrictGetGroupWeapons(const String:groupname[], String:weaponlist[], maxlen, c
public RestrictCanUse(client, weapon, dummy1, dummy2, dummy3, dummy4)
{
// If plugin is disabled then stop.
new bool:enabled = GetConVarBool(gCvars[CVAR_ENABLE]);
new bool:enabled = GetConVarBool(g_hCvarsList[CVAR_ENABLE]);
if (!enabled)
{
return Hacks_Continue;

View File

@ -1,9 +1,12 @@
/**
* ====================
/*
* ============================================================================
*
* Zombie:Reloaded
* File: weapons.inc
* Author: Greyscale
* ====================
*
* File: weapons.inc
* Description: API for all weapon-related functions.
*
* ============================================================================
*/
/**
@ -55,8 +58,12 @@ WeaponsLoad()
// Clear weapon data.
WeaponsClearData();
// Clear weapon restrict data.
RestrictClearData();
// If module is disabled, then stop.
new bool:weapons = GetConVarBool(g_hCvarsList[CVAR_WEAPONS]);
if (!weapons)
{
return;
}
decl String:path[PLATFORM_MAX_PATH];
BuildPath(Path_SM, path, sizeof(path), "configs/zr/weapons/weapons.txt");
@ -66,7 +73,7 @@ WeaponsLoad()
{
if (LogFlagCheck(LOG_CORE_EVENTS, LOG_MODULE_WEAPONS))
{
ZR_LogMessageFormatted(-1, "Weapons", "Config Validation", "Missing file weapons.txt, disabling weapons-based modules.", LOG_FORMAT_TYPE_FULL);
ZR_LogMessageFormatted(-1, "Weapons", "Config Validation", "Missing file weapons.txt, disabling weapons-based modules.", LOG_FORMAT_TYPE_ERROR);
}
return;
@ -93,7 +100,7 @@ WeaponsValidateConfig()
KvRewind(kvWeapons);
if (!KvGotoFirstSubKey(kvWeapons))
{
ZR_LogMessageFormatted(-1, "Weapons", "Config Validation", "No weapons listed in weapons.txt, disabling weapons-based modules.", LOG_FORMAT_TYPE_FULL);
ZR_LogMessageFormatted(-1, "Weapons", "Config Validation", "No weapons listed in weapons.txt, disabling weapons-based modules.", LOG_FORMAT_TYPE_ERROR);
}
}

View File

@ -117,7 +117,7 @@ public ZRAdminMenuHandle(Handle:menu_admin, MenuAction:action, client, slot)
/*ZRKnockbackMMenu(client)
{
new Handle:menu_knockbackm = CreateMenu(ZRKnockbackMHandle);
new Float:curknockback = GetConVarFloat(gCvars[CVAR_ZOMBIE_KNOCKBACK]);
new Float:curknockback = GetConVarFloat(g_hCvarsList[CVAR_ZOMBIE_KNOCKBACK]);
SetGlobalTransTarget(client);
@ -297,7 +297,7 @@ public ZRClassKnockbackHandle(Handle:menu_knockback, MenuAction:action, client,
ZRNVGSMenu(client)
{
new Handle:menu_nvgs = CreateMenu(ZRNVGSHandle);
new curnvgs = GetConVarInt(gCvars[CVAR_ZOMBIE_NVGS]);
new curnvgs = GetConVarInt(g_hCvarsList[CVAR_ZOMBIE_NVGS]);
SetGlobalTransTarget(client);
@ -328,17 +328,17 @@ public ZRNVGSHandle(Handle:menu_nvgs, MenuAction:action, client, slot)
{
case 0:
{
SetConVarInt(gCvars[CVAR_ZOMBIE_NVGS], -1);
SetConVarInt(g_hCvarsList[CVAR_ZOMBIE_NVGS], -1);
ZRNVGSMenu(client);
}
case 1:
{
SetConVarInt(gCvars[CVAR_ZOMBIE_NVGS], 0);
SetConVarInt(g_hCvarsList[CVAR_ZOMBIE_NVGS], 0);
ZRNVGSMenu(client);
}
case 2:
{
SetConVarInt(gCvars[CVAR_ZOMBIE_NVGS], 1);
SetConVarInt(g_hCvarsList[CVAR_ZOMBIE_NVGS], 1);
ZRNVGSMenu(client);
}
}
@ -708,8 +708,8 @@ public ZRLogFlagsMenuHandle(Handle:menu_log_flags, MenuAction:action, client, sl
AddToKnockbackMultiplier(Float:value)
{
new Float:current_val = GetConVarFloat(gCvars[CVAR_ZOMBIE_KNOCKBACK]);
SetConVarFloat(gCvars[CVAR_ZOMBIE_KNOCKBACK], current_val + value);
new Float:current_val = GetConVarFloat(g_hCvarsList[CVAR_ZOMBIE_KNOCKBACK]);
SetConVarFloat(g_hCvarsList[CVAR_ZOMBIE_KNOCKBACK], current_val + value);
}
AddToClassKnockback(classindex, Float:value)
@ -720,7 +720,7 @@ AddToClassKnockback(classindex, Float:value)
ToggleLogFlag(flag)
{
new log_flags;
log_flags = GetConVarInt(gCvars[CVAR_LOG]);
log_flags = GetConVarInt(g_hCvarsList[CVAR_LOG]);
if (log_flags & flag)
{
@ -731,5 +731,5 @@ ToggleLogFlag(flag)
log_flags = log_flags + flag;
}
SetConVarInt(gCvars[CVAR_LOG], log_flags);
SetConVarInt(g_hCvarsList[CVAR_LOG], log_flags);
}

View File

@ -28,7 +28,7 @@ new bool:pZHP[MAXPLAYERS + 1];
ZHPClientInit(client)
{
// Get default client setting from cvar.
new bool:zhp = GetConVarBool(gCvars[CVAR_ZHP_DEFAULT]);
new bool:zhp = GetConVarBool(g_hCvarsList[CVAR_ZHP_DEFAULT]);
// Set flag to default value.
pZHP[client] = zhp;
@ -79,7 +79,7 @@ ZHPOnClientDeath(client)
ZHPOnClientInfected(client)
{
// If ZHP is disabled, then stop.
new bool:zhp = GetConVarBool(gCvars[CVAR_ZHP]);
new bool:zhp = GetConVarBool(g_hCvarsList[CVAR_ZHP]);
if (!zhp)
{
return;
@ -128,7 +128,7 @@ ZHPOnHealthInfectGain(client)
ZHPToggle(client)
{
// If ZHP is disabled, then stop.
new bool:zhp = GetConVarBool(gCvars[CVAR_ZHP]);
new bool:zhp = GetConVarBool(g_hCvarsList[CVAR_ZHP]);
if (!zhp)
{
// Tell client feature is disabled.
@ -164,7 +164,7 @@ ZHPToggle(client)
ZHPUpdateHUD(client)
{
// If ZHP is disabled, then stop.
new bool:zhp = GetConVarBool(gCvars[CVAR_ZHP]);
new bool:zhp = GetConVarBool(g_hCvarsList[CVAR_ZHP]);
if (!zhp)
{
return;

View File

@ -29,13 +29,13 @@ HookCommands()
public Action:Command_NightVision(client, argc)
{
new bool:allow_disable = GetConVarBool(gCvars[CVAR_ZVISION_ALLOW_DISABLE]);
new bool:allow_disable = GetConVarBool(g_hCvarsList[CVAR_ZVISION_ALLOW_DISABLE]);
if (!allow_disable)
{
return;
}
new bool:enabled = GetConVarBool(gCvars[CVAR_ENABLE]);
new bool:enabled = GetConVarBool(g_hCvarsList[CVAR_ENABLE]);
if (!enabled)
{
return;
@ -71,14 +71,14 @@ FindMapSky()
ChangeLightStyle()
{
new bool:dark = GetConVarBool(gCvars[CVAR_DARK]);
new bool:dark = GetConVarBool(g_hCvarsList[CVAR_DARK]);
if (dark)
{
decl String:darkness[2];
decl String:sky[32];
GetConVarString(gCvars[CVAR_DARK_LEVEL], darkness, sizeof(darkness));
GetConVarString(gCvars[CVAR_DARK_SKY], sky, sizeof(sky));
GetConVarString(g_hCvarsList[CVAR_DARK_LEVEL], darkness, sizeof(darkness));
GetConVarString(g_hCvarsList[CVAR_DARK_SKY], sky, sizeof(sky));
SetLightStyle(0, darkness);
SetConVarString(FindConVar("sv_skyname"), sky, true, false);
@ -192,7 +192,7 @@ public Action:MotherZombie(Handle:timer)
new client;
// Ratio of mother zombies to humans.
new ratio = GetConVarInt(gCvars[CVAR_MOTHER_ZOMBIE_RATIO]);
new ratio = GetConVarInt(g_hCvarsList[CVAR_MOTHER_ZOMBIE_RATIO]);
// If ratio is 0 or lower, then pick 1 zombie.
if (ratio <= 0)
@ -288,7 +288,7 @@ InfectPlayer(client, attacker = -1, bool:motherinfect = false)
// Check if consecutive infection protection is enabled.
new bool:consecutive_infect = GetConVarBool(gCvars[CVAR_CONSECUTIVE_INFECT]);
new bool:consecutive_infect = GetConVarBool(g_hCvarsList[CVAR_CONSECUTIVE_INFECT]);
// Flag player to be immune from being mother zombie twice, if consecutive infect protection is enabled.
bMotherInfectImmune[client] = consecutive_infect ? motherinfect : false;
@ -312,13 +312,13 @@ InfectionEffects(client)
clientloc[2] += 30;
decl String:sound[128];
GetConVarString(gCvars[CVAR_INFECT_SOUND], sound, sizeof(sound));
GetConVarString(g_hCvarsList[CVAR_INFECT_SOUND], sound, sizeof(sound));
if (sound[0])
{
SEffectsEmitSoundFromClient(client, sound, SNDLEVEL_SCREAMING);
}
new bool:esplash = GetConVarBool(gCvars[CVAR_INFECT_ESPLASH]);
new bool:esplash = GetConVarBool(g_hCvarsList[CVAR_INFECT_ESPLASH]);
if (esplash)
{
TE_SetupEnergySplash(clientloc, direction, true);
@ -332,19 +332,19 @@ InfectionEffects(client)
new flags = GetEntProp(explosion, Prop_Data, "m_spawnflags");
flags = flags | EXP_NODAMAGE | EXP_NODECAL;
new bool:fireball = GetConVarBool(gCvars[CVAR_INFECT_FIREBALL]);
new bool:fireball = GetConVarBool(g_hCvarsList[CVAR_INFECT_FIREBALL]);
if (!fireball)
{
flags = flags | EXP_NOFIREBALL;
}
new bool:smoke = GetConVarBool(gCvars[CVAR_INFECT_SMOKE]);
new bool:smoke = GetConVarBool(g_hCvarsList[CVAR_INFECT_SMOKE]);
if (!smoke)
{
flags = flags | EXP_NOSMOKE;
}
new bool:sparks = GetConVarBool(gCvars[CVAR_INFECT_SPARKS]);
new bool:sparks = GetConVarBool(g_hCvarsList[CVAR_INFECT_SPARKS]);
if (!sparks)
{
flags = flags | EXP_NOSPARKS;
@ -362,16 +362,16 @@ InfectionEffects(client)
AcceptEntityInput(explosion, "Explode");
}
new bool:shake = GetConVarBool(gCvars[CVAR_INFECT_SHAKE]);
new bool:shake = GetConVarBool(g_hCvarsList[CVAR_INFECT_SHAKE]);
if (shake)
{
new Handle:hShake = StartMessageOne("Shake", client);
if (hShake != INVALID_HANDLE)
{
BfWriteByte(hShake, 0);
BfWriteFloat(hShake, GetConVarFloat(gCvars[CVAR_INFECT_SHAKE_AMP]));
BfWriteFloat(hShake, GetConVarFloat(gCvars[CVAR_INFECT_SHAKE_FREQUENCY]));
BfWriteFloat(hShake, GetConVarFloat(gCvars[CVAR_INFECT_SHAKE_DURATION]));
BfWriteFloat(hShake, GetConVarFloat(g_hCvarsList[CVAR_INFECT_SHAKE_AMP]));
BfWriteFloat(hShake, GetConVarFloat(g_hCvarsList[CVAR_INFECT_SHAKE_FREQUENCY]));
BfWriteFloat(hShake, GetConVarFloat(g_hCvarsList[CVAR_INFECT_SHAKE_DURATION]));
EndMessage();
}

View File

@ -8,6 +8,11 @@
#define DEFAULT_FOV 90
/**
* Minimum dx level required to see overlays.
*/
#define GENERAL_MIN_DXLEVEL 90
/**
* @section Logging flags.
*/